< prev index next >

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Print this page




 585   if (!InstanceKlass::cast(klass)->is_linked()) {
 586     THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Class %s must be linked", klass->external_name()));
 587   }
 588   return LinkResolver::vtable_index_of_interface_method(klass, method);
 589 C2V_END
 590 
 591 C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject receiver_jvmci_type, jobject jvmci_method, jobject caller_jvmci_type))
 592   Klass* recv_klass = CompilerToVM::asKlass(receiver_jvmci_type);
 593   Klass* caller_klass = CompilerToVM::asKlass(caller_jvmci_type);
 594   methodHandle method = CompilerToVM::asMethod(jvmci_method);
 595 
 596   Klass* resolved     = method->method_holder();
 597   Symbol* h_name      = method->name();
 598   Symbol* h_signature = method->signature();
 599 
 600   if (MethodHandles::is_signature_polymorphic_method(method())) {
 601       // Signature polymorphic methods are already resolved, JVMCI just returns NULL in this case.
 602       return NULL;
 603   }
 604 










 605   LinkInfo link_info(resolved, h_name, h_signature, caller_klass);
 606   methodHandle m;
 607   // Only do exact lookup if receiver klass has been linked.  Otherwise,
 608   // the vtable has not been setup, and the LinkResolver will fail.
 609   if (recv_klass->is_array_klass() ||
 610       (InstanceKlass::cast(recv_klass)->is_linked() && !recv_klass->is_interface())) {
 611     if (resolved->is_interface()) {
 612       m = LinkResolver::resolve_interface_call_or_null(recv_klass, link_info);
 613     } else {
 614       m = LinkResolver::resolve_virtual_call_or_null(recv_klass, link_info);
 615     }
 616   }
 617 
 618   if (m.is_null()) {
 619     // Return NULL if there was a problem with lookup (uninitialized class, etc.)
 620     return NULL;
 621   }
 622 
 623   oop result = CompilerToVM::get_jvmci_method(m, CHECK_NULL);
 624   return JNIHandles::make_local(THREAD, result);




 585   if (!InstanceKlass::cast(klass)->is_linked()) {
 586     THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Class %s must be linked", klass->external_name()));
 587   }
 588   return LinkResolver::vtable_index_of_interface_method(klass, method);
 589 C2V_END
 590 
 591 C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject receiver_jvmci_type, jobject jvmci_method, jobject caller_jvmci_type))
 592   Klass* recv_klass = CompilerToVM::asKlass(receiver_jvmci_type);
 593   Klass* caller_klass = CompilerToVM::asKlass(caller_jvmci_type);
 594   methodHandle method = CompilerToVM::asMethod(jvmci_method);
 595 
 596   Klass* resolved     = method->method_holder();
 597   Symbol* h_name      = method->name();
 598   Symbol* h_signature = method->signature();
 599 
 600   if (MethodHandles::is_signature_polymorphic_method(method())) {
 601       // Signature polymorphic methods are already resolved, JVMCI just returns NULL in this case.
 602       return NULL;
 603   }
 604 
 605   if (method->name() == vmSymbols::clone_name() &&
 606       resolved == SystemDictionary::Object_klass() &&
 607       recv_klass->is_array_klass()) {
 608     // Resolution of the clone method on arrays always returns Object.clone even though that method
 609     // has protected access.  There's some trickery in the access checking to make this all work out
 610     // so it's necessary to pass in the array class as the resolved class to properly trigger this.
 611     // Otherwise it's impossible to resolve the array clone methods through JVMCI.
 612     resolved = recv_klass;
 613   }
 614 
 615   LinkInfo link_info(resolved, h_name, h_signature, caller_klass);
 616   methodHandle m;
 617   // Only do exact lookup if receiver klass has been linked.  Otherwise,
 618   // the vtable has not been setup, and the LinkResolver will fail.
 619   if (recv_klass->is_array_klass() ||
 620       (InstanceKlass::cast(recv_klass)->is_linked() && !recv_klass->is_interface())) {
 621     if (resolved->is_interface()) {
 622       m = LinkResolver::resolve_interface_call_or_null(recv_klass, link_info);
 623     } else {
 624       m = LinkResolver::resolve_virtual_call_or_null(recv_klass, link_info);
 625     }
 626   }
 627 
 628   if (m.is_null()) {
 629     // Return NULL if there was a problem with lookup (uninitialized class, etc.)
 630     return NULL;
 631   }
 632 
 633   oop result = CompilerToVM::get_jvmci_method(m, CHECK_NULL);
 634   return JNIHandles::make_local(THREAD, result);


< prev index next >