[gambit-list] What's going on with this expansion?
Bradley Lucier
lucier at math.purdue.edu
Wed Nov 16 14:54:30 EST 2011
Marc:
Here's the contents of a file:
(declare (standard-bindings)
(extended-bindings)
(block))
(declare (not inline))
(define (safe-fixnum-+ x y)
(declare (fixnum))
(+ x y))
Here's the expansion:
[Bradley-Luciers-MacBook-Pro:~/programs/gambc-v4_6_2-devel] lucier% gsc -c -expansion crap.scm
Expansion:
(define safe-fixnum-+
(lambda (x y)
(if (and ('#<procedure #2 ##fixnum?> y) ('#<procedure #2 ##fixnum?> x))
(let ((temp.2 ('#<procedure #3 ##fx+?> x y)))
(if temp.2
temp.2
(if (and ('#<procedure #2 ##fixnum?> y) ('#<procedure #2 ##fixnum?> x))
(let ((temp.5 ('#<procedure #3 ##fx+?> x y))) (if temp.5 temp.5 ('#<procedure #4 fx+> x y)))
('#<procedure #4 fx+> x y))))
(if (and ('#<procedure #2 ##fixnum?> y) ('#<procedure #2 ##fixnum?> x))
(let ((temp.8 ('#<procedure #3 ##fx+?> x y))) (if temp.8 temp.8 ('#<procedure #4 fx+> x y)))
('#<procedure #4 fx+> x y)))))
The C code generated by gsc matches the expansion.
This is very strange results---checking three times whether x and y are fixnums? I can't understand this.
Brad
More information about the Gambit-list
mailing list