public class SpaceDescriptor extends Object
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.
Modifier and Type | Field and Description |
---|---|
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 |
Constructor and Description |
---|
SpaceDescriptor() |
Modifier and Type | Method and Description |
---|---|
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) |
static Address |
getStart(int descriptor) |
static boolean |
isContiguous(int descriptor) |
static boolean |
isContiguousHi(int descriptor) |
private static final int TYPE_BITS
private static final int TYPE_SHARED
private static final int TYPE_CONTIGUOUS
private static final int TYPE_CONTIGUOUS_HI
private static final int TYPE_MASK
private static final int SIZE_SHIFT
private static final int SIZE_BITS
private static final int SIZE_MASK
private static final int EXPONENT_SHIFT
private static final int EXPONENT_BITS
private static final int EXPONENT_MASK
private static final int MANTISSA_SHIFT
private static final int MANTISSA_BITS
private static final int BASE_EXPONENT
private static int discontiguousSpaceIndex
private static final int DISCONTIG_INDEX_INCREMENT
public SpaceDescriptor()
public static int createDescriptor(Address start, Address end)
start
- The start address of the spaceend
- The end address of the spacepublic static int createDescriptor()
public static boolean isContiguous(int descriptor)
descriptor
- a descriptor for a spacetrue
if this descriptor describes a contiguous spacepublic static boolean isContiguousHi(int descriptor)
descriptor
- a descriptor for a spacetrue
if this descriptor describes a contiguous space that
is at the top of the virtual address spacepublic static Address getStart(int descriptor)
descriptor
- a descriptor for a spacepublic static int getChunks(int descriptor)
descriptor
- a descriptor for a space