org.mmtk.utility.sanitychecker
Class SanityDataTable

java.lang.Object
  extended by org.mmtk.utility.SimpleHashtable
      extended by org.mmtk.utility.sanitychecker.SanityDataTable
All Implemented Interfaces:
Constants

public final class SanityDataTable
extends SimpleHashtable
implements Constants

This class implements a simple hashtable to store and retrieve per object information for sanity checking.

This class is not thread safe.


Field Summary
private static int NORMAL_RC_BITS
          The number of bits for the normal reference count
private static int NORMAL_RC_INC
          The increment to use for normal increments
private static int NORMAL_RC_MASK
          The mask for the normal reference count
private static int ROOT_RC_INC
          The increment to use for root increments
private static int ROOT_RC_SHIFT
          The shift for the root reference count
 
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
SanityDataTable(RawPageSpace rps, int logSize)
          Create a new data table of a specified size.
 
Method Summary
 void forwardTable(TraceLocal trace)
          Forward data table using the supplied trace.
 Address getEntry(ObjectReference object, boolean create)
          Get an entry for an object.
static int getNormalRC(Address entry)
          Given an address of an entry, read the reference count, excluding root references.
static ObjectReference getObjectReference(Address entry)
          Given an address of an entry, read the reference component.
static int getRC(Address entry)
          Given an address of an entry, read the total reference count.
static int getRootRC(Address entry)
          Given an address of an entry, read the root reference count.
static boolean incRC(Address entry, boolean root)
          Increment the data word for an object.
 void pushNotInOther(SanityDataTable other, ObjectReferenceDeque deque)
          Push any entries that are only in this table, and not the passed table.
 
Methods inherited from class org.mmtk.utility.SimpleHashtable
acquireTable, contains, getEntry, getFirst, getKey, getNext, getPayloadAddress, getPayloadAddress, isValid, releaseTable, replaceKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL_RC_BITS

private static final int NORMAL_RC_BITS
The number of bits for the normal reference count

See Also:
Constant Field Values

NORMAL_RC_MASK

private static final int NORMAL_RC_MASK
The mask for the normal reference count

See Also:
Constant Field Values

ROOT_RC_SHIFT

private static final int ROOT_RC_SHIFT
The shift for the root reference count

See Also:
Constant Field Values

NORMAL_RC_INC

private static final int NORMAL_RC_INC
The increment to use for normal increments

See Also:
Constant Field Values

ROOT_RC_INC

private static final int ROOT_RC_INC
The increment to use for root increments

See Also:
Constant Field Values
Constructor Detail

SanityDataTable

public SanityDataTable(RawPageSpace rps,
                       int logSize)
Create a new data table of a specified size.

Parameters:
rps - The space to acquire the data structure from.
logSize - The log of the number of table entries.
Method Detail

incRC

public static boolean incRC(Address entry,
                            boolean root)
Increment the data word for an object.

Parameters:
entry - The table entry.
root - True if this is a root reference.
Returns:
True if this is the first ref to that object.

pushNotInOther

public void pushNotInOther(SanityDataTable other,
                           ObjectReferenceDeque deque)
Push any entries that are only in this table, and not the passed table. This does not compare values.

Parameters:
other - The table to use for comparison.
deque - The buffer to push results onto.

getNormalRC

public static int getNormalRC(Address entry)
Given an address of an entry, read the reference count, excluding root references.

Parameters:
entry - The entry
Returns:
The reference count.

getRootRC

public static int getRootRC(Address entry)
Given an address of an entry, read the root reference count.

Parameters:
entry - The entry
Returns:
The root reference count.

getRC

public static int getRC(Address entry)
Given an address of an entry, read the total reference count.

Parameters:
entry - The entry
Returns:
The total reference count.

getObjectReference

public static ObjectReference getObjectReference(Address entry)
Given an address of an entry, read the reference component.

Parameters:
entry - The entry
Returns:
The object reference.

forwardTable

public void forwardTable(TraceLocal trace)
Forward data table using the supplied trace. Note that the data is not hashed correctly, so only enumeration can be used without rehashing.

Parameters:
trace - The trace to use.

getEntry

public Address getEntry(ObjectReference object,
                        boolean create)
Get an entry for an object.

Parameters:
object - The object to find an entry for.
create - Create an entry if none exists?
Returns:
The entry address.