Latest Posts »
Latest Comments »
Popular Posts »

The JSR 292 — invokedynamic

Written by Jevgeni Kabanov on May 20, 2008 – 8:21 am

I read through the first draft of JSR 292 this morning and had several questions that I’m not 100% sure the current specification addresses:

  • Can I rebind the CallSite after I have set the MethodHandle?
  • Can I keep a reference to CallSites at all?
  • Is the setMethodHanlde method implied to be thread-safe?

The reason I’m asking is that the only way to rebind a method as seen in spec is lazily, by invalidating all the call sites in the class (or everywhere) and rebinding methods when called. It may sometimes be necessary or easier to do that eagerly and it looks like the current API does allow that. It should either be forbidden explicitly or allowed explicitly.

I’ll send a link to the JSR-292-COMMENTS list as well, but perhaps someone knows the answer already?


Tags: ,
Posted in cool | 3 Comments »

3 Comments to “The JSR 292 — invokedynamic”

  1. John Rose Says:

    Thanks for giving it a read! Taking your questions in reverse order: 3. Since the linkage state is a single method handle (one reference), there are no race conditions, so it’s thread safe. 2. Yes, the spec. guarantees this; search for “the dynamic language can save it away”. 1. Yes; see the second paragraph of the section “Target method processing”.

  2. Jevgeni Kabanov Says:

    Thanks, John! Do I understand correctly that several CallSites can share a single StaticContext?

  3. John Rose Says:

    Yes.

Leave a Comment

Additional comments powered by BackType