diff --git a/src/share/vm/classfile/vmSymbols.hpp b/src/share/vm/classfile/vmSymbols.hpp index bb9f3076a96123380e045bff4a805ff77758ace2..fdc8786e551f212bde8d546b5f823356c4758d98 100644 --- a/src/share/vm/classfile/vmSymbols.hpp +++ b/src/share/vm/classfile/vmSymbols.hpp @@ -104,6 +104,7 @@ template(java_lang_AssertionStatusDirectives, "java/lang/AssertionStatusDirectives") \ template(sun_jkernel_DownloadManager, "sun/jkernel/DownloadManager") \ template(getBootClassPathEntryForClass_name, "getBootClassPathEntryForClass") \ + template(setBootClassLoaderHook_name, "setBootClassLoaderHook") \ \ /* class file format tags */ \ template(tag_source_file, "SourceFile") \ diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp index 38e3ac438b3a87be4e6357ff41d5ddf86c22df6a..5b2b90dedcbfa71ef9b0510e8ef6095f03e1e300 100644 --- a/src/share/vm/runtime/thread.cpp +++ b/src/share/vm/runtime/thread.cpp @@ -884,6 +884,22 @@ static void call_initializeSystemClass(TRAPS) { vmSymbolHandles::void_method_signature(), CHECK); } +#ifdef KERNEL +static void set_jkernel_boot_classloader_hook(TRAPS) { + klassOop k = SystemDictionary::sun_jkernel_DownloadManager_klass(); + instanceKlassHandle klass (THREAD, k); + + if (k == NULL) { + // sun.jkernel.DownloadManager may not present in the JDK; just return + return; + } + + JavaValue result(T_VOID); + JavaCalls::call_static(&result, klass, vmSymbolHandles::setBootClassLoaderHook_name(), + vmSymbolHandles::void_method_signature(), CHECK); +} +#endif // KERNEL + static void reset_vm_info_property(TRAPS) { // the vm info string ResourceMark rm(THREAD); @@ -3102,6 +3118,12 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); } +#ifdef KERNEL + if (JDK_Version::is_gte_jdk17x_version()) { + set_jkernel_boot_classloader_hook(THREAD); + } +#endif // KERNEL + #ifndef SERIALGC // Support for ConcurrentMarkSweep. This should be cleaned up // and better encapsulated. The ugly nested if test would go away