2012/4/23 Charles Oliver Nutter <head...@headius.com>:
> On Sun, Apr 22, 2012 at 2:12 AM, Rémi Forax <fo...@univ-mlv.fr> wrote:
>> You are the first as far as I know to use only a tree of method handles
>> to implement expressions. The rest of us generates bytecodes
>> and have a compiler that does constant propagation.
>
> JRuby doesn't do any constant propagation in our existing compiler,
> but we will be able to do some in the newer compiler. Ruby's constants
> are lazily discovered at runtime, so we can't propagate their
> values...but Hotspot should be able to in many cases.

Let me try my question in another way, given this context.

In p.11 of Nahi's JRuby/invokedynamic presentation [1], I see that
JRuby already does something to make Ruby constants (or "variables
that gets updated less frequently" as Nahi puts it) go fast, with the
use of MethodHandle that returns a constant. So if I had code like
this:

  def foo
    if !DEBUG then
      ... meat ...
    end
  end

... and DEBUG==false, wouldn't you expect the above to optimize it to:

  def foo
    ... meat ...
  end

... modulo de-optimization via switch point? But if my observation is
correct, then such optimization isn't happening.

Or put another way, in JAX I think you said because of this
optimization, "JRuby constants are more final than Java final", but
really, this is only as final as Java final...

[1] 
https://docs.google.com/presentation/d/1-hA1tAF1ADdCzsIAEQCcVxl2YIieb4Xopm21Slx3XFE/edit?pli=1#slide=id.g856da0e_0_43

-- 
Kohsuke Kawaguchi
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to