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  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.
abstract  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.
abstract  Word performRawWriteInBarrierAtomic(ObjectReference ref, Address slot, Word rawTarget, 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  ObjectReference performReadInBarrier(ObjectReference ref, Address slot, Word metaDataA, Word metaDataB, int mode)
          Perform the actual read of the read barrier.
abstract  void performWriteInBarrier(ObjectReference ref, Address slot, ObjectReference target, Word metaDataA, Word metaDataB, int mode)
          Perform the actual write of the write barrier.
abstract  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.
abstract  void setArrayNoBarrier(Object[] dst, int index, Object value)
          Sets an element of an object array without invoking any write barrier.
abstract  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.
abstract  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

setArrayNoBarrier

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

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

performWriteInBarrier

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

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 - VM specific meta data
metaDataB - VM specific meta data
mode - The context in which the write is occuring

performRawWriteInBarrier

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

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 - VM specific meta data
metaDataB - VM specific meta data
mode - The context in which the write is occuring

performReadInBarrier

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

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

performRawReadInBarrier

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

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

performWriteInBarrierAtomic

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

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 - VM specific meta data
metaDataB - VM specific meta data
mode - The context in which the write is occuring
Returns:
The value that was replaced by the write.

performRawWriteInBarrierAtomic

public abstract Word performRawWriteInBarrierAtomic(ObjectReference ref,
                                                    Address slot,
                                                    Word rawTarget,
                                                    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
slot - The slot that holds the reference
rawTarget - The raw value that the slot will be updated to
metaDataA - VM specific meta data
metaDataB - VM specific meta data
mode - The context in which the write is occuring
Returns:
The raw value that was replaced by the write.

tryCompareAndSwapWriteInBarrier

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

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 - VM specific meta data
metaDataB - VM specific meta data
mode - The context in which the write is occuring
Returns:
True if the compare and swap was successful

tryRawCompareAndSwapWriteInBarrier

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

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 - VM specific meta data
metaDataB - VM specific meta data
mode - The context in which the write is occuring
Returns:
True if the compare and swap was successful