diff options
author | Andy Wingo <wingo@pobox.com> | 2013-05-23 15:07:37 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2013-05-27 07:13:13 +0200 |
commit | c850a0ff4d0073364612ff5785bda8217ea9ae7f (patch) | |
tree | 82d3ce7de2f7eee2f0940eb72b502d2038ab1569 /doc/ref/api-debug.texi | |
parent | 27319ffaa90dc5789843d8b80842b9a6d36120e1 (diff) | |
download | guile-c850a0ff4d0073364612ff5785bda8217ea9ae7f.tar.gz |
pop-continuation abort-continuation hooks pass return vals directly
* doc/ref/api-debug.texi (VM Hooks): Update documentation.
* libguile/vm.c (vm_dispatch_hook):
* libguile/vm-engine.c: Rework the hook machinery so that they can
receive an arbitrary number of arguments. The return and abort
hooks will pass the values that they return to their continuations.
(vm_engine): Adapt to ABORT_CONTINUATION_HOOK change.
* libguile/vm-i-system.c (return, return/values): Adapt to
POP_CONTINUATION_HOOK change.
* module/system/vm/frame.scm (frame-return-values): Remove. The
pop-continuation-hook will pass the values directly.
* module/system/vm/trace.scm (print-return):
(trace-calls-to-procedure):
(trace-calls-in-procedure): Update to receive return values
directly.
* module/system/vm/traps.scm (trap-in-procedure)
(trap-in-dynamic-extent): Ignore return values.
(trap-frame-finish, trap-calls-in-dynamic-extent)
(trap-calls-to-procedure): Pass return values to the handlers.
Diffstat (limited to 'doc/ref/api-debug.texi')
-rw-r--r-- | doc/ref/api-debug.texi | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/doc/ref/api-debug.texi b/doc/ref/api-debug.texi index f6c706c78..4e1b82295 100644 --- a/doc/ref/api-debug.texi +++ b/doc/ref/api-debug.texi @@ -799,10 +799,11 @@ To digress, Guile's VM has 6 different hooks (@pxref{Hooks}) that can be fired at different times, which may be accessed with the following procedures. -All hooks are called with one argument, the frame in -question. @xref{Frames}. Since these hooks may be fired very -frequently, Guile does a terrible thing: it allocates the frames on the -C stack instead of the garbage-collected heap. +The first argument of calls to these hooks is the frame in question. +@xref{Frames}. Some hooks may call their procedures with more +arguments. Since these hooks may be fired very frequently, Guile does a +terrible thing: it allocates the frames on the C stack instead of the +garbage-collected heap. The upshot here is that the frames are only valid within the dynamic extent of the call to the hook. If a hook procedure keeps a reference to @@ -832,11 +833,8 @@ corresponding apply-hook. @deffn {Scheme Procedure} vm-pop-continuation-hook vm The hook that will be fired before returning from a frame. -This hook is a bit trickier than the rest, in that there is a particular -interpretation of the values on the stack. Specifically, the top value -on the stack is the number of values being returned, and the next -@var{n} values are the actual values being returned, with the last value -highest on the stack. +This hook fires with a variable number of arguments, corresponding to +the values that the frame returns to its continuation. @end deffn @deffn {Scheme Procedure} vm-apply-hook vm @@ -852,8 +850,11 @@ hook. @deffn {Scheme Procedure} vm-abort-continuation-hook vm The hook that will be called after aborting to a -prompt. @xref{Prompts}. The stack will be in the same state as for -@code{vm-pop-continuation-hook}. +prompt. @xref{Prompts}. + +Like the pop-continuation hook, this hook fires with a variable number +of arguments, corresponding to the values that returned to the +continuation. @end deffn @deffn {Scheme Procedure} vm-restore-continuation-hook vm |