|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mmtk.utility.deque.Deque org.mmtk.utility.deque.SharedDeque org.mmtk.utility.deque.SortSharedDeque
public abstract class SortSharedDeque
This supports unsynchronized enqueuing and dequeuing of buffers for shared use. The data can be added to and removed from either end of the deque. This class is based upon the SharedQueue class. The sorting routines were modified from code written by Narendran Sachindran and Matthew Hertz for GCTk.
Field Summary | |
---|---|
private static int |
BYTES_PUSHED
|
private static Offset |
INSERTION_SORT_LIMIT
|
private static Word |
mask1
|
private static Word |
mask16
|
private static Word |
mask2
|
private static Word |
mask4
|
private static Word |
mask8
|
private static int |
MAX_STACK_SIZE
|
private AddressArray |
stackBase
|
private int |
stackLoc
|
Fields inherited from class org.mmtk.utility.deque.SharedDeque |
---|
head, tail |
Fields inherited from class org.mmtk.utility.deque.Deque |
---|
BUFFER_MASK, BUFFER_SIZE, HEAD_INITIAL_VALUE, LOG_PAGES_PER_BUFFER, META_DATA_SIZE, NEXT_FIELD_OFFSET, PAGES_PER_BUFFER, TAIL_INITIAL_VALUE, USABLE_BUFFER_BYTES |
Constructor Summary | |
---|---|
SortSharedDeque(String name,
RawPageSpace rps,
int arity)
Constructor |
Method Summary | |
---|---|
private void |
checkIfSorted()
Debug routine, used to check if the object buffer is sorted correctly in decreasing final reference deletion time |
private static Word |
getBitMask(Word addr)
Find the highest bit that is set in a longword and return a mask with only that bit set. |
protected abstract Word |
getKey(Address obj)
Return the sorting key for the object passed as a parameter. |
private void |
initStack()
|
private void |
insertionSort(Address begin,
Address end)
Perform insertion sort within an intra-block address range. |
private void |
partition(Address startAddr,
Address startLinkAddr,
Address endAddr,
Address endLinkAddr,
Word bitMask)
Partition the slots in an address range based on the value in a particular bit. |
private Address |
popStack()
Pop an address from the stack |
private void |
pushOnStack(Address val)
Push an address on to the stack |
void |
sort()
Sort objects using radix exchange sort. |
Methods inherited from class org.mmtk.utility.deque.SharedDeque |
---|
alloc, assertExhausted, clearDeque, dequeue, dequeue, dequeueAndWait, dequeueAndWait, enqueue, enqueuedPages, free, getArity, getNext, getPrev, prepare, prepareNonBlocking, reset |
Methods inherited from class org.mmtk.utility.deque.Deque |
---|
bufferEnd, bufferFirst, bufferLast, bufferLast, bufferLastOffset, bufferOffset, bufferStart |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int BYTES_PUSHED
private static final int MAX_STACK_SIZE
private static final Offset INSERTION_SORT_LIMIT
private static final Word mask16
private static final Word mask8
private static final Word mask4
private static final Word mask2
private static final Word mask1
private int stackLoc
private AddressArray stackBase
Constructor Detail |
---|
public SortSharedDeque(String name, RawPageSpace rps, int arity)
rps
- The space from which the instance should obtain buffers.Method Detail |
---|
protected abstract Word getKey(Address obj)
obj
- The address of the object whose key is wanted
private static Word getBitMask(Word addr)
addr
- Value for which the mask needs to be found
private void insertionSort(Address begin, Address end)
begin
- Start address of the range to be sortedend
- End address of the range to be sortedpublic void sort()
private void partition(Address startAddr, Address startLinkAddr, Address endAddr, Address endLinkAddr, Word bitMask)
startAddr
- The start address of the range to be sortedstartLinkAddr
- The address where the start block has its next fieldendAddr
- The end address of the range to be sortedendLinkAddr
- The address where the end block has its next fieldbitMask
- The mask in which the bit to be commpared is setprivate void initStack()
private void pushOnStack(Address val)
val
- The address to be pushedprivate Address popStack()
private void checkIfSorted()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |