diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-04-10 00:36:05 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-04-10 00:36:05 -0700 |
commit | 079e081ab3f1a1bef175d8185c80108d16452c74 (patch) | |
tree | afb0e2628bfb7f3871e163f299568232cf909752 /vm.c | |
parent | 3376e74aef0bd84a8dd3ef7c0c08a6a2d298dd7d (diff) | |
download | txr-079e081ab3f1a1bef175d8185c80108d16452c74.tar.gz txr-079e081ab3f1a1bef175d8185c80108d16452c74.tar.bz2 txr-079e081ab3f1a1bef175d8185c80108d16452c74.zip |
exceptions: allow description field in catch frames.
* eval.c (op_catch): Extra argument in sys:catch syntax
specifies an expression that evaluates to a description
field.
(expand_catch): Expand the desc expression in sys:catch
syntax.
* parser.c (read_file_common): Increase acceptance of compiled
files from versions 1-4 to 1-5, since we are now marking
compiled files with version 5.0 rather than 4.0.
* share/txr/stdlib/asm.tl (op-catch catch): Support new
argument in the opcode syntax. Turns out we have a spare field
in the instruction format which was previously set to zero
We can use that for the description. Thus, the instruction
set and VM remain backward compatible: old code works.
* share/txr/stdlib/compiler.tl (compiler comp-catch): Handle
the desc argument introduced into the sys:catch form.
We must compile it as an expression, then inject the code into
the instruction template, and reference the output register of
that code block in the catch instruction.
(%tlo-ver%): Bump up the compiled file version to 5.0.
* share/txr/stdlib/except.tl (usr:catch, catch*): Add desc
argument to generated sys:catch form, specifying it as nil.
* unwind.c (desc_s): New symbol variable.
(uw_find_frames_impl): Set the desc member of the extracted
catch structure from the corresponding field in the catch
frame.
(uw_late_init): Initialize desc_s with interned symbol.
Add desc slot to catch-frame type.
* unwind.h (struct uw_catch): New member, desc.
(uw_catch_begin_w_desc): New macro.
* vm.c (vm_catch): Extract the desc field from the catch
instruction, and use uw_catch_begin_w_desc to propagate that
to the catch frame.
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -859,9 +859,10 @@ NOINLINE static void vm_catch(struct vm *vm, vm_word_t insn) unsigned sym_reg = vm_arg_operand_hi(arg1); unsigned args_reg = vm_arg_operand_lo(arg1); val catch_syms = vm_get(vm->dspl, vm_arg_operand_lo(arg2)); + val desc = vm_get(vm->dspl, vm_arg_operand_hi(arg2)); int saved_lev = vm->lev; - uw_catch_begin (catch_syms, exsym, exvals); + uw_catch_begin_w_desc (catch_syms, exsym, exvals, desc); vm_execute(vm); |