module vrt.gc.slab

Stuct and code for sub-allocating data from a memory extent.

Code Map

//! Stuct and code for sub-allocating data from a memory extent.
module vrt.gc.slab;


//! Multiple smaller user memory allocations.
struct Slab
{
public:
	enum MaxSlots;


public:
	alias Alignment = Extent.Alignment;


public:
	extent: Extent;
	bitmap: u32[16];
	marked: u32[16];
	header: u16;
	freeSlots: u16;
	order: u8;
	next: Slab*;


public:
	fn setup(order: u8, memory: void*, finalizer: bool, pointer: bool, internal: bool) { }
	fn allocate() u32 { }
	fn freeAll() { }
	fn makeAllMoreSorted(root: Slab**) { }
	fn isFree(bit: u32) bool { }
	fn free(bit: u32) { }
	fn usedSlots() u16 { }
	fn isMarked(bit: u32) bool { }
	fn mark(bit: u32) { }
	fn isMarked(ptr: void*) bool { }
	fn markChild(ptr: void*) { }
	fn clearMarked() { }
	fn isChildPointer(ptr: void*) bool { }
	fn freePointer(ptr: void*) { }
	fn pointerToSlotStart(ptr: void*) void* { }
	fn slotToPointer(slot: u32) void* { }
	fn pointerToSlot(ptr: void*) i64 { }
	fn hasPointers() bool { }
	fn hasFinalizer() bool { }
}

fn sizeToOrder(n: size_t) u8 { }
fn orderToSize(order: u8) size_t { }
fn countTrailingZeros(bits: u32, isZeroUndef: bool) u32;
struct Slab

Multiple smaller user memory allocations.

You can find the memory that this represents in the extent.memory field.