1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-25 20:50:31 +02:00

Remove add1 and sub1

* libguile/vm-engine.c: Remove add1 and sub1 instructions.  Will replace
  with add/immediate and sub/immediate.
* module/language/tree-il/peval.scm (peval): If we reify a new
  <primcall>, expand it.  Removes 1- and similar primcalls.
* module/language/tree-il/primitives.scm: Don't specialize (+ x 1) to 1+.
  (expand-primcall): New export, does a single primcall expansion.
  (expand-primitives): Use the new helper.
* module/language/cps/effects-analysis.scm:
* module/language/cps/primitives.scm:
* module/language/cps/types.scm:
* module/system/vm/assembler.scm: Remove support for add1 and sub1 CPS
  primitives.
* test-suite/tests/peval.test ("partial evaluation"): Adapt tests that
  expect 1+/1- to expect +/-.
This commit is contained in:
Andy Wingo 2015-11-20 14:03:32 +01:00
parent e003466039
commit 8f18b71b7a
8 changed files with 30 additions and 88 deletions

View file

@ -534,7 +534,7 @@
;; <https://lists.gnu.org/archive/html/bug-guile/2011-09/msg00019.html>.
(let ((fold (lambda (f g) (f (g top)))))
(fold 1+ (lambda (x) x)))
(primcall 1+ (toplevel top)))
(primcall + (toplevel top) (const 1)))
(pass-if-peval
;; Procedure not inlined when residual code contains recursive calls.
@ -557,7 +557,7 @@
(lambda ()
(lambda-case
(((x2) #f #f #f () (_))
(primcall 1- (lexical x2 _))))))))
(primcall - (lexical x2 _) (const 1))))))))
(pass-if "inlined lambdas are alpha-renamed"
;; In this example, `make-adder' is inlined more than once; thus,
@ -788,8 +788,8 @@
(((x) #f #f #f () (_))
(if _ _
(call (lexical loop _)
(primcall 1-
(lexical x _))))))))
(primcall - (lexical x _)
(const 1))))))))
(call (lexical loop _) (toplevel x))))
(pass-if-peval