Kurt Stephens

Nerd Up!

The Broken Promises of MRI/REE/YARV

Kurt on Wed, 2011-07-06 16:34.

Joe Damato drills deep into the implied contracts of the MRI/C API:

http://timetobleed.com/the-broken-promises-of-mrireeyarv/

The need for RB_GC_GUARD(v) is probably due to faulty register spilling in the MRI eval/thread/GC machinery; the PRE_GETCONTEXT() and POST_GETCONTEXT() macros in MRI eval.c might be the real problem.

In contrast, the Boehm-Demers-Weiser (BDW) GC library manages to scan registers without demanding client code to explicitly flush pointers to the stack.

However, in general, it is problematic, in language design practice to make GC contracts completely transparent to API client code. This difficultly is explicitly solved in the design of Lua:

Passing a Language through the Eye of a Needle — How the embeddability of Lua impacted its design: http://queue.acm.org/detail.cfm?id=1983083

Lua mediates all object references through stack manipulations. They were able to implement a generational write-barrier with little (or no) GC API contracts.

MRI does not need a read or write barrier; it’s unclear why RB_GC_GUARD() is needed at all except to cover up a bug elsewhere.


links: Kurt's blog | add new comment | 1149 reads

Primary links

Syndicate

Syndicate content

Browse archives

« February 2012  
Mo Tu We Th Fr Sa Su
    1 2 3 4 5
6 7 8 9 10 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29