abort still not doing the right thing...
This commit is contained in:
parent
d482c78ac4
commit
6f03e04ee8
|
@ -59,7 +59,8 @@
|
||||||
|
|
||||||
;; Begin a prompted evaluation:
|
;; Begin a prompted evaluation:
|
||||||
(make-PushControlFrame/Prompt default-continuation-prompt-tag
|
(make-PushControlFrame/Prompt default-continuation-prompt-tag
|
||||||
before-pop-prompt)
|
before-pop-prompt
|
||||||
|
#f)
|
||||||
(compile exp '() 'val return-linkage/nontail)
|
(compile exp '() 'val return-linkage/nontail)
|
||||||
before-pop-prompt-multiple
|
before-pop-prompt-multiple
|
||||||
(make-PopEnvironment (make-SubtractArg (make-Reg 'argcount) (make-Const 1))
|
(make-PopEnvironment (make-SubtractArg (make-Reg 'argcount) (make-Const 1))
|
||||||
|
@ -93,6 +94,7 @@
|
||||||
|
|
||||||
;; Begin a prompted evaluation:
|
;; Begin a prompted evaluation:
|
||||||
(make-PushControlFrame/Prompt default-continuation-prompt-tag
|
(make-PushControlFrame/Prompt default-continuation-prompt-tag
|
||||||
|
after-pop-prompt: ;; <--- FIXME: this argument isn't used right now!
|
||||||
after-pop-prompt:)
|
after-pop-prompt:)
|
||||||
(compile exp '() 'val next-linkage/keep-multiple-on-stack)
|
(compile exp '() 'val next-linkage/keep-multiple-on-stack)
|
||||||
|
|
||||||
|
@ -108,7 +110,11 @@
|
||||||
(make-Goto (make-Label last:))
|
(make-Goto (make-Label last:))
|
||||||
|
|
||||||
|
|
||||||
;; If we abort, the abort handler code also needs to return values back:
|
;; If we abort, the abort handler code should call the expected thunk
|
||||||
|
;; with a return going to this code:
|
||||||
|
;; FIXME
|
||||||
|
|
||||||
|
|
||||||
after-pop-prompt-multiple:
|
after-pop-prompt-multiple:
|
||||||
(make-DebugPrint (make-Const "abort multiple"))
|
(make-DebugPrint (make-Const "abort multiple"))
|
||||||
(make-TestAndJump (make-TestZero (make-Reg 'argcount)) abort-with-multiple-values:)
|
(make-TestAndJump (make-TestZero (make-Reg 'argcount)) abort-with-multiple-values:)
|
||||||
|
@ -127,6 +133,7 @@
|
||||||
(make-Perform (make-UnspliceRestFromStack! (make-Const 0) (make-Const 1)))
|
(make-Perform (make-UnspliceRestFromStack! (make-Const 0) (make-Const 1)))
|
||||||
(make-AssignImmediate 'val (make-EnvLexicalReference 0 #f))
|
(make-AssignImmediate 'val (make-EnvLexicalReference 0 #f))
|
||||||
(make-PopEnvironment (make-Const 1) (make-Const 0))
|
(make-PopEnvironment (make-Const 1) (make-Const 0))
|
||||||
|
(make-Goto (make-Label last:))
|
||||||
|
|
||||||
last:
|
last:
|
||||||
;; Finally, return to the success continuation on the stack.
|
;; Finally, return to the success continuation on the stack.
|
||||||
|
@ -593,7 +600,8 @@
|
||||||
cenv
|
cenv
|
||||||
(append-instruction-sequences
|
(append-instruction-sequences
|
||||||
(make-PushControlFrame/Prompt default-continuation-prompt-tag
|
(make-PushControlFrame/Prompt default-continuation-prompt-tag
|
||||||
on-return)
|
on-return
|
||||||
|
#f)
|
||||||
(compile (first seq) cenv 'val return-linkage/nontail)
|
(compile (first seq) cenv 'val return-linkage/nontail)
|
||||||
(emit-values-context-check-on-procedure-return (linkage-context linkage)
|
(emit-values-context-check-on-procedure-return (linkage-context linkage)
|
||||||
on-return/multiple
|
on-return/multiple
|
||||||
|
@ -604,7 +612,8 @@
|
||||||
(new-linked-labels 'beforePromptPop))
|
(new-linked-labels 'beforePromptPop))
|
||||||
(append-instruction-sequences
|
(append-instruction-sequences
|
||||||
(make-PushControlFrame/Prompt (make-DefaultContinuationPromptTag)
|
(make-PushControlFrame/Prompt (make-DefaultContinuationPromptTag)
|
||||||
on-return)
|
on-return
|
||||||
|
#f)
|
||||||
|
|
||||||
(compile (first seq) cenv 'val return-linkage/nontail)
|
(compile (first seq) cenv 'val return-linkage/nontail)
|
||||||
on-return/multiple
|
on-return/multiple
|
||||||
|
|
|
@ -267,7 +267,8 @@
|
||||||
|
|
||||||
(define-struct: PushControlFrame/Prompt ([tag : (U OpArg DefaultContinuationPromptTag)]
|
(define-struct: PushControlFrame/Prompt ([tag : (U OpArg DefaultContinuationPromptTag)]
|
||||||
[label : LinkedLabel]
|
[label : LinkedLabel]
|
||||||
;; TODO: add handler and arguments
|
[handler : (U LinkedLabel #f)]
|
||||||
|
;; TODO: add arguments to the handler?
|
||||||
)
|
)
|
||||||
#:transparent)
|
#:transparent)
|
||||||
|
|
||||||
|
@ -620,4 +621,4 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(define-predicate OpArg? OpArg)
|
(define-predicate OpArg? OpArg)
|
||||||
|
|
|
@ -246,7 +246,12 @@
|
||||||
tag
|
tag
|
||||||
(rewrite-oparg tag)))
|
(rewrite-oparg tag)))
|
||||||
(make-LinkedLabel (LinkedLabel-label a-label)
|
(make-LinkedLabel (LinkedLabel-label a-label)
|
||||||
(ref (LinkedLabel-linked-to a-label))))
|
(ref (LinkedLabel-linked-to a-label)))
|
||||||
|
(let ([handler (PushControlFrame/Prompt-handler a-stmt)])
|
||||||
|
(if (eq? handler #f)
|
||||||
|
#f
|
||||||
|
(make-LinkedLabel (LinkedLabel-label handler)
|
||||||
|
(ref (LinkedLabel-linked-to handler))))))
|
||||||
(loop (rest stmts)))]
|
(loop (rest stmts)))]
|
||||||
|
|
||||||
[(PopControlFrame? a-stmt)
|
[(PopControlFrame? a-stmt)
|
||||||
|
|
|
@ -583,7 +583,7 @@ EOF
|
||||||
(assemble-label (make-Label (LinkedLabel-label label)))])))]
|
(assemble-label (make-Label (LinkedLabel-label label)))])))]
|
||||||
|
|
||||||
[(PushControlFrame/Prompt? stmt)
|
[(PushControlFrame/Prompt? stmt)
|
||||||
(format "M.c.push(new RT.PromptFrame(~a,~a,M.e.length,false));"
|
(format "M.c.push(new RT.PromptFrame(~a,~a,M.e.length,~a));"
|
||||||
(let: ([label : (U Symbol LinkedLabel) (PushControlFrame/Prompt-label stmt)])
|
(let: ([label : (U Symbol LinkedLabel) (PushControlFrame/Prompt-label stmt)])
|
||||||
(cond
|
(cond
|
||||||
[(symbol? label)
|
[(symbol? label)
|
||||||
|
@ -597,7 +597,13 @@ EOF
|
||||||
[(DefaultContinuationPromptTag? tag)
|
[(DefaultContinuationPromptTag? tag)
|
||||||
(assemble-default-continuation-prompt-tag)]
|
(assemble-default-continuation-prompt-tag)]
|
||||||
[(OpArg? tag)
|
[(OpArg? tag)
|
||||||
(assemble-oparg tag blockht)])))]
|
(assemble-oparg tag blockht)]))
|
||||||
|
(let: ([handler : (U LinkedLabel #f) (PushControlFrame/Prompt-handler stmt)])
|
||||||
|
(cond
|
||||||
|
[(eq? handler #f)
|
||||||
|
"false"]
|
||||||
|
[else
|
||||||
|
(assemble-label (make-Label (LinkedLabel-label handler)))])))]
|
||||||
|
|
||||||
[(PopControlFrame? stmt)
|
[(PopControlFrame? stmt)
|
||||||
"M.c.pop();"]
|
"M.c.pop();"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user