public final class ImmixSpace extends Space
Space.SpaceVisitor
Modifier and Type | Field and Description |
---|---|
private Address |
allocBlockCursor |
private Address |
allocBlockSentinel |
private ChunkList |
chunkMap |
private Defrag |
defrag |
private boolean |
exhaustedReusableSpace |
private Lock |
gcLock |
private boolean |
inCollection |
(package private) byte |
lineMarkState |
private int |
linesConsumed |
private byte |
lineUnavailState |
private byte |
markState |
private Lock |
mutatorLock |
private static short |
reusableMarkStateThreshold |
AVAILABLE_BYTES, AVAILABLE_END, AVAILABLE_PAGES, AVAILABLE_START, BYTES_IN_CHUNK, contiguous, descriptor, extent, headDiscontiguousRegion, HEAP_END, HEAP_START, immortal, LOG_ADDRESS_SPACE, LOG_BYTES_IN_CHUNK, MAX_CHUNKS, MAX_SPACES, movable, PAGES_IN_CHUNK, pr, start, zeroed
Constructor and Description |
---|
ImmixSpace(String name,
boolean zeroed,
VMRequest vmRequest)
The caller specifies the region of virtual memory to be used for
this space.
|
ImmixSpace(String name,
VMRequest vmRequest)
The caller specifies the region of virtual memory to be used for
this space.
|
Modifier and Type | Method and Description |
---|---|
Address |
acquireReusableBlocks() |
boolean |
copyNurseryIsLive(ObjectReference object)
Test the liveness of an object during copying sticky mark bits collection
|
void |
decideWhetherToDefrag(boolean emergencyCollection,
boolean collectWholeHeap,
int collectionAttempt,
boolean userTriggeredCollection)
Determine the collection kind.
|
int |
defragHeadroomPages()
Return the amount of headroom required to allow defrag, so this can be included in a collection reserve.
|
boolean |
fastIsLive(ObjectReference object)
Test the liveness of an object during defragmentation
|
ObjectReference |
fastTraceObject(TransitiveClosure trace,
ObjectReference object)
Trace a reference to an object in the context of a non-moving collection.
|
(package private) int |
getAvailableLines(int[] spillAvailHistogram)
Establish the number of recyclable lines lines available for allocation
during defragmentation, populating the spillAvailHistogram, which buckets
available lines according to the number of holes on the block on which
the available lines reside.
|
(package private) ChunkList |
getChunkMap() |
(package private) Defrag |
getDefrag() |
int |
getNextAvailableLine(Address baseLineAvailAddress,
int line) |
int |
getNextUnavailableLine(Address baseLineAvailAddress,
int line) |
int |
getPagesAllocated()
Return the number of pages allocated since the last collection
|
static short |
getReusuableMarkStateThreshold(boolean forDefrag)
Return the reusable mark state threshold, which determines how
eagerly lines should be recycled (by default these values are
set so that all lines are recycled).
|
Address |
getSpace(boolean hot,
boolean copy,
int lineUseCount)
Return a pointer to a set of new usable blocks, or null if none are available.
|
private int |
getUsableLinesInRegion(Address start,
Address end,
int[] spillAvailHistogram)
Return the number of lines usable for allocation during defragmentation in the
address range specified by start and end.
|
void |
growSpace(Address start,
Extent bytes,
boolean newChunk)
This hook is called by page resources each time a space grows.
|
boolean |
inImmixCollection()
Return
true if this space is currently being collected. |
boolean |
inImmixDefragCollection()
Return
true if this space is currently being defraged. |
void |
initializeDefrag() |
boolean |
isDefragSource(Address address) |
private boolean |
isDefragSource(ObjectReference object) |
boolean |
isLive(ObjectReference object)
Generic test of the liveness of an object
|
static boolean |
isRecycleAllocChunkAligned(Address ptr) |
private void |
lock()
Acquire the appropriate lock depending on whether the context is
GC or mutator.
|
void |
markLines(ObjectReference object)
Mark the line/s associated with a given object.
|
ObjectReference |
nurseryTraceObject(TransitiveClosure trace,
ObjectReference object,
int allocator)
Trace a reference to an object during a nursery collection for
a sticky mark bits implementation of immix.
|
void |
postAlloc(ObjectReference object,
int bytes)
Perform any required post allocation initialization
|
void |
postCopy(ObjectReference object,
int bytes,
boolean majorGC)
Perform any required post copy (i.e. in-GC allocation) initialization.
|
void |
prepare(boolean majorGC)
Prepare for a new collection increment.
|
void |
release(Address block)
Release a block.
|
boolean |
release(boolean majorGC)
A new collection increment has completed.
|
int |
releaseDiscontiguousChunks(Address chunk)
Release one or more contiguous chunks associated with a discontiguous
space.
|
ObjectReference |
traceObject(TransitiveClosure trace,
ObjectReference object)
Trace a reference to an object.
|
ObjectReference |
traceObject(TransitiveClosure trace,
ObjectReference object,
int allocator)
Trace a reference to an object.
|
private ObjectReference |
traceObjectWithOpportunisticCopy(TransitiveClosure trace,
ObjectReference object,
int allocator,
boolean nurseryCollection)
Trace a reference to an object, forwarding the object if appropriate
If the object is not already marked, mark the object and enqueue it
for subsequent processing.
|
private void |
traceObjectWithoutMoving(TransitiveClosure trace,
ObjectReference object)
Trace a reference to an object in the context of a non-moving collection.
|
private void |
unlock()
Release the appropriate lock depending on whether the context is
GC or mutator.
|
boolean |
willNotMoveThisGC(Address address) |
boolean |
willNotMoveThisGC(ObjectReference object) |
boolean |
willNotMoveThisNurseryGC(ObjectReference object) |
acquire, availablePhysicalPages, chunkAlign, chunkAlign, committedPages, cumulativeCommittedPages, eagerlyMmapMMTkContiguousSpaces, eagerlyMmapMMTkDiscontiguousSpaces, eagerlyMmapMMTkSpaces, getDescriptor, getDiscontigEnd, getDiscontigStart, getExtent, getFracAvailable, getHeadDiscontiguousRegion, getIndex, getName, getSpaceCount, getSpaceForAddress, getSpaceForObject, getSpaces, getStart, growDiscontiguousSpace, isImmortal, isImmortal, isInSpace, isInSpace, isMappedAddress, isMappedObject, isMovable, isMovable, isReachable, printUsageMB, printUsagePages, printVMMap, releaseAllChunks, requiredChunks, reservedPages, setZeroingApproach, skipConcurrentZeroing, triggerConcurrentZeroing, visitSpaces
private static short reusableMarkStateThreshold
private byte markState
byte lineMarkState
private byte lineUnavailState
private boolean inCollection
private int linesConsumed
private final Lock mutatorLock
private Address allocBlockCursor
private Address allocBlockSentinel
private boolean exhaustedReusableSpace
public ImmixSpace(String name, VMRequest vmRequest)
name
- The name of this space (used when printing error messages etc)vmRequest
- The virtual memory requestpublic ImmixSpace(String name, boolean zeroed, VMRequest vmRequest)
name
- The name of this space (used when printing error messages etc)zeroed
- if true, allocations return zeroed memoryvmRequest
- The virtual memory requestpublic void initializeDefrag()
public void prepare(boolean majorGC)
majorGC
- whether the collection will be a full heap collectionpublic boolean release(boolean majorGC)
majorGC
- whether the collection was a full heap collectionpublic void decideWhetherToDefrag(boolean emergencyCollection, boolean collectWholeHeap, int collectionAttempt, boolean userTriggeredCollection)
emergencyCollection
- Is this collection an emergency (last did not yield enough)?collectWholeHeap
- Is this a whole heap collection?collectionAttempt
- Which attempt is this to collect?userTriggeredCollection
- Was this collection requested by the user?public int defragHeadroomPages()
public boolean inImmixCollection()
true
if this space is currently being collected.true
if this space is currently being collected.public boolean inImmixDefragCollection()
true
if this space is currently being defraged.true
if this space is currently being defraged.public int getPagesAllocated()
public static short getReusuableMarkStateThreshold(boolean forDefrag)
forDefrag
- The query is the context of a defragmenting collectionpublic Address getSpace(boolean hot, boolean copy, int lineUseCount)
hot
- True if the requesting context is for hot allocations (used for
allocations from high allocation volume sites).copy
- TODO needs documentationlineUseCount
- TODO needs documentationnull
if no usable blocks are availablepublic void growSpace(Address start, Extent bytes, boolean newChunk)
Space
public Address acquireReusableBlocks()
public void release(Address block)
public int releaseDiscontiguousChunks(Address chunk)
This hook is called by the page level allocators whenever a complete discontiguous chunk is released.
releaseDiscontiguousChunks
in class Space
chunk
- The address of the start of the contiguous chunk or chunkspublic void postAlloc(ObjectReference object, int bytes)
object
- the object ref to the storage to be initializedbytes
- size of the allocated object in bytespublic void postCopy(ObjectReference object, int bytes, boolean majorGC)
object
- the object ref to the storage to be initializedbytes
- size of the copied object in bytesmajorGC
- Is this copy happening during a major gc?public ObjectReference traceObject(TransitiveClosure trace, ObjectReference object, int allocator)
trace
- The trace performing the transitive closureobject
- The object to be traced.allocator
- The allocator to which any copying should be directedpublic ObjectReference fastTraceObject(TransitiveClosure trace, ObjectReference object)
trace
- The trace performing the transitive closureobject
- The object to be traced.public ObjectReference nurseryTraceObject(TransitiveClosure trace, ObjectReference object, int allocator)
trace
- The trace performing the transitive closureobject
- The object to be traced.allocator
- The allocator to which any copying should be directedpublic ObjectReference traceObject(TransitiveClosure trace, ObjectReference object)
traceObject
in class Space
trace
- The trace performing the transitive closureobject
- The object to be traced.private void traceObjectWithoutMoving(TransitiveClosure trace, ObjectReference object)
trace
- The trace performing the transitive closureobject
- The object to be traced.private ObjectReference traceObjectWithOpportunisticCopy(TransitiveClosure trace, ObjectReference object, int allocator, boolean nurseryCollection)
trace
- The trace performing the transitive closureobject
- The object to be traced.allocator
- The allocator to which any copying should be directednurseryCollection
- whether the current collection is a nursery collectionpublic void markLines(ObjectReference object)
object
- The object which is live and for which the associated lines
must be marked.public int getNextUnavailableLine(Address baseLineAvailAddress, int line)
public int getNextAvailableLine(Address baseLineAvailAddress, int line)
int getAvailableLines(int[] spillAvailHistogram)
spillAvailHistogram
- A histogram of availability to be populatedprivate int getUsableLinesInRegion(Address start, Address end, int[] spillAvailHistogram)
start
- The start of the region to be checked for availabilityend
- The end of the region to be checked for availabilityspillAvailHistogram
- The histogram which will be populatedpublic boolean isLive(ObjectReference object)
public boolean copyNurseryIsLive(ObjectReference object)
object
- The object in questionpublic boolean fastIsLive(ObjectReference object)
object
- The object in questiontrue
if this object is known to be live (i.e. it is marked)public boolean willNotMoveThisGC(ObjectReference object)
public boolean willNotMoveThisNurseryGC(ObjectReference object)
private boolean isDefragSource(ObjectReference object)
public boolean willNotMoveThisGC(Address address)
public boolean isDefragSource(Address address)
private void lock()
private void unlock()
public static boolean isRecycleAllocChunkAligned(Address ptr)
ptr
- the block's addressImmixConstants.RECYCLE_ALLOC_CHUNK_MASK
flagChunkList getChunkMap()