org.mmtk.utility.alloc
Class ImmixAllocator

java.lang.Object
  extended by org.mmtk.utility.alloc.Allocator
      extended by org.mmtk.utility.alloc.ImmixAllocator
All Implemented Interfaces:
Constants
Direct Known Subclasses:
MutatorLocal

public class ImmixAllocator
extends Allocator
implements Constants


Field Summary
private  boolean copy
           
private  Address cursor
           
private  boolean hot
           
private  Address largeCursor
           
private  Address largeLimit
           
private  Address limit
           
private  int line
           
private  int lineUseCount
           
private  Address markTable
           
private  Address recyclableBlock
           
private  boolean recyclableExhausted
           
private  boolean requestForLarge
           
protected  ImmixSpace space
          Instance variables
private  boolean straddle
           
 
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
ImmixAllocator(ImmixSpace space, boolean hot, boolean copy)
          Constructor.
 
Method Summary
private  boolean acquireRecyclableBlock()
           
private  boolean acquireRecyclableBlockAddressOrder()
           
private  boolean acquireRecyclableLines(int bytes, int align, int offset)
           
 Address alloc(int bytes, int align, int offset)
          Allocate space for a new object.
private  Address allocSlowHot(int bytes, int align, int offset)
          Internal allocation slow path.
protected  Address allocSlowOnce(int bytes, int align, int offset)
          External allocation slow path (called by superclass when slow path is actually taken.
 boolean getLastAllocLineStraddle()
           
 Space getSpace()
          Return the space this allocator is currently bound to.
 Address overflowAlloc(int bytes, int align, int offset)
          Allocate space for a new object.
 void reset()
          Reset the allocator.
 void show()
          Print out the status of the allocator (for debugging)
private  void zeroBlock(Address block)
           
 
Methods inherited from class org.mmtk.utility.alloc.Allocator
alignAllocation, alignAllocation, alignAllocationNoFill, allocSlow, allocSlowInline, fillAlignmentGap, getMaximumAlignedSize, getMaximumAlignedSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

space

protected final ImmixSpace space
Instance variables


hot

private final boolean hot

copy

private final boolean copy

cursor

private Address cursor

limit

private Address limit

largeCursor

private Address largeCursor

largeLimit

private Address largeLimit

requestForLarge

private boolean requestForLarge

straddle

private boolean straddle

lineUseCount

private int lineUseCount

markTable

private Address markTable

recyclableBlock

private Address recyclableBlock

line

private int line

recyclableExhausted

private boolean recyclableExhausted
Constructor Detail

ImmixAllocator

public ImmixAllocator(ImmixSpace space,
                      boolean hot,
                      boolean copy)
Constructor.

Parameters:
space - The space to bump point into.
hot - TODO
copy - TODO
Method Detail

reset

public void reset()
Reset the allocator. Note that this does not reset the space.


alloc

public final Address alloc(int bytes,
                           int align,
                           int offset)
Allocate space for a new object. This is frequently executed code and the coding is deliberaetly sensitive to the optimizing compiler. After changing this, always check the IR/MC that is generated.

Parameters:
bytes - The number of bytes allocated
align - The requested alignment
offset - The offset from the alignment
Returns:
The address of the first byte of the allocated region

overflowAlloc

public final Address overflowAlloc(int bytes,
                                   int align,
                                   int offset)
Allocate space for a new object. This is frequently executed code and the coding is deliberaetly sensitive to the optimizing compiler. After changing this, always check the IR/MC that is generated.

Parameters:
bytes - The number of bytes allocated
align - The requested alignment
offset - The offset from the alignment
Returns:
The address of the first byte of the allocated region

getLastAllocLineStraddle

public final boolean getLastAllocLineStraddle()

allocSlowOnce

protected final Address allocSlowOnce(int bytes,
                                      int align,
                                      int offset)
External allocation slow path (called by superclass when slow path is actually taken. This is necessary (rather than a direct call from the fast path) because of the possibility of a thread switch and corresponding re-association of bump pointers to kernel threads.

Specified by:
allocSlowOnce in class Allocator
Parameters:
bytes - The number of bytes allocated
align - The requested alignment
offset - The offset from the alignment
Returns:
The address of the first byte of the allocated region or zero on failure

allocSlowHot

private Address allocSlowHot(int bytes,
                             int align,
                             int offset)
Internal allocation slow path. This is called whenever the bump pointer reaches the internal limit. The code is forced out of line. If required we perform an external slow path take, which we inline into this method since this is already out of line.

Parameters:
bytes - The number of bytes allocated
align - The requested alignment
offset - The offset from the alignment
Returns:
The address of the first byte of the allocated region

acquireRecyclableLines

private boolean acquireRecyclableLines(int bytes,
                                       int align,
                                       int offset)

acquireRecyclableBlock

private boolean acquireRecyclableBlock()

acquireRecyclableBlockAddressOrder

private boolean acquireRecyclableBlockAddressOrder()

zeroBlock

private void zeroBlock(Address block)

getSpace

public final Space getSpace()
Description copied from class: Allocator
Return the space this allocator is currently bound to.

Specified by:
getSpace in class Allocator
Returns:
the space associated with this squish allocator

show

public final void show()
Print out the status of the allocator (for debugging)