summaryrefslogtreecommitdiff
path: root/module/language/tree-il/peval.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2013-07-29 21:55:39 +0200
committerAndy Wingo <wingo@pobox.com>2013-08-11 16:45:31 +0200
commit99983d544a931c29065ecb749acd349efc5f36c5 (patch)
treea2c5855685ba71d16fc65dad3a5e5ebbc6de6737 /module/language/tree-il/peval.scm
parentc1bff879980c3a2f107e8d7b54d0a6d8a18eefe4 (diff)
downloadguile-99983d544a931c29065ecb749acd349efc5f36c5.tar.gz
Inline escape-only prompt bodies in the Tree-IL
* module/language/scheme/decompile-tree-il.scm (do-decompile): * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/canonicalize.scm (canonicalize): * module/language/tree-il/compile-glil.scm (flatten-lambda-case): * module/language/tree-il/cse.scm (cse): * module/language/tree-il/peval.scm (peval): * test-suite/tests/peval.test ("partial evaluation"): Partially revert 178a40928, so that escape-only prompts explicitly inline their bodies.
Diffstat (limited to 'module/language/tree-il/peval.scm')
-rw-r--r--module/language/tree-il/peval.scm13
1 files changed, 9 insertions, 4 deletions
diff --git a/module/language/tree-il/peval.scm b/module/language/tree-il/peval.scm
index 57832a698..3d350392e 100644
--- a/module/language/tree-il/peval.scm
+++ b/module/language/tree-il/peval.scm
@@ -1522,7 +1522,7 @@ top-level bindings from ENV and return the resulting expression."
(_ #f)))
(let ((tag (for-value tag))
- (body (for-value body)))
+ (body (if escape-only? (for-tail body) (for-value body))))
(cond
((find-definition tag 1)
(lambda (val op)
@@ -1532,7 +1532,7 @@ top-level bindings from ENV and return the resulting expression."
;; for this <prompt>, so we can elide the <prompt>
;; entirely.
(unrecord-operand-uses op 1)
- (for-tail (make-call src body '()))))
+ (for-tail (if escape-only? body (make-call src body '())))))
(else
(let ((handler (for-value handler)))
(define (escape-only-handler? handler)
@@ -1545,8 +1545,13 @@ top-level bindings from ENV and return the resulting expression."
(_ #f))
body)))
(else #f)))
- (make-prompt src (or escape-only? (escape-only-handler? handler))
- tag body (for-value handler)))))))
+ (if (and (not escape-only?) (escape-only-handler? handler))
+ ;; Prompt transitioning to escape-only; transition body
+ ;; to be an expression.
+ (for-tail
+ (make-prompt src #t tag (make-call #f body '()) handler))
+ (make-prompt src escape-only? tag body handler)))))))
+
(($ <abort> src tag args tail)
(make-abort src (for-value tag) (map for-value args)
(for-value tail))))))