6714758: hotspot: provide an entry point to the BootStrap Class loader[dholmes,acorn]
Summary: adds JVM_FindClassFromBootLoader entry point, for jdk's use
Reviewed-by: dholmes, acorn
--- a/hotspot/make/linux/makefiles/mapfile-vers-debug Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/linux/makefiles/mapfile-vers-debug Tue Jun 17 13:08:15 2008 -0700
@@ -89,6 +89,7 @@
JVM_FillInStackTrace;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
+ JVM_FindClassFromBootLoader;
JVM_FindLibraryEntry;
JVM_FindLoadedClass;
JVM_FindPrimitiveClass;
--- a/hotspot/make/linux/makefiles/mapfile-vers-product Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/linux/makefiles/mapfile-vers-product Tue Jun 17 13:08:15 2008 -0700
@@ -89,6 +89,7 @@
JVM_FillInStackTrace;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
+ JVM_FindClassFromBootLoader;
JVM_FindLibraryEntry;
JVM_FindLoadedClass;
JVM_FindPrimitiveClass;
--- a/hotspot/make/solaris/makefiles/mapfile-vers Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/solaris/makefiles/mapfile-vers Tue Jun 17 13:08:15 2008 -0700
@@ -89,6 +89,7 @@
JVM_FillInStackTrace;
JVM_FindClassFromClass;
JVM_FindClassFromClassLoader;
+ JVM_FindClassFromBootLoader;
JVM_FindLibraryEntry;
JVM_FindLoadedClass;
JVM_FindPrimitiveClass;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER1_i486 Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/solaris/makefiles/reorder_COMPILER1_i486 Tue Jun 17 13:08:15 2008 -0700
@@ -2175,6 +2175,7 @@
text: .text%jni_GetStringUTFRegion: jni.o;
text: .text%__1cQjava_lang_StringOas_utf8_string6FpnHoopDesc_ii_pc_;
text: .text%JVM_FindClassFromClassLoader;
+text: .text%JVM_FindClassFromBootLoader;
text: .text%JVM_IsInterface;
text: .text%JVM_GetClassDeclaredConstructors;
text: .text%__1cNmethodOopDescOis_initializer6kM_i_;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER1_sparc Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/solaris/makefiles/reorder_COMPILER1_sparc Tue Jun 17 13:08:15 2008 -0700
@@ -1500,6 +1500,7 @@
text: .text%jni_GetStringUTFRegion: jni.o;
text: .text%__1cQjava_lang_StringOas_utf8_string6FpnHoopDesc_ii_pc_;
text: .text%JVM_FindClassFromClassLoader;
+text: .text%JVM_FindClassFromBootLoader;
text: .text%JVM_IsInterface;
text: .text%JVM_GetClassDeclaredConstructors;
text: .text%__1cNmethodOopDescOis_initializer6kM_i_;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER2_amd64 Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/solaris/makefiles/reorder_COMPILER2_amd64 Tue Jun 17 13:08:15 2008 -0700
@@ -4339,6 +4339,7 @@
text: .text%__1cFParseLarray_store6MnJBasicType__v_;
text: .text%__1cOmangle_name_on6FpnMoutputStream_pnNsymbolOopDesc_ii_v_: nativeLookup.o;
text: .text%JVM_FindClassFromClassLoader;
+text: .text%JVM_FindClassFromBootLoader;
text: .text%__1cZCallInterpreterDirectNodeSalignment_required6kM_i_;
text: .text%__1cZCallInterpreterDirectNodePoper_input_base6kM_I_;
text: .text%__1cZCallInterpreterDirectNodeEemit6kMrnKCodeBuffer_pnNPhaseRegAlloc__v_;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER2_i486 Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/solaris/makefiles/reorder_COMPILER2_i486 Tue Jun 17 13:08:15 2008 -0700
@@ -4755,6 +4755,7 @@
text: .text%__1cITemplateKinitialize6MinITosState_1pFi_vi_v_;
text: .text%__1cNTemplateTableDdef6FnJBytecodesECode_inITosState_3pFi_vi_v_;
text: .text%JVM_FindClassFromClassLoader;
+text: .text%JVM_FindClassFromBootLoader;
text: .text%__1cPshrI_eReg_1NodeEsize6kMpnNPhaseRegAlloc__I_;
text: .text%__1cHi2bNodeMideal_Opcode6kM_i_: ad_i486_misc.o;
text: .text%__1cMmatch_option6FpknMJavaVMOption_pkcp4_i_: arguments.o;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER2_sparc Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/solaris/makefiles/reorder_COMPILER2_sparc Tue Jun 17 13:08:15 2008 -0700
@@ -3713,6 +3713,7 @@
text: .text%__1cITemplateIgenerate6MpnZInterpreterMacroAssembler__v_;
text: .text%__1cQregI_to_stkINodeHis_Copy6kM_I_: ad_sparc_misc.o;
text: .text%JVM_FindClassFromClassLoader;
+text: .text%JVM_FindClassFromBootLoader;
text: .text%signalHandler;
text: .text%__1cTtypeArrayKlassKlassIoop_size6kMpnHoopDesc__i_: typeArrayKlassKlass.o;
text: .text%JVM_handle_solaris_signal;
--- a/hotspot/make/solaris/makefiles/reorder_COMPILER2_sparcv9 Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/solaris/makefiles/reorder_COMPILER2_sparcv9 Tue Jun 17 13:08:15 2008 -0700
@@ -3735,6 +3735,7 @@
text: .text%__1cQjava_lang_ThreadRget_thread_status6FpnHoopDesc__n0AMThreadStatus__;
text: .text%__1cIMulINodeGadd_id6kM_pknEType__: classes.o;
text: .text%JVM_FindClassFromClassLoader;
+text: .text%JVM_FindClassFromBootLoader;
text: .text%__1cHTypePtrFempty6kM_i_;
text: .text%__1cQaddP_reg_regNodeEsize6kMpnNPhaseRegAlloc__I_;
text: .text%__1cbFunnecessary_membar_volatileNodePoper_input_base6kM_I_: ad_sparc_misc.o;
--- a/hotspot/make/solaris/makefiles/reorder_TIERED_amd64 Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/solaris/makefiles/reorder_TIERED_amd64 Tue Jun 17 13:08:15 2008 -0700
@@ -4339,6 +4339,7 @@
text: .text%__1cFParseLarray_store6MnJBasicType__v_;
text: .text%__1cOmangle_name_on6FpnMoutputStream_pnNsymbolOopDesc_ii_v_: nativeLookup.o;
text: .text%JVM_FindClassFromClassLoader;
+text: .text%JVM_FindClassFromBootLoader;
text: .text%__1cZCallInterpreterDirectNodeSalignment_required6kM_i_;
text: .text%__1cZCallInterpreterDirectNodePoper_input_base6kM_I_;
text: .text%__1cZCallInterpreterDirectNodeEemit6kMrnKCodeBuffer_pnNPhaseRegAlloc__v_;
--- a/hotspot/make/solaris/makefiles/reorder_TIERED_i486 Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/solaris/makefiles/reorder_TIERED_i486 Tue Jun 17 13:08:15 2008 -0700
@@ -4755,6 +4755,7 @@
text: .text%__1cITemplateKinitialize6MinITosState_1pFi_vi_v_;
text: .text%__1cNTemplateTableDdef6FnJBytecodesECode_inITosState_3pFi_vi_v_;
text: .text%JVM_FindClassFromClassLoader;
+text: .text%JVM_FindClassFromBootLoader;
text: .text%__1cPshrI_eReg_1NodeEsize6kMpnNPhaseRegAlloc__I_;
text: .text%__1cHi2bNodeMideal_Opcode6kM_i_: ad_i486_misc.o;
text: .text%__1cMmatch_option6FpknMJavaVMOption_pkcp4_i_: arguments.o;
--- a/hotspot/make/solaris/makefiles/reorder_TIERED_sparc Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/solaris/makefiles/reorder_TIERED_sparc Tue Jun 17 13:08:15 2008 -0700
@@ -3713,6 +3713,7 @@
text: .text%__1cITemplateIgenerate6MpnZInterpreterMacroAssembler__v_;
text: .text%__1cQregI_to_stkINodeHis_Copy6kM_I_: ad_sparc_misc.o;
text: .text%JVM_FindClassFromClassLoader;
+text: .text%JVM_FindClassFromBootLoader;
text: .text%signalHandler;
text: .text%__1cTtypeArrayKlassKlassIoop_size6kMpnHoopDesc__i_: typeArrayKlassKlass.o;
text: .text%JVM_handle_solaris_signal;
--- a/hotspot/make/windows/makefiles/vm.make Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/make/windows/makefiles/vm.make Tue Jun 17 13:08:15 2008 -0700
@@ -88,13 +88,20 @@
!endif
!endif
-LINK_FLAGS=$(LINK_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \
- /export:JNI_GetDefaultJavaVMInitArgs /export:JNI_CreateJavaVM \
- /export:JNI_GetCreatedJavaVMs /export:jio_snprintf \
- /export:jio_printf /export:jio_fprintf \
- /export:jio_vfprintf /export:jio_vsnprintf $(AGCT_EXPORT) \
- /export:JVM_GetVersionInfo \
- /export:JVM_GetThreadStateNames /export:JVM_GetThreadStateValues \
+LINK_FLAGS=$(LINK_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \
+ /export:JNI_GetDefaultJavaVMInitArgs \
+ /export:JNI_CreateJavaVM \
+ /export:JVM_FindClassFromBootLoader \
+ /export:JNI_GetCreatedJavaVMs \
+ /export:jio_snprintf \
+ /export:jio_printf \
+ /export:jio_fprintf \
+ /export:jio_vfprintf \
+ /export:jio_vsnprintf \
+ $(AGCT_EXPORT) \
+ /export:JVM_GetVersionInfo \
+ /export:JVM_GetThreadStateNames \
+ /export:JVM_GetThreadStateValues \
/export:JVM_InitAgentProperties
CPP_INCLUDE_DIRS=\
--- a/hotspot/src/share/vm/prims/jvm.cpp Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/src/share/vm/prims/jvm.cpp Tue Jun 17 13:08:15 2008 -0700
@@ -624,6 +624,30 @@
if (PrintJVMWarnings) warning("JVM_ResolveClass not implemented");
JVM_END
+// Rationale behind JVM_FindClassFromBootLoader
+// a> JVM_FindClassFromClassLoader was never exported in the export tables.
+// b> because of (a) java.dll has a direct dependecy on the unexported
+// private symbol "_JVM_FindClassFromClassLoader@20".
+// c> the launcher cannot use the private symbol as it dynamically opens
+// the entry point, so if something changes, the launcher will fail
+// unexpectedly at runtime, it is safest for the launcher to dlopen a
+// stable exported interface.
+// d> re-exporting JVM_FindClassFromClassLoader as public, will cause its
+// signature to change from _JVM_FindClassFromClassLoader@20 to
+// JVM_FindClassFromClassLoader and will not be backward compatible
+// with older JDKs.
+// Thus a public/stable exported entry point is the right solution,
+// public here means public in linker semantics, and is exported only
+// to the JDK, and is not intended to be a public API.
+
+JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env,
+ const char* name,
+ jboolean throwError))
+ JVMWrapper3("JVM_FindClassFromBootLoader %s throw %s", name,
+ throwError ? "error" : "exception");
+ return JVM_FindClassFromClassLoader(env, name, JNI_FALSE,
+ (jobject)NULL, throwError);
+JVM_END
JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name,
jboolean init, jobject loader,
--- a/hotspot/src/share/vm/prims/jvm.h Tue Jun 17 09:59:59 2008 -0700
+++ b/hotspot/src/share/vm/prims/jvm.h Tue Jun 17 13:08:15 2008 -0700
@@ -390,6 +390,17 @@
jobject loader, jboolean throwError);
/*
+ * Find a class from a boot class loader. Throw ClassNotFoundException
+ * or NoClassDefFoundError depending on the value of the last
+ * argument. This is the same as FindClassFromClassLoader but provided
+ * as a convenience method exported correctly on all platforms for
+ * JSR 277 launcher class loading.
+ */
+JNIEXPORT jclass JNICALL
+JVM_FindClassFromBootLoader(JNIEnv *env, const char *name,
+ jboolean throwError);
+
+/*
* Find a class from a given class.
*/
JNIEXPORT jclass JNICALL