--- old/src/hotspot/share/classfile/systemDictionary.cpp 2018-02-26 15:31:28.425659543 -0800 +++ new/src/hotspot/share/classfile/systemDictionary.cpp 2018-02-26 15:31:28.172635704 -0800 @@ -1059,12 +1059,19 @@ #if INCLUDE_CDS ResourceMark rm(THREAD); if (DumpSharedSpaces && !class_loader.is_null() && - !UseAppCDS && strcmp(class_name->as_C_string(), "Unnamed") != 0) { - // If AppCDS is not enabled, don't define the class at dump time (except for the "Unnamed" - // class, which is used by MethodHandles). + !UseAppCDS && (strcmp(class_name->as_C_string(), "Unnamed") != 0) + // If AppCDS is not enabled, don't define the class at dump time (except for the "Unnamed" + // class, which is used by MethodHandles). +#if INCLUDE_JVMCI + // Need to define the class if force initialization of JVMCI runtime. Otherwise the of the + // JVMCI class will result in ClassNotFoundException. + && !Arguments::is_force_init_jvmci_runtime()) { +#else + ) { +#endif // INCLUDE_JVMCI THROW_MSG_NULL(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string()); } -#endif +#endif // INCLUDE_CDS HandleMark hm(THREAD); --- old/src/hotspot/share/jvmci/jvmciRuntime.cpp 2018-02-26 15:31:29.121725124 -0800 +++ new/src/hotspot/share/jvmci/jvmciRuntime.cpp 2018-02-26 15:31:28.890703358 -0800 @@ -596,6 +596,7 @@ JRT_END void JVMCIRuntime::force_initialization(TRAPS) { + Arguments::set_force_init_jvmci_runtime(); JVMCIRuntime::initialize_well_known_classes(CHECK); ResourceMark rm; --- old/src/hotspot/share/runtime/arguments.cpp 2018-02-26 15:31:29.787787879 -0800 +++ new/src/hotspot/share/runtime/arguments.cpp 2018-02-26 15:31:29.545765076 -0800 @@ -118,6 +118,10 @@ char* Arguments::_ext_dirs = NULL; +#if INCLUDE_JVMCI +bool Arguments::_force_init_jvmci_runtime = false; +#endif + bool PathString::set_value(const char *value) { if (_value != NULL) { FreeHeap(_value); --- old/src/hotspot/share/runtime/arguments.hpp 2018-02-26 15:31:30.503855344 -0800 +++ new/src/hotspot/share/runtime/arguments.hpp 2018-02-26 15:31:30.270833390 -0800 @@ -541,6 +541,9 @@ static void set_gc_specific_flags(); #if INCLUDE_JVMCI + static bool _force_init_jvmci_runtime; + static void set_force_init_jvmci_runtime() {_force_init_jvmci_runtime = true; } + static bool is_force_init_jvmci_runtime() { return _force_init_jvmci_runtime; } // Check consistency of jvmci vm argument settings. static bool check_jvmci_args_consistency(); static void set_jvmci_specific_flags();