comparison src/share/vm/prims/jvmtiExport.cpp @ 2491:0654ee04b214

Merge with OpenJDK.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 22 Apr 2011 15:30:53 +0200
parents f91db74a6810
children 0cddebc420d8
comparison
equal deleted inserted replaced
2490:29246b1d2d3c 2491:0654ee04b214
1803 } 1803 }
1804 } 1804 }
1805 1805
1806 void JvmtiExport::post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) { 1806 void JvmtiExport::post_dynamic_code_generated_internal(const char *name, const void *code_begin, const void *code_end) {
1807 JavaThread* thread = JavaThread::current(); 1807 JavaThread* thread = JavaThread::current();
1808 // In theory everyone coming thru here is in_vm but we need to be certain
1809 // because a callee will do a vm->native transition
1810 ThreadInVMfromUnknown __tiv;
1811
1808 EVT_TRIG_TRACE(JVMTI_EVENT_DYNAMIC_CODE_GENERATED, 1812 EVT_TRIG_TRACE(JVMTI_EVENT_DYNAMIC_CODE_GENERATED,
1809 ("JVMTI [%s] method dynamic code generated event triggered", 1813 ("JVMTI [%s] method dynamic code generated event triggered",
1810 JvmtiTrace::safe_get_thread_name(thread))); 1814 JvmtiTrace::safe_get_thread_name(thread)));
1811 JvmtiEnvIterator it; 1815 JvmtiEnvIterator it;
1812 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { 1816 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {
1824 } 1828 }
1825 } 1829 }
1826 } 1830 }
1827 1831
1828 void JvmtiExport::post_dynamic_code_generated(const char *name, const void *code_begin, const void *code_end) { 1832 void JvmtiExport::post_dynamic_code_generated(const char *name, const void *code_begin, const void *code_end) {
1829 // In theory everyone coming thru here is in_vm but we need to be certain
1830 // because a callee will do a vm->native transition
1831 ThreadInVMfromUnknown __tiv;
1832 jvmtiPhase phase = JvmtiEnv::get_phase(); 1833 jvmtiPhase phase = JvmtiEnv::get_phase();
1833 if (phase == JVMTI_PHASE_PRIMORDIAL || phase == JVMTI_PHASE_START) { 1834 if (phase == JVMTI_PHASE_PRIMORDIAL || phase == JVMTI_PHASE_START) {
1834 post_dynamic_code_generated_internal(name, code_begin, code_end); 1835 post_dynamic_code_generated_internal(name, code_begin, code_end);
1835 return; 1836 } else {
1836 } 1837 // It may not be safe to post the event from this thread. Defer all
1837 1838 // postings to the service thread so that it can perform them in a safe
1838 // Blocks until everything now in the queue has been posted 1839 // context and in-order.
1839 JvmtiDeferredEventQueue::flush_queue(Thread::current()); 1840 MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
1840 1841 JvmtiDeferredEvent event = JvmtiDeferredEvent::dynamic_code_generated_event(
1841 post_dynamic_code_generated_internal(name, code_begin, code_end); 1842 name, code_begin, code_end);
1843 JvmtiDeferredEventQueue::enqueue(event);
1844 }
1842 } 1845 }
1843 1846
1844 1847
1845 // post a DYNAMIC_CODE_GENERATED event for a given environment 1848 // post a DYNAMIC_CODE_GENERATED event for a given environment
1846 // used by GenerateEvents 1849 // used by GenerateEvents