|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mmtk.plan.MutatorContext org.mmtk.plan.SimpleMutator org.mmtk.plan.StopTheWorldMutator org.mmtk.plan.generational.GenMutator
public class GenMutator
This abstract class implements per-mutator thread behavior and state for generational copying collectors.
Specifically, this class defines mutator-time allocation into the nursery; write barrier semantics, and per-mutator thread collection semantics (flushing and restoring per-mutator allocator and remset state).
Gen
,
GenCollector
,
StopTheWorldMutator
,
MutatorContext
Field Summary | |
---|---|
protected AddressPairDeque |
arrayRemset
|
private ObjectReferenceDeque |
modbuf
|
protected CopyLocal |
nursery
|
protected WriteBuffer |
remset
|
Fields inherited from class org.mmtk.plan.MutatorContext |
---|
immortal, lgcode, log, los, nonmove, smcode |
Constructor Summary | |
---|---|
GenMutator()
Constructor Note that each mutator is a producer of remsets, while each collector is a consumer. |
Method Summary | |
---|---|
Address |
alloc(int bytes,
int align,
int offset,
int allocator,
int site)
Allocate memory for an object. |
void |
assertRemsetsFlushed()
Assert that the remsets have been flushed. |
void |
collectionPhase(short phaseId,
boolean primary)
Perform a per-mutator collection phase. |
private void |
fastPath(Address slot,
ObjectReference tgt)
Perform the root write barrier fast path, which may involve remembering a reference if necessary. |
private void |
fastPath(ObjectReference src,
Address slot,
ObjectReference tgt,
int mode)
Perform the write barrier fast path, which may involve remembering a reference if necessary. |
void |
flushRememberedSets()
Flush per-mutator remembered sets into the global remset pool. |
Allocator |
getAllocatorFromSpace(Space space)
Return the allocator instance associated with a space space , for this plan instance. |
private static Gen |
global()
|
boolean |
objectReferenceBulkCopy(ObjectReference src,
Offset srcOffset,
ObjectReference dst,
Offset dstOffset,
int bytes)
A number of references are about to be copied from object src to object dst (as in an array
copy). |
void |
objectReferenceNonHeapWrite(Address slot,
ObjectReference tgt,
Word metaDataA,
Word metaDataB)
A new reference is about to be created in a location that is not a regular heap object. |
boolean |
objectReferenceTryCompareAndSwap(ObjectReference src,
Address slot,
ObjectReference old,
ObjectReference tgt,
Word metaDataA,
Word metaDataB,
int mode)
Attempt to atomically exchange the value in the given slot with the passed replacement value. |
void |
objectReferenceWrite(ObjectReference src,
Address slot,
ObjectReference tgt,
Word metaDataA,
Word metaDataB,
int mode)
Write an object reference. |
void |
postAlloc(ObjectReference ref,
ObjectReference typeRef,
int bytes,
int allocator)
Perform post-allocation actions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final CopyLocal nursery
private final ObjectReferenceDeque modbuf
protected final WriteBuffer remset
protected final AddressPairDeque arrayRemset
Constructor Detail |
---|
public GenMutator()
Note that each mutator is a producer of remsets, while each
collector is a consumer. The GenCollector
class
is responsible for construction of the consumer.
GenCollector
Method Detail |
---|
public Address alloc(int bytes, int align, int offset, int allocator, int site)
alloc
in class MutatorContext
bytes
- The number of bytes required for the object.align
- Required alignment for the object.offset
- Offset associated with the alignment.allocator
- The allocator associated with this request.site
- Allocation site
public void postAlloc(ObjectReference ref, ObjectReference typeRef, int bytes, int allocator)
MutatorContext
postAlloc
in class MutatorContext
ref
- The newly allocated objecttypeRef
- the type reference for the instance being createdbytes
- The size of the space to be allocated (in bytes)allocator
- The allocator number to be used for this allocationpublic Allocator getAllocatorFromSpace(Space space)
MutatorContext
space
, for this plan instance.
getAllocatorFromSpace
in class MutatorContext
space
- The space for which the allocator instance is desired.
space
, or null
if no appropriate allocator can be established.private void fastPath(ObjectReference src, Address slot, ObjectReference tgt, int mode)
src
- The object into which the new reference will be storedslot
- The address into which the new reference will be
stored.tgt
- The target of the new referencemode
- The mode of the store (eg putfield, putstatic etc)public final void objectReferenceWrite(ObjectReference src, Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode)
By default do nothing, override if appropriate.
In this case, we remember the address of the source of the pointer if the new reference points into the nursery from non-nursery space.
objectReferenceWrite
in class MutatorContext
src
- The object into which the new reference will be storedslot
- The address into which the new reference will be
stored.tgt
- The value of the new referencemetaDataA
- A value that assists the host VM in creating a storemetaDataB
- A value that assists the host VM in creating a storemode
- The context in which the store occurredprivate void fastPath(Address slot, ObjectReference tgt)
slot
- The address into which the new reference will be
stored.tgt
- The target of the new referencepublic final void objectReferenceNonHeapWrite(Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB)
By default do nothing, override if appropriate.
In this case, we remember the address of the source of the pointer if the new reference points into the nursery from non-nursery space.
objectReferenceNonHeapWrite
in class MutatorContext
slot
- The address into which the new reference will be
stored.tgt
- The target of the new referencemetaDataA
- A value that assists the host VM in creating a storemetaDataB
- A value that assists the host VM in creating a storepublic boolean objectReferenceTryCompareAndSwap(ObjectReference src, Address slot, ObjectReference old, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode)
By default do nothing, override if appropriate.
In this case, we remember the address of the source of the pointer if the new reference points into the nursery from non-nursery space.
objectReferenceTryCompareAndSwap
in class MutatorContext
src
- The object into which the new reference will be storedslot
- The address into which the new reference will be
stored.old
- The old reference to be swapped outtgt
- The target of the new referencemetaDataA
- A value that assists the host VM in creating a storemetaDataB
- A value that assists the host VM in creating a storemode
- The context in which the store occurred
public final boolean objectReferenceBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
src
to object dst
(as in an array
copy). Thus, dst
is the mutated object. Take
appropriate write barrier actions.In this case, we remember the mutated source address range and will scan that address range at GC time.
objectReferenceBulkCopy
in class MutatorContext
src
- The source arraysrcOffset
- The starting source offsetdst
- The destination arraydstOffset
- The starting destination offsetbytes
- The number of bytes to be copied
true
if the update was performed by the barrier, false if
left to the caller (always false in this case).public final void flushRememberedSets()
MutatorContext
flushRememberedSets
in class MutatorContext
public final void assertRemsetsFlushed()
MutatorContext
assertRemsetsFlushed
in class MutatorContext
public void collectionPhase(short phaseId, boolean primary)
collectionPhase
in class SimpleMutator
phaseId
- The unique phase identifierprimary
- Should this thread be used to execute any single-threaded
local operations?private static Gen global()
Gen
instance.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |