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.

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.

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. This one feature is the primary reason JRuby can only put local variables in registers when there's no blocks present. When there's a block present, any variable can be accessed via its binding at any time. I've argued for this feature to be removed, but I have been unsuccessful.

Current JRuby is also putting local variables in registers (via HotSpot doing so for Java locals) when there's no blocks present.

- Charlie
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to