RFR (S) JDK-8067480: Crash in klassItable::initialize_itable_for_interface when running vm.runtime.defmeth.StaticMethodsTest on Linux x64

Lois Foltan lois.foltan at oracle.com
Mon Jan 19 21:11:37 UTC 2015


Hello,

Please review the following fix:

Webrev:
     http://cr.openjdk.java.net/~lfoltan/bug_jdk8067480/

Bug: Crash in klassItable::initialize_itable_for_interface when running 
vm.runtime.defmeth.StaticMethodsTest on Linux x64
     https://bugs.openjdk.java.net/browse/JDK-8067480

Summary:
The previous fix for JDK-8033150: (invokestatic: 
IncompatibleClassChangeError trying to invoke static method from a 
parent in presence of conflicting defaults), made the change to include 
overpass methods in a class' local method array even when a static 
method is present.  An overpass method is added to the current class' 
local method array for issues that have been encountered during the walk 
of the default methods.  This fix allowed default method processing to 
match method selection where statics are and should be ignored. To have 
the static methods then later be preferred over an overpass method at 
method and interface method resolution time, the fix for JDK-8033150 
introduced the concept of "skipping_overpass" during method lookup.

The current bug, JDK-8067480, exposes a problem with allowing both a 
static method and an overpass method that share the same method name and 
signature to co-exist in a class' local method array.  A class' local 
method array is ordered based on the method name's Symbol* address.  So 
depending on this ordering, which happened to start differing between a 
fastdebug and product build, instanceKlass::find_instance_method() was 
returning NULL because the static method was found first and searching 
did not continue to find the overpass method of the same name and 
signature.  This led to consequences downstream when decisions were 
being made as to whither or not a miranda method should be added during 
the class' vtable initialization.  During a fastdebug build, 
find_instance_method() found the overpass method and vtable 
initialization ended correctly.  During a product build, due to a 
differing sorted order of the class' method array, the static method was 
found which caused the vtable initialization to determine a miranda 
method was needed, overrunning the vtable and actually overwriting the 
first slot in the itable.  instanceKlass::find_instance_method() must 
have the concept added of "skipping_statics", must like the 
"skipping_overpass" concept.  It should skip a static method of the same 
name and signature and instead of stopping, keep searching in case an 
overpass method of the same name and signature exists as well.

Tests:
    defmeth, java/lang, java/util, hotspot jtreg - completed
    vm.quick.testlist - in progress


More information about the hotspot-runtime-dev mailing list