You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2007/02/01 00:53:14 UTC

svn commit: r502050 - in /harmony/enhanced/drlvm/trunk/vm: interpreter/src/interpreter.cpp vmcore/src/exception/exceptions_jit.cpp vmcore/src/jvmti/jvmti_step.cpp

Author: gshimansky
Date: Wed Jan 31 15:53:14 2007
New Revision: 502050

URL: http://svn.apache.org/viewvc?view=rev&rev=502050
Log:
Applied patch for HARMONY-2926 [drlvm][jvmti] JVMTI Exception Callbacks reported at incorrect byte code offset

Tests passed on Ubuntu6 x86, Windows XP x86 and SuSE9 x86_64


Modified:
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp?view=diff&rev=502050&r1=502049&r2=502050
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp Wed Jan 31 15:53:14 2007
@@ -2400,7 +2400,7 @@
 
         if(findExceptionHandler(*frame, exception, &h)) {
             *catch_method = frame->method;
-            *catch_location = frame->ip - (uint8*)(*catch_method)->get_byte_code_addr();
+            *catch_location = h->get_handler_pc();
             return;
         }
         clear_current_thread_exception();

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp?view=diff&rev=502050&r1=502049&r2=502050
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp Wed Jan 31 15:53:14 2007
@@ -194,15 +194,6 @@
     // Save the throw context
     StackIterator *throw_si = si_dup(si);
 
-    // Determine the type of the exception for the type tests below.
-    if (*exn_obj)
-        exn_class = (*exn_obj)->vt()->clss;
-
-#ifdef VM_STATS
-    exn_class->class_thrown();
-    VM_Statistics::get_vm_stats().num_exceptions++;
-#endif // VM_STATS
-
     // Skip first frame if it is an M2nFrame (which is always a transition from managed to the throw code).
     // The M2nFrame will be removed from the thread's M2nFrame list but transfer control or copy to registers.
     if (si_is_native(si)) {
@@ -216,6 +207,26 @@
     Method *interrupted_method = interrupted_cci->get_method();
     NativeCodePtr interrupted_method_location = si_get_ip(si);
     JIT *interrupted_method_jit = interrupted_cci->get_jit();
+
+    if (NULL != *exn_obj)
+    {
+        // Gregory - When *exn_obj is NULL it means we're called from exn_athrow_regs
+        // which means that IP points exactly to the right location. But
+        // when *exn_obj is not NULL, it means that we're called from exn_throw_for_JIT
+        // where *exn_obj is already constructed and is thrown by code via athrow.
+        // So in this case IP reported by stack iterator is past the athrow bytecode
+        // and should be moved back to be inside of bytecode location for interrupted
+        // method.
+        interrupted_method_location = (NativeCodePtr)((POINTER_SIZE_INT)interrupted_method_location - 1);
+
+        // Determine the type of the exception for the type tests below.
+        exn_class = (*exn_obj)->vt()->clss;
+    }
+
+#ifdef VM_STATS
+    exn_class->class_thrown();
+    VM_Statistics::get_vm_stats().num_exceptions++;
+#endif // VM_STATS
 
     // Remove single step breakpoints which could have been set on the
     // exception bytecode

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp?view=diff&rev=502050&r1=502049&r2=502050
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp Wed Jan 31 15:53:14 2007
@@ -1175,7 +1175,7 @@
         }
         assert(res == EXE_ERROR_NONE);
 
-        TRACE2("jvmti.break.ss", "bytecode " << bc_number << ": "
+        ECHO("bytecode " << bc_number << ": "
             << location << " = " << native_location);
 
         location = jvmti_GetNextBytecodeLocation(method, location);