harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r448717 - in /incubator/harmony/enhanced/drlvm/trunk/vm: interpreter/src/ vmcore/src/jvmti/ vmcore/src/util/linux/
Date Thu, 21 Sep 2006 22:21:17 GMT
Author: geirm
Date: Thu Sep 21 15:21:15 2006
New Revision: 448717

URL: http://svn.apache.org/viewvc?view=rev&rev=448717
Log:
HARMONY-1511

This is a patch with several small bugfixes for JVMTI unrelated directly to single step implementation.
The following 
problems are fixed:

- Field watches callback from JIT should have RAISE_AREA set since it is not an unwindable
code
- Stack trace on JIT should skip top level VM internal java methods because they are not supposed
to be shown to user
- Only on interpreter should VM search for breakpoints in the instrumented method bytecode
because on JIT this 
bytecode is not touched, the compiled code is changed instead
- When running on interpreter SingleStep event should be sent before Breakpoint event according
to JVMTI spec. ATM 
there have reverse order

Applied and tested on Ubuntu 6


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter_ti.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_watch.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp?view=diff&rev=448717&r1=448716&r2=448717
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp Thu Sep 21 15:21:15
2006
@@ -2547,6 +2547,8 @@
         vm_monitor_enter_wrapper(ml->monitor);
     }
 
+    bool breakpoint_processed = false;
+
     while (true) {
         uint8 ip0 = *frame.ip;
 
@@ -2563,8 +2565,10 @@
                 }
                 return;
             }
-            if (interpreter_ti_notification_mode
+            if (!breakpoint_processed &&
+                    interpreter_ti_notification_mode
                     & INTERPRETER_TI_SINGLE_STEP_EVENT) {
+                breakpoint_processed = false;
                 single_step_callback(frame);
             }
             //assert(!exn_raised());
@@ -2905,6 +2909,7 @@
             case OPCODE_D2L: Opcode_D2L(frame); break;
             case OPCODE_BREAKPOINT:
                              ip0 = Opcode_BREAKPOINT(frame);
+                             breakpoint_processed = true;
                              goto restart;
 
             case OPCODE_WIDE:
@@ -3234,7 +3239,7 @@
     if (frame.jvmti_pop_frame == POP_FRAME_NOW) {
         setLastStackFrame(frame.prev);
         clear_current_thread_exception();
-        frame.ip -= 3;
+        frame.prev->ip -= 3;
         DEBUG_TRACE("<POP_FRAME> invoke_static }}}\n");
         return;
     }
@@ -3520,7 +3525,7 @@
     if (frame.jvmti_pop_frame == POP_FRAME_NOW) {
         setLastStackFrame(frame.prev);
         clear_current_thread_exception();
-        frame.ip -= 3;
+        frame.prev->ip -= 3;
         DEBUG_TRACE("<POP_FRAME> invoke_special }}}\n");
         return;
     }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter_ti.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter_ti.cpp?view=diff&rev=448717&r1=448716&r2=448717
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter_ti.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter_ti.cpp Thu Sep 21
15:21:15 2006
@@ -489,7 +489,6 @@
 
 void single_step_callback(StackFrame &frame) {
     uint8 ip0 = *frame.ip;
-    if (ip0 == OPCODE_BREAKPOINT) return;
     hythread_suspend_enable();
     Method *method = frame.method;
     

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp?view=diff&rev=448717&r1=448716&r2=448717
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_method.cpp Thu Sep 21
15:21:15 2006
@@ -34,6 +34,8 @@
 #include "suspend_checker.h"
 #include "jvmti_internal.h"
 #include "environment.h"
+#include "exceptions.h"
+#include "interpreter_exports.h"
 
 /*
  * Get Method Name (and Signature)
@@ -524,19 +526,22 @@
     if( err != JVMTI_ERROR_NONE ) return err;
     memcpy( *bytecodes_ptr, mtd->get_byte_code_addr(), *bytecode_count_ptr );
 
-    TIEnv *p_env = (TIEnv *)env;
-    DebugUtilsTI *ti = p_env->vm->vm_env->TI;
+    if (interpreter_enabled())
+    {
+        TIEnv *p_env = (TIEnv *)env;
+        DebugUtilsTI *ti = p_env->vm->vm_env->TI;
 
-    LMAutoUnlock lock(&ti->brkpntlst_lock);
+        LMAutoUnlock lock(&ti->brkpntlst_lock);
 
-    if (!ti->have_breakpoint(method))
-        return JVMTI_ERROR_NONE;
+        if (!ti->have_breakpoint(method))
+            return JVMTI_ERROR_NONE;
 
-    for (BreakPoint* bpt = ti->find_first_bpt(method); bpt;
-         bpt = ti->find_next_bpt(bpt, method))
-    {
-        (*bytecodes_ptr)[bpt->location] =
-            (unsigned char)(POINTER_SIZE_INT) bpt->id;
+        for (BreakPoint* bpt = ti->find_first_bpt(method); bpt;
+             bpt = ti->find_next_bpt(bpt, method))
+        {
+            (*bytecodes_ptr)[bpt->location] =
+                (unsigned char)(POINTER_SIZE_INT) bpt->id;
+        }
     }
 
     return JVMTI_ERROR_NONE;
@@ -672,11 +677,17 @@
 
 void jvmti_method_enter_callback(Method_Handle method)
 {
+    BEGIN_RAISE_AREA;
+
     jvmti_process_method_entry_event(reinterpret_cast<jmethodID>(method));
+
+    END_RAISE_AREA;
 }
 
 void jvmti_method_exit_callback(Method_Handle method, jvalue* return_value)
 {
+    BEGIN_RAISE_AREA;
+
     Method *m = reinterpret_cast<Method *>(method);
     jmethodID mid = reinterpret_cast<jmethodID>(method);
 
@@ -687,4 +698,6 @@
         jvalue jv = { 0 };
         jvmti_process_method_exit_event(mid, JNI_FALSE, jv);
     }
+
+    END_RAISE_AREA;
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp?view=diff&rev=448717&r1=448716&r2=448717
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_stack.cpp Thu Sep 21
15:21:15 2006
@@ -52,28 +52,27 @@
     jint depth = 0;
     Method_Handle method = NULL;
 
+    jint skip = 0;
+
     while (!si_is_past_end(si))
     {
         method = si_get_method(si);
 
         if (method)
+        {
             depth += 1 + si_get_inline_depth(si);
 
-        si_goto_previous(si);
-    }
-
-    jint skip = 0;
+            Class *clss = method_get_class(method);
+            assert(clss);
 
-    if (method)
-    {
-        Class *clss = method_get_class(method);
-        assert(clss);
-
-        if (strcmp(method_get_name(method), "run") == 0 &&
-            strcmp(class_get_name(clss), "java/lang/VMStart$MainThread") == 0)
-        {
-            skip = 3;
+            if (strcmp(method_get_name(method), "runImpl") == 0 &&
+                strcmp(class_get_name(clss), "java/lang/VMStart$MainThread") == 0)
+            {
+                skip = 3;
+            }
         }
+
+        si_goto_previous(si);
     }
 
     depth -= skip;

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_watch.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_watch.cpp?view=diff&rev=448717&r1=448716&r2=448717
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_watch.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_watch.cpp Thu Sep 21
15:21:15 2006
@@ -43,6 +43,7 @@
 #include "suspend_checker.h"
 #include "jvmti_internal.h"
 #include "environment.h"
+#include "exceptions.h"
 
 
 enum Watch_Type
@@ -311,12 +312,14 @@
                                        jlocation location,
                                        jobject* object)
 {
+    BEGIN_RAISE_AREA;
     tmn_suspend_enable();
 
     jvmti_process_field_access_event(field, (jmethodID) method, location,
              object);
 
     tmn_suspend_disable();
+    END_RAISE_AREA;
 }
 
 void jvmti_field_modification_callback(Field_Handle field,
@@ -325,10 +328,12 @@
                                        jobject* object,
                                        jvalue* new_value)
 {
+    BEGIN_RAISE_AREA;
     tmn_suspend_enable();
 
     jvmti_process_field_modification_event(field, (jmethodID) method, location,
             object, *new_value);
 
     tmn_suspend_disable();
+    END_RAISE_AREA;
 }

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp?view=diff&rev=448717&r1=448716&r2=448717
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp Thu Sep
21 15:21:15 2006
@@ -497,9 +497,12 @@
 
     bool handled = jvmti_send_jit_breakpoint_event(&regs);
     if (handled)
+    {
         linux_regs_to_ucontext(uc, &regs);
+        return;
+    }
 
-    fprintf(stderr, "SIGINT in VM code.\n");
+    fprintf(stderr, "SIGTRAP in VM code.\n");
     linux_ucontext_to_regs(&regs, uc);
     st_print_stack(&regs);
     signal(signum, 0);



Mime
View raw message