[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 08/08: $primcall always continues to $kargs
From: |
Andy Wingo |
Subject: |
[Guile-commits] 08/08: $primcall always continues to $kargs |
Date: |
Wed, 3 Jan 2018 15:31:24 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 118f516a8b24ddbfd425603312da351fa8197a5c
Author: Andy Wingo <address@hidden>
Date: Wed Jan 3 21:23:51 2018 +0100
$primcall always continues to $kargs
* module/language/cps/devirtualize-integers.scm (peel-trace): Update
comment.
* module/language/cps/contification.scm (apply-contification): Update to
never contify a return of $primcall to $kreceive.
* module/language/cps/verify.scm (check-arities): Require that primcalls
continue to $kargs.
---
module/language/cps/contification.scm | 11 +++--------
module/language/cps/devirtualize-integers.scm | 3 ++-
module/language/cps/verify.scm | 7 +------
3 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/module/language/cps/contification.scm
b/module/language/cps/contification.scm
index b24d2cb..5c96bb3 100644
--- a/module/language/cps/contification.scm
+++ b/module/language/cps/contification.scm
@@ -413,19 +413,14 @@ function set."
(let ((k* (lookup-return-cont k)))
(if (eq? k k*)
(with-cps cps (build-term ($continue k src ,exp)))
- ;; We are contifying this return. It must be a call, a
- ;; $primcall that can continue to $ktail (basically this is
- ;; only "throw" and friends), or a $values expression. k*
- ;; will be either a $ktail or a $kreceive continuation.
+ ;; We are contifying this return. It must be a call or a
+ ;; $values expression. k* will be either a $ktail or a
+ ;; $kreceive continuation.
(match (intmap-ref conts k*)
(($ $kreceive ($ $arity req () rest () #f) kargs)
(match exp
(($ $call)
(with-cps cps (build-term ($continue k* src ,exp))))
- ;; A primcall that can continue to $ktail can also
- ;; continue to $kreceive.
- (($ $primcall)
- (with-cps cps (build-term ($continue k* src ,exp))))
;; We need to punch through the $kreceive; otherwise we'd
;; have to rewrite as a call to the 'values primitive.
(($ $values vals)
diff --git a/module/language/cps/devirtualize-integers.scm
b/module/language/cps/devirtualize-integers.scm
index 731089e..7dd66f1 100644
--- a/module/language/cps/devirtualize-integers.scm
+++ b/module/language/cps/devirtualize-integers.scm
@@ -123,7 +123,8 @@ the trace should be referenced outside of it."
(match (intmap-ref cps label)
;; We know the initial label is a $kargs, and we won't follow the
;; graph to get to $kreceive etc, so we can stop with these two
- ;; continuation kinds.
+ ;; continuation kinds. (For our purposes, only $values can
+ ;; continue to $ktail.)
(($ $ktail) (fail))
(($ $kargs names vars term)
(let* ((vars-of-interest
diff --git a/module/language/cps/verify.scm b/module/language/cps/verify.scm
index fa3db51..e99afb8 100644
--- a/module/language/cps/verify.scm
+++ b/module/language/cps/verify.scm
@@ -282,12 +282,7 @@ definitions that are available at LABEL."
(assert-kreceive-or-ktail))
(($ $primcall name param args)
(match cont
- (($ $kargs) #t)
- ;; FIXME: Remove this case; instead use $prim and $call.
- (($ $kreceive) #t)
- (($ $ktail)
- (unless (memv name '(throw throw/value throw/value+data))
- (error "primitive should continue to $kargs, not $ktail"
name)))))))
+ (($ $kargs) #t)))))
(define (check-term term)
(match term
(($ $continue k src exp)
- [Guile-commits] branch master updated (108ade6 -> 118f516), Andy Wingo, 2018/01/03
- [Guile-commits] 05/08: Fix add-prompt-control-flow-edges for terms with no continuation, Andy Wingo, 2018/01/03
- [Guile-commits] 02/08: Fix sandbox, Andy Wingo, 2018/01/03
- [Guile-commits] 07/08: Simplify prompt slot allocation now that bailouts can't continue, Andy Wingo, 2018/01/03
- [Guile-commits] 03/08: Variable renaming in type-fold.scm, Andy Wingo, 2018/01/03
- [Guile-commits] 08/08: $primcall always continues to $kargs,
Andy Wingo <=
- [Guile-commits] 06/08: $throw is a new kind of CPS term, Andy Wingo, 2018/01/03
- [Guile-commits] 04/08: $prompt is now its own kind of CPS term., Andy Wingo, 2018/01/03
- [Guile-commits] 01/08: $branch is now a distinct CPS term type, Andy Wingo, 2018/01/03