public abstract class SegregatedFreeList<S extends SegregatedFreeListSpace> extends Allocator
Modifier and Type | Field and Description |
---|---|
protected AddressArray |
freeList
The current free lists for the size classes
|
protected S |
space
The space
|
Constructor and Description |
---|
SegregatedFreeList(S space)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Address |
alloc(int bytes,
int align,
int offset)
Allocate
bytes contiguous bytes of zeroed memory. |
private int |
getSizeClass(int bytes)
Get the size class for a given number of bytes.
|
protected S |
getSpace()
Return the space this allocator is currently bound to.
|
private int |
sizeClassCount()
The number of distinct size classes.
|
alignAllocation, alignAllocation, alignAllocationNoFill, allocSlow, allocSlowInline, allocSlowOnce, determineCollectionAttempts, fillAlignmentGap, getMaximumAlignedSize, getMaximumAlignedSize
protected final S extends SegregatedFreeListSpace space
protected final AddressArray freeList
public SegregatedFreeList(S space)
space
- The space with which this allocator will be associatedprotected final S getSpace()
Allocator
public final Address alloc(int bytes, int align, int offset)
bytes
contiguous bytes of zeroed memory.This code implements the fast path, and on failure delegates to the slow path.
bytes
- The size of the object to occupy this space, in bytes.align
- The requested alignment.offset
- The alignment offset.private int sizeClassCount()
NOTE: For optimal performance this call must be implemented in a way it can be inlined and optimized within the allocation sequence.
private int getSizeClass(int bytes)
NOTE: For optimal performance this call must be implemented in a way it can be inlined and optimized within the allocation sequence.
bytes
- The number of bytes required to accommodate the object