org.jikesrvm.runtime
Class RuntimeEntrypoints

java.lang.Object
  extended by org.jikesrvm.runtime.RuntimeEntrypoints
All Implemented Interfaces:
ArchitectureSpecific.StackframeLayoutConstants, Constants, HeapLayoutConstants, StackframeLayoutConstants, ThinLockConstants, TIBLayoutConstants, SizeConstants

public class RuntimeEntrypoints
extends Object
implements Constants, ArchitectureSpecific.StackframeLayoutConstants

Entrypoints into the runtime of the virtual machine.

These are "helper functions" called from machine code emitted by BaselineCompilerImpl. They implement functionality that cannot be mapped directly into a small inline sequence of machine instructions. See also: Linker.

Note #1: If you add, remove, or change the signature of any of these methods you may need to change Entrypoints to match.

Note #2: Code here must be carefully written to be gc-safe while manipulating stackframe and instruction addresses.

Any time we are holding interior pointers to objects that could be moved by a garbage collection cycle we must either avoid passing through gc-sites (by writing straight line code with no "non-magic" method invocations) or we must turn off the collector (so that a gc request initiated by another thread will not run until we're done manipulating the bare pointers). Furthermore, while the collector is turned off, we must be careful not to make any allocation requests ("new").

The interior pointers that we must worry about are:


Field Summary
(package private) static int allocationCountDownToGC
          Number of allocations left before a GC is forced.
(package private) static int jniCountDownToGC
          Number of c-to-java jni calls left before a GC is forced.
private static boolean traceAthrow
           
static int TRAP_ARRAY_BOUNDS
           
static int TRAP_CHECKCAST
           
static int TRAP_DIVIDE_BY_ZERO
           
static int TRAP_JNI_STACK
           
static int TRAP_MUST_IMPLEMENT
           
static int TRAP_NULL_POINTER
           
static int TRAP_REGENERATE
           
static int TRAP_STACK_OVERFLOW
           
static int TRAP_STACK_OVERFLOW_FATAL
           
static int TRAP_STORE_CHECK
           
static int TRAP_UNKNOWN
           
 
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.SizeConstants
BITS_IN_ADDRESS, BITS_IN_BOOLEAN, BITS_IN_BYTE, BITS_IN_CHAR, BITS_IN_DOUBLE, BITS_IN_EXTENT, BITS_IN_FLOAT, BITS_IN_INT, BITS_IN_LONG, BITS_IN_OFFSET, BITS_IN_PAGE, BITS_IN_SHORT, BITS_IN_WORD, BYTES_IN_ADDRESS, BYTES_IN_BOOLEAN, BYTES_IN_BYTE, BYTES_IN_CHAR, BYTES_IN_DOUBLE, BYTES_IN_EXTENT, BYTES_IN_FLOAT, BYTES_IN_INT, BYTES_IN_LONG, BYTES_IN_OFFSET, BYTES_IN_PAGE, BYTES_IN_SHORT, BYTES_IN_WORD, LOG_BITS_IN_ADDRESS, LOG_BITS_IN_BOOLEAN, LOG_BITS_IN_BYTE, LOG_BITS_IN_CHAR, LOG_BITS_IN_DOUBLE, LOG_BITS_IN_EXTENT, LOG_BITS_IN_FLOAT, LOG_BITS_IN_INT, LOG_BITS_IN_LONG, LOG_BITS_IN_OFFSET, LOG_BITS_IN_PAGE, LOG_BITS_IN_SHORT, LOG_BITS_IN_WORD, LOG_BYTES_IN_ADDRESS, LOG_BYTES_IN_BOOLEAN, LOG_BYTES_IN_BYTE, LOG_BYTES_IN_CHAR, LOG_BYTES_IN_DOUBLE, LOG_BYTES_IN_EXTENT, LOG_BYTES_IN_FLOAT, LOG_BYTES_IN_INT, LOG_BYTES_IN_LONG, LOG_BYTES_IN_OFFSET, LOG_BYTES_IN_PAGE, LOG_BYTES_IN_SHORT, LOG_BYTES_IN_WORD
 
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
 
Fields inherited from interface org.jikesrvm.ia32.StackframeLayoutConstants
BYTES_IN_STACKSLOT, FPU_STATE_SIZE, INVISIBLE_METHOD_ID, LOG_BYTES_IN_STACKSLOT, STACK_SIZE_BOOT, STACK_SIZE_COLLECTOR, STACK_SIZE_DLOPEN, STACK_SIZE_GCDISABLED, STACK_SIZE_GROW, STACK_SIZE_GUARD, STACK_SIZE_JNINATIVE_GROW, STACK_SIZE_MAX, STACK_SIZE_NORMAL, STACK_SIZE_SYSCALL, STACKFRAME_ALIGNMENT, STACKFRAME_BODY_OFFSET, STACKFRAME_FRAME_POINTER_OFFSET, STACKFRAME_HEADER_SIZE, STACKFRAME_METHOD_ID_OFFSET, STACKFRAME_RETURN_ADDRESS_OFFSET, STACKFRAME_SENTINEL_FP, XMM_STATE_SIZE
 
Constructor Summary
RuntimeEntrypoints()
           
 
Method Summary
(package private) static void aastore(Object[] arrayRef, int index, Object value)
          Perform aastore bytecode
(package private) static void aastoreUninterruptible(Object[] arrayRef, int index, Object value)
          Perform uninterruptible aastore bytecode
static void athrow(Throwable exceptionObject)
          Deliver a software exception to current java thread.
static Object buildMDAHelper(RVMMethod method, int[] numElements, int dimIndex, RVMArray arrayType)
           
static Object buildMultiDimensionalArray(int methodId, int[] numElements, RVMArray arrayType)
          Build a multi-dimensional array.
static Object buildTwoDimensionalArray(int methodId, int dim0, int dim1, RVMArray arrayType)
          Build a two-dimensional array.
private static boolean canForceGC()
          Return true if we are stress testing garbage collector and the system is in state where we can force a garbage collection.
private static void checkAllocationCountDownToGC()
          Check to see if we are stress testing garbage collector and if another allocation should trigger a GC then do so.
(package private) static void checkcast(Object object, int id)
          Throw exception unless object is instance of target class/array or implements target interface.
static void checkJNICountDownToGC()
          Check to see if we are stress testing garbage collector and if another JNI call should trigger a gc then do so.
(package private) static void checkstore(Object array, Object arrayElement)
          Throw exception iff array assignment is illegal.
static Object clone(Object obj)
          Clone a Scalar or Array Object.
private static Object cloneArray(Object obj, RVMType type)
          Clone an array
private static Object cloneClass(Object obj, RVMType type)
          Clone an object implementing a class - check that the class is cloneable (we make this a small method with just a test so that the inliner will inline it and hopefully eliminate the instanceof test).
private static Object cloneClass2(Object obj, RVMType type)
          Clone an object implementing a class - the actual clone
private static void deliverException(Throwable exceptionObject, ArchitectureSpecific.Registers exceptionRegisters)
          Deliver an exception to current java thread.
(package private) static void deliverHardwareException(int trapCode, int trapInfo)
          Deliver a hardware exception to current java thread.
static int getObjectHashCode(Object object)
          Get an object's "hashcode" value.
private static void handleUncaughtException(Throwable exceptionObject)
           
static void init()
           
static void initializeClassForDynamicLink(RVMClass cls)
          Prepare a class for use prior to first allocation, field access, or method invocation.
(package private) static boolean instanceOf(Object object, int targetID)
          Test if object is instance of target class/array or implements target interface.
static boolean isAssignableWith(RVMType lhs, RVMType rhs)
          May a variable of type "lhs" be assigned a value of type "rhs"?
(package private) static void raiseAbstractMethodError()
          Create and throw a java.lang.AbstractMethodError.
(package private) static void raiseArithmeticException()
          Create and throw a java.lang.ArithmeticException.
(package private) static void raiseArrayIndexOutOfBoundsException()
          Create and throw a java.lang.ArrayIndexOutOfBoundsException.
(package private) static void raiseArrayIndexOutOfBoundsException(int index)
          Create and throw a java.lang.ArrayIndexOutOfBoundsException.
static void raiseArrayStoreException()
          Create and throw a java.lang.ArrayStoreException.
(package private) static void raiseIllegalAccessError()
          Create and throw a java.lang.IllegalAccessError.
private static void raiseNegativeArraySizeException()
          Helper function to actually throw the required exception.
static void raiseNullPointerException()
          Create and throw a java.lang.NullPointerException.
static Object resolvedNewArray(int numElements, int logElementSize, int headerSize, TIB tib, int allocator, int align, int offset, int site)
          Allocate something like "new int[cnt]" or "new Foo[cnt]".
static Object resolvedNewArray(int numElements, RVMArray array)
          Allocate something like "new Foo[]".
static Object resolvedNewArray(int numElements, RVMArray array, int site)
           
static Object resolvedNewScalar(int size, TIB tib, boolean hasFinalizer, int allocator, int align, int offset, int site)
          Allocate something like "new Foo()".
static Object resolvedNewScalar(RVMClass cls)
          Allocate something like "new Foo()".
(package private) static void unexpectedAbstractMethodCall()
          Report unexpected method call: abstract method (verification error).
(package private) static void unexpectedInterfaceMethodCall()
          Report unexpected method call: interface method (virtual machine dispatching error, shouldn't happen).
(package private) static void unlockAndThrow(Object objToUnlock, Throwable objToThrow)
          Unlock an object and then deliver a software exception to current java thread.
static Object unresolvedNewArray(int numElements, int id, int site)
          Allocate something like "new Foo[]".
(package private) static Object unresolvedNewScalar(int id, int site)
          Allocate something like "new Foo()".
private static void unwindInvisibleStackFrame(ArchitectureSpecific.Registers registers)
          Unwind stack frame for an .
static Address unwindNativeStackFrame(Address currfp)
          Skip over all frames below currfp with saved code pointers outside of heap (C frames), stopping at the native frame immediately preceding the glue frame which contains the method ID of the native method (this is necessary to allow retrieving the return address of the glue frame).
static Address unwindNativeStackFrameForGC(Address currfp)
          The current frame is expected to be one of the JNI functions called from C, below which is one or more native stack frames.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

traceAthrow

private static final boolean traceAthrow
See Also:
Constant Field Values

TRAP_UNKNOWN

public static final int TRAP_UNKNOWN
See Also:
Constant Field Values

TRAP_NULL_POINTER

public static final int TRAP_NULL_POINTER
See Also:
Constant Field Values

TRAP_ARRAY_BOUNDS

public static final int TRAP_ARRAY_BOUNDS
See Also:
Constant Field Values

TRAP_DIVIDE_BY_ZERO

public static final int TRAP_DIVIDE_BY_ZERO
See Also:
Constant Field Values

TRAP_STACK_OVERFLOW

public static final int TRAP_STACK_OVERFLOW
See Also:
Constant Field Values

TRAP_CHECKCAST

public static final int TRAP_CHECKCAST
See Also:
Constant Field Values

TRAP_REGENERATE

public static final int TRAP_REGENERATE
See Also:
Constant Field Values

TRAP_JNI_STACK

public static final int TRAP_JNI_STACK
See Also:
Constant Field Values

TRAP_MUST_IMPLEMENT

public static final int TRAP_MUST_IMPLEMENT
See Also:
Constant Field Values

TRAP_STORE_CHECK

public static final int TRAP_STORE_CHECK
See Also:
Constant Field Values

TRAP_STACK_OVERFLOW_FATAL

public static final int TRAP_STACK_OVERFLOW_FATAL
See Also:
Constant Field Values

allocationCountDownToGC

static int allocationCountDownToGC
Number of allocations left before a GC is forced. Only used if VM.StressGCAllocationInterval is not 0.


jniCountDownToGC

static int jniCountDownToGC
Number of c-to-java jni calls left before a GC is forced. Only used if VM.StressGCAllocationInterval is not 0.

Constructor Detail

RuntimeEntrypoints

public RuntimeEntrypoints()
Method Detail

instanceOf

static boolean instanceOf(Object object,
                          int targetID)
                   throws NoClassDefFoundError
Test if object is instance of target class/array or implements target interface.

Parameters:
object - object to be tested
targetID - type reference id corresponding to target class/array/interface
Returns:
true iff is object instance of target type?
Throws:
NoClassDefFoundError

checkcast

static void checkcast(Object object,
                      int id)
               throws ClassCastException,
                      NoClassDefFoundError
Throw exception unless object is instance of target class/array or implements target interface.

Parameters:
object - object to be tested
id - of type reference corresponding to target class/array/interface
Throws:
ClassCastException
NoClassDefFoundError

aastore

static void aastore(Object[] arrayRef,
                    int index,
                    Object value)
             throws ArrayStoreException,
                    ArrayIndexOutOfBoundsException
Perform aastore bytecode

Throws:
ArrayStoreException
ArrayIndexOutOfBoundsException

aastoreUninterruptible

static void aastoreUninterruptible(Object[] arrayRef,
                                   int index,
                                   Object value)
Perform uninterruptible aastore bytecode


checkstore

static void checkstore(Object array,
                       Object arrayElement)
                throws ArrayStoreException
Throw exception iff array assignment is illegal.

Throws:
ArrayStoreException

isAssignableWith

public static boolean isAssignableWith(RVMType lhs,
                                       RVMType rhs)
May a variable of type "lhs" be assigned a value of type "rhs"?

Parameters:
lhs - type of variable
rhs - type of value
Returns:
true --> assignment is legal false --> assignment is illegal Assumption: caller has already tested "trivial" case (exact type match) so we need not repeat it here

unresolvedNewScalar

static Object unresolvedNewScalar(int id,
                                  int site)
                           throws NoClassDefFoundError,
                                  OutOfMemoryError
Allocate something like "new Foo()".

Parameters:
id - id of type reference of class to create.
Returns:
object with header installed and all fields set to zero/null (ready for initializer to be run on it) See also: bytecode 0xbb ("new")
Throws:
NoClassDefFoundError
OutOfMemoryError

resolvedNewScalar

public static Object resolvedNewScalar(RVMClass cls)
Allocate something like "new Foo()".

Parameters:
cls - RVMClass of array to create
Returns:
object with header installed and all fields set to zero/null (ready for initializer to be run on it) See also: bytecode 0xbb ("new")

resolvedNewScalar

public static Object resolvedNewScalar(int size,
                                       TIB tib,
                                       boolean hasFinalizer,
                                       int allocator,
                                       int align,
                                       int offset,
                                       int site)
                                throws OutOfMemoryError
Allocate something like "new Foo()".

Parameters:
size - size of object (including header), in bytes
tib - type information block for object
hasFinalizer - does this type have a finalizer?
allocator - int that encodes which allocator should be used
align - the alignment requested; must be a power of 2.
offset - the offset at which the alignment is desired.
site - the site id of the calling allocation site
Returns:
object with header installed and all fields set to zero/null (ready for initializer to be run on it) See also: bytecode 0xbb ("new")
Throws:
OutOfMemoryError

unresolvedNewArray

public static Object unresolvedNewArray(int numElements,
                                        int id,
                                        int site)
                                 throws NoClassDefFoundError,
                                        OutOfMemoryError,
                                        NegativeArraySizeException
Allocate something like "new Foo[]".

Parameters:
numElements - number of array elements
id - id of type reference of array to create.
site - the site id of the calling allocation site
Returns:
array with header installed and all fields set to zero/null See also: bytecode 0xbc ("anewarray")
Throws:
NoClassDefFoundError
OutOfMemoryError
NegativeArraySizeException

resolvedNewArray

public static Object resolvedNewArray(int numElements,
                                      RVMArray array)
                               throws OutOfMemoryError,
                                      NegativeArraySizeException
Allocate something like "new Foo[]".

Parameters:
numElements - number of array elements
array - RVMArray of array to create
Returns:
array with header installed and all fields set to zero/null See also: bytecode 0xbc ("anewarray")
Throws:
OutOfMemoryError
NegativeArraySizeException

resolvedNewArray

public static Object resolvedNewArray(int numElements,
                                      RVMArray array,
                                      int site)
                               throws OutOfMemoryError,
                                      NegativeArraySizeException
Throws:
OutOfMemoryError
NegativeArraySizeException

resolvedNewArray

public static Object resolvedNewArray(int numElements,
                                      int logElementSize,
                                      int headerSize,
                                      TIB tib,
                                      int allocator,
                                      int align,
                                      int offset,
                                      int site)
                               throws OutOfMemoryError,
                                      NegativeArraySizeException
Allocate something like "new int[cnt]" or "new Foo[cnt]".

Parameters:
numElements - number of array elements
logElementSize - size in bytes of an array element, log base 2.
headerSize - size in bytes of array header
tib - type information block for array object
allocator - int that encodes which allocator should be used
align - the alignment requested; must be a power of 2.
offset - the offset at which the alignment is desired.
Returns:
array object with header installed and all elements set to zero/null See also: bytecode 0xbc ("newarray") and 0xbd ("anewarray")
Throws:
OutOfMemoryError
NegativeArraySizeException

clone

public static Object clone(Object obj)
                    throws OutOfMemoryError,
                           CloneNotSupportedException
Clone a Scalar or Array Object. called from java/lang/Object.clone().

For simplicity, we just code this more or less in Java using internal reflective operations and some magic. This is inefficient for large scalar objects, but until that is proven to be a performance problem, we won't worry about it. By keeping this in Java instead of dropping into Memory.copy, we avoid having to add special case code to deal with write barriers, and other such things.

This method calls specific cloning routines based on type to help guide the inliner (which won't inline a single large method).

Parameters:
obj - the object to clone
Returns:
the cloned object
Throws:
OutOfMemoryError
CloneNotSupportedException

cloneArray

private static Object cloneArray(Object obj,
                                 RVMType type)
                          throws OutOfMemoryError
Clone an array

Parameters:
obj - the array to clone
type - the type information for the array
Returns:
the cloned object
Throws:
OutOfMemoryError

cloneClass

private static Object cloneClass(Object obj,
                                 RVMType type)
                          throws OutOfMemoryError,
                                 CloneNotSupportedException
Clone an object implementing a class - check that the class is cloneable (we make this a small method with just a test so that the inliner will inline it and hopefully eliminate the instanceof test).

Parameters:
obj - the object to clone
type - the type information for the class
Returns:
the cloned object
Throws:
OutOfMemoryError
CloneNotSupportedException

cloneClass2

private static Object cloneClass2(Object obj,
                                  RVMType type)
                           throws OutOfMemoryError
Clone an object implementing a class - the actual clone

Parameters:
obj - the object to clone
type - the type information for the class
Returns:
the cloned object
Throws:
OutOfMemoryError

raiseNegativeArraySizeException

private static void raiseNegativeArraySizeException()
                                             throws NegativeArraySizeException
Helper function to actually throw the required exception. Keep out of line to mitigate code space when quickNewArray is inlined.

Throws:
NegativeArraySizeException

getObjectHashCode

public static int getObjectHashCode(Object object)
Get an object's "hashcode" value. Side effect: hash value is generated and stored into object's status word.

Returns:
object's hashcode.
See Also:
Object.hashCode().

initializeClassForDynamicLink

public static void initializeClassForDynamicLink(RVMClass cls)
Prepare a class for use prior to first allocation, field access, or method invocation. Made public so that it is accessible from java.lang.reflect.*.

See Also:
MemberReference.needsDynamicLink(org.jikesrvm.classloader.RVMMethod)

unexpectedInterfaceMethodCall

static void unexpectedInterfaceMethodCall()
Report unexpected method call: interface method (virtual machine dispatching error, shouldn't happen).


unexpectedAbstractMethodCall

static void unexpectedAbstractMethodCall()
Report unexpected method call: abstract method (verification error).


athrow

public static void athrow(Throwable exceptionObject)
Deliver a software exception to current java thread.

Parameters:
exceptionObject - exception object to deliver (null --> deliver NullPointerException). does not return (stack is unwound and execution resumes in a catch block) This method is public so that it can be invoked by java.lang.VMClass.

deliverHardwareException

static void deliverHardwareException(int trapCode,
                                     int trapInfo)
Deliver a hardware exception to current java thread.

Does not return. (stack is unwound, starting at trap site, and execution resumes in a catch block somewhere up the stack) /or/ execution resumes at instruction following trap (for TRAP_STACK_OVERFLOW)

Note: Control reaches here by the actions of an external "C" signal handler which saves the register state of the trap site into the "exceptionRegisters" field of the current Thread object. The signal handler also inserts a frame onto the stack immediately above this frame, for use by HardwareTrapGCMapIterator during garbage collection.

Parameters:
trapCode - code indicating kind of exception that was trapped (see TRAP_xxx, above)
trapInfo - array subscript (for array bounds trap, only)

unlockAndThrow

static void unlockAndThrow(Object objToUnlock,
                           Throwable objToThrow)
Unlock an object and then deliver a software exception to current java thread.

Does not return (stack is unwound and execution resumes in a catch block).

Parameters:
objToUnlock - object to unlock
objToThrow - exception object to deliver (null --> deliver NullPointerException).

raiseArrayIndexOutOfBoundsException

static void raiseArrayIndexOutOfBoundsException(int index)
Create and throw a java.lang.ArrayIndexOutOfBoundsException. Only used in some configurations where it is easier to make a call then recover the array index from a trap instruction.


raiseArrayIndexOutOfBoundsException

static void raiseArrayIndexOutOfBoundsException()
Create and throw a java.lang.ArrayIndexOutOfBoundsException. Used (rarely) by the opt compiler when it has determined that an array access will unconditionally raise an array bounds check error, but it has lost track of exactly what the index is going to be.


raiseNullPointerException

public static void raiseNullPointerException()
Create and throw a java.lang.NullPointerException. Used in a few circumstances to reduce code space costs of inlining (see java.lang.System.arraycopy()). Could also be used to raise a null pointer exception without going through the hardware trap handler; currently this is only done when the opt compiler has determined that an instruction will unconditionally raise a null pointer exception.


raiseArrayStoreException

public static void raiseArrayStoreException()
Create and throw a java.lang.ArrayStoreException. Used in a few circumstances to reduce code space costs of inlining (see java.lang.System.arraycopy()).


raiseArithmeticException

static void raiseArithmeticException()
Create and throw a java.lang.ArithmeticException. Used to raise an arithmetic exception without going through the hardware trap handler; currently this is only done when the opt compiler has determined that an instruction will unconditionally raise an arithmetic exception.


raiseAbstractMethodError

static void raiseAbstractMethodError()
Create and throw a java.lang.AbstractMethodError. Used to handle error cases in invokeinterface dispatching.


raiseIllegalAccessError

static void raiseIllegalAccessError()
Create and throw a java.lang.IllegalAccessError. Used to handle error cases in invokeinterface dispatching.


init

public static void init()

buildMultiDimensionalArray

public static Object buildMultiDimensionalArray(int methodId,
                                                int[] numElements,
                                                RVMArray arrayType)
Build a multi-dimensional array.

Parameters:
methodId - TODO document me
numElements - number of elements to allocate for each dimension
arrayType - type of array that will result
Returns:
array object

buildTwoDimensionalArray

public static Object buildTwoDimensionalArray(int methodId,
                                              int dim0,
                                              int dim1,
                                              RVMArray arrayType)
Build a two-dimensional array.

Parameters:
methodId - TODO document me
dim0 - the arraylength for arrays in dimension 0
dim1 - the arraylength for arrays in dimension 1
arrayType - type of array that will result
Returns:
array object

buildMDAHelper

public static Object buildMDAHelper(RVMMethod method,
                                    int[] numElements,
                                    int dimIndex,
                                    RVMArray arrayType)
Parameters:
method - Apparently unused (!)
numElements - Number of elements to allocate for each dimension
dimIndex - Current dimension to build
arrayType - type of array that will result

deliverException

private static void deliverException(Throwable exceptionObject,
                                     ArchitectureSpecific.Registers exceptionRegisters)
Deliver an exception to current java thread. Precondition: VM.disableGC has already been called.
  1. exceptionRegisters may not match any reasonable stack frame at this point.
  2. we're going to be playing with raw addresses (fp, ip).

Does not return:

Parameters:
exceptionObject - exception object to deliver
exceptionRegisters - register state corresponding to exception site

handleUncaughtException

private static void handleUncaughtException(Throwable exceptionObject)

unwindNativeStackFrame

public static Address unwindNativeStackFrame(Address currfp)
Skip over all frames below currfp with saved code pointers outside of heap (C frames), stopping at the native frame immediately preceding the glue frame which contains the method ID of the native method (this is necessary to allow retrieving the return address of the glue frame).

Parameters:
currfp - The current frame is expected to be one of the JNI functions called from C, below which is one or more native stack frames

unwindNativeStackFrameForGC

public static Address unwindNativeStackFrameForGC(Address currfp)
The current frame is expected to be one of the JNI functions called from C, below which is one or more native stack frames. Skip over all frames below which do not contain any object references.


unwindInvisibleStackFrame

private static void unwindInvisibleStackFrame(ArchitectureSpecific.Registers registers)
Unwind stack frame for an . See also: ExceptionDeliverer.unwindStackFrame()

!!TODO: Could be a reflective method invoker frame. Does it clobber any non-volatiles? If so, how do we restore them? (I don't think our current implementations of reflective method invokers save/restore any nonvolatiles, so we're probably ok. --dave 6/29/01


checkJNICountDownToGC

public static void checkJNICountDownToGC()
Check to see if we are stress testing garbage collector and if another JNI call should trigger a gc then do so.


checkAllocationCountDownToGC

private static void checkAllocationCountDownToGC()
Check to see if we are stress testing garbage collector and if another allocation should trigger a GC then do so.


canForceGC

private static boolean canForceGC()
Return true if we are stress testing garbage collector and the system is in state where we can force a garbage collection.