public abstract class SortSharedDeque extends SharedDeque
Modifier and Type | Field and Description |
---|---|
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 |
head, tail
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 and Description |
---|
SortSharedDeque(String name,
RawPageSpace rps,
int arity) |
Modifier and Type | Method and Description |
---|---|
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.
|
alloc, assertExhausted, clearDeque, dequeue, dequeue, dequeueAndWait, dequeueAndWait, enqueue, enqueuedPages, free, getArity, getNext, getPrev, prepare, prepareNonBlocking, reset
bufferEnd, bufferFirst, bufferLast, bufferLast, bufferLastOffset, bufferOffset, bufferStart
private static final int BYTES_PUSHED
private static final int MAX_STACK_SIZE
private static final Offset INSERTION_SORT_LIMIT
private int stackLoc
private final AddressArray stackBase
public SortSharedDeque(String name, RawPageSpace rps, int arity)
name
- human-readable name of ther queuerps
- The space from which the instance should obtain buffersarity
- the queue's arity (number of words per entry)protected abstract Word getKey(Address obj)
obj
- The address of the object whose key is wantedprivate static Word getBitMask(Word addr)
addr
- Value for which the mask needs to be foundprivate 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()