summaryrefslogtreecommitdiff
path: root/libguile/root.c
diff options
context:
space:
mode:
authorGary Houston <ghouston@arglist.com>2000-11-25 16:58:25 +0000
committerGary Houston <ghouston@arglist.com>2000-11-25 16:58:25 +0000
commit5f144b105db0dcbe3b33947317d3e9b98cbd5269 (patch)
treeb2491ba314e94a35b79871c086523d79192f5e91 /libguile/root.c
parent7f555fb4ed423ad783c961bed500c19d3159886a (diff)
downloadguile-5f144b105db0dcbe3b33947317d3e9b98cbd5269.tar.gz
* use an applicable SMOB to represent continuations, instead of a
custom tc7 type. This will make it easier to support R5RS multiple value continuations, without the use of a Scheme-level wrapper. * continuations.c (scm_tc16_continuation, continuation_mark, continuation_free, continuation_print, continuation_apply): new SMOB support. (scm_make_continuation): new procedure, replaces scm_make_cont with a different interface. (copy_stack_and_call, scm_dynthrow, scm_init_continuations): rewritten. (CHEAP_CONTINUATIONS): removed non-working code completely. (scm_call_continuation): removed. * continuations.h (struct scm_contregs): add num_stack_items and stack fields. previously stack was stored following this struct: use a tail array instead. (SCM_CONTINUATIONP): new macro. (SCM_CONTINUATION_LENGTH, SCM_SET_CONTINUATION_LENGTH): rewritten. (SCM_SET_CONTREGS): removed. * tags.h: removed scm_tc7_contin (was tag 61). * debug.c, gc.c, hash.c, print.c, procprop.c, procs.c: removed scm_tc7_contin support. * eval.c: use scm_make_continuation instead of scm_make_cont. don't set jump buffers here. remove scm_tc7_contin support. * init.c, root.c: create SMOB continuation for rootcont instead of scm_tc7_contin. call scm_init_continuations before scm_init_root. * root.c: remove support for static jmpbuf. It's not used by default and I broke it. create SMOB continuation for rootcont. * stacks.c: use SCM_CONTINUATIONP.
Diffstat (limited to 'libguile/root.c')
-rw-r--r--libguile/root.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/libguile/root.c b/libguile/root.c
index 86eee6452..c0c8ebfa6 100644
--- a/libguile/root.c
+++ b/libguile/root.c
@@ -58,12 +58,6 @@
#include "libguile/root.h"
-/* Define this if you want to try out the stack allocation of cwdr's
- jumpbuf. It works for me but I'm still worried that the dynwinds
- might be able to make a mess. */
-
-#undef USE_STACKJMPBUF
-
SCM scm_sys_protects[SCM_NUM_PROTECTS];
long scm_tc16_root;
@@ -248,9 +242,6 @@ scm_internal_cwdr (scm_catch_body_t body, void *body_data,
scm_catch_handler_t handler, void *handler_data,
SCM_STACKITEM *stack_start)
{
-#ifdef USE_STACKJMPBUF
- scm_contregs static_contregs;
-#endif
int old_ints_disabled = scm_ints_disabled;
SCM old_rootcont, old_winds;
struct cwdr_handler_data my_handler_data;
@@ -259,22 +250,22 @@ scm_internal_cwdr (scm_catch_body_t body, void *body_data,
/* Create a fresh root continuation. */
{
SCM new_rootcont;
- SCM_NEWCELL (new_rootcont);
+
SCM_REDEFER_INTS;
-#ifdef USE_STACKJMPBUF
- SCM_SET_CONTREGS (new_rootcont, &static_contregs);
-#else
- SCM_SET_CONTREGS (new_rootcont,
- scm_must_malloc (sizeof (scm_contregs),
- "inferior root continuation"));
-#endif
- SCM_SET_CELL_TYPE (new_rootcont, scm_tc7_contin);
- SCM_DYNENV (new_rootcont) = SCM_EOL;
- SCM_BASE (new_rootcont) = stack_start;
- SCM_SEQ (new_rootcont) = ++n_dynamic_roots;
+ {
+ scm_contregs *contregs = scm_must_malloc (sizeof (scm_contregs),
+ "inferior root continuation");
+
+ contregs->num_stack_items = 0;
+ contregs->dynenv = SCM_EOL;
+ contregs->base = stack_start;
+ contregs->seq = ++n_dynamic_roots;
+ contregs->throw_value = SCM_BOOL_F;
#ifdef DEBUG_EXTENSIONS
- SCM_DFRAME (new_rootcont) = 0;
+ contregs->dframe = 0;
#endif
+ SCM_NEWSMOB (new_rootcont, scm_tc16_continuation, contregs);
+ }
old_rootcont = scm_rootcont;
scm_rootcont = new_rootcont;
SCM_REALLOW_INTS;
@@ -298,9 +289,6 @@ scm_internal_cwdr (scm_catch_body_t body, void *body_data,
scm_dowinds (old_winds, - scm_ilength (old_winds));
SCM_REDEFER_INTS;
-#ifdef USE_STACKCJMPBUF
- SCM_SET_CONTREGS (scm_rootcont, NULL);
-#endif
#ifdef DEBUG_EXTENSIONS
scm_last_debug_frame = SCM_DFRAME (old_rootcont);
#endif