|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jikesrvm.runtime.Statics
public class Statics
The static fields and methods comprising a running virtual machine image.
These fields, methods and literal constants form the "root set" of all the objects in the running virtual machine. They are stored in an array where the middle element is always pointed to by the virtual machine's "table of contents" (JTOC) register. The slots of this array hold either primitives (int, long, float, double), object pointers, or array pointers. To enable the garbage collector to differentiate between reference and non-reference values, reference values are indexed positively and numeric values negatively with respect to the middle of the table.
Consider the following declarations:
class A { static int i = 123; } class B { static String s = "abc"; } class C { static double d = 4.56; } class D { static void m() {} }
Here's a picture of what the corresponding JTOC would look like in memory:
+---------------+ | ... | +---------------+ field -6 | C.d (hi) | +---------------+ field -5 | C.d (lo) | +---------------+ literal -4 | 4.56 (hi) | +---------------+ literal -3 | 4.56 (lo) | +---------------+ field -2 | A.i | +---------------+ literal -1 | 123 | +---------------+ +---------------+ [jtoc register]-> 0:| 0 | | (header) | +---------------+ +---------------+ literal 1:| (objref) --------->| "abc" | +---------------+ +---------------+ field 2:| B.s | +---------------+ +---------------+ 3:| (coderef) ------+ | (header) | +---------------+ | +---------------+ | ... | +-->| machine code | +---------------+ | for "m" | +---------------+
Field Summary | |
---|---|
static int |
middleOfTable
The logical middle of the table, references are slots above this and numeric values below this. |
private static int |
nextNumericSlot
Next available numeric slot number |
private static int |
nextReferenceSlot
Next available reference slot number |
private static BitVector |
numericFieldVector
Bit vector indicating whether a numeric slot is a field (true) or a literal (false). |
private static int |
numericSlotHole
Numeric slot hole. |
private static int |
numNumericSlots
How many 32bit slots do we want in the JTOC to hold numeric (non-reference) values? |
private static int |
numReferenceSlots
How many reference-sized slots do we want in the JTOC to hold reference values? |
private static ImmutableEntryIdentityHashMapRVM<Object,Integer> |
objectLiterals
Map of objects to their literal offsets |
private static Object[] |
objectSlots
Object version of the slots used during boot image creation and destroyed shortly after. |
private static int[] |
slots
Static data values (pointed to by JTOC register). |
Fields inherited from interface org.jikesrvm.Constants |
---|
NOT_REACHED, REFLECTION_FPRS_BITS, REFLECTION_FPRS_MASK, REFLECTION_GPRS_BITS, REFLECTION_GPRS_MASK |
Fields inherited from interface org.jikesrvm.objectmodel.ThinLockConstants |
---|
TL_DEDICATED_U16_OFFSET, TL_DEDICATED_U16_SHIFT, TL_LOCK_COUNT_MASK, TL_LOCK_COUNT_SHIFT, TL_LOCK_COUNT_UNIT, TL_LOCK_ID_MASK, TL_LOCK_ID_SHIFT, TL_NUM_BITS_RC, TL_NUM_BITS_STAT, TL_NUM_BITS_TID, TL_STAT_BIASABLE, TL_STAT_FAT, TL_STAT_MASK, TL_STAT_SHIFT, TL_STAT_THIN, TL_THREAD_ID_MASK, TL_THREAD_ID_SHIFT, TL_UNLOCK_MASK |
Fields inherited from interface org.jikesrvm.objectmodel.TIBLayoutConstants |
---|
IMT_METHOD_SLOTS, NEEDS_DYNAMIC_LINK, TIB_ARRAY_ELEMENT_TIB_INDEX, TIB_DOES_IMPLEMENT_INDEX, TIB_FIRST_SPECIALIZED_METHOD_INDEX, TIB_FIRST_VIRTUAL_METHOD_INDEX, TIB_INTERFACE_DISPATCH_TABLE_INDEX, TIB_SUPERCLASS_IDS_INDEX, TIB_TYPE_INDEX |
Fields inherited from interface org.jikesrvm.HeapLayoutConstants |
---|
BAD_MAP_COMPRESSION, BOOT_IMAGE_CODE_END, BOOT_IMAGE_CODE_SIZE, BOOT_IMAGE_CODE_START, BOOT_IMAGE_DATA_END, BOOT_IMAGE_DATA_SIZE, BOOT_IMAGE_DATA_START, BOOT_IMAGE_END, BOOT_IMAGE_RMAP_END, BOOT_IMAGE_RMAP_START, MAX_BOOT_IMAGE_RMAP_SIZE, MAXIMUM_MAPPABLE |
Constructor Summary | |
---|---|
Statics()
|
Method Summary | |
---|---|
static Offset |
allocateNumericSlot(int size,
boolean field)
Allocate a numeric slot in the JTOC. |
static Offset |
allocateReferenceSlot(boolean field)
Allocate a reference slot in the JTOC. |
static Object |
bootImageInstantiationFinished()
Inform Statics that boot image instantiation is over and that unnecessary data structures, for runtime, can be released. |
static void |
bootImageReportGeneration(Object slots)
After serializing Statics the boot image writer generates a report. |
private static void |
enlargeTable()
Grow the statics table |
static int |
findObjectLiteral(Object literal)
Find a slot in the JTOC with this object literal in else return 0 |
static int |
findOrCreate16ByteSizeLiteral(long literal_high,
long literal_low)
Find the given literal in the 16byte like literal map, if not found create a slot for the literal and place an entry in the map |
static int |
findOrCreateIntSizeLiteral(int literal)
Find the given literal in the int like literal map, if not found create a slot for the literal and place an entry in the map |
static int |
findOrCreateLongSizeLiteral(long literal)
Find the given literal in the long like literal map, if not found create a slot for the literal and place an entry in the map |
static int |
findOrCreateObjectLiteral(Object literal)
Find or allocate a slot in the JTOC for an object literal. |
static int |
getHighestInUseSlot()
Return the highest slot number in use |
static int |
getLowestInUseSlot()
Return the lowest slot number in use |
static int |
getNumberOfNumericSlots()
Fetch number of numeric JTOC slots currently allocated. |
static int |
getNumberOfReferenceSlots()
Fetch number of reference JTOC slots currently allocated. |
static int |
getReferenceSlotSize()
Get size occupied by a reference |
static Address |
getSlotContentsAsAddress(Offset offset)
Fetch contents of a slot, as an Address. |
static int |
getSlotContentsAsInt(Offset offset)
Fetch contents of a slot, as an integer |
static long |
getSlotContentsAsLong(Offset offset)
Fetch contents of a slot-pair, as a long integer. |
static Object |
getSlotContentsAsObject(Offset offset)
Fetch contents of a slot, as an object. |
static Address |
getSlots()
Fetch JTOC object (for JNI environment and GC). |
static int[] |
getSlotsAsIntArray()
Fetch JTOC object (for JNI environment and GC). |
static int |
getTotalNumberOfSlots()
Fetch total number of slots comprising the JTOC. |
static boolean |
isIntSizeLiteral(int slot)
Does specified JTOC slot contain an int sized literal? |
static boolean |
isLongSizeLiteral(int slot)
Does specified JTOC slot contain a long sized literal? |
static boolean |
isReference(int slot)
Does specified JTOC slot contain a reference? |
static boolean |
isReferenceLiteral(int slot)
Does specified JTOC slot contain a reference literal? |
static void |
markAsNumericLiteral(int size,
Offset fieldOffset)
Marks a slot that was previously a field as being a literal as its value is final. |
static void |
markAsReferenceLiteral(Offset fieldOffset)
Marks a slot that was previously a field as being a literal as its value is final. |
static int |
offsetAsSlot(Offset offset)
Conversion from JTOC offset to JTOC slot index. |
static void |
setSlotContents(Offset offset,
Address value)
Set contents of a slot, as a Address |
static void |
setSlotContents(Offset offset,
ArchitectureSpecific.CodeArray code)
Set contents of a slot, as a CodeArray. |
static void |
setSlotContents(Offset offset,
double value)
Set contents of a slot, as a double. |
static void |
setSlotContents(Offset offset,
Extent value)
Set contents of a slot, as a Extent |
static void |
setSlotContents(Offset offset,
float value)
Set contents of a slot, as an float. |
static void |
setSlotContents(Offset offset,
int value)
Set contents of a slot, as an integer. |
static void |
setSlotContents(Offset offset,
long value)
Set contents of a slot, as a long integer. |
static void |
setSlotContents(Offset offset,
Object object)
Set contents of a slot, as an object. |
static void |
setSlotContents(Offset offset,
Offset value)
Set contents of a slot, as a Offset |
static void |
setSlotContents(Offset offset,
TIB tib)
Set contents of a slot, as a CodeArray. |
static void |
setSlotContents(Offset offset,
Word word)
Set contents of a slot, as a Word. |
static Offset |
slotAsOffset(int slot)
Conversion from JTOC slot index to JTOC offset. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int numNumericSlots
private static final int numReferenceSlots
private static final int[] slots
private static Object[] objectSlots
public static final int middleOfTable
private static volatile int nextNumericSlot
private static volatile int numericSlotHole
private static volatile int nextReferenceSlot
private static final BitVector numericFieldVector
private static final ImmutableEntryIdentityHashMapRVM<Object,Integer> objectLiterals
Constructor Detail |
---|
public Statics()
Method Detail |
---|
public static Offset slotAsOffset(int slot)
public static int offsetAsSlot(Offset offset)
public static int getLowestInUseSlot()
public static int getHighestInUseSlot()
public static int findOrCreateIntSizeLiteral(int literal)
literal
- the literal value to find or create
public static int findOrCreateLongSizeLiteral(long literal)
literal
- the literal value to find or create
public static int findOrCreate16ByteSizeLiteral(long literal_high, long literal_low)
literal_high
- the high part of the literal value to find or createliteral_low
- the low part of the literal value to find or create
public static int findOrCreateObjectLiteral(Object literal)
literal
- value
public static int findObjectLiteral(Object literal)
literal
- value
public static void markAsNumericLiteral(int size, Offset fieldOffset)
public static void markAsReferenceLiteral(Offset fieldOffset)
public static Offset allocateNumericSlot(int size, boolean field)
size
- of slotfield
- is the slot for a field
public static Offset allocateReferenceSlot(boolean field)
field
- is the slot for a field
private static void enlargeTable()
public static int getNumberOfNumericSlots()
public static int getNumberOfReferenceSlots()
public static int getTotalNumberOfSlots()
public static boolean isReference(int slot)
slot
- obtained from offsetAsSlot()
true
--> slot contains a referencepublic static boolean isIntSizeLiteral(int slot)
slot
- obtained from offsetAsSlot()
true
--> slot contains a referencepublic static boolean isLongSizeLiteral(int slot)
slot
- obtained from offsetAsSlot()
true
--> slot contains a referencepublic static boolean isReferenceLiteral(int slot)
slot
- obtained from offsetAsSlot()
true
--> slot contains a referencepublic static int getReferenceSlotSize()
public static Address getSlots()
public static int[] getSlotsAsIntArray()
public static int getSlotContentsAsInt(Offset offset)
public static long getSlotContentsAsLong(Offset offset)
public static Object getSlotContentsAsObject(Offset offset)
public static Address getSlotContentsAsAddress(Offset offset)
public static void setSlotContents(Offset offset, int value)
public static void setSlotContents(Offset offset, float value)
public static void setSlotContents(Offset offset, double value)
public static void setSlotContents(Offset offset, long value)
public static void setSlotContents(Offset offset, Object object)
public static void setSlotContents(Offset offset, ArchitectureSpecific.CodeArray code)
public static void setSlotContents(Offset offset, TIB tib)
public static void setSlotContents(Offset offset, Word word)
public static void setSlotContents(Offset offset, Address value)
public static void setSlotContents(Offset offset, Extent value)
public static void setSlotContents(Offset offset, Offset value)
public static Object bootImageInstantiationFinished()
public static void bootImageReportGeneration(Object slots)
slots
- object slots to restore
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |