Virtual dispatch bug in 292 impl
Christian Thalinger
christian.thalinger at oracle.com
Mon Dec 17 17:47:17 PST 2012
On Dec 16, 2012, at 11:55 AM, Charles Oliver Nutter <headius at headius.com> wrote:
> I wasn't sure if this had been filed already by Christian, so I wanted
> to post here.
>
> It appears that in C1, method handles are not properly dispatching to
> an overridden version of a method. My reproduction case is tied to
> JRuby, but I can come up with something isolated if necessary.
>
> In JRuby, the ENV object is a subclass of a Ruby Hash. Rather than
> rebinding all of Hash's methods (defined on org.jruby.RubyHash), the
> ENV impl just overrides them at the Java level. When dispatching to
> the [] method on ENV with invokedynamic, the handle points at
> RubyHash.op_aref, the implementation of [] for Hash. The ENV version
> should raise an error...but it does not, because it dispatches to the
> superclass version rather than the subclass version.
>
> If I turn off tiered compilation, the code works as expected.
>
> Reproduction for JRuby is here: https://gist.github.com/4311979
>
> I tested on hotspot-comp built yesterday:
>
> openjdk version "1.8.0-internal"
> OpenJDK Runtime Environment (build 1.8.0-internal-headius_2012_12_15_16_45-b00)
> OpenJDK 64-Bit Server VM (build 25.0-b13, mixed mode)
>
> If I have time I'll try to investigate in more depth.
This is really odd. I've fixed a similar bug some time ago:
https://jbs.oracle.com/bugs/browse/JDK-8000821
http://bugs.sun.com/view_bug.do?bug_id=8000821
And there is currently a bug with Nashorn that sounds like the same issue.
Is it intermittent? Are you able to reproduce with TieredStopAtLevel=1?
-- Chris
>
> - Charlie
More information about the hotspot-compiler-dev
mailing list