OSDN Git Service

Fix a couple debugging issues involving JIT single-stepping mode.
authorBen Cheng <bccheng@android.com>
Mon, 9 May 2011 23:34:45 +0000 (16:34 -0700)
committerBen Cheng <bccheng@android.com>
Tue, 10 May 2011 17:11:07 +0000 (10:11 -0700)
1) Declare the jitop mask array using a defined length.
2) Fix a spurious divergence when the first instruction in the trace is
single-stepped.

Change-Id: Ic7925acbda70ddd5591a4bb51d42a74d027674e5

vm/Globals.h
vm/Init.cpp
vm/interp/Jit.cpp

index db552c6..00cbf95 100644 (file)
@@ -857,7 +857,7 @@ struct DvmJitGlobals {
     bool includeSelectedMethod;
 
     /* Disable JIT for selected opcodes - one bit for each opcode */
-    char opList[32];
+    char opList[(kNumPackedOpcodes+7)/8];
 
     /* Disable JIT for selected methods */
     HashTable *methodTable;
index c87aea9..82395d1 100644 (file)
@@ -562,11 +562,11 @@ static void processXjitop(const char *opt)
             startValue = strtol(startPtr, &endPtr, 16);
             if (startPtr != endPtr) {
                 /* Just in case value is out of range */
-                startValue &= 0xff;
+                startValue %= kNumPackedOpcodes;
 
                 if (*endPtr == '-') {
                     endValue = strtol(endPtr+1, &endPtr, 16);
-                    endValue &= 0xff;
+                    endValue %= kNumPackedOpcodes;
                 } else {
                     endValue = startValue;
                 }
@@ -575,8 +575,7 @@ static void processXjitop(const char *opt)
                     LOGW("Dalvik opcode %x is selected for debugging",
                          (unsigned int) startValue);
                     /* Mark the corresponding bit to 1 */
-                    gDvmJit.opList[startValue >> 3] |=
-                        1 << (startValue & 0x7);
+                    gDvmJit.opList[startValue >> 3] |= 1 << (startValue & 0x7);
                 }
 
                 if (*endPtr == 0) {
@@ -597,7 +596,7 @@ static void processXjitop(const char *opt)
         } while (1);
     } else {
         int i;
-        for (i = 0; i < 32; i++) {
+        for (i = 0; i < (kNumPackedOpcodes+7)/8; i++) {
             gDvmJit.opList[i] = 0xff;
         }
         dvmFprintf(stderr, "Warning: select all opcodes\n");
index 3434a2c..bb8d6d7 100644 (file)
@@ -289,13 +289,12 @@ void dvmCheckSelfVerification(const u2* pc, Thread* self)
     }
 
     /*
-     * Check that the current pc is the end of the trace when at least one
-     * instruction is interpreted.
+     * Check if the current pc matches the endPC. Only check for non-zero
+     * trace length when backward branches are involved.
      */
-    if ((state == kSVSDebugInterp || state == kSVSSingleStep ||
-         state == kSVSBackwardBranch) &&
-        shadowSpace->traceLength != 0 &&
-        pc == shadowSpace->endPC) {
+    if (pc == shadowSpace->endPC &&
+        (state == kSVSDebugInterp || state == kSVSSingleStep ||
+         (state == kSVSBackwardBranch && shadowSpace->traceLength != 0))) {
 
         shadowSpace->selfVerificationState = kSVSIdle;