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_FLOAT, BITS_IN_INT, BITS_IN_LONG, 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_FLOAT, BYTES_IN_INT, BYTES_IN_LONG, 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_FLOAT, LOG_BITS_IN_INT, LOG_BITS_IN_LONG, 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_FLOAT, LOG_BYTES_IN_INT, LOG_BYTES_IN_LONG, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD
 
Constructor Summary
Barriers()
           
 
Method Summary
 Word performRawReadInBarrier(ObjectReference ref, Address slot, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of the read barrier, returning the value as a raw word.
 void performRawWriteInBarrier(ObjectReference ref, Address slot, Word rawTarget, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of the write barrier, writing the value as a raw word.
 Word performRawWriteInBarrierAtomic(ObjectReference ref, Address slot, Word rawTarget, Word metaDataA, Word metaDataB, int mode)
          Atomically write a raw reference field of an object or array and return the old value of the reference field.
 ObjectReference performReadInBarrier(ObjectReference ref, Address slot, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of the read barrier.
 void performWriteInBarrier(ObjectReference ref, Address slot, ObjectReference target, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of the write barrier.
 ObjectReference performWriteInBarrierAtomic(ObjectReference ref, Address slot, 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.
 void setArrayNoBarrier(Object[] dst, int index, Object value)
          Sets an element of an object array without invoking any write barrier.
 boolean tryCompareAndSwapWriteInBarrier(ObjectReference ref, Address slot, ObjectReference old, ObjectReference target, Word metaDataA, Word metaDataB, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
 boolean tryRawCompareAndSwapWriteInBarrier(ObjectReference ref, Address slot, Word rawOld, Word rawTarget, Word metaDataA, Word metaDataB, int mode)
          Attempt an atomic compare and exchange in a write barrier sequence.
 
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

performWriteInBarrier

public final void performWriteInBarrier(ObjectReference ref,
                                        Address slot,
                                        ObjectReference target,
                                        Word metaDataA,
                                        Word metaDataB,
                                        int mode)
Perform the actual write of the write barrier.

Specified by:
performWriteInBarrier in class Barriers
Parameters:
ref - The object that has the reference field
slot - The slot that holds the reference
target - The value that the slot will be updated to
metaDataA - The offset from the ref
metaDataB - The index of the FieldReference
mode - The context in which the write is occuring

performRawWriteInBarrier

public final void performRawWriteInBarrier(ObjectReference ref,
                                           Address slot,
                                           Word rawTarget,
                                           Word metaDataA,
                                           Word metaDataB,
                                           int mode)
Perform the actual write of the write barrier, writing the value as a raw word.

Specified by:
performRawWriteInBarrier in class Barriers
Parameters:
ref - The object that has the reference field
slot - The slot that holds the reference
rawTarget - The value that the slot will be updated to
metaDataA - The offset from the ref
metaDataB - The index of the FieldReference
mode - The context in which the write is occuring

performReadInBarrier

public final ObjectReference performReadInBarrier(ObjectReference ref,
                                                  Address slot,
                                                  Word metaDataA,
                                                  Word metaDataB,
                                                  int mode)
Perform the actual read of the read barrier.

Specified by:
performReadInBarrier in class Barriers
Parameters:
ref - The object that has the reference field
slot - The slot that holds the reference
metaDataA - The offset from the ref
metaDataB - The index of the FieldReference
mode - The context in which the write is occuring
Returns:
the read value

performRawReadInBarrier

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

Specified by:
performRawReadInBarrier in class Barriers
Parameters:
ref - The object that has the reference field
slot - The slot that holds the reference
metaDataA - The offset from the ref
metaDataB - The index of the FieldReference
mode - The context in which the write is occuring
Returns:
the read value

performWriteInBarrierAtomic

public final ObjectReference performWriteInBarrierAtomic(ObjectReference ref,
                                                         Address slot,
                                                         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.

Specified by:
performWriteInBarrierAtomic in class Barriers
Parameters:
ref - The object that has the reference field
slot - The slot that holds the reference
target - The value that the slot will be updated to
metaDataA - The offset from the ref
metaDataB - Unused
mode - The context in which the write is occuring
Returns:
The value that was replaced by the write.

performRawWriteInBarrierAtomic

public final Word performRawWriteInBarrierAtomic(ObjectReference ref,
                                                 Address slot,
                                                 Word rawTarget,
                                                 Word metaDataA,
                                                 Word metaDataB,
                                                 int mode)
Atomically write a raw reference field of an object or array and return the old value of the reference field.

Specified by:
performRawWriteInBarrierAtomic in class Barriers
Parameters:
ref - The object that has the reference field
slot - The slot that holds the reference
rawTarget - The value that the slot will be updated to
metaDataA - The offset from the ref
metaDataB - Unused
mode - The context in which the write is occuring
Returns:
The value that was replaced by the write.

tryCompareAndSwapWriteInBarrier

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

Specified by:
tryCompareAndSwapWriteInBarrier in class Barriers
Parameters:
ref - The object that has the reference field
slot - The slot that holds the reference
old - The old reference to be swapped out
target - The value that the slot will be updated to
metaDataA - The offset from the ref
metaDataB - Unused
mode - The context in which the write is occuring
Returns:
True if the compare and swap was successful

tryRawCompareAndSwapWriteInBarrier

public final boolean tryRawCompareAndSwapWriteInBarrier(ObjectReference ref,
                                                        Address slot,
                                                        Word rawOld,
                                                        Word rawTarget,
                                                        Word metaDataA,
                                                        Word metaDataB,
                                                        int mode)
Attempt an atomic compare and exchange in a write barrier sequence.

Specified by:
tryRawCompareAndSwapWriteInBarrier in class Barriers
Parameters:
ref - The object that has the reference field
slot - The slot that holds the reference
rawOld - The old reference to be swapped out
rawTarget - The value that the slot will be updated to
metaDataA - The offset from the ref
metaDataB - Unused
mode - The context in which the write is occuring
Returns:
True if the compare and swap was successful

setArrayNoBarrier

public final void setArrayNoBarrier(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:
setArrayNoBarrier in class Barriers
Parameters:
dst - the destination array
index - the index of the element to set
value - the new value for the element