OSDN Git Service

Enable VM assert properly for JIT and fix new compilation/assertion failures.
authorBen Cheng <bccheng@google.com>
Fri, 14 Aug 2009 20:52:09 +0000 (13:52 -0700)
committerBen Cheng <bccheng@google.com>
Fri, 14 Aug 2009 20:52:09 +0000 (13:52 -0700)
vm/Dvm.mk
vm/compiler/codegen/arm/Codegen.c
vm/interp/Jit.c

index 1280c17..655179f 100644 (file)
--- a/vm/Dvm.mk
+++ b/vm/Dvm.mk
@@ -193,16 +193,13 @@ LOCAL_SRC_FILES := \
        test/TestHash.c \
        test/TestIndirectRefTable.c
 
-ifeq ($(WITH_JIT_TUNING),true)
-  LOCAL_CFLAGS += -DWITH_JIT_TUNING
-endif
+WITH_JIT := $(strip $(WITH_JIT))
 
 ifeq ($(WITH_JIT),true)
-  # NOTE: Turn on assertion for JIT for now
-  LOCAL_CFLAGS += -DWITH_DALVIK_ASSERT
-  # NOTE: Also turn on tuning when JIT is enabled for now
-  LOCAL_CFLAGS += -DWITH_JIT_TUNING
   LOCAL_CFLAGS += -DWITH_JIT
+  # Enable assert and JIT_TUNING for now
+  LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
+  WITH_JIT_TUNING := true
   LOCAL_SRC_FILES += \
        ../dexdump/OpCodeNames.c \
        compiler/Compiler.c \
@@ -212,6 +209,10 @@ ifeq ($(WITH_JIT),true)
        interp/Jit.c
 endif
 
+ifeq ($(strip $(WITH_JIT_TUNING)),true)
+  LOCAL_CFLAGS += -DWITH_JIT_TUNING
+endif
+
 WITH_HPROF := $(strip $(WITH_HPROF))
 ifeq ($(WITH_HPROF),)
   WITH_HPROF := true
index 7d127f8..b6c266d 100644 (file)
@@ -1154,8 +1154,7 @@ static void genInvokeSingletonCommon(CompilationUnit *cUnit, MIR *mir,
     ArmLIR *retChainingCell = &labelList[bb->fallThrough->id];
 
     /* r1 = &retChainingCell */
-    ArmLIR *addrRetChain = newLIR3(cUnit, THUMB_ADD_PC_REL,
-                                           r1, 0, 0);
+    ArmLIR *addrRetChain = newLIR3(cUnit, THUMB_ADD_PC_REL, r1, 0, 0);
     /* r4PC = dalvikCallsite */
     loadConstant(cUnit, r4PC,
                  (int) (cUnit->method->insns + mir->offset));
@@ -1215,13 +1214,11 @@ static void genInvokeVirtualCommon(CompilationUnit *cUnit, MIR *mir,
                  (int) (cUnit->method->insns + mir->offset));
 
     /* r1 = &retChainingCell */
-    ArmLIR *addrRetChain = newLIR2(cUnit, THUMB_ADD_PC_REL,
-                                       r1, 0);
+    ArmLIR *addrRetChain = newLIR3(cUnit, THUMB_ADD_PC_REL, r1, 0, 0);
     addrRetChain->generic.target = (LIR *) retChainingCell;
 
     /* r2 = &predictedChainingCell */
-    ArmLIR *predictedChainingCell =
-        newLIR2(cUnit, THUMB_ADD_PC_REL, r2, 0);
+    ArmLIR *predictedChainingCell = newLIR3(cUnit, THUMB_ADD_PC_REL, r2, 0, 0);
     predictedChainingCell->generic.target = (LIR *) predChainingCell;
 
     genDispatchToHandler(cUnit, TEMPLATE_INVOKE_METHOD_PREDICTED_CHAIN);
@@ -2608,13 +2605,12 @@ static bool handleFmt35c_3rc(CompilationUnit *cUnit, MIR *mir, BasicBlock *bb,
                          (int) (cUnit->method->insns + mir->offset));
 
             /* r1 = &retChainingCell */
-            ArmLIR *addrRetChain = newLIR2(cUnit, THUMB_ADD_PC_REL,
-                                               r1, 0);
+            ArmLIR *addrRetChain = newLIR3(cUnit, THUMB_ADD_PC_REL, r1, 0, 0);
             addrRetChain->generic.target = (LIR *) retChainingCell;
 
             /* r2 = &predictedChainingCell */
             ArmLIR *predictedChainingCell =
-                newLIR2(cUnit, THUMB_ADD_PC_REL, r2, 0);
+                newLIR3(cUnit, THUMB_ADD_PC_REL, r2, 0, 0);
             predictedChainingCell->generic.target = (LIR *) predChainingCell;
 
             genDispatchToHandler(cUnit, TEMPLATE_INVOKE_METHOD_PREDICTED_CHAIN);
index 2bcb1f5..9079da1 100644 (file)
@@ -45,8 +45,9 @@ int dvmJitStartup(void)
     if (res && gDvm.executionMode == kExecutionModeJit) {
         JitEntry *pJitTable = NULL;
         unsigned char *pJitProfTable = NULL;
-        assert(gDvm.jitTableSize &&
-            !(gDvm.jitTableSize & (gDvmJit.jitTableSize - 1))); // Power of 2?
+        // Power of 2?
+        assert(gDvmJit.jitTableSize &&
+               !(gDvmJit.jitTableSize & (gDvmJit.jitTableSize - 1)));
         dvmLockMutex(&gDvmJit.tableLock);
         pJitTable = (JitEntry*)
                     calloc(gDvmJit.jitTableSize, sizeof(*pJitTable));
@@ -74,7 +75,7 @@ int dvmJitStartup(void)
            pJitTable[i].u.info.chain = gDvmJit.jitTableSize;
         }
         /* Is chain field wide enough for termination pattern? */
-        assert(pJitTable[0].u.info.chain == gDvm.maxJitTableEntries);
+        assert(pJitTable[0].u.info.chain == gDvmJit.jitTableSize);
 
 done:
         gDvmJit.pJitEntryTable = pJitTable;
@@ -603,7 +604,7 @@ bool dvmJitResizeJitTable( unsigned int size )
     unsigned int oldSize;
     unsigned int i;
 
-    assert(gDvm.pJitEntryTable != NULL);
+    assert(gDvmJit.pJitEntryTable != NULL);
     assert(size && !(size & (size - 1)));   /* Is power of 2? */
 
     LOGD("Jit: resizing JitTable from %d to %d", gDvmJit.jitTableSize, size);