|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mmtk.policy.Space
org.mmtk.policy.CopySpace
public final class CopySpace
This class implements tracing functionality for a simple copying space. Since no state needs to be held globally or locally, all methods are static.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.mmtk.policy.Space |
---|
Space.SpaceVisitor |
Field Summary | |
---|---|
private boolean |
fromSpace
|
static int |
GC_HEADER_WORDS_REQUIRED
|
static int |
GLOBAL_GC_BITS_REQUIRED
|
static int |
LOCAL_GC_BITS_REQUIRED
|
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 |
Constructor Summary | |
---|---|
CopySpace(String name,
boolean fromSpace,
boolean zeroed,
VMRequest vmRequest)
The caller specifies the region of virtual memory to be used for this space. |
|
CopySpace(String name,
boolean fromSpace,
VMRequest vmRequest)
The caller specifies the region of virtual memory to be used for this space. |
Method Summary | |
---|---|
boolean |
isFromSpace()
|
boolean |
isLive(ObjectReference object)
Return true if this object is live in this GC |
boolean |
isMovable()
fromSpace CopySpace can always move, toSpace will not move during current GC |
boolean |
isReachable(ObjectReference object)
Has the object in this space been reached during the current collection. |
void |
postAlloc(ObjectReference object)
Perform any required post-allocation initialization Nothing to be done in this case |
void |
prepare(boolean fromSpace)
Prepare this space instance for a collection. |
void |
release()
Release this copy space after a collection. |
void |
release(Address start)
Release an allocated page or pages. |
ObjectReference |
traceObject(TransitiveClosure trace,
ObjectReference object)
Trace an object under a copying collection policy. |
ObjectReference |
traceObject(TransitiveClosure trace,
ObjectReference object,
int allocator)
Trace an object under a copying collection policy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LOCAL_GC_BITS_REQUIRED
public static final int GLOBAL_GC_BITS_REQUIRED
public static final int GC_HEADER_WORDS_REQUIRED
private static final int META_DATA_PAGES_PER_REGION
private boolean fromSpace
Constructor Detail |
---|
public CopySpace(String name, boolean fromSpace, VMRequest vmRequest)
name
- The name of this space (used when printing error messages etc)fromSpace
- The does this instance start life as from-space
(or to-space)?vmRequest
- An object describing the virtual memory requested.public CopySpace(String name, boolean fromSpace, boolean zeroed, VMRequest vmRequest)
name
- The name of this space (used when printing error messages etc)fromSpace
- The does this instance start life as from-spacezeroed
- if true, allocations return zeroed memory.
(or to-space)?vmRequest
- An object describing the virtual memory requested.Method Detail |
---|
public boolean isFromSpace()
public boolean isMovable()
isMovable
in class Space
public void prepare(boolean fromSpace)
fromSpace
- Set the fromSpace field to this valuepublic void release()
public void release(Address start)
release
in class Space
start
- The address of the start of the page or pagespublic ObjectReference traceObject(TransitiveClosure trace, ObjectReference object)
We use a tri-state algorithm to deal with races to forward the object. The tracer must wait if the object is concurrently being forwarded by another thread.
If the object is already forwarded, the copy is returned. Otherwise, the object is forwarded and the copy is returned.
traceObject
in class Space
trace
- The trace being conducted.object
- The object to be forwarded.
public ObjectReference traceObject(TransitiveClosure trace, ObjectReference object, int allocator)
We use a tri-state algorithm to deal with races to forward the object. The tracer must wait if the object is concurrently being forwarded by another thread.
If the object is already forwarded, the copy is returned. Otherwise, the object is forwarded and the copy is returned.
trace
- The trace being conducted.object
- The object to be forwarded.allocator
- The allocator to use when copying.
public boolean isLive(ObjectReference object)
true
if this object is live in this GC
isLive
in class Space
object
- The object in question
true
if this object is live in this GC (has it been forwarded?)public boolean isReachable(ObjectReference object)
Space
isReachable
in class Space
object
- The object reference.
true
if the object is reachable.public void postAlloc(ObjectReference object)
object
- the object ref to the storage to be initialized
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |