src/hotspot/share/aot/aotCompiledMethod.cpp
changeset 55499 1887e16a5657
parent 55005 9b70ebd131b4
child 58226 408c445d04e8
equal deleted inserted replaced
55487:79c32c7b0992 55499:1887e16a5657
   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(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
   168     MutexLocker pl(Patching_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) {
   191     if (method() != NULL && (method()->code() == this ||
   192       method()->unlink_code(this);
   192                              method()->from_compiled_entry() == verified_entry_point())) {
   193     }
   193       HandleMark hm;
   194   } // leave critical region under CompiledMethod_lock
   194       method()->clear_code(false /* already owns Patching_lock */);
       
   195     }
       
   196   } // leave critical region under Patching_lock
   195 
   197 
   196 
   198 
   197   if (TraceCreateZombies) {
   199   if (TraceCreateZombies) {
   198     ResourceMark m;
   200     ResourceMark m;
   199     const char *new_state_str = (new_state == not_entrant) ? "not entrant" : "not used";
   201     const char *new_state_str = (new_state == not_entrant) ? "not entrant" : "not used";
   212   methodHandle the_method(method());
   214   methodHandle the_method(method());
   213   NoSafepointVerifier nsv;
   215   NoSafepointVerifier nsv;
   214 
   216 
   215   {
   217   {
   216     // Enter critical section.  Does not block for safepoint.
   218     // Enter critical section.  Does not block for safepoint.
   217     MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
   219     MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
   218 
   220 
   219     if (*_state_adr == in_use) {
   221     if (*_state_adr == in_use) {
   220       // another thread already performed this transition so nothing
   222       // another thread already performed this transition so nothing
   221       // to do, but return false to indicate this.
   223       // to do, but return false to indicate this.
   222       return false;
   224       return false;
   226     OrderAccess::storestore();
   228     OrderAccess::storestore();
   227     *_state_adr = in_use;
   229     *_state_adr = in_use;
   228 
   230 
   229     // Log the transition once
   231     // Log the transition once
   230     log_state_change();
   232     log_state_change();
   231   } // leave critical region under CompiledMethod_lock
   233   } // leave critical region under Patching_lock
   232 
   234 
   233 
   235 
   234   if (TraceCreateZombies) {
   236   if (TraceCreateZombies) {
   235     ResourceMark m;
   237     ResourceMark m;
   236     tty->print_cr("aot method <" INTPTR_FORMAT "> %s code made entrant", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null");
   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");