< prev index next >

src/share/vm/opto/library_call.cpp

Print this page




4031     }
4032   } // original reexecute is set back here
4033 
4034   C->set_has_split_ifs(true); // Has chance for split-if optimization
4035   if (!stopped()) {
4036     set_result(newcopy);
4037   }
4038   return true;
4039 }
4040 
4041 
4042 //----------------------generate_virtual_guard---------------------------
4043 // Helper for hashCode and clone.  Peeks inside the vtable to avoid a call.
4044 Node* LibraryCallKit::generate_virtual_guard(Node* obj_klass,
4045                                              RegionNode* slow_region) {
4046   ciMethod* method = callee();
4047   int vtable_index = method->vtable_index();
4048   assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index,
4049          "bad index %d", vtable_index);
4050   // Get the Method* out of the appropriate vtable entry.
4051   int entry_offset  = (InstanceKlass::vtable_start_offset() +
4052                      vtable_index*vtableEntry::size()) * wordSize +
4053                      vtableEntry::method_offset_in_bytes();
4054   Node* entry_addr  = basic_plus_adr(obj_klass, entry_offset);
4055   Node* target_call = make_load(NULL, entry_addr, TypePtr::NOTNULL, T_ADDRESS, MemNode::unordered);
4056 
4057   // Compare the target method with the expected method (e.g., Object.hashCode).
4058   const TypePtr* native_call_addr = TypeMetadataPtr::make(method);
4059 
4060   Node* native_call = makecon(native_call_addr);
4061   Node* chk_native  = _gvn.transform(new CmpPNode(target_call, native_call));
4062   Node* test_native = _gvn.transform(new BoolNode(chk_native, BoolTest::ne));
4063 
4064   return generate_slow_guard(test_native, slow_region);
4065 }
4066 
4067 //-----------------------generate_method_call----------------------------
4068 // Use generate_method_call to make a slow-call to the real
4069 // method if the fast path fails.  An alternative would be to
4070 // use a stub like OptoRuntime::slow_arraycopy_Java.
4071 // This only works for expanding the current library call,
4072 // not another intrinsic.  (E.g., don't use this for making an




4031     }
4032   } // original reexecute is set back here
4033 
4034   C->set_has_split_ifs(true); // Has chance for split-if optimization
4035   if (!stopped()) {
4036     set_result(newcopy);
4037   }
4038   return true;
4039 }
4040 
4041 
4042 //----------------------generate_virtual_guard---------------------------
4043 // Helper for hashCode and clone.  Peeks inside the vtable to avoid a call.
4044 Node* LibraryCallKit::generate_virtual_guard(Node* obj_klass,
4045                                              RegionNode* slow_region) {
4046   ciMethod* method = callee();
4047   int vtable_index = method->vtable_index();
4048   assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index,
4049          "bad index %d", vtable_index);
4050   // Get the Method* out of the appropriate vtable entry.
4051   int entry_offset  = in_bytes(InstanceKlass::vtable_start_offset()) +
4052                      vtable_index*vtableEntry::size_in_bytes() +
4053                      vtableEntry::method_offset_in_bytes();
4054   Node* entry_addr  = basic_plus_adr(obj_klass, entry_offset);
4055   Node* target_call = make_load(NULL, entry_addr, TypePtr::NOTNULL, T_ADDRESS, MemNode::unordered);
4056 
4057   // Compare the target method with the expected method (e.g., Object.hashCode).
4058   const TypePtr* native_call_addr = TypeMetadataPtr::make(method);
4059 
4060   Node* native_call = makecon(native_call_addr);
4061   Node* chk_native  = _gvn.transform(new CmpPNode(target_call, native_call));
4062   Node* test_native = _gvn.transform(new BoolNode(chk_native, BoolTest::ne));
4063 
4064   return generate_slow_guard(test_native, slow_region);
4065 }
4066 
4067 //-----------------------generate_method_call----------------------------
4068 // Use generate_method_call to make a slow-call to the real
4069 // method if the fast path fails.  An alternative would be to
4070 // use a stub like OptoRuntime::slow_arraycopy_Java.
4071 // This only works for expanding the current library call,
4072 // not another intrinsic.  (E.g., don't use this for making an


< prev index next >