1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

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.
This commit is contained in:
Andy Wingo 2017-12-27 11:04:26 +01:00
parent 0b4c1e2c29
commit bc5a599cad
2 changed files with 7 additions and 7 deletions

View file

@ -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

View file

@ -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