Mercurial > hg > truffle
diff src/share/vm/graal/graalCompilerToVM.cpp @ 7027:58dbea9fb973
CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 26 Nov 2012 16:51:43 +0100 |
parents | 6838696d54ac |
children | dd81042f4eb1 |
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompilerToVM.cpp Mon Nov 26 16:18:56 2012 +0100 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Mon Nov 26 16:51:43 2012 +0100 @@ -301,8 +301,9 @@ Symbol* nameSymbol = VmIds::toSymbol(jname); Handle name = JNIHandles::resolve(jname); + assert(nameSymbol != NULL, "name to symbol creation failed"); - oop result; + oop result = NULL; if (nameSymbol == vmSymbols::int_signature()) { result = VMToCompiler::createPrimitiveJavaType((int) T_INT, THREAD); } else if (nameSymbol == vmSymbols::long_signature()) { @@ -323,38 +324,28 @@ result = VMToCompiler::createPrimitiveJavaType((int) T_VOID, THREAD); } else { Klass* resolved_type = NULL; - // if the name isn't in the symbol table then the class isn't loaded anyway... - if (nameSymbol != NULL) { - Handle classloader; - Handle protectionDomain; - if (JNIHandles::resolve(accessingClass) != NULL) { - classloader = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(accessingClass))->class_loader(); - protectionDomain = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(accessingClass))->protection_domain(); - } - if (eagerResolve) { - resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD); + Handle classloader; + Handle protectionDomain; + if (JNIHandles::resolve(accessingClass) != NULL) { + classloader = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(accessingClass))->class_loader(); + protectionDomain = java_lang_Class::as_Klass(HotSpotResolvedJavaType::javaMirror(accessingClass))->protection_domain(); + } + + if (eagerResolve) { + resolved_type = SystemDictionary::resolve_or_fail(nameSymbol, classloader, protectionDomain, true, THREAD); + } else { + resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD); + } + + if (!HAS_PENDING_EXCEPTION) { + if (resolved_type == NULL) { + assert(!eagerResolve, "failed eager resolution should have caused an exception"); + Handle type = VMToCompiler::createUnresolvedJavaType(name, THREAD); + result = type(); } else { - if (FieldType::is_obj(nameSymbol)) { - ResourceMark rm(THREAD); - // Ignore wrapping L and ;. - TempNewSymbol tmp_name = SymbolTable::new_symbol(nameSymbol->as_C_string() + 1, - nameSymbol->utf8_length() - 2, CHECK_NULL); - resolved_type = SystemDictionary::find_instance_or_array_klass(tmp_name, classloader, protectionDomain, THREAD); - } else { - resolved_type = SystemDictionary::find_instance_or_array_klass(nameSymbol, classloader, protectionDomain, THREAD); - } + Handle type = GraalCompiler::createHotSpotResolvedJavaType(resolved_type, name, CHECK_NULL); + result = type(); } - if (HAS_PENDING_EXCEPTION) { - CLEAR_PENDING_EXCEPTION; - resolved_type = NULL; - } - } - if (resolved_type != NULL) { - Handle type = GraalCompiler::createHotSpotResolvedJavaType(resolved_type, name, CHECK_NULL); - result = type(); - } else { - Handle type = VMToCompiler::createUnresolvedJavaType(name, THREAD); - result = type(); } }