Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/jvm.cpp @ 388:f008d3631bd1
6755845: JVM_FindClassFromBoot triggers assertions
Summary: Fixes assertions caused by one jvm_entry calling another, solved by refactoring code and modified gamma test.
Reviewed-by: dholmes, xlu
author | ksrini |
---|---|
date | Wed, 08 Oct 2008 08:10:51 -0700 |
parents | 1ee8caae33af |
children | a45484ea312d |
comparison
equal
deleted
inserted
replaced
387:fad66fdcb7fc | 388:f008d3631bd1 |
---|---|
626 JVM_ENTRY(void, JVM_ResolveClass(JNIEnv* env, jclass cls)) | 626 JVM_ENTRY(void, JVM_ResolveClass(JNIEnv* env, jclass cls)) |
627 JVMWrapper("JVM_ResolveClass"); | 627 JVMWrapper("JVM_ResolveClass"); |
628 if (PrintJVMWarnings) warning("JVM_ResolveClass not implemented"); | 628 if (PrintJVMWarnings) warning("JVM_ResolveClass not implemented"); |
629 JVM_END | 629 JVM_END |
630 | 630 |
631 // Common implementation for JVM_FindClassFromBootLoader and | |
632 // JVM_FindClassFromLoader | |
633 static jclass jvm_find_class_from_class_loader(JNIEnv* env, const char* name, | |
634 jboolean init, jobject loader, | |
635 jboolean throwError, TRAPS) { | |
636 // Java libraries should ensure that name is never null... | |
637 if (name == NULL || (int)strlen(name) > symbolOopDesc::max_length()) { | |
638 // It's impossible to create this class; the name cannot fit | |
639 // into the constant pool. | |
640 if (throwError) { | |
641 THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name); | |
642 } else { | |
643 THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name); | |
644 } | |
645 } | |
646 symbolHandle h_name = oopFactory::new_symbol_handle(name, CHECK_NULL); | |
647 Handle h_loader(THREAD, JNIHandles::resolve(loader)); | |
648 jclass result = find_class_from_class_loader(env, h_name, init, h_loader, | |
649 Handle(), throwError, THREAD); | |
650 | |
651 if (TraceClassResolution && result != NULL) { | |
652 trace_class_resolution(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(result))); | |
653 } | |
654 return result; | |
655 } | |
656 | |
631 // Rationale behind JVM_FindClassFromBootLoader | 657 // Rationale behind JVM_FindClassFromBootLoader |
632 // a> JVM_FindClassFromClassLoader was never exported in the export tables. | 658 // a> JVM_FindClassFromClassLoader was never exported in the export tables. |
633 // b> because of (a) java.dll has a direct dependecy on the unexported | 659 // b> because of (a) java.dll has a direct dependecy on the unexported |
634 // private symbol "_JVM_FindClassFromClassLoader@20". | 660 // private symbol "_JVM_FindClassFromClassLoader@20". |
635 // c> the launcher cannot use the private symbol as it dynamically opens | 661 // c> the launcher cannot use the private symbol as it dynamically opens |
647 JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env, | 673 JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env, |
648 const char* name, | 674 const char* name, |
649 jboolean throwError)) | 675 jboolean throwError)) |
650 JVMWrapper3("JVM_FindClassFromBootLoader %s throw %s", name, | 676 JVMWrapper3("JVM_FindClassFromBootLoader %s throw %s", name, |
651 throwError ? "error" : "exception"); | 677 throwError ? "error" : "exception"); |
652 return JVM_FindClassFromClassLoader(env, name, JNI_FALSE, | 678 return jvm_find_class_from_class_loader(env, name, JNI_FALSE, |
653 (jobject)NULL, throwError); | 679 (jobject)NULL, throwError, THREAD); |
654 JVM_END | 680 JVM_END |
655 | 681 |
656 JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name, | 682 JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name, |
657 jboolean init, jobject loader, | 683 jboolean init, jobject loader, |
658 jboolean throwError)) | 684 jboolean throwError)) |
659 JVMWrapper3("JVM_FindClassFromClassLoader %s throw %s", name, | 685 JVMWrapper3("JVM_FindClassFromClassLoader %s throw %s", name, |
660 throwError ? "error" : "exception"); | 686 throwError ? "error" : "exception"); |
661 // Java libraries should ensure that name is never null... | 687 return jvm_find_class_from_class_loader(env, name, init, loader, |
662 if (name == NULL || (int)strlen(name) > symbolOopDesc::max_length()) { | 688 throwError, THREAD); |
663 // It's impossible to create this class; the name cannot fit | |
664 // into the constant pool. | |
665 if (throwError) { | |
666 THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name); | |
667 } else { | |
668 THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name); | |
669 } | |
670 } | |
671 symbolHandle h_name = oopFactory::new_symbol_handle(name, CHECK_NULL); | |
672 Handle h_loader(THREAD, JNIHandles::resolve(loader)); | |
673 jclass result = find_class_from_class_loader(env, h_name, init, h_loader, | |
674 Handle(), throwError, thread); | |
675 | |
676 if (TraceClassResolution && result != NULL) { | |
677 trace_class_resolution(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(result))); | |
678 } | |
679 | |
680 return result; | |
681 JVM_END | 689 JVM_END |
682 | 690 |
683 | 691 |
684 JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name, | 692 JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name, |
685 jboolean init, jclass from)) | 693 jboolean init, jclass from)) |