Index: vm/include/open/vm.h =================================================================== --- vm/include/open/vm.h (revision 554688) +++ vm/include/open/vm.h (working copy) @@ -843,7 +843,8 @@ * type_info_is_unboxed returned TRUE. * If the type info is a vector or a general array, return the * class handle for the array type (not the element type). - * Does not leave any exception on stack. + * Invokes class loader with no exception but preserves previously + * raised exception. */ VMEXPORT Class_Handle type_info_get_class_no_exn(Type_Info_Handle tih); Index: vm/vmcore/include/type.h =================================================================== --- vm/vmcore/include/type.h (revision 554688) +++ vm/vmcore/include/type.h (working copy) @@ -91,7 +91,7 @@ // For other types return NULL. Class* load_type_desc(); - bool is_loaded() const {return clss != NULL;} + bool is_loaded(); const String* get_type_name(){ return name; Index: vm/vmcore/src/class_support/C_Interface.cpp =================================================================== --- vm/vmcore/src/class_support/C_Interface.cpp (revision 554688) +++ vm/vmcore/src/class_support/C_Interface.cpp (working copy) @@ -2076,8 +2076,17 @@ Class_Handle type_info_get_class_no_exn(Type_Info_Handle tih) { + // Store raised exception + jthrowable exc_object = exn_get(); + // Workaround to let JIT invoke class loader even if exception is pending + exn_clear(); Class_Handle ch = type_info_get_class(tih); + // To clear exn_class if set exn_clear(); + // Restore saved exception + if (exc_object) + exn_raise_object(exc_object); + return ch; } // type_info_get_class_no_exn @@ -2131,22 +2292,7 @@ } return type_info_is_resolved(td->get_element_type()); case K_Object: - { - bool res = td->is_loaded(); - if (!res) { - const String* typeName = td->get_type_name(); - assert(typeName); - res = td->get_classloader()->LookupClass(typeName) != NULL; - if (res) { - // type descs for some bootstrap classes (e.g. java/lang/Throwable) - // are not initialized by default. Do it here to avoid extra lookups next time - td->load_type_desc(); - assert(td->is_loaded()); - } - } - - return res; - } + return td->is_loaded(); default: ABORT("Unexpected kind"); return 0; Index: vm/vmcore/src/class_support/java_type.cpp =================================================================== --- vm/vmcore/src/class_support/java_type.cpp (revision 554688) +++ vm/vmcore/src/class_support/java_type.cpp (working copy) @@ -146,6 +146,21 @@ } } +bool TypeDesc::is_loaded() +{ + if (clss != NULL) + return true; + + assert(name); + assert(loader); + Class* loaded_class = loader->LookupClass(name); + + if (loaded_class) + clss = loaded_class; + + return (clss != NULL); +} + TypeDesc* TypeDesc::type_desc_create_vector() { TypeDesc* td = get_vector_type();