harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r570541 - in /harmony/enhanced/drlvm/trunk/vm: include/open/ jitrino/src/jet/ vmcore/include/ vmcore/src/class_support/ vmcore/src/jvmti/
Date Tue, 28 Aug 2007 19:42:54 GMT
Author: gshimansky
Date: Tue Aug 28 12:42:53 2007
New Revision: 570541

URL: http://svn.apache.org/viewvc?rev=570541&view=rev
Log:
Applied patches from HARMONY-4661
[drlvm][jvmti] MethodEntry and MethodExit event callbacks could be called only when needed


Modified:
    harmony/enhanced/drlvm/trunk/vm/include/open/vm.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/compiler.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sconsts.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sconsts.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/include/open/vm.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/vm.h?rev=570541&r1=570540&r2=570541&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/vm.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/vm.h Tue Aug 28 12:42:53 2007
@@ -1101,6 +1101,20 @@
 // Numbers can include 'm' or 'M' for megabytes, 'k' or 'K' for kilobytes, and 'g' or 'G'
for gigabytes (for example, 32k is the same as 32768).
 VMEXPORT int64 get_numerical_property(const char *property_name, int64 default_value, PropertyTable
table_number);
 
+/**
+ * Returns the address of the global flag that specifies whether
+ * MethodEntry event is enabled. JIT should call this function in case
+ * a method is compiled with exe_notify_method_entry flag set.
+ */
+VMEXPORT char *get_method_entry_flag_address();
+
+/**
+ * Returns the address of the global flag that specifies whether
+ * MethodExit event is enabled. JIT should call this function in case
+ * a method is compiled with exe_notify_method_entry flag set.
+ */
+VMEXPORT char *get_method_exit_flag_address();
+
 ////
 // end miscellaneous functions.
 ////

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp?rev=570541&r1=570540&r2=570541&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/cg_meth.cpp Tue Aug 28 12:42:53 2007
@@ -511,8 +511,17 @@
     // JVMTI method_enter notification
     //
     if (compilation_params.exe_notify_method_entry) {
+        AR ar = valloc(iplatf);
+        Opnd flag_addr(iplatf, ar);
+        mov(flag_addr,Opnd(iplatf,(int_ptr)rt_method_entry_flag_address));
+        Opnd mem(i16, ar, 0);
+        alu(alu_cmp, mem, Opnd(0));
+        unsigned br_off = br(z, 0, 0, taken);
+        
         static const CallSig cs_ti_menter(CCONV_HELPERS, jobj);
         gen_call_vm(cs_ti_menter, rt_helper_ti_method_enter, 0, m_method);
+        
+        patch(br_off, ip());
     }
     
     
@@ -592,6 +601,7 @@
     }
     
     if (compilation_params.exe_notify_method_exit) {
+
         // JVMTI helper takes pointer to return value and method handle
         const CallSig cs_ti_mexit(CCONV_STDCALL, jobj, jobj);
         // The call is a bit unusual, and is processed as follows:
@@ -618,10 +628,20 @@
             lea(retValPtr.as_opnd(), stackTop);
         }
         runlock(retValPtr);
+
+        AR ar = valloc(iplatf);
+        Opnd flag_addr(iplatf, ar);
+        mov(flag_addr,Opnd(iplatf,(int_ptr)rt_method_exit_flag_address));
+        Opnd mem(i16, ar, 0);
+        alu(alu_cmp, mem, Opnd(0));
+        unsigned br_off = br(z, 0, 0, taken);
+
         Val vmeth(jobj, m_method);
         gen_args(cs_ti_mexit, 0, &vmeth, &retValPtr);
         gen_call_vm(cs_ti_mexit, rt_helper_ti_method_exit, cs_ti_mexit.count());
         runlock(cs_ti_mexit);
+
+        patch(br_off, ip());
     }
 
     if (is_f(retType)) {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/compiler.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/compiler.cpp?rev=570541&r1=570540&r2=570541&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/compiler.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/compiler.cpp Tue Aug 28 12:42:53 2007
@@ -1532,6 +1532,8 @@
     //
     rt_array_length_offset = vector_length_offset();
     rt_suspend_req_flag_offset = (unsigned)hythread_tls_get_request_offset();
+    rt_method_entry_flag_address = get_method_entry_flag_address();
+    rt_method_exit_flag_address = get_method_exit_flag_address();
     rt_vtable_offset = object_get_vtable_offset();
     
     Class_Handle clss;

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sconsts.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sconsts.cpp?rev=570541&r1=570540&r2=570541&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sconsts.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sconsts.cpp Tue Aug 28 12:42:53 2007
@@ -78,6 +78,8 @@
 
 unsigned StaticConsts::rt_array_length_offset = NOTHING;
 unsigned StaticConsts::rt_suspend_req_flag_offset = NOTHING;
+char*    StaticConsts::rt_method_entry_flag_address = NULL;
+char*    StaticConsts::rt_method_exit_flag_address = NULL;
 int StaticConsts::rt_vtable_offset = 0;
 
 bool StaticConsts::g_jvmtiMode = false;

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sconsts.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sconsts.h?rev=570541&r1=570540&r2=570541&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sconsts.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/sconsts.h Tue Aug 28 12:42:53 2007
@@ -98,6 +98,18 @@
     static unsigned     rt_suspend_req_flag_offset;
     
     /**
+     * @brief An address of 'method entry flag'.
+     * @see exe_notify_method_enter
+     */
+    static char*        rt_method_entry_flag_address;
+    
+    /**
+     * @brief An address of 'method exit flag'.
+     * @see exe_notify_method_exit
+     */
+    static char*        rt_method_exit_flag_address;
+    
+    /**
      * @brief Address of helper that returns a pointer to 
         thread local struct.
      * @param none

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=570541&r1=570540&r2=570541&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_internal.h Tue Aug 28 12:42:53 2007
@@ -338,6 +338,36 @@
             cml_report_inlined = value;
         }
 
+        char *get_method_entry_flag_address()
+        {
+            return &method_entry_enabled_flag;
+        }
+
+        char *get_method_exit_flag_address()
+        {
+            return &method_exit_enabled_flag;
+        }
+
+        char get_method_entry_flag()
+        {
+            return method_entry_enabled_flag;
+        }
+
+        char get_method_exit_flag()
+        {
+            return method_exit_enabled_flag;
+        }
+
+        void set_method_entry_flag(char value)
+        {
+            method_entry_enabled_flag = value;
+        }
+
+        void get_method_exit_flag(char value)
+        {
+            method_exit_enabled_flag = value;
+        }
+
     private:
 
     protected:
@@ -357,6 +387,7 @@
         unsigned global_capabilities;
         bool single_step_enabled;
         bool cml_report_inlined;
+        char method_entry_enabled_flag, method_exit_enabled_flag;
 }; /* 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/C_Interface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?rev=570541&r1=570540&r2=570541&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Tue Aug 28 12:42:53
2007
@@ -2928,3 +2928,13 @@
     }
     return false;
 }
+
+char * get_method_entry_flag_address()
+{
+    return VM_Global_State::loader_env->TI->get_method_entry_flag_address();
+}
+
+char * get_method_exit_flag_address()
+{
+    return VM_Global_State::loader_env->TI->get_method_exit_flag_address();
+}

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=570541&r1=570540&r2=570541&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp Tue Aug 28 12:42:53 2007
@@ -325,7 +325,9 @@
     prepareListNumber(0),
     global_capabilities(0),
     single_step_enabled(false),
-    cml_report_inlined(false)
+    cml_report_inlined(false),
+    method_entry_enabled_flag(0),
+    method_exit_enabled_flag(0)
 {
     jvmtiError UNUSED res = _allocate( MAX_NOTIFY_LIST * sizeof(Class**),
         (unsigned char**)&notifyLoadList );

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=570541&r1=570540&r2=570541&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 Tue Aug 28 12:42:53 2007
@@ -383,6 +383,41 @@
                     }
                 }
             }
+            else if(JVMTI_EVENT_METHOD_ENTRY == event_type)
+            {
+                if (JVMTI_ENABLE == mode)
+                {
+                    TRACE2("jvmti.event.method.entry", "ENABLED global method entry flag");
+                    ti->set_method_entry_flag(1);
+                }
+                else if (JVMTI_DISABLE == mode && ti->get_method_entry_flag()
!= 0)
+                {
+                    LMAutoUnlock lock(&ti->TIenvs_lock);
+                    bool disable = check_event_is_disable(JVMTI_EVENT_METHOD_ENTRY, ti);
+                    if (disable) {
+                        TRACE2("jvmti.event.method.entry", "DISABLED global method entry
flag");
+                        ti->set_method_entry_flag(0);
+                    }
+                }
+            }
+            else if(JVMTI_EVENT_METHOD_EXIT == event_type || JVMTI_EVENT_FRAME_POP == event_type)
+            {
+                if (JVMTI_ENABLE == mode)
+                {
+                    TRACE2("jvmti.event.method.exit", "ENABLED global method exit flag");
+                    ti->set_method_entry_flag(1);
+                }
+                else if (JVMTI_DISABLE == mode && ti->get_method_entry_flag()
!= 0)
+                {
+                    LMAutoUnlock lock(&ti->TIenvs_lock);
+                    bool disable = check_event_is_disable(JVMTI_EVENT_METHOD_EXIT, ti) ||
+                        check_event_is_disable(JVMTI_EVENT_FRAME_POP, ti);
+                    if (disable) {
+                        TRACE2("jvmti.event.method.entry", "DISABLED global method entry
flag");
+                        ti->set_method_entry_flag(0);
+                    }
+                }
+            }
         }
         if( JVMTI_EVENT_DATA_DUMP_REQUEST == event_type ) {
             if(JVMTI_ENABLE == mode) {



Mime
View raw message