Mercurial > hg > graal-jvmci-8
changeset 22584:f94fd2b4f794
CompilerToVM.getVtableIndexForInterfaceMethod check if receiver class is initialized (JDK-8136655)
author | Stefan Anzinger <stefan.anzinger@oracle.com> |
---|---|
date | Fri, 18 Sep 2015 10:49:43 +0200 |
parents | c9f8eec77163 |
children | 678f989f3953 |
files | jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java src/share/vm/jvmci/jvmciCompilerToVM.cpp |
diffstat | 2 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java Fri Sep 18 10:10:55 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java Fri Sep 18 10:49:43 2015 +0200 @@ -516,7 +516,7 @@ * v-table. * * @throws InternalError if {@code type} is an interface or {@code method} is not held by an - * interface + * interface or class represented by {@code type} is not initialized */ native int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectTypeImpl type, HotSpotResolvedJavaMethodImpl method);
--- a/src/share/vm/jvmci/jvmciCompilerToVM.cpp Fri Sep 18 10:10:55 2015 +0200 +++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp Fri Sep 18 10:49:43 2015 +0200 @@ -470,13 +470,19 @@ C2V_VMENTRY(jint, getVtableIndexForInterfaceMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method)) Klass* klass = CompilerToVM::asKlass(jvmci_type); Method* method = CompilerToVM::asMethod(jvmci_method); + err_msg error_message(""); if (klass->is_interface()) { - ResourceMark rm; - THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", klass->external_name())); + error_message = err_msg("Interface %s should be handled in Java code", klass->external_name()); } if (!method->method_holder()->is_interface()) { + error_message = err_msg("Method %s is not held by an interface, this case should be handled in Java code", method->name_and_sig_as_C_string()); + } + if (!InstanceKlass::cast(klass)->is_initialized()) { + error_message = err_msg("Class %s must be initialized", klass->external_name()); + } + if (error_message.size() > 0) { ResourceMark rm; - THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Method %s is not held by an interface, this case should be handled in Java code", method->name_and_sig_as_C_string())); + THROW_MSG_0(vmSymbols::java_lang_InternalError(), error_message); } return LinkResolver::vtable_index_of_interface_method(klass, method); C2V_END