Virtual dispatch bug in 292 impl

Charles Oliver Nutter headius at headius.com
Sun Dec 16 11:55:58 PST 2012


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.

- Charlie


More information about the hotspot-compiler-dev mailing list