|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mmtk.policy.Space org.mmtk.policy.immix.ImmixSpace
public final class ImmixSpace
Each instance of this class corresponds to one immix space. Each of the instance methods of this class may be called by any thread (i.e. synchronization must be explicit in any instance or class method). This contrasts with the SquishLocal, where instances correspond to *plan* instances and therefore to kernel threads. Thus unlike this class, synchronization is not necessary in the instance methods of SquishLocal.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.mmtk.policy.Space |
---|
Space.SpaceVisitor |
Field Summary | |
---|---|
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
|
Fields inherited from class org.mmtk.policy.Space |
---|
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 Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static short reusableMarkStateThreshold
private byte markState
byte lineMarkState
private byte lineUnavailState
private boolean inCollection
private int linesConsumed
private Lock mutatorLock
private Lock gcLock
private Address allocBlockCursor
private Address allocBlockSentinel
private boolean exhaustedReusableSpace
private final ChunkList chunkMap
private final Defrag defrag
Constructor Detail |
---|
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 requestMethod Detail |
---|
public void prepare(boolean majorGC)
public boolean release(boolean majorGC)
majorGC
- TODOpublic 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 collection
public 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).
public void growSpace(Address start, Extent bytes, boolean newChunk)
Space
growSpace
in class Space
start
- The start of the newly allocated spacebytes
- The size of the newly allocated spacenewChunk
- true
if the new space encroached upon or started a new chunk or chunks.public Address acquireReusableBlocks()
public void release(Address block)
release
in class Space
block
- The address of the block to be releasedpublic 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 chunks
public void postAlloc(ObjectReference object, int bytes)
object
- the object ref to the storage to be initializedpublic void postCopy(ObjectReference object, int bytes, boolean majorGC)
object
- the object ref to the storage to be initializedmajorGC
- 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 directed
public 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 directed
public 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 directed
public 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 populated
private 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 populated
public boolean isLive(ObjectReference object)
isLive
in class Space
object
- The object in question
true
if this object is known to be live (i.e. it is marked)public boolean copyNurseryIsLive(ObjectReference object)
object
- The object in question
public boolean fastIsLive(ObjectReference object)
object
- The object in question
true
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)
ChunkList getChunkMap()
Defrag getDefrag()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |