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
Afficher les réponses par date
On 2011-11-16, at 2:54 PM, Bradley Lucier wrote:
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.
Yes very strange... On the other hand testing for fixnum 3 times has the advantage that it tolerates cosmic rays which could change some bits in the processor for the values x and y... Hey I could probably sell this idea to NASA or DoD!
Seriously, I will investigate.
Marc
On Wed, 2011-11-16 at 22:40 -0500, Marc Feeley wrote:
On 2011-11-16, at 2:54 PM, Bradley Lucier wrote:
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.
It is now fixed on the Gambit repo.
Thanks, I'll test it.
It seems that a few unrelated changes were also committed---by mistake?
Brad
On 2011-11-16, at 10:53 PM, Bradley Lucier wrote:
On Wed, 2011-11-16 at 22:40 -0500, Marc Feeley wrote:
On 2011-11-16, at 2:54 PM, Bradley Lucier wrote:
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.
It is now fixed on the Gambit repo.
Thanks, I'll test it.
It seems that a few unrelated changes were also committed---by mistake?
Brad
The only unrelated change is fixing a comment in gambit.el .
Marc