comparison 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
comparison
equal deleted inserted replaced
2184:5d801e6b9a80 2211:0cd39a385a72
32 #include "compiler/compilerOracle.hpp" 32 #include "compiler/compilerOracle.hpp"
33 #include "compiler/disassembler.hpp" 33 #include "compiler/disassembler.hpp"
34 #include "interpreter/bytecode.hpp" 34 #include "interpreter/bytecode.hpp"
35 #include "oops/methodDataOop.hpp" 35 #include "oops/methodDataOop.hpp"
36 #include "prims/jvmtiRedefineClassesTrace.hpp" 36 #include "prims/jvmtiRedefineClassesTrace.hpp"
37 #include "prims/jvmtiImpl.hpp"
37 #include "runtime/sharedRuntime.hpp" 38 #include "runtime/sharedRuntime.hpp"
38 #include "runtime/sweeper.hpp" 39 #include "runtime/sweeper.hpp"
39 #include "utilities/dtrace.hpp" 40 #include "utilities/dtrace.hpp"
40 #include "utilities/events.hpp" 41 #include "utilities/events.hpp"
41 #include "utilities/xmlstream.hpp" 42 #include "utilities/xmlstream.hpp"
1548 JvmtiExport::should_post_compiled_method_unload()) { 1549 JvmtiExport::should_post_compiled_method_unload()) {
1549 get_and_cache_jmethod_id(); 1550 get_and_cache_jmethod_id();
1550 } 1551 }
1551 1552
1552 if (JvmtiExport::should_post_compiled_method_load()) { 1553 if (JvmtiExport::should_post_compiled_method_load()) {
1553 JvmtiExport::post_compiled_method_load(this); 1554 // Let the Service thread (which is a real Java thread) post the event
1555 MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
1556 JvmtiDeferredEventQueue::enqueue(
1557 JvmtiDeferredEvent::compiled_method_load_event(this));
1554 } 1558 }
1555 } 1559 }
1556 1560
1557 jmethodID nmethod::get_and_cache_jmethod_id() { 1561 jmethodID nmethod::get_and_cache_jmethod_id() {
1558 if (_jmethod_id == NULL) { 1562 if (_jmethod_id == NULL) {
1581 // that the jmethodID is a weak reference to the methodOop so if 1585 // that the jmethodID is a weak reference to the methodOop so if
1582 // it's being unloaded there's no way to look it up since the weak 1586 // it's being unloaded there's no way to look it up since the weak
1583 // ref will have been cleared. 1587 // ref will have been cleared.
1584 if (_jmethod_id != NULL && JvmtiExport::should_post_compiled_method_unload()) { 1588 if (_jmethod_id != NULL && JvmtiExport::should_post_compiled_method_unload()) {
1585 assert(!unload_reported(), "already unloaded"); 1589 assert(!unload_reported(), "already unloaded");
1586 HandleMark hm; 1590 JvmtiDeferredEvent event =
1587 JvmtiExport::post_compiled_method_unload(_jmethod_id, insts_begin()); 1591 JvmtiDeferredEvent::compiled_method_unload_event(
1592 _jmethod_id, insts_begin());
1593 if (SafepointSynchronize::is_at_safepoint()) {
1594 // Don't want to take the queueing lock. Add it as pending and
1595 // it will get enqueued later.
1596 JvmtiDeferredEventQueue::add_pending_event(event);
1597 } else {
1598 MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
1599 JvmtiDeferredEventQueue::enqueue(event);
1600 }
1588 } 1601 }
1589 1602
1590 // The JVMTI CompiledMethodUnload event can be enabled or disabled at 1603 // The JVMTI CompiledMethodUnload event can be enabled or disabled at
1591 // any time. As the nmethod is being unloaded now we mark it has 1604 // any time. As the nmethod is being unloaded now we mark it has
1592 // having the unload event reported - this will ensure that we don't 1605 // having the unload event reported - this will ensure that we don't