org.jikesrvm.mm.mmtk
Class Barriers

java.lang.Object
  extended by org.mmtk.vm.Barriers
      extended by org.jikesrvm.mm.mmtk.Barriers
All Implemented Interfaces:
SizeConstants

public class Barriers
extends Barriers
implements SizeConstants


Field Summary
 
Fields inherited from interface org.jikesrvm.SizeConstants
BITS_IN_ADDRESS, BITS_IN_BOOLEAN, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_DOUBLE, BITS_IN_EXTENT, BITS_IN_FLOAT, BITS_IN_INT, BITS_IN_LONG, BITS_IN_OFFSET, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BOOLEAN, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_DOUBLE, BYTES_IN_EXTENT, BYTES_IN_FLOAT, BYTES_IN_INT, BYTES_IN_LONG, BYTES_IN_OFFSET, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BOOLEAN, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_DOUBLE, LOG_BITS_IN_EXTENT, LOG_BITS_IN_FLOAT, LOG_BITS_IN_INT, LOG_BITS_IN_LONG, LOG_BITS_IN_OFFSET, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_BOOLEAN, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_DOUBLE, LOG_BYTES_IN_EXTENT, LOG_BYTES_IN_FLOAT, LOG_BYTES_IN_INT, LOG_BYTES_IN_LONG, LOG_BYTES_IN_OFFSET, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD
 
Constructor Summary
Barriers()
           
 
Method Summary
 Address addressRead(ObjectReference ref, Word offset, Word location, int mode)
          Perform the actual read of the read barrier, returning the value as a raw Address.
 boolean addressTryCompareAndSwap(ObjectReference objref, Address expected, Address newValue, Word offset, Word unused, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
 void addressWrite(ObjectReference ref, Address target, Word offset, Word location, int mode)
          Perform the actual write of the write barrier, writing the value as a raw Address.
 boolean booleanRead(ObjectReference objref, Word offset, Word location, int mode)
          Perform the actual read of a boolean read barrier.
 void booleanWrite(ObjectReference objref, boolean value, Word offset, Word location, int mode)
          Perform the actual write of a boolean write barrier.
 byte byteRead(ObjectReference objref, Word offset, Word location, int mode)
          Perform the actual read of a byte read barrier.
 void byteWrite(ObjectReference objref, byte value, Word offset, Word location, int mode)
          Perform the actual write of a byte write barrier.
 char charRead(ObjectReference objref, Word offset, Word location, int mode)
          Perform the actual read of a char read barrier.
 void charWrite(ObjectReference objref, char value, Word offset, Word location, int mode)
          Perform the actual write of a char write barrier.
 double doubleRead(ObjectReference objref, Word offset, Word location, int mode)
          Perform the actual read of a double read barrier.
 void doubleWrite(ObjectReference objref, double value, Word offset, Word location, int mode)
          Perform the actual write of a double write barrier.
 Extent extentRead(ObjectReference ref, Word offset, Word location, int mode)
          Perform the actual read of the read barrier, returning the value as a raw Extent.
 void extentWrite(ObjectReference ref, Extent target, Word offset, Word location, int mode)
          Perform the actual write of the write barrier, writing the value as a raw Extent.
 float floatRead(ObjectReference objref, Word offset, Word location, int mode)
          Perform the actual read of a float read barrier.
 void floatWrite(ObjectReference objref, float value, Word offset, Word location, int mode)
          Perform the actual write of a float write barrier.
 int intRead(ObjectReference objref, Word offset, Word location, int mode)
          Perform the actual read of a int read barrier.
 boolean intTryCompareAndSwap(ObjectReference objref, int expected, int newValue, Word offset, Word unused, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
 void intWrite(ObjectReference objref, int value, Word offset, Word location, int mode)
          Perform the actual write of a int write barrier.
 long longRead(ObjectReference objref, Word offset, Word location, int mode)
          Perform the actual read of a long read barrier.
 boolean longTryCompareAndSwap(ObjectReference objref, long expected, long newValue, Word offset, Word unused, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
 void longWrite(ObjectReference objref, long value, Word offset, Word location, int mode)
          Perform the actual write of a long write barrier.
 void objectArrayStoreNoGCBarrier(Object[] dst, int index, Object value)
          Sets an element of an object array without invoking any write barrier.
 ObjectReference objectReferenceAtomicWrite(ObjectReference objref, ObjectReference target, Word offset, Word unused, int mode)
          Atomically write a reference field of an object or array and return the old value of the reference field.
 void objectReferenceNonHeapWrite(Address slot, ObjectReference target, Word unusedA, Word unusedB)
          Perform the actual write of the non-heap write barrier.
 ObjectReference objectReferenceRead(ObjectReference objref, Word offset, Word location, int mode)
          Perform the actual read of an object reference read barrier.
 boolean objectReferenceTryCompareAndSwap(ObjectReference objref, ObjectReference old, ObjectReference target, Word offset, Word unused, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
 void objectReferenceWrite(ObjectReference objref, ObjectReference value, Word offset, Word location, int mode)
          Perform the actual write of an object reference write barrier.
 Offset offsetRead(ObjectReference ref, Word offset, Word location, int mode)
          Perform the actual read of the read barrier, returning the value as a raw Offset.
 void offsetWrite(ObjectReference ref, Offset target, Word offset, Word location, int mode)
          Perform the actual write of the write barrier, writing the value as a raw Offset.
 short shortRead(ObjectReference objref, Word offset, Word location, int mode)
          Perform the actual read of a short read barrier.
 void shortWrite(ObjectReference objref, short value, Word offset, Word location, int mode)
          Perform the actual write of a short write barrier.
 Word wordAtomicWrite(ObjectReference ref, Word target, Word offset, Word unused, int mode)
          Atomically write a raw reference field of an object or array and return the old value of the reference field.
 Word wordRead(ObjectReference ref, Word offset, Word location, int mode)
          Perform the actual read of the read barrier, returning the value as a raw Word.
 boolean wordTryCompareAndSwap(ObjectReference ref, Word old, Word target, Word offset, Word unused, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
 void wordWrite(ObjectReference ref, Word target, Word offset, Word location, 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 final void booleanWrite(ObjectReference objref,
                               boolean value,
                               Word offset,
                               Word location,
                               int mode)
Perform the actual write of a boolean write barrier.

Specified by:
booleanWrite in class Barriers
Parameters:
objref - The object that has the boolean field
value - The value that the slot will be updated to
offset - The offset from the ref
location - The FieldReference index to assist the store
mode - The context in which the write is occurring

booleanRead

public final boolean booleanRead(ObjectReference objref,
                                 Word offset,
                                 Word location,
                                 int mode)
Perform the actual read of a boolean read barrier.

Specified by:
booleanRead in class Barriers
Parameters:
objref - The object that has the boolean field
offset - The offset from the ref
location - Unused
mode - The context in which the write is occurring
Returns:
the read value

byteWrite

public final void byteWrite(ObjectReference objref,
                            byte value,
                            Word offset,
                            Word location,
                            int mode)
Perform the actual write of a byte write barrier.

Specified by:
byteWrite in class Barriers
Parameters:
objref - The object that has the byte field
value - The value that the slot will be updated to
offset - The offset from the ref
location - The FieldReference index to assist the store
mode - The context in which the write is occurring

byteRead

public final byte byteRead(ObjectReference objref,
                           Word offset,
                           Word location,
                           int mode)
Perform the actual read of a byte read barrier.

Specified by:
byteRead in class Barriers
Parameters:
objref - The object that has the byte field
offset - The offset from the ref
location - Unused
mode - The context in which the write is occurring
Returns:
the read value

charWrite

public final void charWrite(ObjectReference objref,
                            char value,
                            Word offset,
                            Word location,
                            int mode)
Perform the actual write of a char write barrier.

Specified by:
charWrite in class Barriers
Parameters:
objref - The object that has the char field
value - The value that the slot will be updated to
offset - The offset from the ref
location - The FieldReference index to assist the store
mode - The context in which the write is occurring

charRead

public final char charRead(ObjectReference objref,
                           Word offset,
                           Word location,
                           int mode)
Perform the actual read of a char read barrier.

Specified by:
charRead in class Barriers
Parameters:
objref - The object that has the char field
offset - The offset from the ref
location - Unused
mode - The context in which the write is occurring
Returns:
the read value

shortWrite

public final void shortWrite(ObjectReference objref,
                             short value,
                             Word offset,
                             Word location,
                             int mode)
Perform the actual write of a short write barrier.

Specified by:
shortWrite in class Barriers
Parameters:
objref - The object that has the short field
value - The value that the slot will be updated to
offset - The offset from the ref
location - The FieldReference index to assist the store
mode - The context in which the write is occurring

shortRead

public final short shortRead(ObjectReference objref,
                             Word offset,
                             Word location,
                             int mode)
Perform the actual read of a short read barrier.

Specified by:
shortRead in class Barriers
Parameters:
objref - The object that has the short field
offset - The offset from the ref
location - Unused
mode - The context in which the write is occurring
Returns:
the read value

intWrite

public final void intWrite(ObjectReference objref,
                           int value,
                           Word offset,
                           Word location,
                           int mode)
Perform the actual write of a int write barrier.

Specified by:
intWrite in class Barriers
Parameters:
objref - The object that has the int field
value - The value that the slot will be updated to
offset - The offset from the ref
location - The FieldReference index to assist the store
mode - The context in which the write is occurring

intRead

public final int intRead(ObjectReference objref,
                         Word offset,
                         Word location,
                         int mode)
Perform the actual read of a int read barrier.

Specified by:
intRead in class Barriers
Parameters:
objref - The object that has the int field
offset - The offset from the ref
location - Unused
mode - The context in which the write is occurring
Returns:
the read value

intTryCompareAndSwap

public boolean intTryCompareAndSwap(ObjectReference objref,
                                    int expected,
                                    int newValue,
                                    Word offset,
                                    Word unused,
                                    int mode)
Attempt an atomic compare and exchange in a write barrier sequence.

Specified by:
intTryCompareAndSwap in class Barriers
Parameters:
objref - The object that has the int field
expected - The old int to be swapped out
newValue - the new int
offset - The offset from the ref
unused - Unused
mode - The context in which the write is occurring
Returns:
True if the compare and swap was successful

longWrite

public final void longWrite(ObjectReference objref,
                            long value,
                            Word offset,
                            Word location,
                            int mode)
Perform the actual write of a long write barrier.

Specified by:
longWrite in class Barriers
Parameters:
objref - The object that has the long field
value - The value that the slot will be updated to
offset - The offset from the ref
location - The FieldReference index to assist the store
mode - The context in which the write is occurring

longRead

public final long longRead(ObjectReference objref,
                           Word offset,
                           Word location,
                           int mode)
Perform the actual read of a long read barrier.

Specified by:
longRead in class Barriers
Parameters:
objref - The object that has the long field
offset - The offset from the ref
location - Unused
mode - The context in which the write is occurring
Returns:
the read value

longTryCompareAndSwap

public boolean longTryCompareAndSwap(ObjectReference objref,
                                     long expected,
                                     long newValue,
                                     Word offset,
                                     Word unused,
                                     int mode)
Attempt an atomic compare and exchange in a write barrier sequence.

Specified by:
longTryCompareAndSwap in class Barriers
Parameters:
objref - The object that has the long field
expected - The old long to be swapped out
newValue - the new long
offset - The offset from the ref
unused - Unused
mode - The context in which the write is occurring
Returns:
True if the compare and swap was successful

floatWrite

public final void floatWrite(ObjectReference objref,
                             float value,
                             Word offset,
                             Word location,
                             int mode)
Perform the actual write of a float write barrier.

Specified by:
floatWrite in class Barriers
Parameters:
objref - The object that has the float field
value - The value that the slot will be updated to
offset - The offset from the ref
location - The FieldReference index to assist the store
mode - The context in which the write is occurring

floatRead

public final float floatRead(ObjectReference objref,
                             Word offset,
                             Word location,
                             int mode)
Perform the actual read of a float read barrier.

Specified by:
floatRead in class Barriers
Parameters:
objref - The object that has the float field
offset - The offset from the ref
location - Unused
mode - The context in which the write is occurring
Returns:
the read value

doubleWrite

public final void doubleWrite(ObjectReference objref,
                              double value,
                              Word offset,
                              Word location,
                              int mode)
Perform the actual write of a double write barrier.

Specified by:
doubleWrite in class Barriers
Parameters:
objref - The object that has the double field
value - The value that the slot will be updated to
offset - The offset from the ref
location - The FieldReference index to assist the store
mode - The context in which the write is occurring

doubleRead

public final double doubleRead(ObjectReference objref,
                               Word offset,
                               Word location,
                               int mode)
Perform the actual read of a double read barrier.

Specified by:
doubleRead in class Barriers
Parameters:
objref - The object that has the double field
offset - The offset from the ref
location - Unused
mode - The context in which the write is occurring
Returns:
the read value

objectReferenceWrite

public final void objectReferenceWrite(ObjectReference objref,
                                       ObjectReference value,
                                       Word offset,
                                       Word location,
                                       int mode)
Perform the actual write of an object reference write barrier.

Specified by:
objectReferenceWrite in class Barriers
Parameters:
objref - The object that has the reference field
value - The value that the slot will be updated to
offset - The offset from the ref
location - The index of the FieldReference
mode - The context in which the write is occurring

objectReferenceRead

public final ObjectReference objectReferenceRead(ObjectReference objref,
                                                 Word offset,
                                                 Word location,
                                                 int mode)
Perform the actual read of an object reference read barrier.

Specified by:
objectReferenceRead in class Barriers
Parameters:
objref - The object that has the reference field
offset - The offset from the ref
location - The index of the FieldReference
mode - The context in which the write is occurring
Returns:
the object reference read value

objectReferenceNonHeapWrite

public final void objectReferenceNonHeapWrite(Address slot,
                                              ObjectReference target,
                                              Word unusedA,
                                              Word unusedB)
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.

Specified by:
objectReferenceNonHeapWrite in class Barriers
Parameters:
slot - The slot to be updated
target - The value that the slot will be updated to
unusedA - Unused
unusedB - Unused

objectReferenceAtomicWrite

public final ObjectReference objectReferenceAtomicWrite(ObjectReference objref,
                                                        ObjectReference target,
                                                        Word offset,
                                                        Word unused,
                                                        int mode)
Atomically write a reference field of an object or array and return the old value of the reference field.

Specified by:
objectReferenceAtomicWrite in class Barriers
Parameters:
objref - The object that has the reference field
target - The value that the slot will be updated to
offset - The offset from the ref
unused - Unused
mode - The context in which the write is occurring
Returns:
The value that was replaced by the write.

objectReferenceTryCompareAndSwap

public final boolean objectReferenceTryCompareAndSwap(ObjectReference objref,
                                                      ObjectReference old,
                                                      ObjectReference target,
                                                      Word offset,
                                                      Word unused,
                                                      int mode)
Attempt an atomic compare and exchange in a write barrier sequence.

Specified by:
objectReferenceTryCompareAndSwap in class Barriers
Parameters:
objref - 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
offset - The offset from the ref
unused - Unused
mode - The context in which the write is occurring
Returns:
True if the compare and swap was successful

wordWrite

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

Specified by:
wordWrite in class Barriers
Parameters:
ref - The object that has the Word field
target - The value that the slot will be updated to
offset - The offset from the ref
location - The index of the FieldReference
mode - The context in which the write is occurring

wordAtomicWrite

public final Word wordAtomicWrite(ObjectReference ref,
                                  Word target,
                                  Word offset,
                                  Word unused,
                                  int mode)
Atomically write a raw reference field of an object or array and return the old value of the reference field.

Specified by:
wordAtomicWrite in class Barriers
Parameters:
ref - The object that has the Word field
target - The value that the slot will be updated to
offset - The offset from the ref
unused - Unused
mode - The context in which the write is occurring
Returns:
The value that was replaced by the write.

wordTryCompareAndSwap

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

Specified by:
wordTryCompareAndSwap in class Barriers
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
offset - The offset from the ref
unused - Unused
mode - The context in which the write is occurring
Returns:
True if the compare and swap was successful

wordRead

public final Word wordRead(ObjectReference ref,
                           Word offset,
                           Word location,
                           int mode)
Perform the actual read of the read barrier, returning the value as a raw Word.

Specified by:
wordRead in class Barriers
Parameters:
ref - The object that has the Word field
offset - The offset from the ref
location - The index of the FieldReference
mode - The context in which the write is occurring
Returns:
the read value

addressWrite

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

Specified by:
addressWrite in class Barriers
Parameters:
ref - The object that has the Address field
target - The value that the slot will be updated to
offset - The offset from the ref
location - The index of the FieldReference
mode - The context in which the write is occurring

addressRead

public final Address addressRead(ObjectReference ref,
                                 Word offset,
                                 Word location,
                                 int mode)
Perform the actual read of the read barrier, returning the value as a raw Address.

Specified by:
addressRead in class Barriers
Parameters:
ref - The object that has the Address field
offset - The offset from the ref
location - The index of the FieldReference
mode - The context in which the write is occurring
Returns:
the read value

addressTryCompareAndSwap

public boolean addressTryCompareAndSwap(ObjectReference objref,
                                        Address expected,
                                        Address newValue,
                                        Word offset,
                                        Word unused,
                                        int mode)
Attempt an atomic compare and exchange in a write barrier sequence.

Specified by:
addressTryCompareAndSwap in class Barriers
Parameters:
objref - The object that has the Address field
expected - The old Address to be swapped out
newValue - the new Address
offset - The offset from the ref
unused - Unused
mode - The context in which the write is occurring
Returns:
True if the compare and swap was successful

offsetWrite

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

Specified by:
offsetWrite in class Barriers
Parameters:
ref - The object that has the Offset field
target - The value that the slot will be updated to
offset - The offset from the ref
location - The index of the FieldReference
mode - The context in which the write is occurring

offsetRead

public final Offset offsetRead(ObjectReference ref,
                               Word offset,
                               Word location,
                               int mode)
Perform the actual read of the read barrier, returning the value as a raw Offset.

Specified by:
offsetRead in class Barriers
Parameters:
ref - The object that has the Offset field
offset - The offset from the ref
location - The index of the FieldReference
mode - The context in which the write is occurring
Returns:
the read value

extentWrite

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

Specified by:
extentWrite in class Barriers
Parameters:
ref - The object that has the Extent field
target - The value that the slot will be updated to
offset - The offset from the ref
location - The index of the FieldReference
mode - The context in which the write is occurring

extentRead

public final Extent extentRead(ObjectReference ref,
                               Word offset,
                               Word location,
                               int mode)
Perform the actual read of the read barrier, returning the value as a raw Extent.

Specified by:
extentRead in class Barriers
Parameters:
ref - The object that has the Extent field
offset - The offset from the ref
location - The index of the FieldReference
mode - The context in which the write is occurring
Returns:
the read value

objectArrayStoreNoGCBarrier

public final 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.

Specified by:
objectArrayStoreNoGCBarrier in class Barriers
Parameters:
dst - the destination array
index - the index of the element to set
value - the new value for the element