[racket-dev] extflonum unboxing, f80vector ffi

From: Michael Filonenko (mfilonenko at ipa.nw.ru)
Date: Fri Feb 15 05:44:38 EST 2013

Hi all.

This time I use the github pull requesting tool, which is more
comfortable for annotation, I think.

The following merge request https://github.com/plt/racket/pull/245 contains:

  * small fixes for extflonum arithmetic: two functions were not jitted.
  * experimental extflonum unboxing
  * f80vector type for ffi (sorry, not documented yet)

I used the extfl flag and therefore did much less copypaste than previous time.

Unfortunately the extflonum unboxing is not stable and is disabled by default.
You can uncomment USE_EXTFLONUM_UNBOXING definition in jit.h to turn
on extfl unboxing.

The following test case fails all the time:

  (require racket/unsafe/ops)

  (let ()
    (define f (lambda (x)
                (collect-garbage)
                (let loop ([a 0.0t0][v 0.0t0][n 1000])
                  (if (zero? n)
                      v
                      (if (odd? n)
                          (let ([b (unsafe-extfl+ a a)])
                            (loop b v (sub1 n)))
                          ;; First arg is un place, but may need re-boxing
                          (loop a
                                (unsafe-extfl+ v x)
                                (- n 1)))))))
    (let ((res (f 1.0t0)))
      (when (not (equal? res 500.0t0))
        (printf "error extfl ~a~%" res))))

If the (collect-garbage) call is removed, then the test can pass (or not).
My hypothesis is that the gc collects unboxed extflonums as garbage,
which pollutes the memory and breaks further calculations.

Other than that, I ran out of ideas. I continue exploring the gc,
but an advice would be of great help. How do you think, what other
reason could it be?


--
With best regards, Michael Filonenko

Posted on the dev mailing list.