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

Fix sub/- primcall bug

* module/language/tree-il/compile-cps2.scm (convert): Fix bug
  in (apply - ...), because the instruction for "-" is "sub", and
  "sub" lookup was failing.  Caught by numbers.test.  Really I would
  like to get rid of $prim, somehow.
This commit is contained in:
Andy Wingo 2015-05-20 19:18:35 +02:00
parent ef5f2fcaaa
commit fa7df5ed3a

View file

@ -657,7 +657,7 @@
(letk ktail ($kargs ('tail) (tail) ,body)) (letk ktail ($kargs ('tail) (tail) ,body))
($ (lp args ktail))))))))))) ($ (lp args ktail)))))))))))
((prim-instruction name) ((prim-instruction name)
=> (lambda (name) => (lambda (instruction)
(convert-args cps args (convert-args cps args
(lambda (cps args) (lambda (cps args)
;; Tree-IL primcalls are sloppy, in that it could be ;; Tree-IL primcalls are sloppy, in that it could be
@ -665,14 +665,14 @@
;; arguments. In CPS we are more strict and only ;; arguments. In CPS we are more strict and only
;; residualize a $primcall if the argument count ;; residualize a $primcall if the argument count
;; matches. ;; matches.
(match (prim-arity name) (match (prim-arity instruction)
((out . in) ((out . in)
(if (= in (length args)) (if (= in (length args))
(with-cps cps (with-cps cps
(let$ k (adapt-arity k src out)) (let$ k (adapt-arity k src out))
(build-term (build-term
($continue k src ($continue k src
($primcall name args)))) ($primcall instruction args))))
(with-cps cps (with-cps cps
(letv prim) (letv prim)
(letk kprim ($kargs ('prim) (prim) (letk kprim ($kargs ('prim) (prim)