org.mmtk.plan.refcount
Class RCHeader

java.lang.Object
  extended by org.mmtk.plan.refcount.RCHeader
All Implemented Interfaces:
Constants

public class RCHeader
extends Object
implements Constants


Field Summary
static Word BEING_LOGGED
           
static int BITS_USED
          Current not using any bits for cycle detection, etc
static int DEC_ALIVE
           
static int DEC_KILL
           
static Word DOUBLE_INCREMENT
           
static int GC_HEADER_WORDS_REQUIRED
           
static int GLOBAL_GC_BITS_REQUIRED
           
static int INC_NEW
           
static int INC_OLD
           
static Word INCREMENT
           
static int INCREMENT_SHIFT
           
static Word LIVE_THRESHOLD
           
static int LOCAL_GC_BITS_REQUIRED
           
static int LOG_BIT
           
static Word LOGGED
           
static Word LOGGING_MASK
           
static int MARK_BIT
          The mark bit used for backup tracing.
static Word MARK_BIT_MASK
           
static int NEW_BIT
          The bit used for newly allocated objects.
static Word NEW_BIT_MASK
           
static Word READ_MASK
           
static Word refSticky
           
static int refStickyValue
           
static Word UNLOGGED
           
static Word WRITE_MASK
           
 
Fields inherited from interface org.mmtk.utility.Constants
ALIGNMENT_VALUE, ARRAY_ELEMENT, BITS_IN_ADDRESS, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_INT, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_INT, BYTES_IN_KBYTE, BYTES_IN_MBYTE, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, CARD_MASK, CARD_META_PAGES_PER_REGION, INSTANCE_FIELD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_INT, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_ADDRESS_SPACE, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_INT, LOG_BYTES_IN_KBYTE, LOG_BYTES_IN_MBYTE, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD, LOG_CARD_BYTES, LOG_CARD_GRAIN, LOG_CARD_META_BYTES, LOG_CARD_META_PAGES, LOG_CARD_META_SIZE, LOG_CARD_UNITS, LOG_MIN_ALIGNMENT, MAX_ALIGNMENT, MAX_BYTES_PADDING, MAX_INT, MIN_ALIGNMENT, MIN_INT, SUPPORT_CARD_SCANNING
 
Constructor Summary
RCHeader()
           
 
Method Summary
static boolean attemptToLog(ObjectReference object)
          Attempt to log object for coalescing RC.
static void clearMarked(ObjectReference object)
          Has this object been marked by the most recent backup trace.
static int decRC(ObjectReference object)
          Decrement the reference count of an object.
static int getRC(ObjectReference object)
          Return the reference count for the object.
static int incRC(ObjectReference object)
          Increment the reference count of an object.
static void initializeHeader(ObjectReference object, boolean initialInc)
          Perform any required initialization of the GC portion of the header.
static int initRC(ObjectReference object)
          Initialize the reference count of an object.
private static boolean isHeaderMarked(Word header)
          Has this object been marked by the most recent backup trace.
private static boolean isHeaderNew(Word header)
          Has this object been marked as new.
static boolean isLiveRC(ObjectReference object)
          Return true if given object is live
static boolean isMarked(ObjectReference object)
          Has this object been marked by the most recent backup trace.
static boolean isNew(ObjectReference object)
          Has this object been marked as new.
private static boolean isStuck(Word value)
          Has this object been stuck
static boolean logRequired(ObjectReference object)
          Return true if object is yet to be logged (for coalescing RC).
static void makeLogged(ObjectReference object)
          Signify completion of logging object.
static void makeUnlogged(ObjectReference object)
          Change object's state to UNLOGGED.
static int remainRC(ObjectReference object)
          Retain the reference count of an object.
static boolean testAndMark(ObjectReference object)
          Attempt to atomically mark this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCAL_GC_BITS_REQUIRED

public static final int LOCAL_GC_BITS_REQUIRED
See Also:
Constant Field Values

GLOBAL_GC_BITS_REQUIRED

public static final int GLOBAL_GC_BITS_REQUIRED
See Also:
Constant Field Values

GC_HEADER_WORDS_REQUIRED

public static final int GC_HEADER_WORDS_REQUIRED
See Also:
Constant Field Values

LOG_BIT

public static final int LOG_BIT
See Also:
Constant Field Values

LOGGED

public static final Word LOGGED

UNLOGGED

public static final Word UNLOGGED

BEING_LOGGED

public static final Word BEING_LOGGED

LOGGING_MASK

public static final Word LOGGING_MASK

MARK_BIT

public static final int MARK_BIT
The mark bit used for backup tracing.

See Also:
Constant Field Values

MARK_BIT_MASK

public static final Word MARK_BIT_MASK

NEW_BIT

public static final int NEW_BIT
The bit used for newly allocated objects.

See Also:
Constant Field Values

NEW_BIT_MASK

public static final Word NEW_BIT_MASK

BITS_USED

public static final int BITS_USED
Current not using any bits for cycle detection, etc

See Also:
Constant Field Values

INCREMENT_SHIFT

public static final int INCREMENT_SHIFT
See Also:
Constant Field Values

INCREMENT

public static final Word INCREMENT

DOUBLE_INCREMENT

public static final Word DOUBLE_INCREMENT

LIVE_THRESHOLD

public static final Word LIVE_THRESHOLD

DEC_KILL

public static final int DEC_KILL
See Also:
Constant Field Values

DEC_ALIVE

public static final int DEC_ALIVE
See Also:
Constant Field Values

INC_OLD

public static final int INC_OLD
See Also:
Constant Field Values

INC_NEW

public static final int INC_NEW
See Also:
Constant Field Values

refSticky

public static final Word refSticky

refStickyValue

public static final int refStickyValue

WRITE_MASK

public static final Word WRITE_MASK

READ_MASK

public static final Word READ_MASK
Constructor Detail

RCHeader

public RCHeader()
Method Detail

logRequired

public static boolean logRequired(ObjectReference object)
Return true if object is yet to be logged (for coalescing RC).

Parameters:
object - The object in question
Returns:
true if object needs to be logged.

attemptToLog

public static boolean attemptToLog(ObjectReference object)
Attempt to log object for coalescing RC. This is used to handle a race to log the object, and returns true if we are to log the object and false if we lost the race to log the object.

If this method returns true, it leaves the object in the BEING_LOGGED state. It is the responsibility of the caller to change the object to LOGGED once the logging is complete.

Parameters:
object - The object in question
Returns:
true if the race to log objectwas won.
See Also:
makeLogged(ObjectReference)

makeLogged

public static void makeLogged(ObjectReference object)
Signify completion of logging object. object is left in the LOGGED state.

Parameters:
object - The object whose state is to be changed.
See Also:
attemptToLog(ObjectReference)

makeUnlogged

public static void makeUnlogged(ObjectReference object)
Change object's state to UNLOGGED.

Parameters:
object - The object whose state is to be changed.

isMarked

public static boolean isMarked(ObjectReference object)
Has this object been marked by the most recent backup trace.


clearMarked

public static void clearMarked(ObjectReference object)
Has this object been marked by the most recent backup trace.


isHeaderMarked

private static boolean isHeaderMarked(Word header)
Has this object been marked by the most recent backup trace.


testAndMark

public static boolean testAndMark(ObjectReference object)
Attempt to atomically mark this object. Return true if the mark was performed.


isNew

public static boolean isNew(ObjectReference object)
Has this object been marked as new.


isHeaderNew

private static boolean isHeaderNew(Word header)
Has this object been marked as new.


initializeHeader

public static void initializeHeader(ObjectReference object,
                                    boolean initialInc)
Perform any required initialization of the GC portion of the header.

Parameters:
object - the object
initialInc - start with a reference count of 1 (0 if false)

isLiveRC

public static boolean isLiveRC(ObjectReference object)
Return true if given object is live

Parameters:
object - The object whose liveness is to be tested
Returns:
true if the object is alive

getRC

public static int getRC(ObjectReference object)
Return the reference count for the object.

Parameters:
object - The object whose liveness is to be tested
Returns:
true if the object is alive

incRC

public static int incRC(ObjectReference object)
Increment the reference count of an object. Return either INC_OLD if the object is not new, INC_NEW if the object is new.

Parameters:
object - The object whose RC is to be incremented.
Returns:
INC_OLD if the object is not new, INC_NEW if the object is new.

decRC

public static int decRC(ObjectReference object)
Decrement the reference count of an object. Return either DEC_KILL if the count went to zero, DEC_ALIVE if the count did not go to zero.

Parameters:
object - The object whose RC is to be decremented.
Returns:
DEC_KILL if the count went to zero, DEC_ALIVE if the count did not go to zero.

initRC

public static int initRC(ObjectReference object)
Initialize the reference count of an object. Return either INC_OLD if the object is not new, INC_NEW if the object is new.

Parameters:
object - The object whose RC is to be initialized.
Returns:
INC_OLD if the object is not new, INC_NEW if the object is new.

remainRC

public static int remainRC(ObjectReference object)
Retain the reference count of an object. Return either INC_OLD if the object is not new, INC_NEW if the object is new.

Parameters:
object - The object whose RC is to be retained.
Returns:
INC_OLD if the object is not new, INC_NEW if the object is new.

isStuck

private static boolean isStuck(Word value)
Has this object been stuck