1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 09:10:22 +02:00

$prompt is now its own kind of CPS term.

* module/language/cps.scm ($prompt): Rework to be its own term kind.
  Now $continue always continues to a single continuation.  Adapt
  callers.
This commit is contained in:
Andy Wingo 2018-01-03 17:17:23 +01:00
parent 29fee39c2a
commit ee15ca1455
22 changed files with 198 additions and 195 deletions

View file

@ -60,12 +60,9 @@ predecessor."
(($ $kfun src meta self ktail kclause) (ref2 ktail kclause))
(($ $ktail) (ref0))
(($ $kclause arity kbody kalt) (ref2 kbody kalt))
(($ $kargs names syms ($ $branch kf kt))
(ref2 kf kt))
(($ $kargs names syms ($ $continue k src exp))
(match exp
(($ $prompt escape-only? tag handler) (ref2 k handler))
(_ (ref1 k))))))
(($ $kargs names syms ($ $continue k)) (ref1 k))
(($ $kargs names syms ($ $branch kf kt)) (ref2 kf kt))
(($ $kargs names syms ($ $prompt k kh)) (ref2 k kh))))
(let*-values (((single multiple) (values empty-intset empty-intset))
((single multiple) (intmap-fold add-ref conts single multiple)))
(intset-subtract (persistent-intset single)
@ -192,11 +189,11 @@ $call, and are always called with a compatible arity."
(($ $callk k proc args)
(exclude-vars functions (cons proc args)))
(($ $primcall name param args)
(exclude-vars functions args))
(($ $prompt escape? tag handler)
(exclude-var functions tag))))
(exclude-vars functions args))))
(($ $kargs _ _ ($ $branch kf kt src op param args))
(exclude-vars functions args))
(($ $kargs _ _ ($ $prompt k kh src escape? tag))
(exclude-var functions tag))
(_ functions)))
(intmap-fold visit-cont conts functions)))
@ -459,7 +456,7 @@ function set."
(match term
(($ $continue k src exp)
(visit-exp cps k src exp))
(($ $branch)
((or ($ $branch) ($ $prompt))
(with-cps cps term))))
;; Renumbering is not strictly necessary but some passes may not be