From 2d026f04cc581915f62b1f2f3be2f27026ee383e Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Mon, 22 Feb 2010 21:53:24 +0100 Subject: abort always dispatches to VM bytecode, to detect same-invocation aborts * libguile/control.h: * libguile/control.c (scm_c_make_prompt): Take an extra arg, a cookie. Continuations will be rewindable only if the abort has the same cookie as the prompt. (scm_at_abort): Redefine from scm_abort, and instead of taking rest args, take the abort values as a list directly. Also, don't allow rewinding, because we won't support rewinding the C stack with delimited continuations. * libguile/eval.c (eval): Adapt to scm_c_make_prompt change. * libguile/vm-engine.c (vm_engine): Use vp->cookie to get a unique value corresponding to this VM invocation. * libguile/vm-i-system.c (prompt): Pass the cookie to scm_c_make_prompt. (abort): Take an additional tail arg. * libguile/vm.c (vm_abort): Parse out the abort tail arg. This is for the @abort case, or the (apply abort ...) case. (make_vm): Initialize the cookie to 0. * libguile/vm.h (struct scm_vm): Add cookie. * module/ice-9/boot-9.scm (abort): Define here as a trampoline to @abort. Needed to make sure that a call to abort dispatches to a VM opcode, so the cookie will be the same. * module/language/tree-il.scm (): Add a "tail" field to , for the (apply abort ...) case, or (@abort tag args). Should be # in the normal case. Add support throughout. * module/language/tree-il/analyze.scm (analyze-lexicals): Add abort-tail support here too. * module/language/tree-il/compile-glil.scm (flatten): Compile the tail argument appropriately. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Fix @abort and abort cases to pass the tail arg to make-abort. --- libguile/vm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'libguile/vm.h') diff --git a/libguile/vm.h b/libguile/vm.h index 17445ea51..6d76f12e8 100644 --- a/libguile/vm.h +++ b/libguile/vm.h @@ -51,6 +51,7 @@ struct scm_vm { SCM hooks[SCM_VM_NUM_HOOKS]; /* hooks */ SCM options; /* options */ int trace_level; /* traces enabled if trace_level > 0 */ + scm_t_int64 cookie; /* used to detect unrewindable continuations */ }; SCM_API SCM scm_the_vm_fluid; -- cgit v1.2.3