diff options
author | Andy Wingo <wingo@pobox.com> | 2010-09-16 12:14:55 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-09-16 12:16:02 +0200 |
commit | c45d4d775d47bd80650e9888bf47815a03b04332 (patch) | |
tree | 69f38925f200a57d7ec3d3d487da7b5f51b50a12 /libguile/vm-i-system.c | |
parent | 7c42238610dbf5780d9aeb12ca799c83f9f6167e (diff) | |
download | guile-c45d4d775d47bd80650e9888bf47815a03b04332.tar.gz |
trim our set of vm hooks
* libguile/vm.h (SCM_VM_PUSH_CONTINUATION_HOOK)
(SCM_VM_POP_CONTINUATION_HOOK): New hooks, to replace
enter/exit/return.
(SCM_VM_BOOT_HOOK, SCM_VM_HALT_HOOK, SCM_VM_BREAK_HOOK): Remove these
useless hooks.
* libguile/vm.c (scm_vm_push_continuation_hook)
(scm_vm_pop_continuation_hook): New accessors.
* libguile/vm-i-system.c: Remove boot, halt, break, enter, exit, and
return hooks. Also remove the break instruction. Instead now when we
push a new continuation onto the stack we call PUSH_CONTINUATION_HOOK,
and when we pop via a return we call POP_CONTINUATION_HOOK. APPLY_HOOK
is now decoupled from continuation pushes and pops.
* libguile/vm-engine.h:
* libguile/vm-engine.c: Adapt for hooks.
* module/system/vm/trace.scm (vm-trace): Adapt for hooks. Also revive
the #:instructions? #t mode.
* module/system/vm/vm.scm: Adapt exports for new set of hooks.
Diffstat (limited to 'libguile/vm-i-system.c')
-rw-r--r-- | libguile/vm-i-system.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index 9ba287d5a..063270ffd 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -31,7 +31,6 @@ VM_DEFINE_INSTRUCTION (0, nop, "nop", 0, 0, 0) VM_DEFINE_INSTRUCTION (1, halt, "halt", 0, 0, 0) { - HALT_HOOK (); nvalues = SCM_I_INUM (*sp--); NULLSTACK (1); if (nvalues == 1) @@ -62,12 +61,6 @@ VM_DEFINE_INSTRUCTION (1, halt, "halt", 0, 0, 0) goto vm_done; } -VM_DEFINE_INSTRUCTION (2, break, "break", 0, 0, 0) -{ - BREAK_HOOK (); - NEXT; -} - VM_DEFINE_INSTRUCTION (3, drop, "drop", 0, 1, 0) { DROP (); @@ -779,7 +772,7 @@ VM_DEFINE_INSTRUCTION (54, call, "call", 1, -1, 1) SCM_FRAME_SET_RETURN_ADDRESS (fp, ip); SCM_FRAME_SET_MV_RETURN_ADDRESS (fp, 0); ip = SCM_C_OBJCODE_BASE (bp); - ENTER_HOOK (); + PUSH_CONTINUATION_HOOK (); APPLY_HOOK (); NEXT; } @@ -818,8 +811,6 @@ VM_DEFINE_INSTRUCTION (55, tail_call, "tail-call", 1, -1, 1) CHECK_STACK_LEAK (); #endif - EXIT_HOOK (); - /* switch programs */ CACHE_PROGRAM (); /* shuffle down the program and the arguments */ @@ -832,7 +823,6 @@ VM_DEFINE_INSTRUCTION (55, tail_call, "tail-call", 1, -1, 1) ip = SCM_C_OBJCODE_BASE (bp); - ENTER_HOOK (); APPLY_HOOK (); NEXT; } @@ -1083,7 +1073,7 @@ VM_DEFINE_INSTRUCTION (61, mv_call, "mv-call", 4, -1, 1) SCM_FRAME_SET_RETURN_ADDRESS (fp, ip); SCM_FRAME_SET_MV_RETURN_ADDRESS (fp, mvra); ip = SCM_C_OBJCODE_BASE (bp); - ENTER_HOOK (); + PUSH_CONTINUATION_HOOK (); APPLY_HOOK (); NEXT; } @@ -1198,8 +1188,7 @@ VM_DEFINE_INSTRUCTION (65, tail_call_cc, "tail-call/cc", 0, 1, 1) VM_DEFINE_INSTRUCTION (66, return, "return", 0, 1, 1) { vm_return: - EXIT_HOOK (); - RETURN_HOOK (1); + POP_CONTINUATION_HOOK (1); VM_HANDLE_INTERRUPTS; @@ -1238,8 +1227,7 @@ VM_DEFINE_INSTRUCTION (67, return_values, "return/values", 1, -1, -1) that perhaps it might be used without declaration. Fooey to that, I say. */ nvalues = FETCH (); vm_return_values: - EXIT_HOOK (); - RETURN_HOOK (nvalues); + POP_CONTINUATION_HOOK (nvalues); VM_HANDLE_INTERRUPTS; |