org.mmtk.policy
Class ImmortalSpace

java.lang.Object
  extended by org.mmtk.policy.Space
      extended by org.mmtk.policy.ImmortalSpace
All Implemented Interfaces:
Constants

public final class ImmortalSpace
extends Space
implements Constants

This class implements tracing for a simple immortal collection policy. Under this policy all that is required is for the "collector" to propagate marks in a liveness trace. It does not actually collect. This class does not hold any state, all methods are static.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.mmtk.policy.Space
Space.SpaceVisitor
 
Field Summary
(package private) static byte GC_MARK_BIT_MASK
           
private  byte markState
           
private static int META_DATA_PAGES_PER_REGION
           
 
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
 
Fields inherited from interface org.mmtk.utility.Constants
ALIGNMENT_VALUE, ARRAY_ELEMENT, BITS_IN_ADDRESS, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_INT, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_INT, BYTES_IN_KBYTE, BYTES_IN_MBYTE, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, CARD_MASK, CARD_META_PAGES_PER_REGION, INSTANCE_FIELD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_INT, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_ADDRESS_SPACE, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_INT, LOG_BYTES_IN_KBYTE, LOG_BYTES_IN_MBYTE, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD, LOG_CARD_BYTES, LOG_CARD_GRAIN, LOG_CARD_META_BYTES, LOG_CARD_META_PAGES, LOG_CARD_META_SIZE, LOG_CARD_UNITS, LOG_MIN_ALIGNMENT, MAX_ALIGNMENT, MAX_BYTES_PADDING, MAX_INT, MIN_ALIGNMENT, MIN_INT, SUPPORT_CARD_SCANNING
 
Constructor Summary
ImmortalSpace(String name, boolean zeroed, VMRequest vmRequest)
          The caller specifies the region of virtual memory to be used for this space.
ImmortalSpace(String name, VMRequest vmRequest)
          The caller specifies the region of virtual memory to be used for this space.
 
Method Summary
 Word getMarkState()
           
 void initializeHeader(ObjectReference object)
          Initialize the object header post-allocation.
 boolean isLive(ObjectReference object)
          Is the object in this space alive?
 boolean isReachable(ObjectReference object)
          Returns if the object in question is currently thought to be reachable.
 void prepare()
          Prepare for a new collection increment.
 void release()
           
 void release(Address start)
          Release an allocated page or pages.
private static boolean testAndMark(ObjectReference object, byte value)
          Used to mark boot image objects during a parallel scan of objects during GC Returns true if marking was done.
 ObjectReference traceObject(TransitiveClosure trace, ObjectReference object)
          Trace a reference to an object under an immortal collection policy.
 
Methods inherited from class org.mmtk.policy.Space
acquire, availablePhysicalPages, chunkAlign, chunkAlign, committedPages, cumulativeCommittedPages, eagerlyMmapMMTkContiguousSpaces, eagerlyMmapMMTkDiscontiguousSpaces, eagerlyMmapMMTkSpaces, getDescriptor, getDiscontigEnd, getDiscontigStart, getExtent, getFracAvailable, getHeadDiscontiguousRegion, getIndex, getName, getSpaceForAddress, getSpaceForObject, getStart, growDiscontiguousSpace, growSpace, isImmortal, isImmortal, isInSpace, isInSpace, isMappedAddress, isMappedObject, isMovable, isMovable, printUsageMB, printUsagePages, printVMMap, releaseAllChunks, releaseDiscontiguousChunks, requiredChunks, reservedPages, setZeroingApproach, skipConcurrentZeroing, triggerConcurrentZeroing, visitSpaces
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GC_MARK_BIT_MASK

static final byte GC_MARK_BIT_MASK
See Also:
Constant Field Values

META_DATA_PAGES_PER_REGION

private static final int META_DATA_PAGES_PER_REGION

markState

private byte markState
Constructor Detail

ImmortalSpace

public ImmortalSpace(String name,
                     VMRequest vmRequest)
The caller specifies the region of virtual memory to be used for this space. If this region conflicts with an existing space, then the constructor will fail.

Parameters:
name - The name of this space (used when printing error messages etc)
vmRequest - An object describing the virtual memory requested.

ImmortalSpace

public ImmortalSpace(String name,
                     boolean zeroed,
                     VMRequest vmRequest)
The caller specifies the region of virtual memory to be used for this space. If this region conflicts with an existing space, then the constructor will fail.

Parameters:
name - The name of this space (used when printing error messages etc)
zeroed - if true, allocations return zeroed memory.
vmRequest - An object describing the virtual memory requested.
Method Detail

getMarkState

public Word getMarkState()
Returns:
the current mark state

initializeHeader

public void initializeHeader(ObjectReference object)
Initialize the object header post-allocation. We need to set the mark state correctly and set the logged bit if necessary.

Parameters:
object - The newly allocated object instance whose header we are initializing

testAndMark

private static boolean testAndMark(ObjectReference object,
                                   byte value)
Used to mark boot image objects during a parallel scan of objects during GC Returns true if marking was done.


traceObject

public ObjectReference traceObject(TransitiveClosure trace,
                                   ObjectReference object)
Trace a reference to an object under an immortal collection policy. If the object is not already marked, enqueue the object for subsequent processing. The object is marked as (an atomic) side-effect of checking whether already marked.

Specified by:
traceObject in class Space
Parameters:
trace - The trace being conducted.
object - The object to be traced.
Returns:
The object, forwarded, if appropriate

prepare

public void prepare()
Prepare for a new collection increment. For the immortal collector we must flip the state of the mark bit between collections.


release

public void release()

release

public void release(Address start)
Release an allocated page or pages. In this case we do nothing because we only release pages enmasse.

Specified by:
release in class Space
Parameters:
start - The address of the start of the page or pages

isLive

public boolean isLive(ObjectReference object)
Description copied from class: Space
Is the object in this space alive?

Specified by:
isLive in class Space
Parameters:
object - The object reference.
Returns:
true if the object is live.

isReachable

public boolean isReachable(ObjectReference object)
Returns if the object in question is currently thought to be reachable. This is done by comparing the mark bit to the current mark state. For the immortal collector reachable and live are different, making this method necessary.

Overrides:
isReachable in class Space
Parameters:
object - The address of an object in immortal space to test
Returns:
true if ref may be a reachable object (e.g., having the current mark state). While all immortal objects are live, some may be unreachable.