public class ForwardingWord extends Object
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.
Modifier and Type | Field and Description |
---|---|
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
|
private static byte |
FORWARDING_NOT_TRIGGERED_YET
If this bit pattern is set, the forwarding of this object has not been
triggered yet.
|
Constructor and Description |
---|
ForwardingWord() |
Modifier and Type | Method and Description |
---|---|
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?
|
private static final byte FORWARDING_NOT_TRIGGERED_YET
private static final byte BEING_FORWARDED
private static final byte FORWARDED
public static final byte FORWARDING_MASK
public static final int FORWARDING_BITS
public ForwardingWord()
public static Word attemptToForward(ObjectReference object)
object
- The object to be forwardedpublic 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 checkedtrue
if the object has been forwardedpublic static boolean isForwardedOrBeingForwarded(ObjectReference object)
object
- The object to be checkedtrue
if the object has been forwardedpublic static boolean stateIsForwardedOrBeingForwarded(Word header)
header
- The object header to be checkedtrue
if the object has been forwardedpublic static boolean stateIsBeingForwarded(Word header)
header
- The object header to be checkedtrue
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)