org.mmtk.utility
Class DoublyLinkedList

java.lang.Object
  extended by org.mmtk.utility.DoublyLinkedList
All Implemented Interfaces:
Constants

public final class DoublyLinkedList
extends Object
implements Constants

FIXME This class must be re-written as it makes the assumption that the implementation language (Java) and the language being implemented are the same. This is true in the case of Jikes RVM, but it is not true for any VM implementing a language other than Java.

Each instance of this class is a doubly-linked list, in which each item or node is a piece of memory. The first two words of each node contains the forward and backward links. The third word contains the treadmill. The remaining portion is the payload.

The treadmill object itself must not be moved.

Access to the instances may be synchronized depending on the constructor argument.


Field Summary
private  Address head
           
private static Offset HEADER_SIZE
           
private  Lock lock
           
private  int logGranularity
           
private static Offset NEXT_OFFSET
           
private static Word nodeMask
           
private static Offset PREV_OFFSET
           
 
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
DoublyLinkedList(int logGranularity, boolean shared)
          Constructor
 
Method Summary
 void add(Address node)
           
(package private)  void gcspyGatherData(AbstractDriver driver)
          Gather data for GCSpy
 Address getHead()
           
 Address getNext(Address node)
           
static int headerSize()
           
 boolean isEmpty()
           
 boolean isMember(Address node)
          Return true if a cell is on a given treadmill
 boolean isNode(Address node)
           
static Address midPayloadToNode(Address payload)
           
static Address nodeToPayload(Address node)
           
 Address pop()
           
 void remove(Address node)
           
 void show()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

head

private Address head

lock

private final Lock lock

logGranularity

private final int logGranularity

PREV_OFFSET

private static final Offset PREV_OFFSET

NEXT_OFFSET

private static Offset NEXT_OFFSET

HEADER_SIZE

private static Offset HEADER_SIZE

nodeMask

private static final Word nodeMask
Constructor Detail

DoublyLinkedList

public DoublyLinkedList(int logGranularity,
                        boolean shared)
Constructor

Method Detail

headerSize

public static int headerSize()

isNode

public boolean isNode(Address node)

nodeToPayload

public static Address nodeToPayload(Address node)

midPayloadToNode

public static Address midPayloadToNode(Address payload)

add

public void add(Address node)

remove

public void remove(Address node)

getHead

public Address getHead()

getNext

public Address getNext(Address node)

pop

public Address pop()

isEmpty

public boolean isEmpty()

isMember

public boolean isMember(Address node)
Return true if a cell is on a given treadmill

Parameters:
node - The cell being searched for
Returns:
true if the cell is found on the treadmill

show

public void show()

gcspyGatherData

void gcspyGatherData(AbstractDriver driver)
Gather data for GCSpy

Parameters:
driver - the GCSpy space driver