mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-28 22:10:29 +02:00
<prompt> body and handler are lambdas; add escape-only? field
* module/language/tree-il.scm (<prompt>): Change to have the body and handler be lambdas, and add an "escape-only?" field. This will make generic prompts work better in CPS or ANF with the RTL VM, as it doesn't make sense in that context to capture only part of a frame. Escape-only prompts can still be fully inlined. (parse-tree-il, unparse-tree-il): Add escape-only? to the serialization. (make-tree-il-folder, pre-post-order): Deal with escape-only?. * module/language/tree-il/analyze.scm (analyze-lexicals): Handle escape-only?, and the new expectations for the body and handler. * module/language/tree-il/canonicalize.scm (canonicalize): Ensure that the body of an escape-only continuation is a thunk, and that the handler is always a lambda. * module/language/tree-il/debug.scm (verify-tree-il): Assert that escape-only? is a boolean. * module/language/tree-il/cse.scm (cse): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/peval.scm (peval): * module/language/tree-il/primitives.scm (*primitive-expand-table*): * test-suite/tests/peval.test ("partial evaluation"): * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Adapt to <prompt> change.
This commit is contained in:
parent
98eaef1b50
commit
178a40928a
11 changed files with 166 additions and 112 deletions
|
@ -1135,25 +1135,29 @@
|
|||
(call-with-prompt tag
|
||||
(lambda () 1)
|
||||
(lambda (k x) x))
|
||||
(prompt (toplevel tag)
|
||||
(const 1)
|
||||
(lambda-case
|
||||
(((k x) #f #f #f () (_ _))
|
||||
(lexical x _)))))
|
||||
(prompt #t
|
||||
(toplevel tag)
|
||||
(lambda _
|
||||
(lambda-case
|
||||
((() #f #f #f () ())
|
||||
(const 1))))
|
||||
(lambda _
|
||||
(lambda-case
|
||||
(((k x) #f #f #f () (_ _))
|
||||
(lexical x _))))))
|
||||
|
||||
;; Handler toplevel not inlined
|
||||
(pass-if-peval
|
||||
(call-with-prompt tag
|
||||
(lambda () 1)
|
||||
handler)
|
||||
(let (handler) (_) ((toplevel handler))
|
||||
(prompt (toplevel tag)
|
||||
(const 1)
|
||||
(lambda-case
|
||||
((() #f args #f () (_))
|
||||
(primcall apply
|
||||
(lexical handler _)
|
||||
(lexical args _)))))))
|
||||
(call-with-prompt tag
|
||||
(lambda () 1)
|
||||
handler)
|
||||
(prompt #f
|
||||
(toplevel tag)
|
||||
(lambda _
|
||||
(lambda-case
|
||||
((() #f #f #f () ())
|
||||
(const 1))))
|
||||
(toplevel handler)))
|
||||
|
||||
(pass-if-peval
|
||||
;; `while' without `break' or `continue' has no prompts and gets its
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue