1 Exception Handling
2 ==================
3
4 Active Exceptions
5 =================
6
7 When an exception is raised, an exception instance is defined as the active
8 exception. This active exception remains in force until either a new exception
9 is raised in any handling of the exception, or upon exit of a handler where
10 the active exception has been caught (thus resetting the active exception).
11
12 Instructions
13 ------------
14
15 StoreException records the current value reference using the exception
16 register.
17
18 LoadException obtains the current exception and puts it in the value register.
19
20 CheckException checks the current exception against a class referenced by the
21 current value.
22
23 ClearException resets the exception register.
24
25 Handlers
26 ========
27
28 An exception handler stack is defined such that when a try...except or
29 try...finally block is entered, a new handler is defined.
30
31 When an exception is raised, the program jumps to the most recently defined
32 handler. Inside the handler, the stack entry for the handler will be removed.
33
34 Depending on the nature of the handler and whether the exception is handled,
35 the program may jump to the next most recent handler, and so on.
36
37 If no handler is defined when an exception is raised or re-raised, the program
38 should terminate. This might be done by having a "handler #0" which explicitly
39 terminates the program.
40
41 Instructions
42 ------------
43
44 PushHandler(block) defines an active handler at the location indicated by the
45 given block.
46
47 PopHandler removes the active handler at or after the location indicated by
48 the previously given block.