comparison src/share/vm/code/compiledIC.cpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 aff6ccb506cb
children be896a1983c0
comparison
equal deleted inserted replaced
20184:84105dcdb05b 20804:7848fc12602b
97 } 97 }
98 tty->cr(); 98 tty->cr();
99 } 99 }
100 100
101 { 101 {
102 MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag); 102 MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag);
103 #ifdef ASSERT 103 #ifdef ASSERT
104 CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call); 104 CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call);
105 assert(cb != NULL && cb->is_nmethod(), "must be nmethod"); 105 assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
106 #endif 106 #endif
107 _ic_call->set_destination_mt_safe(entry_point); 107 _ic_call->set_destination_mt_safe(entry_point);
108 } 108 }
109 109
110 if (is_optimized() || is_icstub) { 110 if (is_optimized() || is_icstub) {
111 // Optimized call sites don't have a cache value and ICStub call 111 // Optimized call sites don't have a cache value and ICStub call
112 // sites only change the entry point. Changing the value in that 112 // sites only change the entry point. Changing the value in that
113 // case could lead to MT safety issues. 113 // case could lead to MT safety issues.
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 void CompiledIC::initialize_from_iter(RelocIterator* iter) {
163 assert(iter->addr() == _ic_call->instruction_address(), "must find ic_call");
164
165 if (iter->type() == relocInfo::virtual_call_type) {
166 virtual_call_Relocation* r = iter->virtual_call_reloc();
167 _is_optimized = false;
168 _value = nativeMovConstReg_at(r->cached_value());
169 } else {
170 assert(iter->type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
171 _is_optimized = true;
172 _value = NULL;
173 }
174 }
175
176 CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
177 : _ic_call(call)
178 {
179 address ic_call = _ic_call->instruction_address();
180
181 assert(ic_call != NULL, "ic_call address must be set");
182 assert(nm != NULL, "must pass nmethod");
183 assert(nm->contains(ic_call), "must be in nmethod");
184
185 // Search for the ic_call at the given address.
186 RelocIterator iter(nm, ic_call, ic_call+1);
187 bool ret = iter.next();
188 assert(ret == true, "relocInfo must exist at this address");
189 assert(iter.addr() == ic_call, "must find ic_call");
190
191 initialize_from_iter(&iter);
192 }
193
194 CompiledIC::CompiledIC(RelocIterator* iter)
195 : _ic_call(nativeCall_at(iter->addr()))
196 {
197 address ic_call = _ic_call->instruction_address();
198
199 nmethod* nm = iter->code();
200 assert(ic_call != NULL, "ic_call address must be set");
201 assert(nm != NULL, "must pass nmethod");
202 assert(nm->contains(ic_call), "must be in nmethod");
203
204 initialize_from_iter(iter);
205 }
162 206
163 bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) { 207 bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) {
164 assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), ""); 208 assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
165 assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic"); 209 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?"); 210 assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?");
485 // ---------------------------------------------------------------------------- 529 // ----------------------------------------------------------------------------
486 530
487 void CompiledStaticCall::set_to_clean() { 531 void CompiledStaticCall::set_to_clean() {
488 assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call"); 532 assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call");
489 // Reset call site 533 // Reset call site
490 MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag); 534 MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag);
491 #ifdef ASSERT 535 #ifdef ASSERT
492 CodeBlob* cb = CodeCache::find_blob_unsafe(this); 536 CodeBlob* cb = CodeCache::find_blob_unsafe(this);
493 assert(cb != NULL && cb->is_nmethod(), "must be nmethod"); 537 assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
494 #endif 538 #endif
495 set_destination_mt_safe(SharedRuntime::get_resolve_static_call_stub()); 539 set_destination_mt_safe(SharedRuntime::get_resolve_static_call_stub());
551 info._to_interpreter = false; 595 info._to_interpreter = false;
552 info._entry = m_code->verified_entry_point(); 596 info._entry = m_code->verified_entry_point();
553 } else { 597 } else {
554 // Callee is interpreted code. In any case entering the interpreter 598 // Callee is interpreted code. In any case entering the interpreter
555 // puts a converter-frame on the stack to save arguments. 599 // puts a converter-frame on the stack to save arguments.
600 assert(!m->is_method_handle_intrinsic(), "Compiled code should never call interpreter MH intrinsics");
556 info._to_interpreter = true; 601 info._to_interpreter = true;
557 info._entry = m()->get_c2i_entry(); 602 info._entry = m()->get_c2i_entry();
558 } 603 }
559 } 604 }
560 605