hotspot/src/share/vm/prims/jvm.cpp
changeset 28168 b9139c952329
parent 27694 543f6042c268
child 28731 f7339cba0a6a
equal deleted inserted replaced
28163:322d55d167be 28168:b9139c952329
   698 JVM_END
   698 JVM_END
   699 
   699 
   700 
   700 
   701 // Returns a class loaded by the bootstrap class loader; or null
   701 // Returns a class loaded by the bootstrap class loader; or null
   702 // if not found.  ClassNotFoundException is not thrown.
   702 // if not found.  ClassNotFoundException is not thrown.
   703 //
   703 // FindClassFromBootLoader is exported to the launcher for windows.
   704 // Rationale behind JVM_FindClassFromBootLoader
       
   705 // a> JVM_FindClassFromClassLoader was never exported in the export tables.
       
   706 // b> because of (a) java.dll has a direct dependecy on the  unexported
       
   707 //    private symbol "_JVM_FindClassFromClassLoader@20".
       
   708 // c> the launcher cannot use the private symbol as it dynamically opens
       
   709 //    the entry point, so if something changes, the launcher will fail
       
   710 //    unexpectedly at runtime, it is safest for the launcher to dlopen a
       
   711 //    stable exported interface.
       
   712 // d> re-exporting JVM_FindClassFromClassLoader as public, will cause its
       
   713 //    signature to change from _JVM_FindClassFromClassLoader@20 to
       
   714 //    JVM_FindClassFromClassLoader and will not be backward compatible
       
   715 //    with older JDKs.
       
   716 // Thus a public/stable exported entry point is the right solution,
       
   717 // public here means public in linker semantics, and is exported only
       
   718 // to the JDK, and is not intended to be a public API.
       
   719 
       
   720 JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env,
   704 JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env,
   721                                               const char* name))
   705                                               const char* name))
   722   JVMWrapper2("JVM_FindClassFromBootLoader %s", name);
   706   JVMWrapper2("JVM_FindClassFromBootLoader %s", name);
   723 
   707 
   724   // Java libraries should ensure that name is never null...
   708   // Java libraries should ensure that name is never null...
   736 
   720 
   737   if (TraceClassResolution) {
   721   if (TraceClassResolution) {
   738     trace_class_resolution(k);
   722     trace_class_resolution(k);
   739   }
   723   }
   740   return (jclass) JNIHandles::make_local(env, k->java_mirror());
   724   return (jclass) JNIHandles::make_local(env, k->java_mirror());
   741 JVM_END
       
   742 
       
   743 // Not used; JVM_FindClassFromCaller replaces this.
       
   744 JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name,
       
   745                                                jboolean init, jobject loader,
       
   746                                                jboolean throwError))
       
   747   JVMWrapper3("JVM_FindClassFromClassLoader %s throw %s", name,
       
   748                throwError ? "error" : "exception");
       
   749   // Java libraries should ensure that name is never null...
       
   750   if (name == NULL || (int)strlen(name) > Symbol::max_length()) {
       
   751     // It's impossible to create this class;  the name cannot fit
       
   752     // into the constant pool.
       
   753     if (throwError) {
       
   754       THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name);
       
   755     } else {
       
   756       THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name);
       
   757     }
       
   758   }
       
   759   TempNewSymbol h_name = SymbolTable::new_symbol(name, CHECK_NULL);
       
   760   Handle h_loader(THREAD, JNIHandles::resolve(loader));
       
   761   jclass result = find_class_from_class_loader(env, h_name, init, h_loader,
       
   762                                                Handle(), throwError, THREAD);
       
   763 
       
   764   if (TraceClassResolution && result != NULL) {
       
   765     trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result)));
       
   766   }
       
   767   return result;
       
   768 JVM_END
   725 JVM_END
   769 
   726 
   770 // Find a class with this name in this loader, using the caller's protection domain.
   727 // Find a class with this name in this loader, using the caller's protection domain.
   771 JVM_ENTRY(jclass, JVM_FindClassFromCaller(JNIEnv* env, const char* name,
   728 JVM_ENTRY(jclass, JVM_FindClassFromCaller(JNIEnv* env, const char* name,
   772                                           jboolean init, jobject loader,
   729                                           jboolean init, jobject loader,