RFR (S + L test) : 8016839 : JSR292: AME instead of IAE when calling a method

Joel Borggrén-Franck joel.franck at oracle.com
Mon Nov 25 18:33:44 UTC 2013


On 22 Nov 2013, at 20:07, David Chase <david.r.chase at oracle.com> wrote:

> The last choice was to define a helper method in sun.misc.Unsafe that
> would always throw IllegalAccessError when called, and use that Method *
> in the should-throw-IAE case.  The risk here is that the helper method
> is zero-arg, where the method about to be called (and whose parameters
> had been pushed on the stack) could have a different set of arguments,
> and perhaps there is some platform where this does not work cleanly.
> However, the existing code that checks for null and throws AME seems to
> not be special-cased for number of args (that is, it branches to a
> generic exception thrower with no additional cleanup).  In addition, I
> enhanced the test to try faulty invocations with both zero and 11 args,
> and to run under jtreg in several modes, and I added iteration to help
> force code to the compiled case as well, and it has performed properly
> on Sparc, Intel, and embedded.

I was under the impression that a HotSpot Method can move as the result of a class redefine. An added bonus of having this in s.m.Unsafe is that hopefully it should be very uncommon to redefine those methods.


More information about the core-libs-dev mailing list