[MacRuby-devel] branches/experimental
Laurent Sansonetti
lsansonetti at apple.com
Sun Mar 29 10:12:29 PDT 2009
On Mar 28, 2009, at 10:38 PM, Charles Oliver Nutter wrote:
> Laurent Sansonetti wrote:
>> It's possible by modifying the source code and comment the call to
>> createInstructionCombiningPass() and createCFGSimplificationPass(),
>> but I do not recommend to remove these because I think it would
>> break the way we compile Dwarf exception handlers in blocks.
>> # In my personal benchmark suite I try to make sure these
>> optimizations do not provide false positive numbers when comparing
>> against YARV.
>
> Ok, it would be nice if there were a simpler way to turn those off;
> I don't want to break 'experimental' completely, but it would be
> nice to get real benchmark results in these cases.
I don't think it's a good idea to provide a way to turn off
optimizations and I do not see the point in benchmarking dead code in
general (I would never do this).
>> Yes, currently calling eval with a literal string will call the
>> JIT, so doing this in a loop will most likely eat all your memory :-)
>> I plan to address that later by fallbacking to the LLVM interpreter
>> in some cases, but I doubt this will affect real-world
>> applications. Also, there are ways to improve the JIT (nothing has
>> been done yet).
>
> In Rails, as recently as 2.2 (I haven't checked 2.3) there's a small
> bit of eval'ed code used to look up constants. Before we fixed our
> parser performance, we found it was a bottleneck. So that's at least
> one real-world case.
Good to know, I just hope they are not doing this 30 million times in
a loop or something :-)
>> Yes as you noticed Binding has not been implemented yet :-( This is
>> on the very top of my TODO list (needed for IRB) and I already know
>> how to implement it without disabling our current "local variables
>> into CPU registers" optimization.
>
> How will you do that? Given that a block can be used as a binding,
> you can't statically inspect contained blocks to determine which
> variables are used and which aren't. For example, this code:
>
> def foo
> a = 1
> bar { }
> puts a
> end
>
> def bar(&b)
> eval "a = 2", b.binding
> end
>
> foo
>
> This should print out "2" but prints out "1" in 'experimental' right
> now.
Yes, Binding is not implemented yet. Do not worry I have read the MRI
source code and know how Binding works and how to provide a compliant
implementation. Please stay tuned.
Laurent
More information about the MacRuby-devel
mailing list