org.mmtk.utility.heap
Class SpaceDescriptor

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

public class SpaceDescriptor
extends Object
implements Constants

This class manages the encoding and decoding of space descriptors.

Space descriptors are integers that encode a space's mapping into virtual memory. For discontiguous spaces, they indicate discontiguity and mapping must be done by consulting the space map. For contiguous spaces, the space's address range is encoded into the integer (using a fixed point notation).

The purpose of this class is to allow static final int space descriptors to exist for each space, which can then be used in tests to determine whether an object is in a space. A good compiler can perform this decoding at compile time and produce optimal code for the test.


Field Summary
private static int BASE_EXPONENT
           
private static int DISCONTIG_INDEX_INCREMENT
           
private static int discontiguousSpaceIndex
           
private static int EXPONENT_BITS
           
private static int EXPONENT_MASK
           
private static int EXPONENT_SHIFT
           
private static int MANTISSA_BITS
           
private static int MANTISSA_SHIFT
           
private static int SIZE_BITS
           
private static int SIZE_MASK
           
private static int SIZE_SHIFT
           
private static int TYPE_BITS
           
private static int TYPE_CONTIGUOUS
           
private static int TYPE_CONTIGUOUS_HI
           
private static int TYPE_MASK
           
private static int TYPE_SHARED
           
 
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
SpaceDescriptor()
           
 
Method Summary
static int createDescriptor()
          Create a descriptor for a dis-contiguous (shared) space
static int createDescriptor(Address start, Address end)
          Create a descriptor for a contiguous space
static int getChunks(int descriptor)
          Return the size of the region of memory encoded in this descriptor, in chunks
static Address getStart(int descriptor)
          Return the start of this region of memory encoded in this descriptor
static boolean isContiguous(int descriptor)
          Return true if this descriptor describes a contiguous space
static boolean isContiguousHi(int descriptor)
          Return true if this descriptor describes a contiguous space that is at the top of the virtual address space
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_BITS

private static final int TYPE_BITS
See Also:
Constant Field Values

TYPE_SHARED

private static final int TYPE_SHARED
See Also:
Constant Field Values

TYPE_CONTIGUOUS

private static final int TYPE_CONTIGUOUS
See Also:
Constant Field Values

TYPE_CONTIGUOUS_HI

private static final int TYPE_CONTIGUOUS_HI
See Also:
Constant Field Values

TYPE_MASK

private static final int TYPE_MASK
See Also:
Constant Field Values

SIZE_SHIFT

private static final int SIZE_SHIFT
See Also:
Constant Field Values

SIZE_BITS

private static final int SIZE_BITS
See Also:
Constant Field Values

SIZE_MASK

private static final int SIZE_MASK
See Also:
Constant Field Values

EXPONENT_SHIFT

private static final int EXPONENT_SHIFT
See Also:
Constant Field Values

EXPONENT_BITS

private static final int EXPONENT_BITS
See Also:
Constant Field Values

EXPONENT_MASK

private static final int EXPONENT_MASK
See Also:
Constant Field Values

MANTISSA_SHIFT

private static final int MANTISSA_SHIFT
See Also:
Constant Field Values

MANTISSA_BITS

private static final int MANTISSA_BITS
See Also:
Constant Field Values

BASE_EXPONENT

private static final int BASE_EXPONENT
See Also:
Constant Field Values

discontiguousSpaceIndex

private static int discontiguousSpaceIndex

DISCONTIG_INDEX_INCREMENT

private static final int DISCONTIG_INDEX_INCREMENT
See Also:
Constant Field Values
Constructor Detail

SpaceDescriptor

public SpaceDescriptor()
Method Detail

createDescriptor

public static int createDescriptor(Address start,
                                   Address end)
Create a descriptor for a contiguous space

Parameters:
start - The start address of the space
end - The end address of the space
Returns:
An integer descriptor encoding the region of virtual memory occupied by the space

createDescriptor

public static int createDescriptor()
Create a descriptor for a dis-contiguous (shared) space

Returns:
An integer descriptor reflecting the fact that this space is shared (and thus discontiguous and so must be established via maps).

isContiguous

public static boolean isContiguous(int descriptor)
Return true if this descriptor describes a contiguous space

Parameters:
descriptor -
Returns:
true if this descriptor describes a contiguous space

isContiguousHi

public static boolean isContiguousHi(int descriptor)
Return true if this descriptor describes a contiguous space that is at the top of the virtual address space

Parameters:
descriptor -
Returns:
true if this descriptor describes a contiguous space that is at the top of the virtual address space

getStart

public static Address getStart(int descriptor)
Return the start of this region of memory encoded in this descriptor

Parameters:
descriptor -
Returns:
The start of this region of memory encoded in this descriptor

getChunks

public static int getChunks(int descriptor)
Return the size of the region of memory encoded in this descriptor, in chunks

Parameters:
descriptor -
Returns:
The size of the region of memory encoded in this descriptor, in chunks