|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jikesrvm.runtime.Magic
public final class Magic
Magic methods for accessing raw machine memory, registers, and operating system calls.
These are "inline assembler functions" that cannot be implemented in Java code. Their names are recognized by RVM's compilers and cause inline machine code to be generated instead of actual method calls.
| Field Summary | |
|---|---|
private static ObjectAddressRemapper |
objectAddressRemapper
|
| Constructor Summary | |
|---|---|
Magic()
|
|
| Method Summary | ||
|---|---|---|
static byte[] |
addressAsByteArray(Address byte_array)
Recast. |
|
static Object |
addressAsObject(Address address)
Cast bits. |
|
static TIB |
addressAsTIB(Address address)
Cast bits. |
|
static boolean |
attemptAddress(Object object,
Offset offset,
Address oldValue,
Address newValue)
Sets the memory at (object + offset) to newValue if its contents are oldValue. |
|
static boolean |
attemptInt(Object object,
Offset offset,
int oldValue,
int newValue)
Sets the memory at (object + offset) to newValue if its contents are oldValue. |
|
static boolean |
attemptLong(Object object,
Offset offset,
long oldValue,
long newValue)
Sets the memory at (object + offset) to newValue if its contents are oldValue. |
|
static boolean |
attemptObject(Object object,
Offset offset,
Object oldValue,
Object newValue)
Sets the memory at (object + offset) to newValue if its contents are oldValue. |
|
static boolean |
attemptWord(Object object,
Offset offset,
Word oldValue,
Word newValue)
Sets the memory at (object + offset) to newValue if its contents are oldValue. |
|
static int |
bootImageIdentityHashCode(Object object)
Certain objects aren't replicated in the boot image to save space. |
|
static
|
bootImageIntern(T object)
Certain objects aren't replicated in the boot image to save space. |
|
static Object |
codeArrayAsObject(ArchitectureSpecific.CodeArray code)
Cast bits of code array into an object Note: for use by Statics when assigning slots to static method pointers |
|
static long |
doubleAsLongBits(double number)
Cast bits. |
|
static void |
dynamicBridgeTo(ArchitectureSpecific.CodeArray instructions)
Transfer execution to target of a dynamic bridge method. |
|
static int |
floatAsIntBits(float number)
Cast bits. |
|
static int |
getArrayLength(Object object)
Get an array's length. |
|
static byte |
getByteAtOffset(Object object,
Offset offset)
Get byte at arbitrary (byte) offset from object. |
|
static Address |
getCallerFramePointer(Address fp)
Get fp for parent frame |
|
static char |
getCharAtOffset(Object object,
Offset offset)
Get char at arbitrary (byte) offset from object. |
|
static int |
getCompiledMethodID(Address fp)
Get Compiled Method ID for a frame |
|
static double |
getDoubleAtOffset(Object object,
Offset offset)
Get double at arbitrary (byte) offset from object. |
|
static Processor |
getESIAsProcessor()
Get contents of ESI, as a Processor. |
|
static Address |
getFramePointer()
Get contents of "stack frame pointer" register. |
|
static int |
getIntAtOffset(Object object,
Offset offset)
Get int at arbitrary (byte) offset from object. |
|
static Address |
getJTOC()
Get contents of "jtoc" register |
|
static long |
getLongAtOffset(Object object,
Offset offset)
Get long at arbitrary (byte) offset from object. |
|
static Address |
getNextInstructionAddress(Address fp)
Get next instruction address for a frame |
|
static Object |
getObjectAtOffset(Object object,
Offset offset)
Get Object at arbitrary (byte) offset from object. |
|
static Object |
getObjectAtOffset(Object object,
Offset offset,
int locationMetadata)
Get Object at arbitrary (byte) offset from object. |
|
static RVMType |
getObjectType(Object object)
Get an object's type. |
|
static Processor |
getProcessorRegister()
Get contents of "processor" register. |
|
static Address |
getReturnAddress(Address fp)
Get return address for a frame |
|
static Address |
getReturnAddressLocation(Address fp)
Get location containing return address for a frame |
|
static short |
getShortAtOffset(Object object,
Offset offset)
Get short at arbitrary (byte) offset from object. |
|
static TIB |
getTIBAtOffset(Object object,
Offset offset)
Get TIB at arbitrary (byte) offset from object. |
|
static long |
getTimeBase()
Read contents of hardware time base registers. |
|
static Address |
getTocPointer()
Get contents of "jtoc" register. |
|
static byte |
getUnsignedByteAtOffset(Object object,
Offset offset)
Get unsigned byte at arbitrary (byte) offset from object. |
|
static Word |
getWordAtOffset(Object object,
Offset offset)
Get Word at arbitrary (byte) offset from object. |
|
static Word |
getWordAtOffset(Object object,
Offset offset,
int locationMetadata)
Get Word at arbitrary (byte) offset from object. |
|
static float |
intBitsAsFloat(int number)
Cast bits. |
|
static void |
invokeClassInitializer(ArchitectureSpecific.CodeArray clinit)
Call " |
|
static double |
invokeMethodReturningDouble(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
Call arbitrary method with argument list. |
|
static float |
invokeMethodReturningFloat(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
Call arbitrary method with argument list. |
|
static int |
invokeMethodReturningInt(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
Call arbitrary method with argument list. |
|
static long |
invokeMethodReturningLong(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
Call arbitrary method with argument list. |
|
static Object |
invokeMethodReturningObject(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
Call arbitrary method with argument list. |
|
static void |
invokeMethodReturningVoid(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
Call arbitrary method with argument list. |
|
static void |
isync()
Wait for all preceeding instructions to complete and discard any prefetched instructions on this processor. |
|
static double |
longBitsAsDouble(long number)
Cast bits. |
|
static
|
objectAsAddress(T object)
Cast bits. |
|
static int[] |
objectAsIntArray(Object object)
Cast object. |
|
static Processor |
objectAsProcessor(Object object)
Cast object. |
|
static short[] |
objectAsShortArray(Object object)
Cast object. |
|
static RVMThread |
objectAsThread(Object object)
Cast object. |
|
static RVMType |
objectAsType(Object object)
Cast object. |
|
static void |
pause()
On IA32, emit a PAUSE instruction, to optimize spin-wait loops. |
|
static Address |
prepareAddress(Object object,
Offset offset)
Get contents of (object + offset) and begin conditional critical section. |
|
static int |
prepareInt(Object object,
Offset offset)
Get contents of (object + offset) and begin conditional critical section. |
|
static long |
prepareLong(Object object,
Offset offset)
Get contents of (object + offset) and begin conditional critical section. |
|
static Object |
prepareObject(Object object,
Offset offset)
Get contents of (object + offset) and begin conditional critical section. |
|
static Word |
prepareWord(Object object,
Offset offset)
Get contents of (object + offset) and begin conditional critical section. |
|
static GreenProcessor |
processorAsGreenProcessor(Processor proc)
Cast object. |
|
static void |
restoreHardwareExceptionState(ArchitectureSpecific.Registers registers)
Resume execution with specified thread exception state. |
|
static void |
returnToNewStack(Address fp)
Return to caller of current method, resuming execution on a new stack that's a copy of the original. |
|
static void |
saveThreadState(ArchitectureSpecific.Registers registers)
Save current thread state. |
|
static void |
setByteAtOffset(Object object,
Offset offset,
byte newvalue)
Set byte at arbitrary (byte) offset from object. |
|
static void |
setCallerFramePointer(Address fp,
Address newCallerFP)
Set fp for parent frame |
|
static void |
setCharAtOffset(Object object,
Offset offset,
char newvalue)
Set char at arbitrary (byte) offset from object. |
|
static void |
setCompiledMethodID(Address fp,
int newCMID)
Set the Compiled Method ID for a frame. |
|
static void |
setDoubleAtOffset(Object object,
Offset offset,
double newvalue)
Set double at arbitrary (byte) offset from object. |
|
static void |
setESIAsProcessor(Processor p)
Set contents of ESI to hold a reference to a processor object. |
|
static void |
setIntAtOffset(Object object,
Offset offset,
int newvalue)
Set int at arbitrary (byte) offset from object. |
|
static void |
setLongAtOffset(Object object,
Offset offset,
long newvalue)
Set long at arbitrary (byte) offset from object. |
|
static void |
setObjectAddressRemapper(ObjectAddressRemapper x)
Specify how to handle "objectAsAddress" and "addressAsObject" casts. |
|
static void |
setObjectAtOffset(Object object,
Offset offset,
Object newvalue)
Set Object at arbitrary (byte) offset from object. |
|
static void |
setObjectAtOffset(Object object,
Offset offset,
Object newvalue,
int locationMetadata)
Set Object at arbitrary (byte) offset from object. |
|
static void |
setProcessorRegister(Processor p)
Set contents of "processor" register. |
|
static void |
setReturnAddress(Address fp,
Address v)
Get return address for a frame |
|
static void |
setWordAtOffset(Object object,
Offset offset,
Word newvalue)
Set word at arbitrary (byte) offset from object. |
|
static void |
setWordAtOffset(Object object,
Offset offset,
Word newvalue,
int locationMetadata)
Set word at arbitrary (byte) offset from object. |
|
static double |
sqrt(double value)
A hardware SQRT instruction |
|
static float |
sqrt(float value)
A hardware SQRT instruction |
|
static void |
sync()
Wait for preceeding cache flush/invalidate instructions to complete on all processors. |
|
static CollectorThread |
threadAsCollectorThread(RVMThread t)
Downcast. |
|
static void |
threadSwitch(RVMThread currentThread,
ArchitectureSpecific.Registers restoreRegs)
Switch threads. |
|
static Object |
tibAsObject(TIB tib)
Cast bits of tib into an object Note: for use by Statics when assigning slots |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static ObjectAddressRemapper objectAddressRemapper
| Constructor Detail |
|---|
public Magic()
| Method Detail |
|---|
public static Address getFramePointer()
public static Address getTocPointer()
public static Address getJTOC()
public static Processor getProcessorRegister()
public static void setProcessorRegister(Processor p)
public static Processor getESIAsProcessor()
public static void setESIAsProcessor(Processor p)
public static long getTimeBase()
public static Address getCallerFramePointer(Address fp)
fp - frame pointer for child frame
public static void setCallerFramePointer(Address fp,
Address newCallerFP)
fp - frame pointer for child framenewCallerFP - new value for caller frame pointerpublic static int getCompiledMethodID(Address fp)
fp - its frame pointer).
public static void setCompiledMethodID(Address fp,
int newCMID)
fp - its frame pointernewCMID - a new cmid for the framepublic static Address getNextInstructionAddress(Address fp)
fp - its frame pointer.public static Address getReturnAddressLocation(Address fp)
fp - its frame pointerpublic static Address getReturnAddress(Address fp)
fp - its frame pointer
public static void setReturnAddress(Address fp,
Address v)
fp - its frame pointer
public static byte getUnsignedByteAtOffset(Object object,
Offset offset)
public static byte getByteAtOffset(Object object,
Offset offset)
public static short getShortAtOffset(Object object,
Offset offset)
public static char getCharAtOffset(Object object,
Offset offset)
public static int getIntAtOffset(Object object,
Offset offset)
public static Word getWordAtOffset(Object object,
Offset offset)
public static Object getObjectAtOffset(Object object,
Offset offset)
public static Object getObjectAtOffset(Object object,
Offset offset,
int locationMetadata)
public static Word getWordAtOffset(Object object,
Offset offset,
int locationMetadata)
public static TIB getTIBAtOffset(Object object,
Offset offset)
public static long getLongAtOffset(Object object,
Offset offset)
public static double getDoubleAtOffset(Object object,
Offset offset)
public static void setByteAtOffset(Object object,
Offset offset,
byte newvalue)
public static void setCharAtOffset(Object object,
Offset offset,
char newvalue)
public static void setIntAtOffset(Object object,
Offset offset,
int newvalue)
public static void setWordAtOffset(Object object,
Offset offset,
Word newvalue)
public static void setWordAtOffset(Object object,
Offset offset,
Word newvalue,
int locationMetadata)
public static void setObjectAtOffset(Object object,
Offset offset,
Object newvalue)
public static void setObjectAtOffset(Object object,
Offset offset,
Object newvalue,
int locationMetadata)
public static void setLongAtOffset(Object object,
Offset offset,
long newvalue)
public static void setDoubleAtOffset(Object object,
Offset offset,
double newvalue)
public static int prepareInt(Object object,
Offset offset)
public static Object prepareObject(Object object,
Offset offset)
public static Address prepareAddress(Object object,
Offset offset)
public static Word prepareWord(Object object,
Offset offset)
public static long prepareLong(Object object,
Offset offset)
public static boolean attemptInt(Object object,
Offset offset,
int oldValue,
int newValue)
public static boolean attemptObject(Object object,
Offset offset,
Object oldValue,
Object newValue)
public static boolean attemptAddress(Object object,
Offset offset,
Address oldValue,
Address newValue)
public static boolean attemptWord(Object object,
Offset offset,
Word oldValue,
Word newValue)
public static boolean attemptLong(Object object,
Offset offset,
long oldValue,
long newValue)
public static void setObjectAddressRemapper(ObjectAddressRemapper x)
public static <T> Address objectAsAddress(T object)
object - object reference
public static <T> T bootImageIntern(T object)
object - to intern
public static int bootImageIdentityHashCode(Object object)
object - to intern
public static Object addressAsObject(Address address)
address - object reference as bits
public static Object codeArrayAsObject(ArchitectureSpecific.CodeArray code)
code - the code array to convert
public static Object tibAsObject(TIB tib)
tib - the tib to convert
public static TIB addressAsTIB(Address address)
address - object array reference as bits
public static RVMType objectAsType(Object object)
object - object reference
public static Processor objectAsProcessor(Object object)
object - object reference
public static GreenProcessor processorAsGreenProcessor(Processor proc)
proc - processor
public static RVMThread objectAsThread(Object object)
object - object reference
public static int floatAsIntBits(float number)
number - A floating point number
number as bitspublic static float intBitsAsFloat(int number)
number - as bits
number as a floatpublic static long doubleAsLongBits(double number)
number - as double
public static double longBitsAsDouble(long number)
number - as bits
public static CollectorThread threadAsCollectorThread(RVMThread t)
t - Thread object reference
public static byte[] addressAsByteArray(Address byte_array)
byte_array - an address
Returned: byte array (byte[]) object referencepublic static short[] objectAsShortArray(Object object)
object -
public static int[] objectAsIntArray(Object object)
object -
public static RVMType getObjectType(Object object)
object - object reference
public static int getArrayLength(Object object)
object - object reference
public static void saveThreadState(ArchitectureSpecific.Registers registers)
registers - place to save register values
public static void threadSwitch(RVMThread currentThread,
ArchitectureSpecific.Registers restoreRegs)
currentThread - thread that is currently runningrestoreRegs - registers from which we should restore
the saved hardware state of another thread.public static void restoreHardwareExceptionState(ArchitectureSpecific.Registers registers)
registers - register values to be usedpublic static void returnToNewStack(Address fp)
fp - value to place into FRAME_POINTER registerpublic static void dynamicBridgeTo(ArchitectureSpecific.CodeArray instructions)
instructions - target method
public static void invokeClassInitializer(ArchitectureSpecific.CodeArray clinit)
throws Exception
Exception
public static void invokeMethodReturningVoid(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
public static int invokeMethodReturningInt(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
public static long invokeMethodReturningLong(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
public static float invokeMethodReturningFloat(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
public static double invokeMethodReturningDouble(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
public static Object invokeMethodReturningObject(ArchitectureSpecific.CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills)
public static void sync()
public static void isync()
public static void pause()
public static float sqrt(float value)
public static double sqrt(double value)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||