JDK-8316951 : assert(known_holder == NULL || ... ) failed: should be default method
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2023-09-25
  • Updated: 2023-09-26
Description
ADDITIONAL SYSTEM INFORMATION :
# JRE version: OpenJDK Runtime Environment (8.0_392) (build 1.8.0_392-internal-fastdebug--b00)
# Java VM: OpenJDK 64-Bit Server VM (25.392-b00-fastdebug mixed mode linux-amd64 compressed oops)

A DESCRIPTION OF THE PROBLEM :
I ran a regression test on JDK8u392 and found that the JVM crashed without any options.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/data//jdk8u/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp:4504), pid=97353, tid=0x00007fcda0434700
#  assert(known_holder == NULL || (known_holder->is_instance_klass() && (!known_holder->is_interface() || ((ciInstanceKlass*)known_holder)->has_default_methods()))) failed: should be default method
#
# JRE version: OpenJDK Runtime Environment (8.0_392) (build 1.8.0_392-internal-fastdebug--b00)
# Java VM: OpenJDK 64-Bit Server VM (25.392-b00-fastdebug mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
java compiler.c1.TestStaticInterfaceMethodCall

ACTUAL -
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/c1_GraphBuilder.cpp:4504
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/data//jdk8u/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp:4504), pid=97353, tid=0x00007fcda0434700
#  assert(known_holder == NULL || (known_holder->is_instance_klass() && (!known_holder->is_interface() || ((ciInstanceKlass*)known_holder)->has_default_methods()))) failed: should be default method
#
# JRE version: OpenJDK Runtime Environment (8.0_392) (build 1.8.0_392-internal-fastdebug--b00)
# Java VM: OpenJDK 64-Bit Server VM (25.392-b00-fastdebug mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home//repository//toreport/TestStaticInterfaceMethodCall_09_22_23_53_15/hs_err_pid97353.log
[thread 140521132734208 also had an error]
#
# Compiler replay data is saved as:
# /home//repository//toreport/TestStaticInterfaceMethodCall_09_22_23_53_15/replay_pid97353.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

---------- BEGIN SOURCE ----------
package compiler.c1;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;

public class TestStaticInterfaceMethodCall {

     static final MethodHandle MH_m;

     static {
         try {
             MH_m = MethodHandles.lookup().findStatic(MyInterface.class, "m", MethodType.methodType(void.class));
         } catch (ReflectiveOperationException e) {
             throw new BootstrapMethodError(e);
         }
     }

     public static void main(String[] args) throws Throwable {
         for (int i = 0; i < 20_000; i++) {
             test_call_by_method_handle();
             test_direct_call();
         }
     }

     static void test_call_by_method_handle() throws Throwable {
         MH_m.invokeExact();
     }

     static void test_direct_call() {
         MyInterface.m();
     }

}

interface MyInterface {
     static void m() {}
}
---------- END SOURCE ----------

FREQUENCY : always



Comments
Issue is not reproduced. Crash is not observed for oracle JDK 8u381 OS: Windows 10 JDK 8u381: Pass JDK 8u381 Fastdebug : Pass OS: Ubuntu 20.08 JDK 8u381: Pass JDK 8u381 Fastdebug : Pass Moving it to dev team for further analysis.
26-09-2023