[racket-dev] futures waiting for scheme_make_envunbox

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Wed Aug 25 10:07:04 EDT 2010

On Wed, Aug 25, 2010 at 9:56 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Wed, 25 Aug 2010 09:42:40 -0400, Sam Tobin-Hochstadt wrote:
>> While trying to use futures to parallelize a simple piece of code, I
>> was able to remove all of the waiting except for this:
>>
>> future: 3 waiting for runtime at 1282743524205.783936: [scheme_make_envunbox]
>>
>> which happens continuously.  What causes this function to be invoked,
>> and how can I eliminate it?
>
> It happens when initializing a local variable that is assigned via
> `set!'. Probably we should inline scheme_make_envunbox() in
> JIT-generated code.

Ok, that's kind of surprising.  It seems that Typed Racket's optimizer
is transforming the program in such a way that the bytecode compiler
inserts `set!' where it wasn't before.  I've attached the relevant
file (which is just TR applied to the mandlebrot example from the
futures paper).  When the #:optimize keyword is used, the futures wait
on `scheme_make_envunbox'.  When it isn't used, there's much less
waiting (just allocation and jitting).

Unfortunately, trying to decompile this file produces an error in the
decompiler:

[samth at punge:~/tmp plt] raco decompile mandelbrot.rkt
hash-ref: no value found for key: 1128

so it's hard to tell exactly what's happening.
-- 
sam th
samth at ccs.neu.edu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mandelbrot.rkt
Type: application/octet-stream
Size: 1090 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20100825/821481c7/attachment.obj>

Posted on the dev mailing list.