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 int AVAILABLE_BITS
           
static Word BEING_LOGGED
           
static int BITS_USED
           
static int DEC_ALIVE
           
static int DEC_KILL
           
static int GC_HEADER_WORDS_REQUIRED
           
static int GLOBAL_GC_BITS_REQUIRED
           
static Word INCREMENT
           
static Word INCREMENT_LIMIT
           
static int INCREMENT_SHIFT
           
static Word LIVE_THRESHOLD
           
static int LOCAL_GC_BITS_REQUIRED
           
static int LOG_BIT
          Object Logging (applies to *all* objects)
static Word LOGGED
           
static Word LOGGING_MASK
           
static int MARK_BIT
           
static Word MARK_BIT_MASK
           
static Offset RC_HEADER_OFFSET
          RC header word
static int RESERVED_ALIGN_BIT
           
static Word UNLOGGED
           
 
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 void 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.
private static boolean isHeaderMarked(Word header)
          Has this object been marked by the most recent backup trace.
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 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 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
Object Logging (applies to *all* objects)

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

RC_HEADER_OFFSET

public static final Offset RC_HEADER_OFFSET
RC header word


RESERVED_ALIGN_BIT

public static final int RESERVED_ALIGN_BIT
See Also:
Constant Field Values

MARK_BIT

public static final int MARK_BIT
See Also:
Constant Field Values

MARK_BIT_MASK

public static final Word MARK_BIT_MASK

BITS_USED

public static final int BITS_USED
See Also:
Constant Field Values

INCREMENT_SHIFT

public static final int INCREMENT_SHIFT
See Also:
Constant Field Values

INCREMENT

public static final Word INCREMENT

AVAILABLE_BITS

public static final int AVAILABLE_BITS

INCREMENT_LIMIT

public static final Word INCREMENT_LIMIT

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


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 void incRC(ObjectReference object)
Increment the reference count of an object.

Parameters:
object - The object whose reference count is to be incremented.

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.