description: |
The top word of the operand stack, objectref, must be a reference
that points either to an instance of class java.lang.Throwable
or to
an instance of some subclass of java.lang.Throwabl e. To execute the
athrow instruction, the Java Virtual Machine pops objectref from the
operand stack. The virtual machine "throws" the exception by
searching through the current method's exception table for the most
recent catch clause that catches either the class of the throwable
object pointed to by objectref, or a subclass of the throwable
object's class. If the current method's exception table contains a
matching entry, the virtual machine extracts the address of the
handler to jump to from the matching exception table entry. The
virtual machine pops any words remaining on the operand stack,
pushes the objectref, sets the program counter to the handler
address, and continues execution there. If the current method's
exception table doesn't have a matching catch clause, the virtual
machine pops the current method's entire frame and rethrows the
exception in the previous method. This process repeats until either
a matching catch clause is found or the stack frames for all the
methods along the current thread's call stack have been popped. If
no catch clause is found by this process, the current thread exits.
If the objectref word is null, the virtual machine throws
NullPointerException .
|