src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6934604 Sdiff src/share/vm/opto

src/share/vm/opto/library_call.cpp

Print this page




3686 //-----------------------generate_method_call----------------------------
3687 // Use generate_method_call to make a slow-call to the real
3688 // method if the fast path fails.  An alternative would be to
3689 // use a stub like OptoRuntime::slow_arraycopy_Java.
3690 // This only works for expanding the current library call,
3691 // not another intrinsic.  (E.g., don't use this for making an
3692 // arraycopy call inside of the copyOf intrinsic.)
3693 CallJavaNode*
3694 LibraryCallKit::generate_method_call(vmIntrinsics::ID method_id, bool is_virtual, bool is_static) {
3695   // When compiling the intrinsic method itself, do not use this technique.
3696   guarantee(callee() != C->method(), "cannot make slow-call to self");
3697 
3698   ciMethod* method = callee();
3699   // ensure the JVMS we have will be correct for this call
3700   guarantee(method_id == method->intrinsic_id(), "must match");
3701 
3702   const TypeFunc* tf = TypeFunc::make(method);
3703   CallJavaNode* slow_call;
3704   if (is_static) {
3705     assert(!is_virtual, "");
3706     slow_call = new(C) CallStaticJavaNode(tf,
3707                            SharedRuntime::get_resolve_static_call_stub(),
3708                            method, bci());
3709   } else if (is_virtual) {
3710     null_check_receiver();
3711     int vtable_index = Method::invalid_vtable_index;
3712     if (UseInlineCaches) {
3713       // Suppress the vtable call
3714     } else {
3715       // hashCode and clone are not a miranda methods,
3716       // so the vtable index is fixed.
3717       // No need to use the linkResolver to get it.
3718        vtable_index = method->vtable_index();
3719     }
3720     slow_call = new(C) CallDynamicJavaNode(tf,
3721                           SharedRuntime::get_resolve_virtual_call_stub(),
3722                           method, vtable_index, bci());
3723   } else {  // neither virtual nor static:  opt_virtual
3724     null_check_receiver();
3725     slow_call = new(C) CallStaticJavaNode(tf,
3726                                 SharedRuntime::get_resolve_opt_virtual_call_stub(),
3727                                 method, bci());
3728     slow_call->set_optimized_virtual(true);
3729   }
3730   set_arguments_for_java_call(slow_call);
3731   set_edges_for_java_call(slow_call);
3732   return slow_call;
3733 }
3734 
3735 
3736 //------------------------------inline_native_hashcode--------------------
3737 // Build special case code for calls to hashCode on an object.
3738 bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) {
3739   assert(is_static == callee()->is_static(), "correct intrinsic selection");
3740   assert(!(is_virtual && is_static), "either virtual, special, or static");
3741 
3742   enum { _slow_path = 1, _fast_path, _null_path, PATH_LIMIT };
3743 
3744   RegionNode* result_reg = new(C) RegionNode(PATH_LIMIT);
3745   PhiNode*    result_val = new(C) PhiNode(result_reg,




3686 //-----------------------generate_method_call----------------------------
3687 // Use generate_method_call to make a slow-call to the real
3688 // method if the fast path fails.  An alternative would be to
3689 // use a stub like OptoRuntime::slow_arraycopy_Java.
3690 // This only works for expanding the current library call,
3691 // not another intrinsic.  (E.g., don't use this for making an
3692 // arraycopy call inside of the copyOf intrinsic.)
3693 CallJavaNode*
3694 LibraryCallKit::generate_method_call(vmIntrinsics::ID method_id, bool is_virtual, bool is_static) {
3695   // When compiling the intrinsic method itself, do not use this technique.
3696   guarantee(callee() != C->method(), "cannot make slow-call to self");
3697 
3698   ciMethod* method = callee();
3699   // ensure the JVMS we have will be correct for this call
3700   guarantee(method_id == method->intrinsic_id(), "must match");
3701 
3702   const TypeFunc* tf = TypeFunc::make(method);
3703   CallJavaNode* slow_call;
3704   if (is_static) {
3705     assert(!is_virtual, "");
3706     slow_call = new(C) CallStaticJavaNode(C, tf,
3707                            SharedRuntime::get_resolve_static_call_stub(),
3708                            method, bci());
3709   } else if (is_virtual) {
3710     null_check_receiver();
3711     int vtable_index = Method::invalid_vtable_index;
3712     if (UseInlineCaches) {
3713       // Suppress the vtable call
3714     } else {
3715       // hashCode and clone are not a miranda methods,
3716       // so the vtable index is fixed.
3717       // No need to use the linkResolver to get it.
3718        vtable_index = method->vtable_index();
3719     }
3720     slow_call = new(C) CallDynamicJavaNode(tf,
3721                           SharedRuntime::get_resolve_virtual_call_stub(),
3722                           method, vtable_index, bci());
3723   } else {  // neither virtual nor static:  opt_virtual
3724     null_check_receiver();
3725     slow_call = new(C) CallStaticJavaNode(C, tf,
3726                                 SharedRuntime::get_resolve_opt_virtual_call_stub(),
3727                                 method, bci());
3728     slow_call->set_optimized_virtual(true);
3729   }
3730   set_arguments_for_java_call(slow_call);
3731   set_edges_for_java_call(slow_call);
3732   return slow_call;
3733 }
3734 
3735 
3736 //------------------------------inline_native_hashcode--------------------
3737 // Build special case code for calls to hashCode on an object.
3738 bool LibraryCallKit::inline_native_hashcode(bool is_virtual, bool is_static) {
3739   assert(is_static == callee()->is_static(), "correct intrinsic selection");
3740   assert(!(is_virtual && is_static), "either virtual, special, or static");
3741 
3742   enum { _slow_path = 1, _fast_path, _null_path, PATH_LIMIT };
3743 
3744   RegionNode* result_reg = new(C) RegionNode(PATH_LIMIT);
3745   PhiNode*    result_val = new(C) PhiNode(result_reg,


src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File