chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] Mostly fix #1604


From: felix . winkelmann
Subject: Re: [Chicken-hackers] [PATCH] Mostly fix #1604
Date: Sun, 19 May 2019 07:59:16 +0200

> Here's what I figured out fwiw:
>
> This is the program from #1604:
>
>   (define (fib n)
>     (if (or (= n 0) (= n 1))
>         n
>         (+ (fib (- n 1)) (fib (- n 2)))))
>
>   (time (let loop ((n 0))
>           (when (< n 35)
>             (fib n)
>             (loop (+ n 1)))))
>
> Relevant output from compiling this with your your patch:
>
>   $ csc -f -debug 5 -O5 fib-orig.scm
>   ...
>   (if r145 (k147 r145) (scheme#= k147 n10 1))
>   ...
>   (scheme#= k144 n10 0)
>   ...
>   [optimized-iteration]
>   ...
>   (if r145
>       (k147 r145)
>       (let ((g232 n10))
>         (let ((g233 1))
>           (k147 (##core#inline "C_eqp" g232 g233)))))
>   ...
>   (let ((g234 n10))
>     (let ((g235 0))
>       (k144 (##core#inline "C_eqp" g234 g235))))
>   ...
>
> This transformation comes from this rewrite rule:
>   (rewrite 'scheme#= 9 "C_eqp" "C_i_equalp" #t #t)
>

Shouldn't the types.db specialization for scheme#= be applied
here? Or can't it figure out the ffixnum types of the arguments?
Even though it is slightly dangerous, the scrutinizer _could_ assume
arguments to numerical primitives are fixnums in fixnum mode...

felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]