org.jikesrvm.runtime
Class ExceptionDeliverer

java.lang.Object
  extended by org.jikesrvm.runtime.ExceptionDeliverer
Direct Known Subclasses:
BaselineExceptionDeliverer, JNIExceptionDeliverer, OptExceptionDeliverer

public abstract class ExceptionDeliverer
extends Object

Interface for exception delivery called by RuntimeEntrypoints.deliverException() to pass control to a stackframe whose method has an appropriate "catch" block or to step over a stackframe that does not have an appropriate catch block.

The exception delivery implementation is specific to the compiler that generated the method's machine instructions.

Note that the "deliverException" and "unwindStackFrame" methods of this class will be called in an environment that does not permit garbage collection: see VM.disableGC(). We must do this because some of the parameters to these methods are raw machine addresses. They are not recognized by the garbage collector as Object references and so would not be correctly fixed up in the event of object motion during GC. As a consequence, implementors of these methods must not cause object allocations to take place (i.e. by calling "new" either directly or indirectly).


Constructor Summary
ExceptionDeliverer()
           
 
Method Summary
abstract  void deliverException(CompiledMethod compiledMethod, Address catchBlockInstructionAddress, Throwable exceptionObject, ArchitectureSpecific.Registers registers)
          Stackframe's method has a "catch" block for exception being thrown and control is to be passed to that catch block.
abstract  void unwindStackFrame(CompiledMethod compiledMethod, ArchitectureSpecific.Registers registers)
          Stackframe's method has no "catch" block for exception being thrown and stackframe is to be "unwound" as follows: 1. for a synchronized method, call ObjectModel.genericUnlock(), passing it the appropriate "lock" object for non-static methods, the lock is the method's first argument ("this") for static methods, the lock is the method's java.lang.Class 2. restore the non-volatile registers (including fp) that were saved in the method's prologue, by copying them from the method's stackframe save area into the provided "registers" object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionDeliverer

public ExceptionDeliverer()
Method Detail

deliverException

public abstract void deliverException(CompiledMethod compiledMethod,
                                      Address catchBlockInstructionAddress,
                                      Throwable exceptionObject,
                                      ArchitectureSpecific.Registers registers)
Stackframe's method has a "catch" block for exception being thrown and control is to be passed to that catch block.

Note: Implementers must issue the following two lines just before transferring control to the catch block:

           VM.enableGC();
           registers.inuse = false;
 

Note: this method does not return (execution resumes at catchBlockInstructionAddress)

Parameters:
compiledMethod - method whose catch block is to receive control
catchBlockInstructionAddress - instruction address at which to begin execution of catch block
exceptionObject - exception object to be passed as argument to catch block
registers - registers to be loaded before passing control to catch block

unwindStackFrame

public abstract void unwindStackFrame(CompiledMethod compiledMethod,
                                      ArchitectureSpecific.Registers registers)
Stackframe's method has no "catch" block for exception being thrown and stackframe is to be "unwound" as follows:

Parameters:
compiledMethod - method whose stackframe is to be unwound
registers - thread state to be updated by restoring non-volatiles and unwinding the stackframe