#undef FUNC_NAME
SCM
-scm_c_make_prompt (SCM vm, SCM k, SCM handler, SCM pre_unwind,
- scm_t_uint8 inline_p, scm_t_uint8 escape_only_p)
+scm_c_make_prompt (SCM vm, SCM k, SCM handler, scm_t_uint8 inline_handler_p,
+ scm_t_uint8 escape_only_p)
{
scm_t_bits tag;
SCM ret;
struct scm_prompt_registers *regs;
tag = scm_tc7_prompt;
- if (inline_p)
+ if (inline_handler_p)
tag |= SCM_F_PROMPT_INLINE;
if (escape_only_p)
tag |= SCM_F_PROMPT_ESCAPE;
- ret = scm_words (tag, 6);
+ ret = scm_words (tag, 5);
regs = scm_gc_malloc_pointerless (sizeof (*regs), "prompt registers");
regs->fp = SCM_VM_DATA (vm)->fp;
SCM_SET_CELL_WORD (ret, 2, (scm_t_bits)regs);
SCM_SET_CELL_OBJECT (ret, 3, scm_i_dynwinds ());
SCM_SET_CELL_OBJECT (ret, 4, handler);
- SCM_SET_CELL_OBJECT (ret, 5, pre_unwind);
return ret;
}
#define SCM_PROMPT_REGISTERS(x) ((struct scm_prompt_registers*)SCM_CELL_WORD ((x), 2))
#define SCM_PROMPT_DYNENV(x) (SCM_CELL_OBJECT ((x), 3))
#define SCM_PROMPT_HANDLER(x) (SCM_CELL_OBJECT ((x), 4))
-#define SCM_PROMPT_PRE_UNWIND_HANDLER(x) (SCM_CELL_OBJECT ((x), 5))
#define SCM_PROMPT_SETJMP(p) (SCM_I_SETJMP (SCM_PROMPT_REGISTERS (p)->regs))
};
-SCM_INTERNAL SCM scm_c_make_prompt (SCM vm, SCM k, SCM handler, SCM pre_unwind,
- scm_t_uint8 inline_p, scm_t_uint8 escape_only_p);
+SCM_INTERNAL SCM scm_c_make_prompt (SCM vm, SCM k, SCM handler,
+ scm_t_uint8 inline_handler_p,
+ scm_t_uint8 escape_only_p);
SCM_INTERNAL void scm_register_control (void);
NEXT;
}
-VM_DEFINE_INSTRUCTION (83, prompt, "prompt", 5, 3, 0)
+VM_DEFINE_INSTRUCTION (83, prompt, "prompt", 5, 2, 0)
{
scm_t_int32 offset;
scm_t_uint8 inline_handler_p, escape_only_p;
- SCM k, handler, pre_unwind, prompt;
+ SCM k, handler, prompt;
inline_handler_p = FETCH ();
escape_only_p = FETCH ();
FETCH_OFFSET (offset);
- POP (pre_unwind);
POP (handler);
POP (k);
/* Push the prompt onto the dynamic stack. The setjmp itself has to be local
to this procedure. */
/* FIXME: do more error checking */
- prompt = scm_c_make_prompt (vm, k, handler, pre_unwind,
- inline_handler_p, escape_only_p);
+ prompt = scm_c_make_prompt (vm, k, handler, inline_handler_p, escape_only_p);
scm_i_set_dynwinds (scm_cons (prompt, scm_i_dynwinds ()));
if (SCM_PROMPT_SETJMP (prompt))
{
<let-values> let-values? make-let-values let-values-src let-values-exp let-values-body
<dynwind> dynwind? make-dynwind dynwind-src dynwind-winder dynwind-body dynwind-unwinder
<dynlet> dynlet? make-dynlet dynlet-src dynlet-fluids dynlet-vals dynlet-body
- <prompt> prompt? make-prompt prompt-src prompt-tag prompt-body prompt-handler prompt-pre-unwind-handler
+ <prompt> prompt? make-prompt prompt-src prompt-tag prompt-body prompt-handler
<control> control? make-control control-src control-tag control-type control-args
parse-tree-il
(<let-values> exp body)
(<dynwind> winder body unwinder)
(<dynlet> fluids vals body)
- (<prompt> tag body handler pre-unwind-handler)
+ (<prompt> tag body handler)
(<control> tag type args))
\f
((dynlet ,fluids ,vals ,body)
(make-dynlet loc (map retrans fluids) (map retrans vals) (retrans body)))
- ((prompt ,tag ,body ,handler ,pre-unwind-handler)
- (make-prompt loc (retrans tag) (retrans body) (retrans handler)
- (and=> pre-unwind-handler retrans)))
+ ((prompt ,tag ,body ,handler)
+ (make-prompt loc (retrans tag) (retrans body) (retrans handler)))
((control ,tag ,type ,args)
(make-control loc (retrans tag) type (map retrans args)))
`(dynlet ,(map unparse-tree-il fluids) ,(map unparse-tree-il vals)
,(unparse-tree-il body)))
- ((<prompt> tag body handler pre-unwind-handler)
- `(prompt ,tag ,(unparse-tree-il body) ,(unparse-tree-il handler)
- ,(and=> pre-unwind-handler unparse-tree-il)))
+ ((<prompt> tag body handler)
+ `(prompt ,tag ,(unparse-tree-il body) ,(unparse-tree-il handler)))
((<control> tag type args)
`(control ,(unparse-tree-il tag) ,type ,(map unparse-tree-il args)))))
(map tree-il->scheme vals))
,(tree-il->scheme body)))
- ((<prompt> tag body handler pre-unwind-handler)
+ ((<prompt> tag body handler)
`((@ (ice-9 control) prompt)
,(tree-il->scheme tag) (lambda () ,(tree-il->scheme body))
- ,(tree-il->scheme handler) ,(and=> pre-unwind-handler tree-il->scheme)))
+ ,(tree-il->scheme handler)))
((<control> tag type args)
(up tree (loop body
(loop vals
(loop fluids (down tree result))))))
- ((<prompt> tag body handler pre-unwind-handler)
- (up tree (loop tag
- (loop body
- (loop handler
- (if pre-unwind-handler
- (loop pre-unwind-handler
- (down tree result))
- (down tree result)))))))
+ ((<prompt> tag body handler)
+ (up tree
+ (loop tag (loop body (loop handler
+ (down tree result))))))
((<control> tag type args)
(up tree (loop tag (loop args (down tree result)))))
(else
(let*-values (((seed ...) (fold-values foldts fluids seed ...))
((seed ...) (fold-values foldts vals seed ...)))
(foldts body seed ...)))
- ((<prompt> tag body handler pre-unwind-handler)
+ ((<prompt> tag body handler)
(let*-values (((seed ...) (foldts tag seed ...))
- ((seed ...) (foldts body seed ...))
- ((seed ...) (foldts handler seed ...)))
- (if pre-unwind-handler
- (values seed ...)
- (foldts pre-unwind-handler seed ...))))
+ ((seed ...) (foldts body seed ...)))
+ (foldts handler seed ...)))
((<control> tag args)
(let*-values (((seed ...) (foldts tag seed ...)))
(fold-values foldts args seed ...)))
(set! (dynlet-vals x) (map lp vals))
(set! (dynlet-body x) (lp body)))
- ((<prompt> tag body handler pre-unwind-handler)
+ ((<prompt> tag body handler)
(set! (prompt-tag x) (lp tag))
(set! (prompt-body x) (lp body))
- (set! (prompt-handler x) (lp handler))
- (if pre-unwind-handler
- (set! (prompt-pre-unwind-handler x) (lp pre-unwind-handler))))
+ (set! (prompt-handler x) (lp handler)))
((<control> tag args)
(set! (control-tag x) (lp tag))
(set! (dynlet-vals x) (map lp vals))
(set! (dynlet-body x) (lp body)))
- ((<prompt> tag body handler pre-unwind-handler)
+ ((<prompt> tag body handler)
(set! (prompt-tag x) (lp tag))
(set! (prompt-body x) (lp body))
- (set! (prompt-handler x) (lp handler))
- (if pre-unwind-handler
- (set! (prompt-pre-unwind-handler x) (lp pre-unwind-handler))))
+ (set! (prompt-handler x) (lp handler)))
((<control> tag args)
(set! (control-tag x) (lp tag))
((<dynlet> fluids vals body)
(apply lset-union eq? (step body) (map step (append fluids vals))))
- ((<prompt> tag body handler pre-unwind-handler)
- (lset-union eq? (step tag) (step handler)
- (if pre-unwind-handler (step pre-unwind-handler) '())))
+ ((<prompt> tag body handler)
+ (lset-union eq? (step tag) (step handler)))
((<control> tag type args)
(apply lset-union eq? (step tag) (map step args)))
((<dynlet> fluids vals body)
(apply max (recur body) (map recur (append fluids vals))))
- ((<prompt> tag body handler pre-unwind-handler)
+ ((<prompt> tag body handler)
(let ((cont-var (and (lambda-case? handler)
(pair? (lambda-case-vars handler))
(car (lambda-case-vars handler)))))
(hashq-set! allocation x
(and cont-var (zero? (hashq-ref refcounts cont-var 0))))
- (max (recur tag) (recur body) (recur handler)
- (if pre-unwind-handler (recur pre-unwind-handler) 0))))
+ (max (recur tag) (recur body) (recur handler))))
((<control> tag type args)
(apply max (recur tag) (map recur args)))
;; if the continuation isn't referenced, we don't reify it. This makes it
;; possible to implement catch and throw with delimited continuations,
;; without any overhead.
- ((<prompt> src tag body handler pre-unwind-handler)
+ ((<prompt> src tag body handler)
(let ((H (make-label))
(POST (make-label))
(inline? (lambda-case? handler))
(if inline?
(emit-code #f (make-glil-const #f)) ;; push #f as handler
(comp-push handler))
- (if pre-unwind-handler
- (comp-push pre-unwind-handler)
- (emit-code #f (make-glil-const #f)))
(emit-code src (make-glil-prompt H inline? escape-only?))
;; Then we compile the body, with its normal return path, unwinding
((<fix> vars body)
(if (null? vars) body x))
- ((<prompt> src tag body handler pre-unwind-handler)
+ ((<prompt> src tag body handler)
;; If the handler is a simple lambda, inline it.
(if (and (lambda? handler)
(record-case (lambda-body handler)
((<lambda-case> req opt kw rest alternate)
(and (pair? req) (not opt) (not kw) (not alternate)))
(else #f)))
- (make-prompt src tag body (lambda-body handler) pre-unwind-handler)
+ (make-prompt src tag body (lambda-body handler))
x))
(else #f)))
((src tag thunk handler)
(make-prompt src tag (make-application #f thunk '())
handler #f))
- ((src tag thunk handler pre)
- (make-prompt src tag (make-application #f thunk '())
- handler pre))
(else #f)))
(hashq-set! *primitive-expand-table*
'@prompt
(case-lambda
- ((src tag thunk handler pre)
+ ((src tag thunk handler)
(make-prompt src tag (make-application #f thunk '())
- handler pre))
+ handler))
(else #f)))
(hashq-set! *primitive-expand-table*