public final class Magic extends Object
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.
Modifier and Type | Field and Description |
---|---|
private static ObjectAddressRemapper |
objectAddressRemapper |
Constructor and Description |
---|
Magic() |
Modifier and Type | Method and Description |
---|---|
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 <T> T |
bootImageIntern(T object)
Certain objects aren't replicated in the boot image to save space.
|
static Object |
codeArrayAsObject(CodeArray code)
Cast bits of code array into an object
Note: for use by Statics when assigning slots to static method pointers
|
static void |
combinedLoadBarrier()
Emits an instruction that provides both a LoadLoad and a LoadStore barrier.
|
static long |
doubleAsLongBits(double number)
Cast bits.
|
static void |
dynamicBridgeTo(CodeArray instructions)
Transfer execution to target of a dynamic bridge method.
|
static void |
fence()
Emits a strong memory fence, used to enforce StoreLoad in the JMM.
|
static int |
floatAsIntBits(float number)
Cast bits.
|
static Address |
getAddressAtOffset(Object object,
Offset offset)
Get Address at arbitrary (byte) offset from object.
|
static Address |
getAddressAtOffset(Object object,
Offset offset,
int locationMetadata)
Get Address at arbitrary (byte) offset from object.
|
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) |
static double |
getDoubleAtOffset(Object object,
Offset offset)
Get double at arbitrary (byte) offset from object.
|
static RVMThread |
getESIAsThread() |
static Extent |
getExtentAtOffset(Object object,
Offset offset)
Get Extent at arbitrary (byte) offset from object.
|
static Extent |
getExtentAtOffset(Object object,
Offset offset,
int locationMetadata)
Get Extent at arbitrary (byte) offset from object.
|
static float |
getFloatAtOffset(Object object,
Offset offset)
Get float at arbitrary (byte) offset from object.
|
static Address |
getFramePointer() |
static int |
getInlineDepth()
How deeply inlined is this method (0 means no inlining).
|
static int |
getIntAtOffset(Object object,
Offset offset)
Get int at arbitrary (byte) offset from object.
|
static Address |
getJTOC() |
static long |
getLongAtOffset(Object object,
Offset offset)
Get long at arbitrary (byte) offset from object.
|
static Address |
getNextInstructionAddress(Address fp) |
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 Offset |
getOffsetAtOffset(Object object,
Offset offset)
Get Offset at arbitrary (byte) offset from object.
|
static Offset |
getOffsetAtOffset(Object object,
Offset offset,
int locationMetadata)
Get Offset at arbitrary (byte) offset from object.
|
static Address |
getReturnAddress(Address fp)
Get return address for a frame in the current thread
|
static Address |
getReturnAddress(Address fp,
RVMThread thread)
Get return address for a frame in a specific thread
|
static Address |
getReturnAddressLocation(Address fp) |
static Address |
getReturnAddressUnchecked(Address fp)
Get return address for a frame in a case where the frame is
known not to be a trampoline frame.
|
static short |
getShortAtOffset(Object object,
Offset offset)
Get short at arbitrary (byte) offset from object.
|
static RVMThread |
getThreadRegister() |
static TIB |
getTIBAtOffset(Object object,
Offset offset)
Get TIB at arbitrary (byte) offset from object.
|
static long |
getTimeBase()
Reads contents of hardware time base registers.
|
static Address |
getTocPointer() |
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(CodeArray clinit)
Call <clinit> method with no argument list
|
static double |
invokeMethodReturningDouble(CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills) |
static float |
invokeMethodReturningFloat(CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills) |
static int |
invokeMethodReturningInt(CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills) |
static long |
invokeMethodReturningLong(CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills) |
static Object |
invokeMethodReturningObject(CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills) |
static void |
invokeMethodReturningVoid(CodeArray code,
WordArray gprs,
double[] fprs,
byte[] fprmeta,
WordArray spills) |
static boolean |
isConstantParameter(int index)
Is the specified parameter constant (due to either inlining or specialization).
|
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 <T> Address |
objectAsAddress(T object)
Cast bits.
|
static int[] |
objectAsIntArray(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)
Gets 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 void |
restoreHardwareExceptionState(AbstractRegisters 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(AbstractRegisters registers)
Saves current thread state.
|
static void |
setAddressAtOffset(Object object,
Offset offset,
Address newvalue)
Set Address at arbitrary (byte) offset from object.
|
static void |
setAddressAtOffset(Object object,
Offset offset,
Address newvalue,
int locationMetadata)
Set Address at arbitrary (byte) offset from object.
|
static void |
setBooleanAtOffset(Object object,
Offset offset,
boolean newvalue)
Set boolean at arbitrary (byte) offset from object.
|
static void |
setBooleanAtOffset(Object object,
Offset offset,
boolean newvalue,
int locationMetadata)
Set boolean at arbitrary (byte) offset from object.
|
static void |
setByteAtOffset(Object object,
Offset offset,
byte newvalue)
Set byte at arbitrary (byte) offset from object.
|
static void |
setByteAtOffset(Object object,
Offset offset,
byte newvalue,
int locationMetadata)
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 |
setCharAtOffset(Object object,
Offset offset,
char newvalue,
int locationMetadata)
Set char at arbitrary (byte) offset from object.
|
static void |
setCompiledMethodID(Address fp,
int newCMID)
Sets 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 |
setDoubleAtOffset(Object object,
Offset offset,
double newvalue,
int locationMetadata)
Set double at arbitrary (byte) offset from object.
|
static void |
setESIAsThread(RVMThread p)
Sets contents of ESI to hold a reference to a thread object.
|
static void |
setExtentAtOffset(Object object,
Offset offset,
Extent newvalue)
Set Extent at arbitrary (byte) offset from object.
|
static void |
setExtentAtOffset(Object object,
Offset offset,
Extent newvalue,
int locationMetadata)
Set Extent at arbitrary (byte) offset from object.
|
static void |
setFloatAtOffset(Object object,
Offset offset,
float newvalue)
Set float at arbitrary (byte) offset from object.
|
static void |
setFloatAtOffset(Object object,
Offset offset,
float newvalue,
int locationMetadata)
Set float at arbitrary (byte) offset from object.
|
static void |
setIntAtOffset(Object object,
Offset offset,
int newvalue)
Set int at arbitrary (byte) offset from object.
|
static void |
setIntAtOffset(Object object,
Offset offset,
int newvalue,
int locationMetadata)
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 |
setLongAtOffset(Object object,
Offset offset,
long newvalue,
int locationMetadata)
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 |
setOffsetAtOffset(Object object,
Offset offset,
Offset newvalue)
Set Offset at arbitrary (byte) offset from object.
|
static void |
setOffsetAtOffset(Object object,
Offset offset,
Offset newvalue,
int locationMetadata)
Set Offset at arbitrary (byte) offset from object.
|
static void |
setReturnAddress(Address fp,
Address v)
Sets return address for a frame.
|
static void |
setShortAtOffset(Object object,
Offset offset,
short newvalue)
Set short at arbitrary (byte) offset from object.
|
static void |
setShortAtOffset(Object object,
Offset offset,
short newvalue,
int locationMetadata)
Set short at arbitrary (byte) offset from object.
|
static void |
setThreadRegister(RVMThread p)
Sets contents of "thread" register.
|
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 |
storeStoreBarrier()
Emits a StoreStore barrier.
|
static void |
sync()
Wait for preceeding cache flush/invalidate instructions to
complete on all processors.
|
static void |
threadSwitch(RVMThread currentThread,
AbstractRegisters restoreRegs)
Switch threads.
|
static Object |
tibAsObject(TIB tib)
Cast bits of tib into an object
Note: for use by Statics when assigning slots
|
private static ObjectAddressRemapper objectAddressRemapper
public Magic()
public static Address getFramePointer()
public static Address getTocPointer()
public static RVMThread getThreadRegister()
public static void setThreadRegister(RVMThread p)
p
- new contents of the thread registerpublic static RVMThread getESIAsThread()
public static void setESIAsThread(RVMThread p)
p
- the threadpublic static long getTimeBase()
Note: we think that 1 "tick" == 4 "machine cycles", but this seems to be undocumented and may vary across processor implementations.
public static Address getCallerFramePointer(Address fp)
fp
- frame pointer for child framepublic 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 pointerpublic 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 getReturnAddressUnchecked(Address fp)
fp
- its frame pointerpublic static Address getReturnAddress(Address fp)
fp
- its frame pointerpublic static Address getReturnAddress(Address fp, RVMThread thread)
fp
- its frame pointerthread
- the thread whose stack is being examinedpublic static void setReturnAddress(Address fp, Address v)
fp
- its frame pointerv
- the new return addresspublic static byte getUnsignedByteAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static byte getByteAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static char getCharAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static short getShortAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static int getIntAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static long getLongAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static float getFloatAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static double getDoubleAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static Object getObjectAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static Object getObjectAtOffset(Object object, Offset offset, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectlocationMetadata
- metadata about the location for the compilerspublic static Word getWordAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static Word getWordAtOffset(Object object, Offset offset, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectlocationMetadata
- metadata about the location for the compilerspublic static Address getAddressAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static Address getAddressAtOffset(Object object, Offset offset, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectlocationMetadata
- metadata about the location for the compilerspublic static Extent getExtentAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static Extent getExtentAtOffset(Object object, Offset offset, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectlocationMetadata
- metadata about the location for the compilerspublic static Offset getOffsetAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static Offset getOffsetAtOffset(Object object, Offset offset, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectlocationMetadata
- metadata about the location for the compilerspublic static TIB getTIBAtOffset(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static void setBooleanAtOffset(Object object, Offset offset, boolean newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setBooleanAtOffset(Object object, Offset offset, boolean newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setByteAtOffset(Object object, Offset offset, byte newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setByteAtOffset(Object object, Offset offset, byte newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setCharAtOffset(Object object, Offset offset, char newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setCharAtOffset(Object object, Offset offset, char newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setShortAtOffset(Object object, Offset offset, short newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setShortAtOffset(Object object, Offset offset, short newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setIntAtOffset(Object object, Offset offset, int newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setIntAtOffset(Object object, Offset offset, int newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setLongAtOffset(Object object, Offset offset, long newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setLongAtOffset(Object object, Offset offset, long newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setFloatAtOffset(Object object, Offset offset, float newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setFloatAtOffset(Object object, Offset offset, float newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setDoubleAtOffset(Object object, Offset offset, double newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setDoubleAtOffset(Object object, Offset offset, double newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setWordAtOffset(Object object, Offset offset, Word newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setWordAtOffset(Object object, Offset offset, Word newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setAddressAtOffset(Object object, Offset offset, Address newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setAddressAtOffset(Object object, Offset offset, Address newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setExtentAtOffset(Object object, Offset offset, Extent newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setExtentAtOffset(Object object, Offset offset, Extent newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setOffsetAtOffset(Object object, Offset offset, Offset newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setOffsetAtOffset(Object object, Offset offset, Offset newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static void setObjectAtOffset(Object object, Offset offset, Object newvalue)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresspublic static void setObjectAtOffset(Object object, Offset offset, Object newvalue, int locationMetadata)
object
- the object serving as start addressoffset
- the offset from the objectnewvalue
- the value to write to the computed addresslocationMetadata
- metadata about the location for the compilerspublic static int prepareInt(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static Object prepareObject(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static Address prepareAddress(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static Word prepareWord(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static long prepareLong(Object object, Offset offset)
object
- the object serving as start addressoffset
- the offset from the objectpublic static boolean attemptInt(Object object, Offset offset, int oldValue, int newValue)
object
- the object serving as start addressoffset
- the offset from the objectoldValue
- the value that is expected to be at the computed addressnewValue
- the value that is supposed to be written to the computed
addresstrue
if successful, false
if notpublic static boolean attemptObject(Object object, Offset offset, Object oldValue, Object newValue)
object
- the object serving as start addressoffset
- the offset from the objectoldValue
- the value that is expected to be at the computed addressnewValue
- the value that is supposed to be written to the computed
addresstrue
if successful, false
if notpublic static boolean attemptAddress(Object object, Offset offset, Address oldValue, Address newValue)
object
- the object serving as start addressoffset
- the offset from the objectoldValue
- the value that is expected to be at the computed addressnewValue
- the value that is supposed to be written to the computed
addresstrue
if successful, false
if notpublic static boolean attemptWord(Object object, Offset offset, Word oldValue, Word newValue)
object
- the object serving as start addressoffset
- the offset from the objectoldValue
- the value that is expected to be at the computed addressnewValue
- the value that is supposed to be written to the computed
addresstrue
if successful, false
if notpublic static boolean attemptLong(Object object, Offset offset, long oldValue, long newValue)
object
- the object serving as start addressoffset
- the offset from the objectoldValue
- the value that is expected to be at the computed addressnewValue
- the value that is supposed to be written to the computed
addresstrue
if successful, false
if notpublic static void setObjectAddressRemapper(ObjectAddressRemapper x)
x
- the remapper ot usepublic static <T> Address objectAsAddress(T object)
T
- the object's typeobject
- object referencepublic static <T> T bootImageIntern(T object)
T
- the object's typeobject
- to internpublic static int bootImageIdentityHashCode(Object object)
object
- to internpublic static Object addressAsObject(Address address)
address
- object reference as bitspublic static Object codeArrayAsObject(CodeArray code)
code
- the code array to convertpublic static Object tibAsObject(TIB tib)
tib
- the tib to convertpublic static TIB addressAsTIB(Address address)
address
- object array reference as bitspublic static RVMType objectAsType(Object object)
object
- object referencepublic static RVMThread objectAsThread(Object object)
object
- object referencepublic static int floatAsIntBits(float number)
number
- A floating point numbernumber
as bitspublic static float intBitsAsFloat(int number)
number
- as bitsnumber
as a float
public static long doubleAsLongBits(double number)
number
- as doublepublic static double longBitsAsDouble(long number)
number
- as bitspublic static byte[] addressAsByteArray(Address byte_array)
byte_array
- an addresspublic static short[] objectAsShortArray(Object object)
object
- an object that must be a short arraypublic static int[] objectAsIntArray(Object object)
object
- an object that must be an int arraypublic static RVMType getObjectType(Object object)
object
- object referencepublic static int getArrayLength(Object object)
object
- object referencepublic static void saveThreadState(AbstractRegisters registers)
We used to use this to implement thread switching, but we have a threadSwitch magic now that does both of these in a single step as that is less error-prone. saveThreadState is now only used in the implementation of athrow (RuntimeEntrypoints.athrow).
The following registers are saved:
registers
- place to save register valuespublic static void threadSwitch(RVMThread currentThread, AbstractRegisters restoreRegs)
currentThread
- thread that is currently runningrestoreRegs
- registers from which we should restore
the saved hardware state of another thread.public static void restoreHardwareExceptionState(AbstractRegisters registers)
Restores virtually all registers (details vary by architecture). But, the following are _NOT_ restored
registers
- register values to be usedpublic static void returnToNewStack(Address fp)
fp
- value to place into FRAME_POINTER registerpublic static void dynamicBridgeTo(CodeArray instructions)
The following registers are restored: non-volatiles, volatiles
Note: this method must only be called from a DynamicBridge method because it never returns (target method returns to caller of dynamic bridge method)
instructions
- target methodpublic static void invokeClassInitializer(CodeArray clinit) throws Exception
clinit
- the code of the class initializerException
- all expections from invocation of the class initializer
are passed alongpublic static void invokeMethodReturningVoid(CodeArray code, WordArray gprs, double[] fprs, byte[] fprmeta, WordArray spills)
code
- the method's codegprs
- parameters passed in the general purpose registersfprs
- parameters passed in the floating point registersfprmeta
- meta-data (e.g. flags) about the floating point registersspills
- parameters passed on the stackpublic static int invokeMethodReturningInt(CodeArray code, WordArray gprs, double[] fprs, byte[] fprmeta, WordArray spills)
code
- the method's codegprs
- parameters passed in the general purpose registersfprs
- parameters passed in the floating point registersfprmeta
- meta-data (e.g. flags) about the floating point registersspills
- parameters passed on the stackpublic static long invokeMethodReturningLong(CodeArray code, WordArray gprs, double[] fprs, byte[] fprmeta, WordArray spills)
code
- the method's codegprs
- parameters passed in the general purpose registersfprs
- parameters passed in the floating point registersfprmeta
- meta-data (e.g. flags) about the floating point registersspills
- parameters passed on the stackpublic static float invokeMethodReturningFloat(CodeArray code, WordArray gprs, double[] fprs, byte[] fprmeta, WordArray spills)
code
- the method's codegprs
- parameters passed in the general purpose registersfprs
- parameters passed in the floating point registersfprmeta
- meta-data (e.g. flags) about the floating point registersspills
- parameters passed on the stackpublic static double invokeMethodReturningDouble(CodeArray code, WordArray gprs, double[] fprs, byte[] fprmeta, WordArray spills)
code
- the method's codegprs
- parameters passed in the general purpose registersfprs
- parameters passed in the floating point registersfprmeta
- meta-data (e.g. flags) about the floating point registersspills
- parameters passed on the stackpublic static Object invokeMethodReturningObject(CodeArray code, WordArray gprs, double[] fprs, byte[] fprmeta, WordArray spills)
code
- the method's codegprs
- parameters passed in the general purpose registersfprs
- parameters passed in the floating point registersfprmeta
- meta-data (e.g. flags) about the floating point registersspills
- parameters passed on the stackpublic static void fence()
Note: A StoreLoad barrier includes all other barriers on all platforms that we currently support (IA32 and PPC).
public static void combinedLoadBarrier()
We don't provide separate methods for LoadStore and LoadLoad barriers because the appropriate instructions for IA32 and PPC provide both barriers.
public static void storeStoreBarrier()
public static void sync()
public static void isync()
public static void pause()
public static float sqrt(float value)
Note: this method may only be if the current configuration supports
hardware floating point, i.e. if
Configuration.BuildForHwFsqrt
is true.
value
- the value whose square root will be computedpublic static double sqrt(double value)
Note: this method may only be if the current configuration supports
hardware floating point, i.e. if
Configuration.BuildForHwFsqrt
is true.
value
- the value whose square root will be computedpublic static int getInlineDepth()
public static boolean isConstantParameter(int index)
index
- the index for the parameter as described above