diff options
author | Andy Wingo <wingo@pobox.com> | 2018-06-26 16:39:34 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2018-06-26 16:39:34 +0200 |
commit | 770360e06645528ede0595f7efb553e7e0ac3bfd (patch) | |
tree | 917ce04305775ba53eb1b3591850a2d4d2f4feb7 /libguile/control.c | |
parent | e7778c62aa35ae10743cb4680df0bb3440163e26 (diff) | |
download | guile-770360e06645528ede0595f7efb553e7e0ac3bfd.tar.gz |
Refactors to abort-to-prompt implementation
* libguile/control.c (scm_abort_to_prompt_star)
* libguile/throw.c (abort_to_prompt): Pass prompt tag and argv in one
array.
* libguile/vm.c (scm_i_vm_abort): Reimplement as a call into the VM's
abort_to_prompt builtin.
(vm_abort): New helper, a copy of scm_i_vm_abort. Will allow us to
avoid some arg shuffling when aborting from the VM.
* libguile/vm.h: Remove setjmp include and simplify scm_i_vm_abort
decl.
Diffstat (limited to 'libguile/control.c')
-rw-r--r-- | libguile/control.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libguile/control.c b/libguile/control.c index 38378aed2..3068f6a83 100644 --- a/libguile/control.c +++ b/libguile/control.c @@ -94,16 +94,18 @@ SCM_DEFINE (scm_abort_to_prompt_star, "abort-to-prompt*", 2, 0, 0, "values in the list, @var{args}.") #define FUNC_NAME s_scm_abort_to_prompt_star { - SCM *argv; + SCM *tag_and_argv; size_t i; long n; SCM_VALIDATE_LIST_COPYLEN (SCM_ARG2, args, n); - argv = alloca (sizeof (SCM)*n); - for (i = 0; i < n; i++, args = scm_cdr (args)) - argv[i] = scm_car (args); + n = n + 1; /* Add space for the tag. */ + tag_and_argv = alloca (sizeof (SCM)*(n+1)); + tag_and_argv[0] = tag; + for (i = 1; i < n; i++, args = scm_cdr (args)) + tag_and_argv[i] = scm_car (args); - scm_i_vm_abort (&SCM_I_CURRENT_THREAD->vm, tag, n, argv, NULL); + scm_i_vm_abort (tag_and_argv, n); /* Oh, what, you're still here? The abort must have been reinstated. Actually, that's quite impossible, given that we're already in C-land here, so... |