[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 15/16: Unknown primcalls convert as calls
From: |
Andy Wingo |
Subject: |
[Guile-commits] 15/16: Unknown primcalls convert as calls |
Date: |
Wed, 27 Dec 2017 10:02:49 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit bc5a599cadb23829f751c4d25ca4da11528ab934
Author: Andy Wingo <address@hidden>
Date: Wed Dec 27 11:04:26 2017 +0100
Unknown primcalls convert as calls
* module/language/cps/reify-primitives.scm (reify-primitives): Remove
case where $prim could continue to $kreceive; this isn't possible.
However when reifying an unknown primcall, always add a $kreceive, as
the continuation has to be $kargs.
* module/language/tree-il/compile-cps.scm (convert): Unknown primcalls
convert as calls. With this change, all primcalls should continue to
$kargs, with the exception of 'throw.
---
module/language/cps/reify-primitives.scm | 5 ++---
module/language/tree-il/compile-cps.scm | 9 +++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/module/language/cps/reify-primitives.scm
b/module/language/cps/reify-primitives.scm
index 52c7573..8765ee2 100644
--- a/module/language/cps/reify-primitives.scm
+++ b/module/language/cps/reify-primitives.scm
@@ -237,7 +237,6 @@
(setk label ($kfun src meta self tail clause))))
(($ $kargs names vars ($ $continue k src ($ $prim name)))
(with-cps cps
- (let$ k (uniquify-receive k))
(let$ body (resolve-prim name k src))
(setk label ($kargs names vars ,body))))
(($ $kargs names vars
@@ -380,9 +379,9 @@
(else
(with-cps cps
(letv proc)
- (let$ k (uniquify-receive k))
+ (letk krecv ($kreceive '(res) #f k))
(letk kproc ($kargs ('proc) (proc)
- ($continue k src ($call proc args))))
+ ($continue krecv src ($call proc args))))
(let$ body (resolve-prim name kproc src))
(setk label ($kargs names vars ,body))))))
(($ $kargs names vars
diff --git a/module/language/tree-il/compile-cps.scm
b/module/language/tree-il/compile-cps.scm
index e690a40..e66b09b 100644
--- a/module/language/tree-il/compile-cps.scm
+++ b/module/language/tree-il/compile-cps.scm
@@ -820,13 +820,14 @@
(build-term ($continue kprim src ($prim name))))))))))
(else
;; We have something that's a primcall for Tree-IL but not for
- ;; CPS, which will get compiled as a call and so the right thing
- ;; to do is to continue to the given $ktail or $kreceive.
+ ;; CPS; compile as a call.
(convert-args cps args
(lambda (cps args)
(with-cps cps
- (build-term
- ($continue k src ($primcall name #f args)))))))))
+ (letv prim)
+ (letk kprim ($kargs ('prim) (prim)
+ ($continue k src ($call prim args))))
+ (build-term ($continue kprim src ($prim name)))))))))
;; Prompts with inline handlers.
(($ <prompt> src escape-only? tag body
- [Guile-commits] branch master updated (da7144d -> 108ade6), Andy Wingo, 2017/12/27
- [Guile-commits] 01/16: Fix stack effect/clobber parsing for calls, Andy Wingo, 2017/12/27
- [Guile-commits] 04/16: Reify-primitives removes "/unlikely" ephemeral instructions, Andy Wingo, 2017/12/27
- [Guile-commits] 07/16: Refactor list->seq to make return arity apparent, Andy Wingo, 2017/12/27
- [Guile-commits] 05/16: Remove compile-bytecode cases for ephemeral primitives, Andy Wingo, 2017/12/27
- [Guile-commits] 12/16: CPS conversion avoids residualizing unknown primcalls, Andy Wingo, 2017/12/27
- [Guile-commits] 06/16: Refactor reify-primitives pass, Andy Wingo, 2017/12/27
- [Guile-commits] 08/16: Flesh out compile-bytecode for all heap objects, Andy Wingo, 2017/12/27
- [Guile-commits] 15/16: Unknown primcalls convert as calls,
Andy Wingo <=
- [Guile-commits] 13/16: Contification also inlines "elide-values" pass, Andy Wingo, 2017/12/27
- [Guile-commits] 10/16: CPS conversion expands "list", Andy Wingo, 2017/12/27
- [Guile-commits] 11/16: Inline "elide-values" optimization into CPS conversion, Andy Wingo, 2017/12/27
- [Guile-commits] 09/16: Refactor lowering of Tree-IL primcalls to CPS, Andy Wingo, 2017/12/27
- [Guile-commits] 16/16: Re-add support for logbit?, Andy Wingo, 2017/12/27
- [Guile-commits] 03/16: Refactor boxing/unboxing primcall args/results, Andy Wingo, 2017/12/27
- [Guile-commits] 02/16: Fix mismatch between CPS and Scheme "complex?" predicate, Andy Wingo, 2017/12/27
- [Guile-commits] 14/16: Remove inline-constructors pass, Andy Wingo, 2017/12/27