org.mmtk.vm
Class Barriers

java.lang.Object
  extended by org.mmtk.vm.Barriers
Direct Known Subclasses:
Barriers

public abstract class Barriers
extends Object


Constructor Summary
Barriers()
           
 
Method Summary
abstract  Address addressRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of the read barrier, returning the value as a raw Address.
abstract  boolean addressTryCompareAndSwap(ObjectReference ref, Address old, Address target, Word metaDataA, Word metaDataB, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
abstract  void addressWrite(ObjectReference ref, Address target, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of the write barrier, writing the value as a raw Address.
abstract  boolean booleanRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of a boolean read barrier.
abstract  void booleanWrite(ObjectReference ref, boolean value, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of a boolean write barrier.
abstract  byte byteRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of a byte read barrier.
abstract  void byteWrite(ObjectReference ref, byte value, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of a byte write barrier.
abstract  char charRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of a char read barrier.
abstract  void charWrite(ObjectReference ref, char value, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of a char write barrier.
abstract  double doubleRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of a double read barrier.
abstract  void doubleWrite(ObjectReference ref, double value, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of a double write barrier.
abstract  Extent extentRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of the read barrier, returning the value as a raw Extent.
abstract  void extentWrite(ObjectReference ref, Extent target, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of the write barrier, writing the value as a raw Extent.
abstract  float floatRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of a float read barrier.
abstract  void floatWrite(ObjectReference ref, float value, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of a float write barrier.
abstract  int intRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of a int read barrier.
abstract  boolean intTryCompareAndSwap(ObjectReference objref, int old, int value, Word metaDataA, Word metaDataB, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
abstract  void intWrite(ObjectReference ref, int value, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of a int write barrier.
abstract  long longRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of a long read barrier.
abstract  boolean longTryCompareAndSwap(ObjectReference objref, long old, long value, Word metaDataA, Word metaDataB, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
abstract  void longWrite(ObjectReference ref, long value, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of a long write barrier.
abstract  void objectArrayStoreNoGCBarrier(Object[] dst, int index, Object value)
          Sets an element of an object array without invoking any write barrier.
abstract  ObjectReference objectReferenceAtomicWrite(ObjectReference ref, ObjectReference target, Word metaDataA, Word metaDataB, int mode)
          Atomically write a reference field of an object or array and return the old value of the reference field.
abstract  void objectReferenceNonHeapWrite(Address slot, ObjectReference target, Word metaDataA, Word metaDataB)
          Perform the actual write of the non-heap write barrier.
abstract  ObjectReference objectReferenceRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of a read barrier.
abstract  boolean objectReferenceTryCompareAndSwap(ObjectReference ref, ObjectReference old, ObjectReference target, Word metaDataA, Word metaDataB, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
abstract  void objectReferenceWrite(ObjectReference ref, ObjectReference value, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of an object reference write barrier.
abstract  Offset offsetRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of the read barrier, returning the value as a raw Offset.
abstract  void offsetWrite(ObjectReference ref, Offset target, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of the write barrier, writing the value as a raw Offset.
abstract  short shortRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of a short read barrier.
abstract  void shortWrite(ObjectReference ref, short value, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of a short write barrier.
abstract  Word wordAtomicWrite(ObjectReference ref, Word rawTarget, Word metaDataA, Word metaDataB, int mode)
          Atomically write a Word field of an object or array and return the old value of the Word field.
abstract  Word wordRead(ObjectReference ref, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of the read barrier, returning the value as a raw Word.
abstract  boolean wordTryCompareAndSwap(ObjectReference ref, Word old, Word target, Word metaDataA, Word metaDataB, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
abstract  void wordWrite(ObjectReference ref, Word target, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of the write barrier, writing the value as a raw Word.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Barriers

public Barriers()
Method Detail

booleanWrite

public abstract void booleanWrite(ObjectReference ref,
                                  boolean value,
                                  Word metaDataA,
                                  Word metaDataB,
                                  int mode)
Perform the actual write of a boolean write barrier.

Parameters:
ref - The object that has the boolean field
value - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

booleanRead

public abstract boolean booleanRead(ObjectReference ref,
                                    Word metaDataA,
                                    Word metaDataB,
                                    int mode)
Perform the actual read of a boolean read barrier.

Parameters:
ref - The object that has the boolean field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

byteWrite

public abstract void byteWrite(ObjectReference ref,
                               byte value,
                               Word metaDataA,
                               Word metaDataB,
                               int mode)
Perform the actual write of a byte write barrier.

Parameters:
ref - The object that has the byte field
value - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

byteRead

public abstract byte byteRead(ObjectReference ref,
                              Word metaDataA,
                              Word metaDataB,
                              int mode)
Perform the actual read of a byte read barrier.

Parameters:
ref - The object that has the byte field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

charWrite

public abstract void charWrite(ObjectReference ref,
                               char value,
                               Word metaDataA,
                               Word metaDataB,
                               int mode)
Perform the actual write of a char write barrier.

Parameters:
ref - The object that has the char field
value - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

charRead

public abstract char charRead(ObjectReference ref,
                              Word metaDataA,
                              Word metaDataB,
                              int mode)
Perform the actual read of a char read barrier.

Parameters:
ref - The object that has the char field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

shortWrite

public abstract void shortWrite(ObjectReference ref,
                                short value,
                                Word metaDataA,
                                Word metaDataB,
                                int mode)
Perform the actual write of a short write barrier.

Parameters:
ref - The object that has the short field
value - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

shortRead

public abstract short shortRead(ObjectReference ref,
                                Word metaDataA,
                                Word metaDataB,
                                int mode)
Perform the actual read of a short read barrier.

Parameters:
ref - The object that has the short field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

intWrite

public abstract void intWrite(ObjectReference ref,
                              int value,
                              Word metaDataA,
                              Word metaDataB,
                              int mode)
Perform the actual write of a int write barrier.

Parameters:
ref - The object that has the int field
value - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

intRead

public abstract int intRead(ObjectReference ref,
                            Word metaDataA,
                            Word metaDataB,
                            int mode)
Perform the actual read of a int read barrier.

Parameters:
ref - The object that has the int field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

intTryCompareAndSwap

public abstract boolean intTryCompareAndSwap(ObjectReference objref,
                                             int old,
                                             int value,
                                             Word metaDataA,
                                             Word metaDataB,
                                             int mode)
Attempt an atomic compare and exchange in a write barrier sequence.

Parameters:
objref - The object that has the int field
old - The old int to be swapped out
value - the new int
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
True if the compare and swap was successful

longWrite

public abstract void longWrite(ObjectReference ref,
                               long value,
                               Word metaDataA,
                               Word metaDataB,
                               int mode)
Perform the actual write of a long write barrier.

Parameters:
ref - The object that has the long field
value - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

longRead

public abstract long longRead(ObjectReference ref,
                              Word metaDataA,
                              Word metaDataB,
                              int mode)
Perform the actual read of a long read barrier.

Parameters:
ref - The object that has the long field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

longTryCompareAndSwap

public abstract boolean longTryCompareAndSwap(ObjectReference objref,
                                              long old,
                                              long value,
                                              Word metaDataA,
                                              Word metaDataB,
                                              int mode)
Attempt an atomic compare and exchange in a write barrier sequence.

Parameters:
objref - The object that has the long field
old - The old long to be swapped out
value - the new long
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
True if the compare and swap was successful

floatWrite

public abstract void floatWrite(ObjectReference ref,
                                float value,
                                Word metaDataA,
                                Word metaDataB,
                                int mode)
Perform the actual write of a float write barrier.

Parameters:
ref - The object that has the float field
value - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

floatRead

public abstract float floatRead(ObjectReference ref,
                                Word metaDataA,
                                Word metaDataB,
                                int mode)
Perform the actual read of a float read barrier.

Parameters:
ref - The object that has the float field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

doubleWrite

public abstract void doubleWrite(ObjectReference ref,
                                 double value,
                                 Word metaDataA,
                                 Word metaDataB,
                                 int mode)
Perform the actual write of a double write barrier.

Parameters:
ref - The object that has the double field
value - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

doubleRead

public abstract double doubleRead(ObjectReference ref,
                                  Word metaDataA,
                                  Word metaDataB,
                                  int mode)
Perform the actual read of a double read barrier.

Parameters:
ref - The object that has the double field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

objectReferenceWrite

public abstract void objectReferenceWrite(ObjectReference ref,
                                          ObjectReference value,
                                          Word metaDataA,
                                          Word metaDataB,
                                          int mode)
Perform the actual write of an object reference write barrier.

Parameters:
ref - The object that has the reference field
value - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

objectReferenceRead

public abstract ObjectReference objectReferenceRead(ObjectReference ref,
                                                    Word metaDataA,
                                                    Word metaDataB,
                                                    int mode)
Perform the actual read of a read barrier.

Parameters:
ref - The object that has the reference field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

objectReferenceNonHeapWrite

public abstract void objectReferenceNonHeapWrite(Address slot,
                                                 ObjectReference target,
                                                 Word metaDataA,
                                                 Word metaDataB)
Perform the actual write of the non-heap write barrier. This is used when the store is not to an object, but to a non-heap location such as statics or the stack.

Parameters:
slot - The address that contains the reference field
target - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot

objectReferenceAtomicWrite

public abstract ObjectReference objectReferenceAtomicWrite(ObjectReference ref,
                                                           ObjectReference target,
                                                           Word metaDataA,
                                                           Word metaDataB,
                                                           int mode)
Atomically write a reference field of an object or array and return the old value of the reference field.

Parameters:
ref - The object that has the reference field
target - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
The value that was replaced by the write.

objectReferenceTryCompareAndSwap

public abstract boolean objectReferenceTryCompareAndSwap(ObjectReference ref,
                                                         ObjectReference old,
                                                         ObjectReference target,
                                                         Word metaDataA,
                                                         Word metaDataB,
                                                         int mode)
Attempt an atomic compare and exchange in a write barrier sequence.

Parameters:
ref - The object that has the reference field
old - The old reference to be swapped out
target - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
True if the compare and swap was successful

wordWrite

public abstract void wordWrite(ObjectReference ref,
                               Word target,
                               Word metaDataA,
                               Word metaDataB,
                               int mode)
Perform the actual write of the write barrier, writing the value as a raw Word.

Parameters:
ref - The object that has the Word field
target - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

wordAtomicWrite

public abstract Word wordAtomicWrite(ObjectReference ref,
                                     Word rawTarget,
                                     Word metaDataA,
                                     Word metaDataB,
                                     int mode)
Atomically write a Word field of an object or array and return the old value of the Word field.

Parameters:
ref - The object that has the Word field
rawTarget - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
The raw value that was replaced by the write.

wordTryCompareAndSwap

public abstract boolean wordTryCompareAndSwap(ObjectReference ref,
                                              Word old,
                                              Word target,
                                              Word metaDataA,
                                              Word metaDataB,
                                              int mode)
Attempt an atomic compare and exchange in a write barrier sequence.

Parameters:
ref - The object that has the Word field
old - The old Word to be swapped out
target - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
True if the compare and swap was successful

wordRead

public abstract Word wordRead(ObjectReference ref,
                              Word metaDataA,
                              Word metaDataB,
                              int mode)
Perform the actual read of the read barrier, returning the value as a raw Word.

Parameters:
ref - The object that has the Word field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

addressWrite

public abstract void addressWrite(ObjectReference ref,
                                  Address target,
                                  Word metaDataA,
                                  Word metaDataB,
                                  int mode)
Perform the actual write of the write barrier, writing the value as a raw Address.

Parameters:
ref - The object that has the Address field
target - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

addressRead

public abstract Address addressRead(ObjectReference ref,
                                    Word metaDataA,
                                    Word metaDataB,
                                    int mode)
Perform the actual read of the read barrier, returning the value as a raw Address.

Parameters:
ref - The object that has the Address field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

addressTryCompareAndSwap

public abstract boolean addressTryCompareAndSwap(ObjectReference ref,
                                                 Address old,
                                                 Address target,
                                                 Word metaDataA,
                                                 Word metaDataB,
                                                 int mode)
Attempt an atomic compare and exchange in a write barrier sequence.

Parameters:
ref - The object that has the Address field
old - The old address to be swapped out
target - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
True if the compare and swap was successful

offsetWrite

public abstract void offsetWrite(ObjectReference ref,
                                 Offset target,
                                 Word metaDataA,
                                 Word metaDataB,
                                 int mode)
Perform the actual write of the write barrier, writing the value as a raw Offset.

Parameters:
ref - The object that has the Offset field
target - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

offsetRead

public abstract Offset offsetRead(ObjectReference ref,
                                  Word metaDataA,
                                  Word metaDataB,
                                  int mode)
Perform the actual read of the read barrier, returning the value as a raw Offset.

Parameters:
ref - The object that has the Offset field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

extentWrite

public abstract void extentWrite(ObjectReference ref,
                                 Extent target,
                                 Word metaDataA,
                                 Word metaDataB,
                                 int mode)
Perform the actual write of the write barrier, writing the value as a raw Extent.

Parameters:
ref - The object that has the Extent field
target - The value that the slot will be updated to
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring

extentRead

public abstract Extent extentRead(ObjectReference ref,
                                  Word metaDataA,
                                  Word metaDataB,
                                  int mode)
Perform the actual read of the read barrier, returning the value as a raw Extent.

Parameters:
ref - The object that has the Extent field
metaDataA - Opaque, VM-specific, meta-data identifying the slot
metaDataB - Opaque, VM-specific, meta-data identifying the slot
mode - The context in which the write is occurring
Returns:
the read value

objectArrayStoreNoGCBarrier

public abstract void objectArrayStoreNoGCBarrier(Object[] dst,
                                                 int index,
                                                 Object value)
Sets an element of an object array without invoking any write barrier. This method is called by the Map class to ensure potentially-allocation-triggering write barriers do not occur in allocation slow path code.

Parameters:
dst - the destination array
index - the index of the element to set
value - the new value for the element