Work / Virtual Machine / Instruction Set
2012-01-14 21:38:30
Exception Handling
SEXH (SET EXCEPTION HANDLER)
Usage:
1 2 3 | sexh symbol ; set value of frame exception handler pointer to address of symbol |
Operation:
- Stores the address of the specified local symbol in the exception handler pointer of the current frame. Control passes to the specified symbol if an exception is raised within the current stack frame.
THROW (THROW EXCEPTION)
Usage:
1 2 3 | throw n ; throw an exception with the value of local variable n |
Operation:
- Reads the value of the specified local variable.
- Raises an exception in the current context.
Note: If an exception handler is not specified for a given frame, the exception will travel up the stack until a frame is found that has specified an exception handler. The stack is then unwound to the frame containing the handler and control is passed to the specified symbol.