[gambit-list] decreasing GC

Bradley Lucier lucier at math.purdue.edu
Wed Apr 24 13:44:03 EDT 2013


On 04/24/2013 01:33 PM, Mikael wrote:
> Hi Brad!
>
> 2013/4/24 Bradley Lucier <lucier at math.purdue.edu 
> <mailto:lucier at math.purdue.edu>>
>
>     On 04/24/2013 12:37 PM, Zhen Shen wrote:
>
>
> [...]
>
>     > Now, doing (declare (flonum)) at the top level, does this stop
>     gambit
>     > from boxing flonums across function calls?
>
>     No.  Gambit keeps flonums unboxed inside a basic block, whenever
>     there's
>     a jump (or the possibility of a jump), Gambit boxes up all the
>     still-needed flonums.
>
>
> What about fixnums, would they remain unboxed in a loop?

Yes.  Fixnums are always "immediate" (not boxed) values.

>
> Also btw, are there any tricks that can be applied to make it keep 
> flonums and fixnums unboxed in loops, like, (declare (not 
> interrupts-enabled)) or (not safe)?

Use (declare (not safe)) and flonum-specific operations to keep flonums 
unboxed in a basic block.  There's no way to keep them unboxed across 
jumps.  (With generic operations, flonums are boxed even in a basic block.)

Or, you can use an f64vector as an explicit "box" for your flonum and 
write monstrous code like this.

(define (Array-sum a)
   (f64vector-ref (Array-reduce (lambda (result y)
                                  (f64vector-set! result 0 (fl+ 
(f64vector-ref result 0) y))
                                  result)
                                (f64vector 0.)
                                a)
                    0))

Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130424/505af47c/attachment.htm>


More information about the Gambit-list mailing list