Struct comet::block::Block [−][src]
#[repr(C, align(16))]pub struct Block {
pub all_next: *mut Self,
pub next: *mut Self,
pub allocated: u32,
pub hole_count: u8,
pub heap: *mut Heap,
}Expand description
A block is a page-aligned container for heap-allocated objects.
Fields
all_next: *mut Selfnext: *mut Selfallocated: u32Stores magic number to check if block is allocated.
hole_count: u8heap: *mut HeapImplementations
Convert an address on this block into a line number.
Get pointer to block from object pointer.
Safety
Does not do anything unsafe but might return wrong pointer
pub fn update_lines<const MARK: bool>(
&self,
bitmap: &SpaceBitmap<LINE_SIZE>,
object: *const u8
)
pub fn update_lines<const MARK: bool>(
&self,
bitmap: &SpaceBitmap<LINE_SIZE>,
object: *const u8
)
Update the line counter for the given object.
Mark if MARK, otherwise clear mark bit.
pub fn sweep<const MAJOR: bool>(
&mut self,
bitmap: &SpaceBitmap<8>,
live: &SpaceBitmap<8>,
line: &SpaceBitmap<LINE_SIZE>
) -> SweepResult
pub fn scan_block(
&self,
bitmap: &SpaceBitmap<LINE_SIZE>,
last_high_offset: u16
) -> Option<(u16, u16)>
pub fn scan_block(
&self,
bitmap: &SpaceBitmap<LINE_SIZE>,
last_high_offset: u16
) -> Option<(u16, u16)>
Scan the block for a hole to allocate into.
The scan will start at last_high_offset bytes into the block and
return a tuple of low_offset, high_offset as the lowest and
highest usable offsets for a hole.
None is returned if no hole was found.