143 int signature_len = Bytes::get_Java_u2((address)klass_name + klass_len + 2 + method_name_len); 144 int full_len = 2 + klass_len + 2 + method_name_len + 2 + signature_len; 145 if (!klass_matched || memcmp(_name, meta_name, full_len) != 0) { // Does not match? 146 Thread* thread = Thread::current(); 147 const char* method_name = klass_name + klass_len; 148 m = AOTCodeHeap::find_method(k, thread, method_name); 149 } 150 meta = ((intptr_t)m) | 1; 151 *entry = (Metadata*)meta; // Should be atomic on x64 152 return (Metadata*)m; 153 } 154 } 155 ShouldNotReachHere(); return NULL; 156 } 157 158 void AOTCompiledMethod::do_unloading(bool unloading_occurred) { 159 unload_nmethod_caches(unloading_occurred); 160 } 161 162 bool AOTCompiledMethod::make_not_entrant_helper(int new_state) { 163 // Make sure the method is not flushed in case of a safepoint in code below. 164 methodHandle the_method(method()); 165 NoSafepointVerifier nsv; 166 167 { 168 // Enter critical section. Does not block for safepoint. 169 MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag); 170 171 if (*_state_adr == new_state) { 172 // another thread already performed this transition so nothing 173 // to do, but return false to indicate this. 174 return false; 175 } 176 177 // Change state 178 OrderAccess::storestore(); 179 *_state_adr = new_state; 180 181 // Log the transition once 182 log_state_change(); 183 184 #ifdef TIERED 191 // Remove AOTCompiledMethod from method. 192 if (method() != NULL) { 193 method()->unlink_code(this); 194 } 195 } // leave critical region under CompiledMethod_lock 196 197 198 if (TraceCreateZombies) { 199 ResourceMark m; 200 const char *new_state_str = (new_state == not_entrant) ? "not entrant" : "not used"; 201 tty->print_cr("aot method <" INTPTR_FORMAT "> %s code made %s", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null", new_state_str); 202 } 203 204 return true; 205 } 206 207 #ifdef TIERED 208 bool AOTCompiledMethod::make_entrant() { 209 assert(!method()->is_old(), "reviving evolved method!"); 210 211 // Make sure the method is not flushed in case of a safepoint in code below. 212 methodHandle the_method(method()); 213 NoSafepointVerifier nsv; 214 215 { 216 // Enter critical section. Does not block for safepoint. 217 MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag); 218 219 if (*_state_adr == in_use || *_state_adr == not_entrant) { 220 // another thread already performed this transition so nothing 221 // to do, but return false to indicate this. 222 return false; 223 } 224 225 // Change state 226 OrderAccess::storestore(); 227 *_state_adr = in_use; 228 229 // Log the transition once 230 log_state_change(); 231 } // leave critical region under CompiledMethod_lock 232 233 234 if (TraceCreateZombies) { | 143 int signature_len = Bytes::get_Java_u2((address)klass_name + klass_len + 2 + method_name_len); 144 int full_len = 2 + klass_len + 2 + method_name_len + 2 + signature_len; 145 if (!klass_matched || memcmp(_name, meta_name, full_len) != 0) { // Does not match? 146 Thread* thread = Thread::current(); 147 const char* method_name = klass_name + klass_len; 148 m = AOTCodeHeap::find_method(k, thread, method_name); 149 } 150 meta = ((intptr_t)m) | 1; 151 *entry = (Metadata*)meta; // Should be atomic on x64 152 return (Metadata*)m; 153 } 154 } 155 ShouldNotReachHere(); return NULL; 156 } 157 158 void AOTCompiledMethod::do_unloading(bool unloading_occurred) { 159 unload_nmethod_caches(unloading_occurred); 160 } 161 162 bool AOTCompiledMethod::make_not_entrant_helper(int new_state) { 163 NoSafepointVerifier nsv; 164 165 { 166 // Enter critical section. Does not block for safepoint. 167 MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag); 168 169 if (*_state_adr == new_state) { 170 // another thread already performed this transition so nothing 171 // to do, but return false to indicate this. 172 return false; 173 } 174 175 // Change state 176 OrderAccess::storestore(); 177 *_state_adr = new_state; 178 179 // Log the transition once 180 log_state_change(); 181 182 #ifdef TIERED 189 // Remove AOTCompiledMethod from method. 190 if (method() != NULL) { 191 method()->unlink_code(this); 192 } 193 } // leave critical region under CompiledMethod_lock 194 195 196 if (TraceCreateZombies) { 197 ResourceMark m; 198 const char *new_state_str = (new_state == not_entrant) ? "not entrant" : "not used"; 199 tty->print_cr("aot method <" INTPTR_FORMAT "> %s code made %s", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null", new_state_str); 200 } 201 202 return true; 203 } 204 205 #ifdef TIERED 206 bool AOTCompiledMethod::make_entrant() { 207 assert(!method()->is_old(), "reviving evolved method!"); 208 209 NoSafepointVerifier nsv; 210 { 211 // Enter critical section. Does not block for safepoint. 212 MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag); 213 214 if (*_state_adr == in_use || *_state_adr == not_entrant) { 215 // another thread already performed this transition so nothing 216 // to do, but return false to indicate this. 217 return false; 218 } 219 220 // Change state 221 OrderAccess::storestore(); 222 *_state_adr = in_use; 223 224 // Log the transition once 225 log_state_change(); 226 } // leave critical region under CompiledMethod_lock 227 228 229 if (TraceCreateZombies) { |