hotspot/src/share/vm/code/compiledIC.cpp
changeset 25359 8a19ff205f89
parent 24424 2658d7834c6e
child 25486 be44827be5e7
equal deleted inserted replaced
25358:be17a72e2b3b 25359:8a19ff205f89
   157 
   157 
   158 
   158 
   159 //-----------------------------------------------------------------------------
   159 //-----------------------------------------------------------------------------
   160 // High-level access to an inline cache. Guaranteed to be MT-safe.
   160 // High-level access to an inline cache. Guaranteed to be MT-safe.
   161 
   161 
       
   162 CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
       
   163   : _ic_call(call)
       
   164 {
       
   165   address ic_call = call->instruction_address();
       
   166 
       
   167   assert(ic_call != NULL, "ic_call address must be set");
       
   168   assert(nm != NULL, "must pass nmethod");
       
   169   assert(nm->contains(ic_call), "must be in nmethod");
       
   170 
       
   171   // Search for the ic_call at the given address.
       
   172   RelocIterator iter(nm, ic_call, ic_call+1);
       
   173   bool ret = iter.next();
       
   174   assert(ret == true, "relocInfo must exist at this address");
       
   175   assert(iter.addr() == ic_call, "must find ic_call");
       
   176   if (iter.type() == relocInfo::virtual_call_type) {
       
   177     virtual_call_Relocation* r = iter.virtual_call_reloc();
       
   178     _is_optimized = false;
       
   179     _value = nativeMovConstReg_at(r->cached_value());
       
   180   } else {
       
   181     assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
       
   182     _is_optimized = true;
       
   183     _value = NULL;
       
   184   }
       
   185 }
   162 
   186 
   163 bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) {
   187 bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) {
   164   assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
   188   assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
   165   assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic");
   189   assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic");
   166   assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?");
   190   assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?");