src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6656830 Cdiff src/share/vm/code/nmethod.cpp

src/share/vm/code/nmethod.cpp

Print this page

        

*** 582,591 **** --- 582,592 ---- NOT_PRODUCT(_has_debug_info = false); _oops_do_mark_link = NULL; _method = method; _entry_bci = InvocationEntryBci; + _jmethod_id = NULL; _osr_link = NULL; _scavenge_root_link = NULL; _scavenge_root_state = 0; _saved_nmethod_link = NULL; _compiler = NULL;
*** 675,684 **** --- 676,686 ---- NOT_PRODUCT(_has_debug_info = false); _oops_do_mark_link = NULL; _method = method; _entry_bci = InvocationEntryBci; + _jmethod_id = NULL; _osr_link = NULL; _scavenge_root_link = NULL; _scavenge_root_state = 0; _compiler = NULL; // We have no exception handler or deopt handler make the
*** 782,791 **** --- 784,794 ---- assert_locked_or_safepoint(CodeCache_lock); NOT_PRODUCT(_has_debug_info = false); _oops_do_mark_link = NULL; _method = method; + _jmethod_id = NULL; _compile_id = compile_id; _comp_level = comp_level; _entry_bci = entry_bci; _osr_link = NULL; _scavenge_root_link = NULL;
*** 1486,1500 **** --- 1489,1517 ---- moop->name()->utf8_length(), moop->signature()->bytes(), moop->signature()->utf8_length(), code_begin(), code_size()); + if (JvmtiExport::should_post_compiled_method_load() || + JvmtiExport::should_post_compiled_method_unload()) { + get_and_cache_jmethod_id(); + } + if (JvmtiExport::should_post_compiled_method_load()) { JvmtiExport::post_compiled_method_load(this); } } + jmethodID nmethod::get_and_cache_jmethod_id() { + if (_jmethod_id == NULL) { + // Cache the jmethod_id since it can no longer be looked up once the + // method itself has been marked for unloading. + _jmethod_id = method()->jmethod_id(); + } + return _jmethod_id; + } + void nmethod::post_compiled_method_unload() { if (unload_reported()) { // During unloading we transition to unloaded and then to zombie // and the unloading is reported during the first transition. return;
*** 1502,1517 **** assert(_method != NULL && !is_unloaded(), "just checking"); DTRACE_METHOD_UNLOAD_PROBE(method()); // If a JVMTI agent has enabled the CompiledMethodUnload event then ! // post the event. Sometime later this nmethod will be made a zombie by ! // the sweeper but the methodOop will not be valid at that point. ! if (JvmtiExport::should_post_compiled_method_unload()) { assert(!unload_reported(), "already unloaded"); HandleMark hm; ! JvmtiExport::post_compiled_method_unload(method()->jmethod_id(), code_begin()); } // The JVMTI CompiledMethodUnload event can be enabled or disabled at // any time. As the nmethod is being unloaded now we mark it has // having the unload event reported - this will ensure that we don't --- 1519,1539 ---- assert(_method != NULL && !is_unloaded(), "just checking"); DTRACE_METHOD_UNLOAD_PROBE(method()); // If a JVMTI agent has enabled the CompiledMethodUnload event then ! // post the event. Sometime later this nmethod will be made a zombie ! // by the sweeper but the methodOop will not be valid at that point. ! // If the _jmethod_id is null then no load event was ever requested ! // so don't bother posting the unload. The main reason for this is ! // that the jmethodID is a weak reference to the methodOop so if ! // it's being unloaded there's no way to look it up since the weak ! // ref will have been cleared. ! if (_jmethod_id != NULL && JvmtiExport::should_post_compiled_method_unload()) { assert(!unload_reported(), "already unloaded"); HandleMark hm; ! JvmtiExport::post_compiled_method_unload(_jmethod_id, code_begin()); } // The JVMTI CompiledMethodUnload event can be enabled or disabled at // any time. As the nmethod is being unloaded now we mark it has // having the unload event reported - this will ensure that we don't
src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File