harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r594177 - in /harmony/enhanced/drlvm/trunk/vm: port/src/lil/ vmcore/include/ vmcore/src/class_support/ vmcore/src/gc/ vmcore/src/init/ vmcore/src/jit/ vmcore/src/jni/ vmcore/src/jvmti/ vmcore/src/thread/ vmcore/src/util/em64t/base/ vmcore/s...
Date Mon, 12 Nov 2007 15:19:28 GMT
Author: gshimansky
Date: Mon Nov 12 07:19:25 2007
New Revision: 594177

URL: http://svn.apache.org/viewvc?rev=594177&view=rev
Log:
Applied patch from HARMONY-4862
[drlvm][jvmti] TI->setLocallyDisabled() disables whole TI functionality while should disable TI event reporting only


Modified:
    harmony/enhanced/drlvm/trunk/vm/port/src/lil/lil_code_generator.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_tags.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_monitors.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/compile_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/lil/lil_code_generator.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/lil/lil_code_generator.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/lil/lil_code_generator.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/lil/lil_code_generator.cpp Mon Nov 12 07:19:25 2007
@@ -63,9 +63,11 @@
     
     compile_add_dynamic_generated_code_chunk("unknown", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if(jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED))
+    {
         jvmti_send_dynamic_code_generated_event("unknown", stub,
             (jint)stub_size);
+    }
 
     return stub;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h Mon Nov 12 07:19:25 2007
@@ -107,7 +107,8 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-    
+
+bool jvmti_should_report_event(jvmtiEvent event_type);
 void jvmti_send_vm_start_event(Global_Env *env, JNIEnv *jni_env);
 void jvmti_send_vm_init_event(Global_Env *env);
 void jvmti_send_region_compiled_method_load_event(Method *method, uint32 codeSize, 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h Mon Nov 12 07:19:25 2007
@@ -150,7 +150,7 @@
         jint agent_counter;
         Lock_Manager TIenvs_lock;
         VMBreakPoints* vm_brpt;
-        hythread_tls_key_t TL_ti_enabled; //thread local TI flag
+        hythread_tls_key_t TL_ti_report; //thread local TI flag
 
         // TI event thread data
         vm_thread_t event_thread;
@@ -168,6 +168,10 @@
         Agent *getAgents();
         void setAgents(Agent *agent);
         bool isEnabled();
+        void addEventSubscriber(jvmtiEvent event_type);
+        void removeEventSubscriber(jvmtiEvent event_type);
+        bool hasSubscribersForEvent(jvmtiEvent event_type);
+        bool shouldReportEvent(jvmtiEvent event_type);
         void setEnabled();
         void setDisabled();
 
@@ -175,9 +179,9 @@
         void enableEventThreadCreation();
         void disableEventThreadCreation();
 
-        bool isLocallyEnabled();
-        void setLocallyEnabled();
-        void setLocallyDisabled();
+        bool shouldReportLocally();
+        void doNotReportLocally();
+        void reportLocally();
 
         jvmtiPhase getPhase()
         {
@@ -388,6 +392,7 @@
         bool single_step_enabled;
         bool cml_report_inlined;
         char method_entry_enabled_flag, method_exit_enabled_flag;
+        unsigned event_needed[TOTAL_EVENT_TYPE_NUM];
 }; /* end of class DebugUtilsTI */
 
 jvmtiError add_event_to_thread(jvmtiEnv *env, jvmtiEvent event_type, jthread event_thread);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Prepare.cpp Mon Nov 12 07:19:25 2007
@@ -1268,7 +1268,9 @@
         {
             autoUnlocker.ForceUnlock();
             assert(hythread_is_suspend_enabled());
-            if (init_fields) {
+            if (init_fields
+                && jvmti_should_report_event(JVMTI_EVENT_CLASS_PREPARE))
+            {
                 jvmti_send_class_prepare_event(this);
             }
         }
@@ -1517,7 +1519,9 @@
     {
         autoUnlocker.ForceUnlock();
         assert(hythread_is_suspend_enabled());
-        jvmti_send_class_prepare_event(this);
+        if(jvmti_should_report_event(JVMTI_EVENT_CLASS_PREPARE)) {
+            jvmti_send_class_prepare_event(this);
+        }
     }
     TRACE2("classloader.prepare", "END class prepare, class name = " << m_name->bytes);
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp Mon Nov 12 07:19:25 2007
@@ -262,9 +262,11 @@
 
     uint8 *redef_buf = NULL;
     int redef_buflen = 0;
-    jvmti_send_class_file_load_hook_event(env, this, class_name,
-        length, bytecode + offset,
-        &redef_buflen, &redef_buf);
+    if(jvmti_should_report_event(JVMTI_EVENT_CLASS_FILE_LOAD_HOOK)) {
+        jvmti_send_class_file_load_hook_event(env, this, class_name,
+            length, bytecode + offset,
+            &redef_buflen, &redef_buf);
+    }
     if(NULL != redef_buf)
     {
         bytecode = redef_buf;
@@ -325,7 +327,9 @@
 
     if(this != env->bootstrap_class_loader || !env->InBootstrap())
     {
-        jvmti_send_class_load_event(env, clss);
+        if(jvmti_should_report_event(JVMTI_EVENT_CLASS_LOAD)) {
+            jvmti_send_class_load_event(env, clss);
+        }
     }
     ++(env->total_loaded_class_count);
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp Mon Nov 12 07:19:25 2007
@@ -46,11 +46,13 @@
 {
     LMAutoUnlock au(& _lock);
 
-    for (iterator i = _entries.begin(); i != _entries.end(); i++) {
-        Entry& e = *i;
-        jvmti_send_region_compiled_method_load_event(e.method, e.codeSize,
-                e.codeAddr, e.mapLength, 
-                e.addrLocationMap, NULL);
+    if(jvmti_should_report_event(JVMTI_EVENT_COMPILED_METHOD_LOAD)) {
+        for (iterator i = _entries.begin(); i != _entries.end(); i++) {
+            Entry& e = *i;
+            jvmti_send_region_compiled_method_load_event(e.method, e.codeSize,
+                    e.codeAddr, e.mapLength, 
+                    e.addrLocationMap, NULL);
+        }
     }
 
 } // InlineInfo::send_compiled_method_load_event

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp Mon Nov 12 07:19:25 2007
@@ -105,7 +105,9 @@
     thread_suspend_time = vm_time_end_hook(&_start_time, &_end_time);
     INFO2("tm.suspend","Thread suspension time: "<< thread_suspend_time <<" mksec");
 
-    jvmti_send_gc_start_event();
+    if(jvmti_should_report_event(JVMTI_EVENT_GARBAGE_COLLECTION_START)) {
+        jvmti_send_gc_start_event();
+    }
 
     if(gc_supports_class_unloading()) class_unloading_clear_mark_bits();
 
@@ -155,7 +157,9 @@
 
     if(gc_supports_class_unloading()) class_unloading_start();
 
-    jvmti_send_gc_finish_event();
+    if(jvmti_should_report_event(JVMTI_EVENT_GARBAGE_COLLECTION_FINISH)) {
+        jvmti_send_gc_finish_event();
+    }
     jvmti_clean_reclaimed_object_tags();
 
     // Run through list of active threads and resume each one of them.

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Mon Nov 12 07:19:25 2007
@@ -578,9 +578,9 @@
     
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
     if (ti->isEnabled()) {
-        ti->setLocallyDisabled();//-----------------------------------V
+        ti->doNotReportLocally();//-----------------------------------V
         vm_execute_java_method_array((jmethodID) constructor, 0, args);
-        ti->setLocallyEnabled();//-----------------------------------^
+        ti->reportLocally();     //-----------------------------------^
     } else {
         vm_execute_java_method_array((jmethodID) constructor, 0, args);
     }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp Mon Nov 12 07:19:25 2007
@@ -703,7 +703,9 @@
     DebugUtilsTI *ti = vm_env->TI;
 
     // Call TI callbacks
-    if (ti->isEnabled() && ti->getPhase() == JVMTI_PHASE_LIVE) {
+    if (jvmti_should_report_event(JVMTI_EVENT_COMPILED_METHOD_LOAD)
+        && ti->getPhase() == JVMTI_PHASE_LIVE)
+    {
         jvmti_send_chunks_compiled_method_load_event(method);
     }
     return JIT_SUCCESS;
@@ -874,7 +876,9 @@
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
 
     // Call TI callbacks
-    if (ti->isEnabled() && ti->getPhase() == JVMTI_PHASE_LIVE) {
+    if (jvmti_should_report_event(JVMTI_EVENT_COMPILED_METHOD_LOAD)
+        && ti->getPhase() == JVMTI_PHASE_LIVE)
+    {
         jvmti_send_region_compiled_method_load_event(method, codeSize,
             codeAddr, mapLength, addrLocationMap, NULL);
     }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp Mon Nov 12 07:19:25 2007
@@ -538,7 +538,9 @@
     jvmti_send_vm_init_event(vm_env);
 
     // Thread start event for the main thread should be sent after VMInit callback has finished.
-    jvmti_send_thread_start_end_event(p_TLS_vmthread, 1);
+    if (jvmti_should_report_event(JVMTI_EVENT_THREAD_START)) {
+        jvmti_send_thread_start_end_event(p_TLS_vmthread, 1);
+    }
 
     // Register created VM.
     APR_RING_INSERT_TAIL(&GLOBAL_VMS, java_vm, JavaVM_Internal, link);
@@ -1532,12 +1534,6 @@
 
     // Now JVMTIThread keeps global reference. Discared temporary global reference.
     jni_env->DeleteGlobalRef(java_thread);
-
-    // Send thread start event.
-    // TODO: Thread start event should be sent before its initial method executes.
-    // 20061207: psrebriy: ThreadStart event is already started in
-    //                     jthread_attach function
-    // jvmti_send_thread_start_end_event(1);
 
     return status == TM_ERROR_NONE ? JNI_OK : JNI_ERR;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp Mon Nov 12 07:19:25 2007
@@ -40,6 +40,7 @@
 #include "port_filepath.h"
 #include "port_dso.h"
 #include <apr_strings.h>
+#include <apr_atomic.h>
 
 #if defined(PLATFORM_NT) && !defined(_WIN64)
 #define AGENT_ONLOAD "_Agent_OnLoad@12"
@@ -337,8 +338,9 @@
     assert(res == JVMTI_ERROR_NONE);
     vm_brpt = new VMBreakPoints();
     assert(vm_brpt);
-    IDATA status = hythread_tls_alloc(&TL_ti_enabled);
+    IDATA status = hythread_tls_alloc(&TL_ti_report);
     assert(status == TM_ERROR_NONE);
+    memset(event_needed, 0, TOTAL_EVENT_TYPE_NUM*sizeof(unsigned));
 
     return;
 }
@@ -346,7 +348,7 @@
 DebugUtilsTI::~DebugUtilsTI()
 {
     ReleaseNotifyLists();
-    hythread_tls_free(TL_ti_enabled);
+    hythread_tls_free(TL_ti_report);
     delete vm_brpt;
     jvmti_destroy_event_thread();
     return;
@@ -717,23 +719,44 @@
     this->agents = agents;
 }
 
-bool DebugUtilsTI::isLocallyEnabled() {
+bool DebugUtilsTI::shouldReportLocally() {
     //default value is that ti enabled on thread level
-    return hythread_tls_get(hythread_self(), this->TL_ti_enabled) == NULL;
+    return hythread_tls_get(hythread_self(), this->TL_ti_report) != NULL;
 }
 
-void DebugUtilsTI::setLocallyEnabled() {
+void DebugUtilsTI::doNotReportLocally() {
     //default value is that ti enabled on thread level
-    hythread_tls_set(hythread_self(), this->TL_ti_enabled, NULL);
+    hythread_tls_set(hythread_self(), this->TL_ti_report, NULL);
 }
 
-void DebugUtilsTI::setLocallyDisabled() {
-    hythread_tls_set(hythread_self(), this->TL_ti_enabled, this);
+void DebugUtilsTI::reportLocally() {
+    hythread_tls_set(hythread_self(), this->TL_ti_report, this);
 }
 
 bool DebugUtilsTI::isEnabled() {
-    return status && isLocallyEnabled();
+    return status;
 }
+
+void DebugUtilsTI::addEventSubscriber(jvmtiEvent event_type) {
+    apr_atomic_inc32((volatile apr_uint32_t*)&(event_needed[event_type - JVMTI_MIN_EVENT_TYPE_VAL]));
+}
+
+void DebugUtilsTI::removeEventSubscriber(jvmtiEvent event_type) {
+    apr_atomic_dec32((volatile apr_uint32_t*)&(event_needed[event_type - JVMTI_MIN_EVENT_TYPE_VAL]));
+}
+
+
+bool DebugUtilsTI::hasSubscribersForEvent(jvmtiEvent event_type) {
+    return event_needed[event_type - JVMTI_MIN_EVENT_TYPE_VAL] != 0;
+}
+
+
+bool DebugUtilsTI::shouldReportEvent(jvmtiEvent event_type) {
+    return isEnabled()
+        && hasSubscribersForEvent(event_type)
+        && shouldReportLocally();
+}
+
 
 void DebugUtilsTI::setEnabled() {
     this->status = true;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break.cpp Mon Nov 12 07:19:25 2007
@@ -52,7 +52,7 @@
             << " :" << bp->location << " :" << bp->addr );
 
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled() || ti->getPhase() != JVMTI_PHASE_LIVE)
+    if (ti->getPhase() != JVMTI_PHASE_LIVE)
         return false;
 
     jlocation location = bp->location;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_break_intf.cpp Mon Nov 12 07:19:25 2007
@@ -616,7 +616,7 @@
     // inside of callbacks
     InstructionDisassembler idisasm(*bp->disasm);
 
-    bool is_enabled = VM_Global_State::loader_env->TI->isLocallyEnabled();
+    bool is_enabled = VM_Global_State::loader_env->TI->shouldReportLocally();
     // if is_enabled is false then we should continue execution without
     // reporting breakpoint event
     for (unsigned priority = 0;
@@ -842,7 +842,7 @@
         << " :" << location );
 
     jbyte orig_byte = bp->saved_byte;
-    bool is_enabled = VM_Global_State::loader_env->TI->isLocallyEnabled();
+    bool is_enabled = VM_Global_State::loader_env->TI->shouldReportLocally();
     // if is_enabled is false then we should continue execution without
     // reporting breakpoint event
     for (unsigned priority = 0;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp Mon Nov 12 07:19:25 2007
@@ -85,6 +85,9 @@
     hythread_t p_thread = jthread_get_native_thread(event_thread);
     TIEventThread *et = p_env->event_threads[event_type - JVMTI_MIN_EVENT_TYPE_VAL];
 
+    // protect event_threads collection
+    hymutex_lock(&(p_env->lock));
+
     // Find out if this environment is already registered on this thread on this event type
     while (NULL != et)
     {
@@ -99,9 +102,14 @@
         return errorCode;
     newet->thread = p_thread;
 
-    // FIXME: dynamic list modification without synchronization
+    // record event is needed
+    VM_Global_State::loader_env->TI->addEventSubscriber(event_type);
+
     newet->next = p_env->event_threads[event_type - JVMTI_MIN_EVENT_TYPE_VAL];
     p_env->event_threads[event_type - JVMTI_MIN_EVENT_TYPE_VAL] = newet;
+
+    // free environment lock
+    hymutex_unlock(&(p_env->lock));
     return JVMTI_ERROR_NONE;
 }
 
@@ -114,11 +122,15 @@
     if (NULL == et)
         return;
 
-    // FIXME: dynamic list modification without synchronization
+    // protect event_threads collection
+    hymutex_lock(&(p_env->lock));
+
     if (et->thread == p_thread)
     {
+        VM_Global_State::loader_env->TI->removeEventSubscriber(event_type);
         p_env->event_threads[event_type - JVMTI_MIN_EVENT_TYPE_VAL] = et->next;
         _deallocate((unsigned char *)et);
+        hymutex_unlock(&(p_env->lock));
         return;
     }
 
@@ -127,25 +139,40 @@
     {
         if (et->next->thread == p_thread)
         {
+            VM_Global_State::loader_env->TI->removeEventSubscriber(event_type);
             TIEventThread *oldet = et->next;
             et->next = oldet->next;
             _deallocate((unsigned char *)oldet);
+            hymutex_unlock(&(p_env->lock));
             return;
         }
         et = et->next;
     }
+
+    // release protection
+    hymutex_unlock(&(p_env->lock));
 }
 
 void add_event_to_global(jvmtiEnv *env, jvmtiEvent event_type)
 {
     TIEnv *p_env = (TIEnv *)env;
+    hymutex_lock(&(p_env->lock));
+    if(!p_env->global_events[event_type - JVMTI_MIN_EVENT_TYPE_VAL]) {
+        VM_Global_State::loader_env->TI->addEventSubscriber(event_type);
+    }
     p_env->global_events[event_type - JVMTI_MIN_EVENT_TYPE_VAL] = true;
+    hymutex_unlock(&(p_env->lock));
 }
 
 void remove_event_from_global(jvmtiEnv *env, jvmtiEvent event_type)
 {
     TIEnv *p_env = (TIEnv *)env;
+    hymutex_lock(&(p_env->lock));
+    if(p_env->global_events[event_type - JVMTI_MIN_EVENT_TYPE_VAL]) {
+        VM_Global_State::loader_env->TI->removeEventSubscriber(event_type);
+    }
     p_env->global_events[event_type - JVMTI_MIN_EVENT_TYPE_VAL] = false;
+    hymutex_unlock(&(p_env->lock));
 }
 
 // disable all events except VM_DEATH
@@ -181,14 +208,7 @@
  */
 jboolean event_enabled(jvmtiEvent event_type) {
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if ( !ti->isEnabled() ) return false;
-
-    for (TIEnv * ti_env = ti -> getEnvironments(); NULL != ti_env; ti_env = ti_env -> next) {
-        if (ti_env->global_events[event_type - JVMTI_MIN_EVENT_TYPE_VAL]) return true;
-        if (ti_env->event_threads[event_type - JVMTI_MIN_EVENT_TYPE_VAL] != 0) return true;
-    }
-
-    return false;
+    return ti->isEnabled() && ti->hasSubscribersForEvent(event_type);
 }
 
 static inline bool
@@ -437,6 +457,10 @@
     return JVMTI_ERROR_NONE;
 }
 
+bool jvmti_should_report_event(jvmtiEvent event_type) {
+    return VM_Global_State::loader_env->TI->shouldReportEvent(event_type);
+}
+
 void jvmti_send_vm_start_event(Global_Env *env, JNIEnv *jni_env)
 {
     DebugUtilsTI *ti = env->TI;
@@ -445,6 +469,10 @@
 
     // Switch phase to VM_Start and sent VMStart event
     ti->nextPhase(JVMTI_PHASE_START);
+
+    if(!jvmti_should_report_event(JVMTI_EVENT_VM_START))
+        return;
+
     // Send VM_Start TI events
     TIEnv *ti_env = ti->getEnvironments();
     TIEnv *next_env;
@@ -466,13 +494,17 @@
     }
     // send notify events
     unsigned index;
-    for( index = 0; index < env->TI->GetNumberPendingNotifyLoadClass(); index++ ) {
-        Class *klass = env->TI->GetPendingNotifyLoadClass( index );
-        jvmti_send_class_load_event(env, klass);
-    }
-    for( index = 0; index < env->TI->GetNumberPendingNotifyPrepareClass(); index++ ) {
-        Class *klass = env->TI->GetPendingNotifyPrepareClass( index );
-        jvmti_send_class_prepare_event(klass);
+    if(jvmti_should_report_event(JVMTI_EVENT_CLASS_LOAD)) {
+        for( index = 0; index < env->TI->GetNumberPendingNotifyLoadClass(); index++ ) {
+            Class *klass = env->TI->GetPendingNotifyLoadClass( index );
+            jvmti_send_class_load_event(env, klass);
+        }
+    }
+    if(jvmti_should_report_event(JVMTI_EVENT_CLASS_PREPARE)) {
+        for( index = 0; index < env->TI->GetNumberPendingNotifyPrepareClass(); index++ ) {
+            Class *klass = env->TI->GetPendingNotifyPrepareClass( index );
+            jvmti_send_class_prepare_event(klass);
+        }
     }
     env->TI->ReleaseNotifyLists();
 }
@@ -487,6 +519,10 @@
 
     // Switch phase to VM_Live and sent VMLive event
     ti->nextPhase(JVMTI_PHASE_LIVE);
+
+    if (!jvmti_should_report_event(JVMTI_EVENT_VM_INIT))
+        return;
+
     tmn_suspend_disable();
     ObjectHandle hThread = oh_allocate_local_handle();
     hThread->object = (Java_java_lang_Thread *)jthread_self()->object;
@@ -684,6 +720,9 @@
     if (!capa.can_generate_compiled_method_load_events)
         return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
 
+    if(!jvmti_should_report_event(JVMTI_EVENT_COMPILED_METHOD_LOAD))
+        return JVMTI_ERROR_NONE;
+
     ClassLoader::LockLoadersTable();
 
     /**
@@ -742,11 +781,13 @@
 
 static jvmtiError generate_events_dynamic_code_generated(jvmtiEnv* env)
 {
-    // FIXME: linked list usage without sync
-    for (DynamicCode *dcList = compile_get_dynamic_code_list();
-        NULL != dcList; dcList = dcList->next)
-        jvmti_send_dynamic_code_generated_event(dcList->name,
-            dcList->address, (jint)dcList->length);
+    if(jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
+        // FIXME: linked list usage without sync
+        for (DynamicCode *dcList = compile_get_dynamic_code_list();
+            NULL != dcList; dcList = dcList->next)
+            jvmti_send_dynamic_code_generated_event(dcList->name,
+                dcList->address, (jint)dcList->length);
+    }
 
     return JVMTI_ERROR_NONE;
 } // generate_events_dynamic_code_generated
@@ -800,7 +841,7 @@
     SuspendDisabledChecker sdc;
 
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled() )
+    if (!jvmti_should_report_event(JVMTI_EVENT_METHOD_ENTRY))
         return;
 
     if (JVMTI_PHASE_LIVE != ti->getPhase())
@@ -965,7 +1006,7 @@
     SuspendDisabledChecker sdc;
 
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled() )
+    if (!jvmti_should_report_event(JVMTI_EVENT_METHOD_EXIT))
         return;
 
     if (JVMTI_PHASE_LIVE != ti->getPhase())
@@ -987,7 +1028,7 @@
     SuspendDisabledChecker sdc;
 
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled() )
+    if (!jvmti_should_report_event(JVMTI_EVENT_METHOD_EXIT))
         return;
 
     if (JVMTI_PHASE_LIVE != ti->getPhase())
@@ -1022,7 +1063,8 @@
     assert(hythread_is_suspend_enabled());
 
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled() ) return;
+    if (!jvmti_should_report_event(JVMTI_EVENT_FRAME_POP))
+        return;
 
     if (JVMTI_PHASE_LIVE != ti->getPhase())
         return;
@@ -1049,7 +1091,7 @@
     SuspendEnabledChecker sec;
 
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if( !ti->isEnabled() )
+    if(!jvmti_should_report_event(JVMTI_EVENT_NATIVE_METHOD_BIND))
         return;
 
     //Checking current phase
@@ -1113,7 +1155,7 @@
 VMEXPORT void
 jvmti_process_single_step_event(jmethodID method, jlocation location) {
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if ( !ti->isEnabled() ) return;
+    if (!ti->isEnabled() ) return;
 
     if (ti->getPhase() != JVMTI_PHASE_LIVE) return;
 
@@ -1180,10 +1222,10 @@
         object->object = managed_object;
     }
 
-    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled() )
+    if (!jvmti_should_report_event(JVMTI_EVENT_FIELD_ACCESS))
         return;
 
+    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
     if (JVMTI_PHASE_LIVE != ti->getPhase())
         return;
 
@@ -1253,7 +1295,7 @@
     }
 
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled() )
+    if (!jvmti_should_report_event(JVMTI_EVENT_FIELD_MODIFICATION))
         return;
 
     if (JVMTI_PHASE_LIVE != ti->getPhase())
@@ -1321,7 +1363,7 @@
     SuspendDisabledChecker sdc;
 
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled() )
+    if (!jvmti_should_report_event(JVMTI_EVENT_VM_OBJECT_ALLOC))
         return;
 
     if (JVMTI_PHASE_LIVE != ti->getPhase())
@@ -1475,10 +1517,10 @@
 
     VM_thread *curr_thread = p_TLS_vmthread;
 
-    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled())
+    if (!jvmti_should_report_event(JVMTI_EVENT_EXCEPTION))
         return;
 
+    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
     if (JVMTI_PHASE_LIVE != ti->getPhase())
         return;
 
@@ -1520,10 +1562,10 @@
     assert(exn_object);
     SuspendDisabledChecker sdc;
 
-    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled())
+    if (!jvmti_should_report_event(JVMTI_EVENT_EXCEPTION))
         return exn_object;
 
+    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
     if (JVMTI_PHASE_LIVE != ti->getPhase())
         return exn_object;
 
@@ -1645,11 +1687,11 @@
     assert(!exn_raised());
     SuspendDisabledChecker sdc;
 
-    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled())
+    if (!jvmti_should_report_event(JVMTI_EVENT_EXCEPTION_CATCH))
         return exn_object;
 
- if (JVMTI_PHASE_LIVE != ti->getPhase())
+    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
+    if (JVMTI_PHASE_LIVE != ti->getPhase())
         return exn_object;
 
     if (!ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_EXCEPTION_EVENT))
@@ -1680,10 +1722,10 @@
     assert(!exn_raised());
     SuspendDisabledChecker sdc;
 
-    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if (!ti->isEnabled())
+    if (!jvmti_should_report_event(JVMTI_EVENT_EXCEPTION_CATCH))
         return;
 
+    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
     if (JVMTI_PHASE_LIVE != ti->getPhase())
         return;
 
@@ -1703,37 +1745,40 @@
         return;
     }
 
-    JNIEnv *jni_env = p_TLS_vmthread->jni_env;
-
-    tmn_suspend_disable();
     // Create local handles frame
     NativeObjectHandles lhs;
-    ObjectHandle hThread = oh_allocate_local_handle();
-    hThread->object = (Java_java_lang_Thread *)jthread_self()->object;
-    tmn_suspend_enable();
+    // ppervov: both hThread and jni_env are initialized lazily on the first use
+    ObjectHandle hThread = NULL;
+    JNIEnv* jni_env = NULL;
 
     TIEnv *ti_env = ti->getEnvironments();
     TIEnv *next_env;
+    jvmtiEvent enter_event_type = isEnter ?
+        JVMTI_EVENT_MONITOR_CONTENDED_ENTER
+        : JVMTI_EVENT_MONITOR_CONTENDED_ENTERED;
     while (NULL != ti_env)
     {
+        void* untyped_func = ti_env->get_event_callback(enter_event_type);
         next_env = ti_env->next;
-        if (isEnter && ti_env->global_events[JVMTI_EVENT_MONITOR_CONTENDED_ENTER -
-                JVMTI_MIN_EVENT_TYPE_VAL])
+        if(untyped_func != NULL
+            && ti_env->global_events[enter_event_type - JVMTI_MIN_EVENT_TYPE_VAL])
         {
-            jvmtiEventMonitorContendedEnter func = (jvmtiEventMonitorContendedEnter)
-                ti_env->get_event_callback(JVMTI_EVENT_MONITOR_CONTENDED_ENTER);
-            if (NULL != func)
-            {
+            if(hThread == NULL) {
+                tmn_suspend_disable();
+                hThread = oh_allocate_local_handle();
+                hThread->object = (Java_java_lang_Thread *)jthread_self()->object;
+                tmn_suspend_enable();
+                jni_env = p_TLS_vmthread->jni_env;
+            }
+            if(isEnter) {
+                assert(enter_event_type == JVMTI_EVENT_MONITOR_CONTENDED_ENTER);
+                jvmtiEventMonitorContendedEnter func =
+                    (jvmtiEventMonitorContendedEnter)untyped_func;
                 func((jvmtiEnv*)ti_env, jni_env, (jthread)hThread, obj);
-            }
-        }
-        else if (! isEnter && ti_env->global_events[JVMTI_EVENT_MONITOR_CONTENDED_ENTERED -
-                JVMTI_MIN_EVENT_TYPE_VAL])
-        {
-            jvmtiEventMonitorContendedEntered func = (jvmtiEventMonitorContendedEntered)
-                ti_env->get_event_callback(JVMTI_EVENT_MONITOR_CONTENDED_ENTERED);
-            if (NULL != func)
-            {
+            } else {
+                assert(enter_event_type == JVMTI_EVENT_MONITOR_CONTENDED_ENTERED);
+                jvmtiEventMonitorContendedEntered func =
+                    (jvmtiEventMonitorContendedEntered)untyped_func;
                 func((jvmtiEnv*)ti_env, jni_env, (jthread)hThread, obj);
             }
         }
@@ -2012,9 +2057,11 @@
     bool unwindable;
     jthrowable excn = NULL;
 
-    if (! ti->isEnabled()) return;
+    if (!jvmti_should_report_event(event_type))
+        return;
+
     unwindable = set_unwindable(false);
-    
+
     if (!unwindable) {
         if (excn = exn_get()) {
             exn_clear();
@@ -2035,9 +2082,8 @@
         if (callback_func) call_callback(event_type, jni_env, ti_env, callback_func, args);
         ti_env = next_env;
     }
-    
+
     assert(!exn_get());
-    
     if (excn) exn_raise_object(excn);
 
     set_unwindable(unwindable);
@@ -2243,9 +2289,8 @@
 {
     assert(hythread_is_suspend_enabled());
     DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
-    if( !ti->isEnabled() ) {
+    if (!jvmti_should_report_event(JVMTI_EVENT_DATA_DUMP_REQUEST))
         return;
-    }
 
     //Checking current phase
     jvmtiPhase phase = ti->getPhase();

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_tags.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_tags.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_tags.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_tags.cpp Mon Nov 12 07:19:25 2007
@@ -174,7 +174,7 @@
     while (NULL != ti_env)
     {
         next_env = ti_env->next;
-        bool send_event = ti_env->global_events[JVMTI_EVENT_OBJECT_FREE - JVMTI_MIN_EVENT_TYPE_VAL];
+        bool send_event = jvmti_should_report_event(JVMTI_EVENT_OBJECT_FREE);
 
         TITags* tags = ti_env->tags;
         if (tags != NULL) {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_thread_group.cpp Mon Nov 12 07:19:25 2007
@@ -226,14 +226,14 @@
             "getActiveChildren","()[Ljava/lang/Object;");
     assert(method);
 
-    ti->setLocallyDisabled();//-----------------------------------V
+    ti->doNotReportLocally();   //------------------V
 
     // by contract this method returns Object[2] array.
     // First element is Object[] array of child Thread objects.
     // Second element is Object[] array of child ThreadGroup objects.
     jobjectArray result = jvmti_test_jenv->CallObjectMethod(group, method);
 
-    ti->setLocallyEnabled();//-----------------------------------^
+    ti->reportLocally();        //------------------^
 
     if (exn_raised())
         return JVMTI_ERROR_INTERNAL;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp Mon Nov 12 07:19:25 2007
@@ -228,6 +228,9 @@
 
         vm_thread->jvmti_thread.jvmti_jit_breakpoints_handling_buffer =
             reinterpret_cast<jbyte *>(addr);
+
+        assert(VM_Global_State::loader_env->TI);
+        VM_Global_State::loader_env->TI->reportLocally();
     }
     ((hythread_t)vm_thread)->java_status = TM_STATUS_INITIALIZED;
 
@@ -248,7 +251,9 @@
     assert(p_vm_thread);
 
     // Send Thread End event
-    jvmti_send_thread_start_end_event(p_vm_thread, 0);
+    if(jvmti_should_report_event(JVMTI_EVENT_THREAD_END)) {
+        jvmti_send_thread_start_end_event(p_vm_thread, 0);
+    }
 
     hythread_suspend_disable();
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_basic.cpp Mon Nov 12 07:19:25 2007
@@ -146,8 +146,10 @@
     status = hythread_global_unlock();
     assert(status == TM_ERROR_NONE);
 
-    // set JVMTI Thread Start event
-    jvmti_send_thread_start_end_event(vm_thread, 1);
+    // send JVMTI Thread Start event
+    if(jvmti_should_report_event(JVMTI_EVENT_THREAD_START)) {
+        jvmti_send_thread_start_end_event(vm_thread, 1);
+    }
 
     jvmtiStartFunction start_jvmti_proc = start_proc_data.proc;
     if (start_jvmti_proc != NULL) {
@@ -299,7 +301,9 @@
 
     // Send Thread Start event.
     assert(hythread_is_alive(native_thread));
-    jvmti_send_thread_start_end_event(vm_thread, 1);
+    if(jvmti_should_report_event(JVMTI_EVENT_THREAD_START)) {
+        jvmti_send_thread_start_end_event(vm_thread, 1);
+    }
     jthread_start_count();
 
     TRACE(("TM: Current thread attached to jthread=%p", java_thread));

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_monitors.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_monitors.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_monitors.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_java_monitors.cpp Mon Nov 12 07:19:25 2007
@@ -106,7 +106,9 @@
         enter_begin = apr_time_now();
         int disable_count = hythread_reset_suspend_disable();
         jthread_set_owned_monitor(monitor);
-        jvmti_send_contended_enter_or_entered_monitor_event(monitor, 1);
+        if(jvmti_should_report_event(JVMTI_EVENT_MONITOR_CONTENDED_ENTER)) {
+            jvmti_send_contended_enter_or_entered_monitor_event(monitor, 1);
+        }
         hythread_set_suspend_disable(disable_count);
     }
 
@@ -140,7 +142,9 @@
 contended_entered:
     if (ti_is_enabled()) {
         int disable_count = hythread_reset_suspend_disable();
-        jvmti_send_contended_enter_or_entered_monitor_event(monitor, 0);
+        if(jvmti_should_report_event(JVMTI_EVENT_MONITOR_CONTENDED_ENTERED)) {
+            jvmti_send_contended_enter_or_entered_monitor_event(monitor, 0);
+        }
         hythread_set_suspend_disable(disable_count);
         // should be moved to event handler
         jvmti_thread_t jvmti_thread =
@@ -314,8 +318,12 @@
         int disable_count = hythread_reset_suspend_disable();
         jthread_set_wait_monitor(monitor);
         jthread_set_owned_monitor(monitor);
-        jvmti_send_wait_monitor_event(monitor, (jlong) millis);
-        jvmti_send_contended_enter_or_entered_monitor_event(monitor, 1);
+        if(jvmti_should_report_event(JVMTI_EVENT_MONITOR_WAIT)) {
+            jvmti_send_wait_monitor_event(monitor, (jlong) millis);
+        }
+        if(jvmti_should_report_event(JVMTI_EVENT_MONITOR_CONTENDED_ENTER)) {
+            jvmti_send_contended_enter_or_entered_monitor_event(monitor, 1);
+        }
         hythread_set_suspend_disable(disable_count);
 
         // should be moved to event handler
@@ -357,9 +365,13 @@
     if (ti_is_enabled()) {
         jthread_add_owned_monitor(monitor);
         int disable_count = hythread_reset_suspend_disable();
-        jvmti_send_contended_enter_or_entered_monitor_event(monitor, 0);
-        jvmti_send_waited_monitor_event(monitor,
-            ((status == APR_TIMEUP) ? (jboolean) 1 : (jboolean) 0));
+        if(jvmti_should_report_event(JVMTI_EVENT_MONITOR_CONTENDED_ENTERED)) {
+            jvmti_send_contended_enter_or_entered_monitor_event(monitor, 0);
+        }
+        if(jvmti_should_report_event(JVMTI_EVENT_MONITOR_WAITED)) {
+            jvmti_send_waited_monitor_event(monitor,
+                ((status == APR_TIMEUP) ? (jboolean) 1 : (jboolean) 0));
+        }
         hythread_set_suspend_disable(disable_count);
         // should be moved to event handler
         jvmti_thread_t jvmti_thread =

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/compile_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/compile_em64t.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/compile_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/compile_em64t.cpp Mon Nov 12 07:19:25 2007
@@ -287,7 +287,9 @@
     if (VM_Global_State::loader_env->TI->isEnabled())
     {
         jvmti_add_dynamic_generated_code_chunk("compile_me_generic", stub, STUB_SIZE);
-        jvmti_send_dynamic_code_generated_event("compile_me_generic", stub, STUB_SIZE);
+        if(jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
+            jvmti_send_dynamic_code_generated_event("compile_me_generic", stub, STUB_SIZE);
+        }
     }
 #endif
 
@@ -334,7 +336,9 @@
         name = (char *)STD_MALLOC(sz);
         sprintf(name, "compileme.%s.%s%s", c, m, d);
         jvmti_add_dynamic_generated_code_chunk(name, stub, STUB_SIZE);
-        jvmti_send_dynamic_code_generated_event(name, stub, STUB_SIZE);
+        if(jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
+            jvmti_send_dynamic_code_generated_event(name, stub, STUB_SIZE);
+        }
     }
 #endif
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/jit_lock_rt_support_em64t.cpp Mon Nov 12 07:19:25 2007
@@ -192,8 +192,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_monitor_enter_static_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_monitor_enter_static_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_monitor_enter_static_naked", ss - stub);
 
@@ -266,8 +267,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_monitor_exit_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_monitor_exit_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_monitor_exit_naked", ss - stub);
 
@@ -300,8 +302,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_monitor_exit_static_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_monitor_exit_static_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_monitor_exit_static_naked", ss - stub);
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp Mon Nov 12 07:19:25 2007
@@ -202,8 +202,9 @@
 
     compile_add_dynamic_generated_code_chunk("compile_me_generic", addr, STUB_SIZE);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("compile_me_generic", addr, STUB_SIZE);
+    }
 
     DUMP_STUB(addr, "compileme_generic", stub - (char *)addr);
 
@@ -238,9 +239,9 @@
     sprintf(name, "compileme.%s.%s%s", c, m, d);
     compile_add_dynamic_generated_code_chunk(name, addr, STUB_SIZE);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event(name, addr, STUB_SIZE);
-
+    }
 
 #ifndef NDEBUG
     static unsigned done = 0;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp Mon Nov 12 07:19:25 2007
@@ -85,17 +85,16 @@
     ss = alu(ss, add_opc,  esp_opnd,  Imm_Opnd(12));
     Imm_Opnd imm(n);
     ss = ret(ss,  imm);
-    
+
     addr = stub;
     assert((ss - stub) <= stub_size);
 
-
     compile_add_dynamic_generated_code_chunk("vm_lshl_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_lshl_naked", stub, stub_size);
+    }
 
-    
     DUMP_STUB(stub, "getaddress__vm_lshl_naked", ss - stub);
 
     return addr;
@@ -144,8 +143,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_lshr_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_lshr_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_lshr_naked", ss - stub);
 
@@ -195,8 +195,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_lushr_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_lushr_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_lushr_naked", ss - stub);
 
@@ -328,8 +329,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_const_lrem_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_const_lrem_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_const_lrem_naked", ss - stub);
 
@@ -534,8 +536,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_const_ldiv_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_const_ldiv_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_const_ldiv_naked", ss - stub);
 
@@ -611,8 +614,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_d2i", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_d2i", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_d2i", ss - stub);
 
@@ -666,8 +670,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_d2l", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_d2l", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_d2l", ss - stub);
 
@@ -788,8 +793,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_f2i", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_f2i", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_f2i", ss - stub);
 
@@ -842,8 +848,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_f2l", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_f2l", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_f2l", ss - stub);
 
@@ -938,8 +945,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_frem", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_frem", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_frem", ss - stub);
 
@@ -987,12 +995,13 @@
 
     compile_add_dynamic_generated_code_chunk("vm_drem", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_drem", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_drem", ss - stub);
 
-    return addr;    
+    return addr;
 } //getaddress__vm_drem
 
 #ifdef VM_STATS // exclude remark in release mode (defined but not used)

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_lock_rt_support_ia32.cpp Mon Nov 12 07:19:25 2007
@@ -298,8 +298,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_monitor_enter_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_monitor_enter_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_monitor_enter_naked", ss - stub);
 
@@ -335,8 +336,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_monitor_enter_static_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_monitor_enter_static_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_monitor_enter_static_naked", ss - stub);
 
@@ -370,8 +372,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_monitor_exit_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_monitor_exit_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_monitor_exit_naked", ss - stub);
 
@@ -404,8 +407,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_monitor_exit_static_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_monitor_exit_static_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_monitor_exit_static_naked", ss - stub);
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp?rev=594177&r1=594176&r2=594177&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp Mon Nov 12 07:19:25 2007
@@ -172,8 +172,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_rt_checkcast", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_rt_checkcast", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_checkcast_naked", ss - stub);
 
@@ -297,8 +298,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_initialize_class_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_initialize_class_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_initialize_class_naked", ss - stub);
 
@@ -379,8 +381,9 @@
 
     compile_add_dynamic_generated_code_chunk("object_allocation_stub_with_thread_pointer", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("object_allocation_stub_with_thread_pointer", stub, stub_size);
+    }
 
     DUMP_STUB(stub, stub_name, ss - stub);
 
@@ -451,8 +454,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_aastore_nullpointer", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_aastore_nullpointer", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "vm_aastore_array_index_out_of_bounds",  ss - stub);
 
@@ -484,8 +488,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_aastore_arraystore", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_aastore_arraystore", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "vm_aastore_arraystore", ss - stub);
 
@@ -637,8 +642,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_new_vector_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_new_vector_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, stub_name, ss - stub);
 
@@ -732,8 +738,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_multinewarray_resolved_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_multinewarray_resolved_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_multianewarray_resolved_naked", ss - stub);
 
@@ -767,8 +774,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_instantiate_cp_string_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_instantiate_cp_string_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_instantiate_cp_string_naked", ss - stub);
 
@@ -840,8 +848,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_get_interface_vtable_old_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_get_interface_vtable_old_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_get_interface_vtable_old_naked", ss - stub);
 
@@ -882,8 +891,9 @@
 
     compile_add_dynamic_generated_code_chunk("setup_java_to_native_frame", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("setup_java_to_native_frame", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__setup_java_to_native_frame", ss - stub);
 
@@ -922,8 +932,9 @@
 
     compile_add_dynamic_generated_code_chunk("pop_java_to_native_frame", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("pop_java_to_native_frame", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__pop_java_to_native_frame", ss - stub);
 
@@ -979,8 +990,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_throw_linking_exception_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_throw_linking_exception_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_throw_linking_exception_naked", ss - stub);
 
@@ -1028,8 +1040,9 @@
 
     compile_add_dynamic_generated_code_chunk("gc_write_barrier_fastcall", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("gc_write_barrier_fastcall", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__gc_write_barrier_fastcall", ss - stub);
 
@@ -1076,8 +1089,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_lrem_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_lrem_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_lrem_naked", ss - stub);
 
@@ -1123,8 +1137,9 @@
 
     compile_add_dynamic_generated_code_chunk("vm_ldiv_naked", stub, stub_size);
 
-    if (VM_Global_State::loader_env->TI->isEnabled())
+    if (jvmti_should_report_event(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) {
         jvmti_send_dynamic_code_generated_event("vm_ldiv_naked", stub, stub_size);
+    }
 
     DUMP_STUB(stub, "getaddress__vm_ldiv_naked", s - stub);
 



Mime
View raw message