RFR 8166974: invokedynamic implementation should not wrap Errors

Paul Sandoz paul.sandoz at oracle.com
Mon Oct 17 22:38:17 UTC 2016


> On 17 Oct 2016, at 15:01, Stuart Marks <stuart.marks at oracle.com> wrote:
> 
> Hi Paul,
> 
> I took a look at the jdk changes. They look good to me.
> 
> One section of code gave me pause, which is the throw of ClassCastException at 339 of CallSite.java, and the throw of the exception returned from wrongTargetType() at 344 of CallSite.java. This appears odd given the "rethrow any Error and wrap anything else in BSME" rule. But these throws are caught by the catch of Throwable below, which does the wrap and throw of BSME.
> 
> This arrangement was already present in the code.
> 
> Usually I wrinkle my nose at a throw that's caught by a catch clause later on, but in this case it's not obvious what would be better. Maybe a comment is warranted?

In addition to the

  // See the "Linking Exceptions" section for the invokedynamic
  // instruction in JVMS 6.5.

I can add something like:

  // Throws a runtime exception defining the cause that is then later wrapped in BootstrapMethodError

?

Thanks,
Paul.


More information about the hotspot-dev mailing list