equal
deleted
inserted
replaced
163 methodHandle the_method(method()); |
163 methodHandle the_method(method()); |
164 NoSafepointVerifier nsv; |
164 NoSafepointVerifier nsv; |
165 |
165 |
166 { |
166 { |
167 // Enter critical section. Does not block for safepoint. |
167 // Enter critical section. Does not block for safepoint. |
168 MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag); |
168 MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag); |
169 |
169 |
170 if (*_state_adr == new_state) { |
170 if (*_state_adr == new_state) { |
171 // another thread already performed this transition so nothing |
171 // another thread already performed this transition so nothing |
172 // to do, but return false to indicate this. |
172 // to do, but return false to indicate this. |
173 return false; |
173 return false; |
186 method()->set_aot_code(NULL); |
186 method()->set_aot_code(NULL); |
187 } |
187 } |
188 #endif |
188 #endif |
189 |
189 |
190 // Remove AOTCompiledMethod from method. |
190 // Remove AOTCompiledMethod from method. |
191 if (method() != NULL && (method()->code() == this || |
191 if (method() != NULL) { |
192 method()->from_compiled_entry() == verified_entry_point())) { |
192 method()->unlink_code(this); |
193 HandleMark hm; |
193 } |
194 method()->clear_code(false /* already owns Patching_lock */); |
194 } // leave critical region under CompiledMethod_lock |
195 } |
|
196 } // leave critical region under Patching_lock |
|
197 |
195 |
198 |
196 |
199 if (TraceCreateZombies) { |
197 if (TraceCreateZombies) { |
200 ResourceMark m; |
198 ResourceMark m; |
201 const char *new_state_str = (new_state == not_entrant) ? "not entrant" : "not used"; |
199 const char *new_state_str = (new_state == not_entrant) ? "not entrant" : "not used"; |
206 } |
204 } |
207 |
205 |
208 #ifdef TIERED |
206 #ifdef TIERED |
209 bool AOTCompiledMethod::make_entrant() { |
207 bool AOTCompiledMethod::make_entrant() { |
210 assert(!method()->is_old(), "reviving evolved method!"); |
208 assert(!method()->is_old(), "reviving evolved method!"); |
211 assert(*_state_adr != not_entrant, "%s", method()->has_aot_code() ? "has_aot_code() not cleared" : "caller didn't check has_aot_code()"); |
|
212 |
209 |
213 // Make sure the method is not flushed in case of a safepoint in code below. |
210 // Make sure the method is not flushed in case of a safepoint in code below. |
214 methodHandle the_method(method()); |
211 methodHandle the_method(method()); |
215 NoSafepointVerifier nsv; |
212 NoSafepointVerifier nsv; |
216 |
213 |
217 { |
214 { |
218 // Enter critical section. Does not block for safepoint. |
215 // Enter critical section. Does not block for safepoint. |
219 MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag); |
216 MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag); |
220 |
217 |
221 if (*_state_adr == in_use) { |
218 if (*_state_adr == in_use || *_state_adr == not_entrant) { |
222 // another thread already performed this transition so nothing |
219 // another thread already performed this transition so nothing |
223 // to do, but return false to indicate this. |
220 // to do, but return false to indicate this. |
224 return false; |
221 return false; |
225 } |
222 } |
226 |
223 |
228 OrderAccess::storestore(); |
225 OrderAccess::storestore(); |
229 *_state_adr = in_use; |
226 *_state_adr = in_use; |
230 |
227 |
231 // Log the transition once |
228 // Log the transition once |
232 log_state_change(); |
229 log_state_change(); |
233 } // leave critical region under Patching_lock |
230 } // leave critical region under CompiledMethod_lock |
234 |
231 |
235 |
232 |
236 if (TraceCreateZombies) { |
233 if (TraceCreateZombies) { |
237 ResourceMark m; |
234 ResourceMark m; |
238 tty->print_cr("aot method <" INTPTR_FORMAT "> %s code made entrant", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null"); |
235 tty->print_cr("aot method <" INTPTR_FORMAT "> %s code made entrant", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null"); |