equal
deleted
inserted
replaced
926 assert(!CompilationPolicy::can_be_osr_compiled(this, comp_level), "sanity check"); |
926 assert(!CompilationPolicy::can_be_osr_compiled(this, comp_level), "sanity check"); |
927 } |
927 } |
928 |
928 |
929 // Revert to using the interpreter and clear out the nmethod |
929 // Revert to using the interpreter and clear out the nmethod |
930 void Method::clear_code(bool acquire_lock /* = true */) { |
930 void Method::clear_code(bool acquire_lock /* = true */) { |
931 MutexLockerEx pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag); |
931 MutexLocker pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag); |
932 // this may be NULL if c2i adapters have not been made yet |
932 // this may be NULL if c2i adapters have not been made yet |
933 // Only should happen at allocate time. |
933 // Only should happen at allocate time. |
934 if (adapter() == NULL) { |
934 if (adapter() == NULL) { |
935 _from_compiled_entry = NULL; |
935 _from_compiled_entry = NULL; |
936 } else { |
936 } else { |
1159 return code == NULL || (code->method() == NULL) || (code->method() == (Method*)this && !code->is_osr_method()); |
1159 return code == NULL || (code->method() == NULL) || (code->method() == (Method*)this && !code->is_osr_method()); |
1160 } |
1160 } |
1161 |
1161 |
1162 // Install compiled code. Instantly it can execute. |
1162 // Install compiled code. Instantly it can execute. |
1163 void Method::set_code(const methodHandle& mh, CompiledMethod *code) { |
1163 void Method::set_code(const methodHandle& mh, CompiledMethod *code) { |
1164 MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag); |
1164 MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag); |
1165 assert( code, "use clear_code to remove code" ); |
1165 assert( code, "use clear_code to remove code" ); |
1166 assert( mh->check_code(), "" ); |
1166 assert( mh->check_code(), "" ); |
1167 |
1167 |
1168 guarantee(mh->adapter() != NULL, "Adapter blob must already exist!"); |
1168 guarantee(mh->adapter() != NULL, "Adapter blob must already exist!"); |
1169 |
1169 |
2062 ClassLoaderData* cld = loader_data; |
2062 ClassLoaderData* cld = loader_data; |
2063 if (!SafepointSynchronize::is_at_safepoint()) { |
2063 if (!SafepointSynchronize::is_at_safepoint()) { |
2064 // Have to add jmethod_ids() to class loader data thread-safely. |
2064 // Have to add jmethod_ids() to class loader data thread-safely. |
2065 // Also have to add the method to the list safely, which the cld lock |
2065 // Also have to add the method to the list safely, which the cld lock |
2066 // protects as well. |
2066 // protects as well. |
2067 MutexLockerEx ml(cld->metaspace_lock(), Mutex::_no_safepoint_check_flag); |
2067 MutexLocker ml(cld->metaspace_lock(), Mutex::_no_safepoint_check_flag); |
2068 if (cld->jmethod_ids() == NULL) { |
2068 if (cld->jmethod_ids() == NULL) { |
2069 cld->set_jmethod_ids(new JNIMethodBlock(capacity)); |
2069 cld->set_jmethod_ids(new JNIMethodBlock(capacity)); |
2070 } else { |
2070 } else { |
2071 cld->jmethod_ids()->ensure_methods(capacity); |
2071 cld->jmethod_ids()->ensure_methods(capacity); |
2072 } |
2072 } |
2086 |
2086 |
2087 if (!SafepointSynchronize::is_at_safepoint()) { |
2087 if (!SafepointSynchronize::is_at_safepoint()) { |
2088 // Have to add jmethod_ids() to class loader data thread-safely. |
2088 // Have to add jmethod_ids() to class loader data thread-safely. |
2089 // Also have to add the method to the list safely, which the cld lock |
2089 // Also have to add the method to the list safely, which the cld lock |
2090 // protects as well. |
2090 // protects as well. |
2091 MutexLockerEx ml(cld->metaspace_lock(), Mutex::_no_safepoint_check_flag); |
2091 MutexLocker ml(cld->metaspace_lock(), Mutex::_no_safepoint_check_flag); |
2092 if (cld->jmethod_ids() == NULL) { |
2092 if (cld->jmethod_ids() == NULL) { |
2093 cld->set_jmethod_ids(new JNIMethodBlock()); |
2093 cld->set_jmethod_ids(new JNIMethodBlock()); |
2094 } |
2094 } |
2095 // jmethodID is a pointer to Method* |
2095 // jmethodID is a pointer to Method* |
2096 return (jmethodID)cld->jmethod_ids()->add_method(m); |
2096 return (jmethodID)cld->jmethod_ids()->add_method(m); |
2380 ptr->_next = nptr; |
2380 ptr->_next = nptr; |
2381 } |
2381 } |
2382 } |
2382 } |
2383 |
2383 |
2384 void Method::print_touched_methods(outputStream* out) { |
2384 void Method::print_touched_methods(outputStream* out) { |
2385 MutexLockerEx ml(Thread::current()->is_VM_thread() ? NULL : TouchedMethodLog_lock); |
2385 MutexLocker ml(Thread::current()->is_VM_thread() ? NULL : TouchedMethodLog_lock); |
2386 out->print_cr("# Method::print_touched_methods version 1"); |
2386 out->print_cr("# Method::print_touched_methods version 1"); |
2387 if (_touched_method_table) { |
2387 if (_touched_method_table) { |
2388 for (int i = 0; i < TOUCHED_METHOD_TABLE_SIZE; i++) { |
2388 for (int i = 0; i < TOUCHED_METHOD_TABLE_SIZE; i++) { |
2389 TouchedMethodRecord* ptr = _touched_method_table[i]; |
2389 TouchedMethodRecord* ptr = _touched_method_table[i]; |
2390 while(ptr) { |
2390 while(ptr) { |