1887
1888 // post a DynamicCodeGenerated event while holding locks in the VM.
1889 void JvmtiExport::post_dynamic_code_generated_while_holding_locks(const char* name,
1890 address code_begin, address code_end)
1891 {
1892 // register the stub with the current dynamic code event collector
1893 JvmtiThreadState* state = JvmtiThreadState::state_for(JavaThread::current());
1894 // state can only be NULL if the current thread is exiting which
1895 // should not happen since we're trying to post an event
1896 guarantee(state != NULL, "attempt to register stub via an exiting thread");
1897 JvmtiDynamicCodeEventCollector* collector = state->get_dynamic_code_event_collector();
1898 guarantee(collector != NULL, "attempt to register stub without event collector");
1899 collector->register_stub(name, code_begin, code_end);
1900 }
1901
1902 // Collect all the vm internally allocated objects which are visible to java world
1903 void JvmtiExport::record_vm_internal_object_allocation(oop obj) {
1904 Thread* thread = Thread::current_or_null();
1905 if (thread != NULL && thread->is_Java_thread()) {
1906 // Can not take safepoint here.
1907 No_Safepoint_Verifier no_sfpt;
1908 // Can not take safepoint here so can not use state_for to get
1909 // jvmti thread state.
1910 JvmtiThreadState *state = ((JavaThread*)thread)->jvmti_thread_state();
1911 if (state != NULL ) {
1912 // state is non NULL when VMObjectAllocEventCollector is enabled.
1913 JvmtiVMObjectAllocEventCollector *collector;
1914 collector = state->get_vm_object_alloc_event_collector();
1915 if (collector != NULL && collector->is_enabled()) {
1916 // Don't record classes as these will be notified via the ClassLoad
1917 // event.
1918 if (obj->klass() != SystemDictionary::Class_klass()) {
1919 collector->record_allocation(obj);
1920 }
1921 }
1922 }
1923 }
1924 }
1925
1926 void JvmtiExport::post_garbage_collection_finish() {
1927 Thread *thread = Thread::current(); // this event is posted from VM-Thread.
|
1887
1888 // post a DynamicCodeGenerated event while holding locks in the VM.
1889 void JvmtiExport::post_dynamic_code_generated_while_holding_locks(const char* name,
1890 address code_begin, address code_end)
1891 {
1892 // register the stub with the current dynamic code event collector
1893 JvmtiThreadState* state = JvmtiThreadState::state_for(JavaThread::current());
1894 // state can only be NULL if the current thread is exiting which
1895 // should not happen since we're trying to post an event
1896 guarantee(state != NULL, "attempt to register stub via an exiting thread");
1897 JvmtiDynamicCodeEventCollector* collector = state->get_dynamic_code_event_collector();
1898 guarantee(collector != NULL, "attempt to register stub without event collector");
1899 collector->register_stub(name, code_begin, code_end);
1900 }
1901
1902 // Collect all the vm internally allocated objects which are visible to java world
1903 void JvmtiExport::record_vm_internal_object_allocation(oop obj) {
1904 Thread* thread = Thread::current_or_null();
1905 if (thread != NULL && thread->is_Java_thread()) {
1906 // Can not take safepoint here.
1907 NoSafepointVerifier no_sfpt;
1908 // Can not take safepoint here so can not use state_for to get
1909 // jvmti thread state.
1910 JvmtiThreadState *state = ((JavaThread*)thread)->jvmti_thread_state();
1911 if (state != NULL ) {
1912 // state is non NULL when VMObjectAllocEventCollector is enabled.
1913 JvmtiVMObjectAllocEventCollector *collector;
1914 collector = state->get_vm_object_alloc_event_collector();
1915 if (collector != NULL && collector->is_enabled()) {
1916 // Don't record classes as these will be notified via the ClassLoad
1917 // event.
1918 if (obj->klass() != SystemDictionary::Class_klass()) {
1919 collector->record_allocation(obj);
1920 }
1921 }
1922 }
1923 }
1924 }
1925
1926 void JvmtiExport::post_garbage_collection_finish() {
1927 Thread *thread = Thread::current(); // this event is posted from VM-Thread.
|