org.mmtk.plan
Class MutatorContext

java.lang.Object
  extended by org.mmtk.plan.MutatorContext
All Implemented Interfaces:
Constants
Direct Known Subclasses:
NoGCMutator, SimpleMutator

public abstract class MutatorContext
extends Object
implements Constants

This class (and its sub-classes) implement per-mutator thread behavior. We assume N collector threads and M mutator threads, where N is often equal to the number of available processors, P (for P-way parallelism at GC-time), and M may simply be the number of mutator (application) threads. Both N and M are determined by the VM, not MMTk. In the case where a VM uses posix threads (pthreads) for each mutator ("1:1" threading), M will typically be equal to the number of mutator threads. When a uses "green threads" or a hybrid threading scheme (such as Jikes RVM), M will typically be equal to the level of true parallelism (ie the number of underlying kernel threads).

MMTk assumes that the VM instantiates instances of MutatorContext in thread local storage (TLS) for each thread participating in collection. Accesses to this state are therefore assumed to be low-cost during mutator time.

This class (and its children) is therefore used for unsynchronized per-mutator operations such as allocation and write barriers. The semantics and necessary state for these operations are therefore specified in the GC-specific subclasses of this class. MMTk explicitly separates thread-local (this class) and global operations (@see Plan), so that syncrhonization is localized and explicit, and thus hopefully minimized (@see Plan). Gloabl (Plan) and per-thread (this class) state are also explicitly separated. Operations in this class (and its children) are therefore strictly local to each mutator thread, and synchronized operations always happen via access to explicitly global classes such as Plan and its children. Therefore only "fast path" (unsynchronized) allocation and barrier semantics are defined in MutatorContext and its subclasses. These call out to "slow path" (synchronize(d) methods which have global state and are globally synchronized. For example, an allocation fast path may bump a pointer without any syncrhonization (the "fast path") until a limit is reached, at which point the "slow path" is called, and more memory is aquired from a global resource.

As the super-class of all per-mutator contexts, this class implements basic per-mutator behavior common to all MMTk collectors, including support for immortal and large object space allocation, as well as empty stubs for write barriers (to be overridden by sub-classes as needed).

See Also:
CollectorContext, ActivePlan, Plan

Field Summary
private  int id
          Unique mutator identifier
protected  BumpPointer immortal
          Per-mutator allocator into the immortal space
protected  LargeObjectLocal lgcode
          Per-mutator allocator into the large code space
protected  Log log
          Used for printing log information in a thread safe manner
protected  LargeObjectLocal los
          Per-mutator allocator into the large object space
protected  MarkSweepLocal nonmove
          Per-mutator allocator into the non moving space
protected  MarkSweepLocal smcode
          Per-mutator allocator into the small code space
 
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
MutatorContext()
           
 
Method Summary
 boolean addressBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of Addresse's are about to be copied from object src to object dst (as in an array copy).
 Address addressRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read an Address.
 boolean addressTryCompareAndSwap(ObjectReference src, Address slot, Address old, Address value, Word metaDataA, Word metaDataB, int mode)
          Attempt to atomically exchange the value in the given slot with the passed replacement value.
 void addressWrite(ObjectReference src, Address slot, Address value, Word metaDataA, Word metaDataB, int mode)
          Write an Address.
 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.
 boolean booleanBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of booleans are about to be copied from object src to object dst (as in an array copy).
 boolean booleanRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read a boolean.
 void booleanWrite(ObjectReference src, Address slot, boolean value, Word metaDataA, Word metaDataB, int mode)
          Write a boolean.
 boolean byteBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of bytes are about to be copied from object src to object dst (as in an array copy).
 byte byteRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read a byte.
 void byteWrite(ObjectReference src, Address slot, byte value, Word metaDataA, Word metaDataB, int mode)
          Write a byte.
 boolean charBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of chars are about to be copied from object src to object dst (as in an array copy).
 char charRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read a char.
 void charWrite(ObjectReference src, Address slot, char value, Word metaDataA, Word metaDataB, int mode)
          Write a char.
 int checkAllocator(int bytes, int align, int allocator)
          Run-time check of the allocator to use for a given allocation At the moment this method assumes that allocators will use the simple (worst) method of aligning to determine if the object is a large object to ensure that no objects are larger than other allocators can handle.
abstract  void collectionPhase(short phaseId, boolean primary)
          Perform a per-mutator collection phase.
 void deinitMutator()
          The mutator is about to be cleaned up, make sure all local data is returned.
 boolean doubleBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of doubles are about to be copied from object src to object dst (as in an array copy).
 double doubleRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read a double.
 void doubleWrite(ObjectReference src, Address slot, double value, Word metaDataA, Word metaDataB, int mode)
          Write a double.
 boolean extentBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of Extents are about to be copied from object src to object dst (as in an array copy).
 Extent extentRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read an Extent.
 void extentWrite(ObjectReference src, Address slot, Extent value, Word metaDataA, Word metaDataB, int mode)
          Write an Extent.
 boolean floatBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of floats are about to be copied from object src to object dst (as in an array copy).
 float floatRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read a float.
 void floatWrite(ObjectReference src, Address slot, float value, Word metaDataA, Word metaDataB, int mode)
          Write a float.
 void flush()
          Flush mutator context, in response to a requestMutatorFlush.
 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.
 int getId()
           
 Log getLog()
           
 void initMutator(int id)
          Notify that the mutator context is registered and ready to execute.
 boolean intBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of ints are about to be copied from object src to object dst (as in an array copy).
 int intRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read a int.
 boolean intTryCompareAndSwap(ObjectReference src, Address slot, int old, int value, Word metaDataA, Word metaDataB, int mode)
          Attempt to atomically exchange the value in the given slot with the passed replacement value.
 void intWrite(ObjectReference src, Address slot, int value, Word metaDataA, Word metaDataB, int mode)
          Write a int.
 ObjectReference javaLangReferenceReadBarrier(ObjectReference referent)
          Read a reference type.
 boolean longBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of longs are about to be copied from object src to object dst (as in an array copy).
 long longRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read a long.
 boolean longTryCompareAndSwap(ObjectReference src, Address slot, long old, long value, Word metaDataA, Word metaDataB, int mode)
          Attempt to atomically exchange the value in the given slot with the passed replacement value.
 void longWrite(ObjectReference src, Address slot, long value, Word metaDataA, Word metaDataB, int mode)
          Write a long.
 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).
 ObjectReference objectReferenceNonHeapRead(Address slot, Word metaDataA, Word metaDataB)
          Read an object reference.
 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.
 ObjectReference objectReferenceRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read an object reference.
 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 value, Word metaDataA, Word metaDataB, int mode)
          Write an object reference.
 boolean offsetBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of Offsets are about to be copied from object src to object dst (as in an array copy).
 Offset offsetRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read an Offset.
 void offsetWrite(ObjectReference src, Address slot, Offset value, Word metaDataA, Word metaDataB, int mode)
          Write an Offset.
 void postAlloc(ObjectReference ref, ObjectReference typeRef, int bytes, int allocator)
          Perform post-allocation actions.
 boolean shortBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of shorts are about to be copied from object src to object dst (as in an array copy).
 short shortRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read a short.
 void shortWrite(ObjectReference src, Address slot, short value, Word metaDataA, Word metaDataB, int mode)
          Write a short.
 boolean wordBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes)
          A number of Words are about to be copied from object src to object dst (as in an array copy).
 Word wordRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode)
          Read a Word.
 boolean wordTryCompareAndSwap(ObjectReference src, Address slot, Word old, Word value, Word metaDataA, Word metaDataB, int mode)
          Attempt to atomically exchange the value in the given slot with the passed replacement value.
 void wordWrite(ObjectReference src, Address slot, Word value, Word metaDataA, Word metaDataB, int mode)
          Write a Word.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private int id
Unique mutator identifier


log

protected final Log log
Used for printing log information in a thread safe manner


immortal

protected final BumpPointer immortal
Per-mutator allocator into the immortal space


los

protected final LargeObjectLocal los
Per-mutator allocator into the large object space


smcode

protected final MarkSweepLocal smcode
Per-mutator allocator into the small code space


lgcode

protected final LargeObjectLocal lgcode
Per-mutator allocator into the large code space


nonmove

protected final MarkSweepLocal nonmove
Per-mutator allocator into the non moving space

Constructor Detail

MutatorContext

public MutatorContext()
Method Detail

initMutator

public void initMutator(int id)
Notify that the mutator context is registered and ready to execute. From this point it will be included in iterations over mutators.

Parameters:
id - The id of this mutator context.

deinitMutator

public void deinitMutator()
The mutator is about to be cleaned up, make sure all local data is returned.


collectionPhase

public abstract void collectionPhase(short phaseId,
                                     boolean primary)
Perform a per-mutator collection phase.

Parameters:
phaseId - The unique phase identifier
primary - Should this thread be used to execute any single-threaded local operations?

checkAllocator

public int checkAllocator(int bytes,
                          int align,
                          int allocator)
Run-time check of the allocator to use for a given allocation

At the moment this method assumes that allocators will use the simple (worst) method of aligning to determine if the object is a large object to ensure that no objects are larger than other allocators can handle.

Parameters:
bytes - The number of bytes to be allocated
align - The requested alignment.
allocator - The allocator statically assigned to this allocation
Returns:
The allocator dynamically assigned to this allocation

alloc

public Address alloc(int bytes,
                     int align,
                     int offset,
                     int allocator,
                     int site)
Allocate memory for an object.

Parameters:
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
Returns:
The low address of the allocated chunk.

postAlloc

public void postAlloc(ObjectReference ref,
                      ObjectReference typeRef,
                      int bytes,
                      int allocator)
Perform post-allocation actions. For many allocators none are required.

Parameters:
ref - The newly allocated object
typeRef - the type reference for the instance being created
bytes - The size of the space to be allocated (in bytes)
allocator - The allocator number to be used for this allocation

getAllocatorFromSpace

public Allocator getAllocatorFromSpace(Space space)
Return the allocator instance associated with a space space, for this plan instance.

Parameters:
space - The space for which the allocator instance is desired.
Returns:
The allocator instance associated with this plan instance which is allocating into space, or null if no appropriate allocator can be established.

javaLangReferenceReadBarrier

public ObjectReference javaLangReferenceReadBarrier(ObjectReference referent)
Read a reference type. In a concurrent collector this may involve adding the referent to the marking queue.

Parameters:
referent - The referent being read.
Returns:
The new referent.

booleanWrite

public void booleanWrite(ObjectReference src,
                         Address slot,
                         boolean value,
                         Word metaDataA,
                         Word metaDataB,
                         int mode)
Write a boolean. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new boolean
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

booleanRead

public boolean booleanRead(ObjectReference src,
                           Address slot,
                           Word metaDataA,
                           Word metaDataB,
                           int mode)
Read a boolean. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The boolean that was read.

booleanBulkCopy

public boolean booleanBulkCopy(ObjectReference src,
                               Offset srcOffset,
                               ObjectReference dst,
                               Offset dstOffset,
                               int bytes)
A number of booleans are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

byteWrite

public void byteWrite(ObjectReference src,
                      Address slot,
                      byte value,
                      Word metaDataA,
                      Word metaDataB,
                      int mode)
Write a byte. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new byte
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

byteRead

public byte byteRead(ObjectReference src,
                     Address slot,
                     Word metaDataA,
                     Word metaDataB,
                     int mode)
Read a byte. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The byte that was read.

byteBulkCopy

public boolean byteBulkCopy(ObjectReference src,
                            Offset srcOffset,
                            ObjectReference dst,
                            Offset dstOffset,
                            int bytes)
A number of bytes are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

charWrite

public void charWrite(ObjectReference src,
                      Address slot,
                      char value,
                      Word metaDataA,
                      Word metaDataB,
                      int mode)
Write a char. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new char
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

charRead

public char charRead(ObjectReference src,
                     Address slot,
                     Word metaDataA,
                     Word metaDataB,
                     int mode)
Read a char. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The char that was read.

charBulkCopy

public boolean charBulkCopy(ObjectReference src,
                            Offset srcOffset,
                            ObjectReference dst,
                            Offset dstOffset,
                            int bytes)
A number of chars are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

shortWrite

public void shortWrite(ObjectReference src,
                       Address slot,
                       short value,
                       Word metaDataA,
                       Word metaDataB,
                       int mode)
Write a short. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new short
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

shortRead

public short shortRead(ObjectReference src,
                       Address slot,
                       Word metaDataA,
                       Word metaDataB,
                       int mode)
Read a short. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The short that was read.

shortBulkCopy

public boolean shortBulkCopy(ObjectReference src,
                             Offset srcOffset,
                             ObjectReference dst,
                             Offset dstOffset,
                             int bytes)
A number of shorts are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

intWrite

public void intWrite(ObjectReference src,
                     Address slot,
                     int value,
                     Word metaDataA,
                     Word metaDataB,
                     int mode)
Write a int. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new int
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

intRead

public int intRead(ObjectReference src,
                   Address slot,
                   Word metaDataA,
                   Word metaDataB,
                   int mode)
Read a int. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The int that was read.

intBulkCopy

public boolean intBulkCopy(ObjectReference src,
                           Offset srcOffset,
                           ObjectReference dst,
                           Offset dstOffset,
                           int bytes)
A number of ints are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

intTryCompareAndSwap

public boolean intTryCompareAndSwap(ObjectReference src,
                                    Address slot,
                                    int old,
                                    int value,
                                    Word metaDataA,
                                    Word metaDataB,
                                    int mode)
Attempt to atomically exchange the value in the given slot with the passed replacement value. By default do nothing, override if appropriate.

Parameters:
src - The object into which the value will be stored
slot - The address into which the value will be stored.
old - The old int to be swapped out
value - The new int
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred
Returns:
True if the swap was successful.

longWrite

public void longWrite(ObjectReference src,
                      Address slot,
                      long value,
                      Word metaDataA,
                      Word metaDataB,
                      int mode)
Write a long. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new long
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

longRead

public long longRead(ObjectReference src,
                     Address slot,
                     Word metaDataA,
                     Word metaDataB,
                     int mode)
Read a long. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The long that was read.

longBulkCopy

public boolean longBulkCopy(ObjectReference src,
                            Offset srcOffset,
                            ObjectReference dst,
                            Offset dstOffset,
                            int bytes)
A number of longs are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

longTryCompareAndSwap

public boolean longTryCompareAndSwap(ObjectReference src,
                                     Address slot,
                                     long old,
                                     long value,
                                     Word metaDataA,
                                     Word metaDataB,
                                     int mode)
Attempt to atomically exchange the value in the given slot with the passed replacement value. By default do nothing, override if appropriate.

Parameters:
src - The object into which the value will be stored
slot - The address into which the value will be stored.
old - The old long to be swapped out
value - The new long
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred
Returns:
True if the swap was successful.

floatWrite

public void floatWrite(ObjectReference src,
                       Address slot,
                       float value,
                       Word metaDataA,
                       Word metaDataB,
                       int mode)
Write a float. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new float
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

floatRead

public float floatRead(ObjectReference src,
                       Address slot,
                       Word metaDataA,
                       Word metaDataB,
                       int mode)
Read a float. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The float that was read.

floatBulkCopy

public boolean floatBulkCopy(ObjectReference src,
                             Offset srcOffset,
                             ObjectReference dst,
                             Offset dstOffset,
                             int bytes)
A number of floats are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

doubleWrite

public void doubleWrite(ObjectReference src,
                        Address slot,
                        double value,
                        Word metaDataA,
                        Word metaDataB,
                        int mode)
Write a double. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new double
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

doubleRead

public double doubleRead(ObjectReference src,
                         Address slot,
                         Word metaDataA,
                         Word metaDataB,
                         int mode)
Read a double. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The double that was read.

doubleBulkCopy

public boolean doubleBulkCopy(ObjectReference src,
                              Offset srcOffset,
                              ObjectReference dst,
                              Offset dstOffset,
                              int bytes)
A number of doubles are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

wordWrite

public void wordWrite(ObjectReference src,
                      Address slot,
                      Word value,
                      Word metaDataA,
                      Word metaDataB,
                      int mode)
Write a Word. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new Word
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

wordRead

public Word wordRead(ObjectReference src,
                     Address slot,
                     Word metaDataA,
                     Word metaDataB,
                     int mode)
Read a Word. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The Word that was read.

wordBulkCopy

public boolean wordBulkCopy(ObjectReference src,
                            Offset srcOffset,
                            ObjectReference dst,
                            Offset dstOffset,
                            int bytes)
A number of Words are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

wordTryCompareAndSwap

public boolean wordTryCompareAndSwap(ObjectReference src,
                                     Address slot,
                                     Word old,
                                     Word value,
                                     Word metaDataA,
                                     Word metaDataB,
                                     int mode)
Attempt to atomically exchange the value in the given slot with the passed replacement value. By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
old - The old Word to be swapped out
value - The new Word
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred
Returns:
True if the swap was successful.

addressWrite

public void addressWrite(ObjectReference src,
                         Address slot,
                         Address value,
                         Word metaDataA,
                         Word metaDataB,
                         int mode)
Write an Address. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the Word will be stored
slot - The address into which the Word will be stored.
value - The value of the new Address
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

addressRead

public Address addressRead(ObjectReference src,
                           Address slot,
                           Word metaDataA,
                           Word metaDataB,
                           int mode)
Read an Address. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The Address that was read.

addressBulkCopy

public boolean addressBulkCopy(ObjectReference src,
                               Offset srcOffset,
                               ObjectReference dst,
                               Offset dstOffset,
                               int bytes)
A number of Addresse's are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

addressTryCompareAndSwap

public boolean addressTryCompareAndSwap(ObjectReference src,
                                        Address slot,
                                        Address old,
                                        Address value,
                                        Word metaDataA,
                                        Word metaDataB,
                                        int mode)
Attempt to atomically exchange the value in the given slot with the passed replacement value. By default do nothing, override if appropriate.

Parameters:
src - The object into which the Address will be stored
slot - The address into which the Address will be stored.
old - The old Address to be swapped out
value - The new Address
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred
Returns:
True if the swap was successful.

extentWrite

public void extentWrite(ObjectReference src,
                        Address slot,
                        Extent value,
                        Word metaDataA,
                        Word metaDataB,
                        int mode)
Write an Extent. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new Extent
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

extentRead

public Extent extentRead(ObjectReference src,
                         Address slot,
                         Word metaDataA,
                         Word metaDataB,
                         int mode)
Read an Extent. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The Extent that was read.

extentBulkCopy

public boolean extentBulkCopy(ObjectReference src,
                              Offset srcOffset,
                              ObjectReference dst,
                              Offset dstOffset,
                              int bytes)
A number of Extents are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

offsetWrite

public void offsetWrite(ObjectReference src,
                        Address slot,
                        Offset value,
                        Word metaDataA,
                        Word metaDataB,
                        int mode)
Write an Offset. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new Offset
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

offsetRead

public Offset offsetRead(ObjectReference src,
                         Address slot,
                         Word metaDataA,
                         Word metaDataB,
                         int mode)
Read an Offset. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The Offset that was read.

offsetBulkCopy

public boolean offsetBulkCopy(ObjectReference src,
                              Offset srcOffset,
                              ObjectReference dst,
                              Offset dstOffset,
                              int bytes)
A number of Offsets are about to be copied from object src to object dst (as in an array copy). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
True if the update was performed by the barrier, false if left to the caller (always false in this case).

objectReferenceWrite

public void objectReferenceWrite(ObjectReference src,
                                 Address slot,
                                 ObjectReference value,
                                 Word metaDataA,
                                 Word metaDataB,
                                 int mode)
Write an object reference. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
value - The value of the new reference
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred

objectReferenceRead

public ObjectReference objectReferenceRead(ObjectReference src,
                                           Address slot,
                                           Word metaDataA,
                                           Word metaDataB,
                                           int mode)
Read an object reference. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
src - The object reference holding the field being read.
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
mode - The context in which the load occurred
Returns:
The reference that was read.

objectReferenceBulkCopy

public 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). Thus, dst is the mutated object. Take appropriate write barrier actions.

Parameters:
src - The source array
srcOffset - The starting source offset
dst - The destination array
dstOffset - The starting destination offset
bytes - The number of bytes to be copied
Returns:
true if the update was performed by the barrier, false if left to the caller (always false in this case).

objectReferenceNonHeapWrite

public 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. Take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
slot - The address into which the new reference will be stored.
tgt - The target of the new reference
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store

objectReferenceNonHeapRead

public ObjectReference objectReferenceNonHeapRead(Address slot,
                                                  Word metaDataA,
                                                  Word metaDataB)
Read an object reference. Take appropriate read barrier action, and return the value that was read.

This is a substituting barrier. The call to this barrier takes the place of a load.

Parameters:
slot - The address of the slot being read.
metaDataA - A value that assists the host VM in creating a load
metaDataB - A value that assists the host VM in creating a load
Returns:
The reference that was read.

objectReferenceTryCompareAndSwap

public 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. If a new reference is created, we must then take appropriate write barrier actions.

By default do nothing, override if appropriate.

Parameters:
src - The object into which the new reference will be stored
slot - The address into which the new reference will be stored.
old - The old reference to be swapped out
tgt - The target of the new reference
metaDataA - A value that assists the host VM in creating a store
metaDataB - A value that assists the host VM in creating a store
mode - The context in which the store occurred
Returns:
True if the swap was successful.

flush

public void flush()
Flush mutator context, in response to a requestMutatorFlush. Also called by the default implementation of deinitMutator.


flushRememberedSets

public void flushRememberedSets()
Flush per-mutator remembered sets into the global remset pool.


assertRemsetsFlushed

public void assertRemsetsFlushed()
Assert that the remsets have been flushed. This is critical to correctness. We need to maintain the invariant that remset entries do not accrue during GC. If the host JVM generates barrier entries it is its own responsibility to ensure that they are flushed before returning to MMTk.


getLog

public final Log getLog()
Returns:
the Log instance for this mutator context.

getId

public int getId()
Returns:
the unique identifier for this mutator context.