Mercurial > hg > openjdk > jdk6 > hotspot
changeset 4163:aa0313a30a38
8180881: Better packaging of deserialization
Reviewed-by: chegar, acorn
author | robm |
---|---|
date | Fri, 27 Oct 2017 20:39:22 +0100 |
parents | d2e4c962b08a |
children | 1dbca6a56a79 |
files | src/share/vm/classfile/systemDictionary.cpp src/share/vm/classfile/systemDictionary.hpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/prims/jvm.cpp |
diffstat | 4 files changed, 20 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/classfile/systemDictionary.cpp Tue Nov 28 12:14:30 2017 +0100 +++ b/src/share/vm/classfile/systemDictionary.cpp Fri Oct 27 20:39:22 2017 +0100 @@ -139,6 +139,17 @@ } return false; } + +/** + * Returns true if the passed class loader is the extension class loader. + */ +bool SystemDictionary::is_ext_class_loader(Handle class_loader) { + if (class_loader.is_null()) { + return false; + } + return (class_loader->klass()->klass_part()->name() == vmSymbols::sun_misc_Launcher_ExtClassLoader()); +} + // ---------------------------------------------------------------------------- // Resolving of classes
--- a/src/share/vm/classfile/systemDictionary.hpp Tue Nov 28 12:14:30 2017 +0100 +++ b/src/share/vm/classfile/systemDictionary.hpp Fri Oct 27 20:39:22 2017 +0100 @@ -624,12 +624,15 @@ static bool is_parallelCapable(Handle class_loader); static bool is_parallelDefine(Handle class_loader); +public: + static bool is_ext_class_loader(Handle class_loader); + +private: static klassOop find_shared_class(Symbol* class_name); // Setup link to hierarchy static void add_to_hierarchy(instanceKlassHandle k, TRAPS); -private: // We pass in the hashtable index so we can calculate it outside of // the SystemDictionary_lock.
--- a/src/share/vm/classfile/vmSymbols.hpp Tue Nov 28 12:14:30 2017 +0100 +++ b/src/share/vm/classfile/vmSymbols.hpp Fri Oct 27 20:39:22 2017 +0100 @@ -112,6 +112,7 @@ template(sun_jkernel_DownloadManager, "sun/jkernel/DownloadManager") \ template(getBootClassPathEntryForClass_name, "getBootClassPathEntryForClass") \ template(sun_misc_PostVMInitHook, "sun/misc/PostVMInitHook") \ + template(sun_misc_Launcher_ExtClassLoader, "sun/misc/Launcher$ExtClassLoader") \ \ /* class file format tags */ \ template(tag_source_file, "SourceFile") \
--- a/src/share/vm/prims/jvm.cpp Tue Nov 28 12:14:30 2017 +0100 +++ b/src/share/vm/prims/jvm.cpp Fri Oct 27 20:39:22 2017 +0100 @@ -3473,8 +3473,9 @@ JVM_END -// Return the first non-null class loader up the execution stack, or null -// if only code from the null class loader is on the stack. +// Returns first non-privileged class loader on the stack (excluding reflection +// generated frames) or null if only classes loaded by the boot class loader +// and extension class loader are found on the stack. JVM_ENTRY(jobject, JVM_LatestUserDefinedLoader(JNIEnv *env)) for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) { @@ -3482,7 +3483,7 @@ vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection klassOop holder = vfst.method()->method_holder(); oop loader = instanceKlass::cast(holder)->class_loader(); - if (loader != NULL) { + if (loader != NULL && !SystemDictionary::is_ext_class_loader(loader)) { return JNIHandles::make_local(env, loader); } }