On 05/16/2011 02:36 AM, Charles Oliver Nutter wrote:
> Can I get a rough guesstimate from the JVM guys how much more overhead
> is involved in accessing a never-changed MutableCallSite versus a
> ConstantCallSite? I have a few places where I want to use
> invokedynamic to lazily initialize some literals. They'll never change
> after the initial construction, but I can't create them in the
> bootstrap because I need the state they pass in (e.g. the
> org.jruby.Ruby instance they're associated with). I'd like to bind a
> constant method handle into the site after the first call and never
> change it again.
>
> - Charlie

Theoretically, the is no speed difference between a  ConstantCallSite
and a MutableCallSite that at some point never mutate.
The difference is more that a MutableCallsite has to keep metada
to trigger a de-optimization and not the ConstantCallSite.

Now, practically, I don't know if hotspot make a difference between them.

Charles, in your case you have two options:
First, you are able to serialize the literal in the bytecode, the trick is
that you can see an array of byte as a String, Terence Parr explains that
2 or 3 years ago at the JVM Summit.
Second, if you know the org.jruby.Ruby instance when generating
the code, you can cache it and look it up in the BSM.

Rémi

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

Reply via email to