|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mmtk.utility.ForwardingWord
public class ForwardingWord
This class provides generic support for object forwarding, which is specific to a few policies that support copying. The broad idea is two-fold: 1) the two low-order bits of the GC byte (which are also the two low-order bits of the header word) are used to indicate whether an object has been forwarded or is being forwarded, and 2) if an object has been forwarded then the entire header word of the dead object is used to store a pointer to the forwarded pointer. This is a standard implementation of forwarding.
The two lowest order bits are used for object forwarding because forwarding generally must steal the unused two low order bits of the forwarding pointer.
Field Summary | |
---|---|
private static byte |
BEING_FORWARDED
If this bit is set, then forwarding of this object is incomplete |
private static byte |
FORWARDED
If this bit is set, then forwarding of this object has commenced |
static int |
FORWARDING_BITS
|
static byte |
FORWARDING_MASK
This mask is used to reveal which state this object is in with respect to forwarding |
Constructor Summary | |
---|---|
ForwardingWord()
|
Method Summary | |
---|---|
static Word |
attemptToForward(ObjectReference object)
Either return the forwarding pointer if the object is already forwarded (or being forwarded) or write the bit pattern that indicates that the object is being forwarded |
static void |
clearForwardingBits(ObjectReference object)
Clear the GC forwarding portion of the header for an object. |
static ObjectReference |
extractForwardingPointer(Word forwardingWord)
|
static ObjectReference |
forwardObject(ObjectReference object,
int allocator)
|
static boolean |
isForwarded(ObjectReference object)
Has an object been forwarded? |
static boolean |
isForwardedOrBeingForwarded(ObjectReference object)
Has an object been forwarded or is it being forwarded? |
static void |
setForwardingPointer(ObjectReference object,
ObjectReference ptr)
Non-atomic write of forwarding pointer word (assumption, thread doing the set has done attempt to forward and owns the right to copy the object) |
static ObjectReference |
spinAndGetForwardedObject(ObjectReference object,
Word statusWord)
|
static boolean |
stateIsBeingForwarded(Word header)
Has an object been forwarded or being forwarded? |
static boolean |
stateIsForwardedOrBeingForwarded(Word header)
Has an object been forwarded or being forwarded? |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final byte BEING_FORWARDED
private static final byte FORWARDED
public static final byte FORWARDING_MASK
public static final int FORWARDING_BITS
Constructor Detail |
---|
public ForwardingWord()
Method Detail |
---|
public static Word attemptToForward(ObjectReference object)
object
- The object to be forwarded
public static ObjectReference spinAndGetForwardedObject(ObjectReference object, Word statusWord)
public static ObjectReference forwardObject(ObjectReference object, int allocator)
public static void setForwardingPointer(ObjectReference object, ObjectReference ptr)
object
- The object whose forwarding pointer is to be setptr
- The forwarding pointer to be stored in the object's
forwarding wordpublic static boolean isForwarded(ObjectReference object)
object
- The object to be checked
true
if the object has been forwardedpublic static boolean isForwardedOrBeingForwarded(ObjectReference object)
object
- The object to be checked
true
if the object has been forwardedpublic static boolean stateIsForwardedOrBeingForwarded(Word header)
header
- The object header to be checked
true
if the object has been forwardedpublic static boolean stateIsBeingForwarded(Word header)
header
- The object header to be checked
true
if the object has been forwardedpublic static void clearForwardingBits(ObjectReference object)
object
- the object ref to the storage to be initializedpublic static ObjectReference extractForwardingPointer(Word forwardingWord)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |