< prev index next >

src/share/vm/opto/library_call.cpp

Print this page




3811     }
3812   } // original reexecute is set back here
3813 
3814   C->set_has_split_ifs(true); // Has chance for split-if optimization
3815   if (!stopped()) {
3816     set_result(newcopy);
3817   }
3818   return true;
3819 }
3820 
3821 
3822 //----------------------generate_virtual_guard---------------------------
3823 // Helper for hashCode and clone.  Peeks inside the vtable to avoid a call.
3824 Node* LibraryCallKit::generate_virtual_guard(Node* obj_klass,
3825                                              RegionNode* slow_region) {
3826   ciMethod* method = callee();
3827   int vtable_index = method->vtable_index();
3828   assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index,
3829          "bad index %d", vtable_index);
3830   // Get the Method* out of the appropriate vtable entry.
3831   int entry_offset  = in_bytes(InstanceKlass::vtable_start_offset()) +
3832                      vtable_index*vtableEntry::size_in_bytes() +
3833                      vtableEntry::method_offset_in_bytes();
3834   Node* entry_addr  = basic_plus_adr(obj_klass, entry_offset);
3835   Node* target_call = make_load(NULL, entry_addr, TypePtr::NOTNULL, T_ADDRESS, MemNode::unordered);
3836 
3837   // Compare the target method with the expected method (e.g., Object.hashCode).
3838   const TypePtr* native_call_addr = TypeMetadataPtr::make(method);
3839 
3840   Node* native_call = makecon(native_call_addr);
3841   Node* chk_native  = _gvn.transform(new CmpPNode(target_call, native_call));
3842   Node* test_native = _gvn.transform(new BoolNode(chk_native, BoolTest::ne));
3843 
3844   return generate_slow_guard(test_native, slow_region);
3845 }
3846 
3847 //-----------------------generate_method_call----------------------------
3848 // Use generate_method_call to make a slow-call to the real
3849 // method if the fast path fails.  An alternative would be to
3850 // use a stub like OptoRuntime::slow_arraycopy_Java.
3851 // This only works for expanding the current library call,




3811     }
3812   } // original reexecute is set back here
3813 
3814   C->set_has_split_ifs(true); // Has chance for split-if optimization
3815   if (!stopped()) {
3816     set_result(newcopy);
3817   }
3818   return true;
3819 }
3820 
3821 
3822 //----------------------generate_virtual_guard---------------------------
3823 // Helper for hashCode and clone.  Peeks inside the vtable to avoid a call.
3824 Node* LibraryCallKit::generate_virtual_guard(Node* obj_klass,
3825                                              RegionNode* slow_region) {
3826   ciMethod* method = callee();
3827   int vtable_index = method->vtable_index();
3828   assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index,
3829          "bad index %d", vtable_index);
3830   // Get the Method* out of the appropriate vtable entry.
3831   int entry_offset  = in_bytes(Klass::vtable_start_offset()) +
3832                      vtable_index*vtableEntry::size_in_bytes() +
3833                      vtableEntry::method_offset_in_bytes();
3834   Node* entry_addr  = basic_plus_adr(obj_klass, entry_offset);
3835   Node* target_call = make_load(NULL, entry_addr, TypePtr::NOTNULL, T_ADDRESS, MemNode::unordered);
3836 
3837   // Compare the target method with the expected method (e.g., Object.hashCode).
3838   const TypePtr* native_call_addr = TypeMetadataPtr::make(method);
3839 
3840   Node* native_call = makecon(native_call_addr);
3841   Node* chk_native  = _gvn.transform(new CmpPNode(target_call, native_call));
3842   Node* test_native = _gvn.transform(new BoolNode(chk_native, BoolTest::ne));
3843 
3844   return generate_slow_guard(test_native, slow_region);
3845 }
3846 
3847 //-----------------------generate_method_call----------------------------
3848 // Use generate_method_call to make a slow-call to the real
3849 // method if the fast path fails.  An alternative would be to
3850 // use a stub like OptoRuntime::slow_arraycopy_Java.
3851 // This only works for expanding the current library call,


< prev index next >