Mercurial > hg > graal-compiler
diff src/share/vm/code/nmethod.cpp @ 2211:0cd39a385a72
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@gmail.com> |
---|---|
date | Mon, 21 Feb 2011 19:17:33 +0100 |
parents | d25d4ca69222 bf8517f4e4d0 |
children | d9e4d0aefc90 |
line wrap: on
line diff
--- a/src/share/vm/code/nmethod.cpp Mon Feb 21 19:17:10 2011 +0100 +++ b/src/share/vm/code/nmethod.cpp Mon Feb 21 19:17:33 2011 +0100 @@ -34,6 +34,7 @@ #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" @@ -1550,7 +1551,10 @@ } 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_load_event(this)); } } @@ -1583,8 +1587,17 @@ // 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_unload_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