harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r450709 - in /incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src: jit/ini.cpp jvmti/jvmti_step.cpp
Date Thu, 28 Sep 2006 05:56:24 GMT
Author: geirm
Date: Wed Sep 27 22:56:23 2006
New Revision: 450709

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

Single stepping back from java to native requres predicting a next bytecode after *return
one. But there is an 
assertion that frame is java. If the frame is native it fails. This assertion was removed
because it cannot be 
satisfied always. But instead I removed incorrect assumption comments on returning from native
code back to Java (it 
it returns to Java at all) to start single stepping back in Java code. If the calling code
was not Java single 
stepping won't happen, it will just wait another native from Java transition.

Ubuntu 6 - smoke, c-unit and kernel


Modified:
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/ini.cpp
    incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/ini.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/ini.cpp?view=diff&rev=450709&r1=450708&r2=450709
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/ini.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/ini.cpp Wed Sep 27 22:56:23 2006
@@ -57,11 +57,24 @@
     VM_Global_State::loader_env->em_interface->ExecuteMethod(method, result, args);
     //DEBUG_POP_LOCK(JAVA_CODE_PSEUDO_LOCK);
 
-    // gregory - When method executes *return bytecode in Java it will
-    // set a breakpoint on the bytecode after invoke* or another
-    // bytecode which caused managed to VM transition. This is a
-    // general case of *return handling. So it seems here we don't
-    // have to do anything, *return handling will set a breakpoint up
-    // the stack in java automatically.
-}
+    // Return from native code. It is necessary to set up a breakpoint
+    // in the method which called us
+    if (ti->isEnabled() && ti->is_single_step_enabled() &&
+        ti->getPhase() == JVMTI_PHASE_LIVE)
+    {
+        VM_thread *vm_thread = p_TLS_vmthread;
+        if (NULL != vm_thread->ss_state)
+        {
+            LMAutoUnlock lock(ti->vm_brpt->get_lock());
+
+            jvmti_StepLocation *method_return;
+            unsigned locations_number;
 
+            jvmtiError errorCode = jvmti_get_next_bytecodes_from_native(
+                vm_thread, &method_return, &locations_number, false);
+            assert (JVMTI_ERROR_NONE == errorCode);
+
+            jvmti_set_single_step_breakpoints(ti , vm_thread, method_return, locations_number);
+        }
+    }
+}

Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp?view=diff&rev=450709&r1=450708&r2=450709
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_step.cpp Wed Sep 27 22:56:23
2006
@@ -714,7 +714,14 @@
         return JVMTI_ERROR_NONE;
     }
 
-    assert(!si_is_native(si));
+    if (si_is_native(si))
+    {
+        // We are called from native code, nothing to be done
+        // here. The bytecode which called us will be instrumented
+        // when we return back to java in vm_execute_java_method_array
+        return JVMTI_ERROR_NONE;
+    }
+
     if( invoked_frame ) {
         // get previous stack frame
         si_goto_previous(si);



Mime
View raw message