src/share/vm/code/nmethod.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/code/nmethod.cpp	Fri Jan 28 11:12:47 2011
--- new/src/share/vm/code/nmethod.cpp	Fri Jan 28 11:12:47 2011

*** 32,41 **** --- 32,42 ---- #include "compiler/compilerOracle.hpp" #include "compiler/disassembler.hpp" #include "interpreter/bytecode.hpp" #include "oops/methodDataOop.hpp" #include "prims/jvmtiRedefineClassesTrace.hpp" + #include "prims/jvmtiImpl.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/sweeper.hpp" #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/xmlstream.hpp"
*** 1531,1541 **** --- 1532,1545 ---- JvmtiExport::should_post_compiled_method_unload()) { get_and_cache_jmethod_id(); } if (JvmtiExport::should_post_compiled_method_load()) { JvmtiExport::post_compiled_method_load(this); + // Let the Service thread (which is a real Java thread) post the event + MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag); + JvmtiDeferredEventQueue::enqueue( + JvmtiDeferredEvent::compiled_method_loaded_event(this)); } } jmethodID nmethod::get_and_cache_jmethod_id() { if (_jmethod_id == NULL) {
*** 1565,1576 **** --- 1569,1590 ---- // 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, insts_begin()); ! JvmtiDeferredEvent event = + JvmtiDeferredEvent::compiled_method_unloaded_event( + _jmethod_id, insts_begin()); + if (SafepointSynchronize::is_at_safepoint()) { + // Don't want to take the queueing lock. Add it as pending and + // it will get enqueued later. + JvmtiDeferredEventQueue::add_pending_event(event); + } else { + MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag); + JvmtiDeferredEventQueue::enqueue(event); } + } // 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 // attempt to report the event in the unlikely scenario where the

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