OSDN Git Service

Remove unused labels, variables, and functions. Enable warnings.
authorCarl Shapiro <cshapiro@google.com>
Fri, 21 May 2010 05:54:18 +0000 (22:54 -0700)
committerCarl Shapiro <cshapiro@google.com>
Fri, 21 May 2010 23:17:32 +0000 (16:17 -0700)
Change-Id: Icbe24eaf1ad499f28b68b6a5f05368271a0a7e86

58 files changed:
vm/CheckJni.c
vm/Debugger.c
vm/Dvm.mk
vm/Exception.c
vm/IndirectRefTable.c
vm/Init.c
vm/InlineNative.c
vm/JarFile.c
vm/Jni.c
vm/Misc.c
vm/Native.c
vm/PointerSet.c
vm/Profile.c
vm/StdioConverter.c
vm/Sync.c
vm/Thread.c
vm/alloc/HeapSource.c
vm/analysis/CodeVerify.c
vm/analysis/DexPrepare.c
vm/analysis/DexVerify.c
vm/analysis/Optimize.c
vm/analysis/ReduceConstants.c
vm/analysis/RegisterMap.c
vm/analysis/VerifySubs.c
vm/arch/arm/HintsEABI.c
vm/compiler/Compiler.c
vm/compiler/Dataflow.c
vm/compiler/Frontend.c
vm/compiler/Loop.c
vm/compiler/Ralloc.c
vm/compiler/Utility.c
vm/compiler/codegen/arm/ArchUtility.c
vm/compiler/codegen/arm/Assemble.c
vm/compiler/codegen/arm/CodegenDriver.c
vm/compiler/codegen/arm/CodegenFactory.c
vm/compiler/codegen/arm/FP/Thumb2VFP.c
vm/compiler/codegen/arm/LocalOptimizations.c
vm/compiler/codegen/arm/RallocUtil.c
vm/compiler/codegen/arm/Thumb2/Factory.c
vm/compiler/codegen/arm/Thumb2/Gen.c
vm/interp/Interp.c
vm/interp/Jit.c
vm/interp/Stack.c
vm/jdwp/JdwpEvent.c
vm/jdwp/JdwpHandler.c
vm/jdwp/JdwpMain.c
vm/jdwp/JdwpSocket.c
vm/mterp/out/InterpC-portdbg.c
vm/mterp/portable/debug.c
vm/native/dalvik_system_DexFile.c
vm/native/dalvik_system_Zygote.c
vm/native/java_lang_VMClassLoader.c
vm/native/java_lang_VMThread.c
vm/oo/Class.c
vm/reflect/Annotation.c
vm/reflect/Proxy.c
vm/reflect/Reflect.c
vm/test/TestHash.c

index c43b1c6..3c87eaf 100644 (file)
@@ -878,7 +878,6 @@ static void checkMethodArgsV(JNIEnv* env, jmethodID methodID, va_list args,
 
     const Method* meth = (const Method*) methodID;
     const char* desc = meth->shorty;
-    ClassObject* clazz;
 
     LOGV("V-checking %s.%s:%s...\n", meth->clazz->descriptor, meth->name, desc);
 
@@ -901,7 +900,6 @@ static void checkMethodArgsV(JNIEnv* env, jmethodID methodID, va_list args,
         }
     }
 
-bail:
     JNI_EXIT();
 #endif
 }
@@ -918,7 +916,6 @@ static void checkMethodArgsA(JNIEnv* env, jmethodID methodID, jvalue* args,
 
     const Method* meth = (const Method*) methodID;
     const char* desc = meth->shorty;
-    ClassObject* clazz;
     int idx = 0;
 
     LOGV("A-checking %s.%s:%s...\n", meth->clazz->descriptor, meth->name, desc);
@@ -932,7 +929,6 @@ static void checkMethodArgsA(JNIEnv* env, jmethodID methodID, jvalue* args,
         idx++;
     }
 
-bail:
     JNI_EXIT();
 #endif
 }
@@ -1174,8 +1170,6 @@ static void* releaseGuardedPACopy(JNIEnv* env, jarray jarr, void* dataBuf,
     int mode)
 {
     ArrayObject* arrObj = (ArrayObject*) dvmDecodeIndirectRef(env, jarr);
-    PrimitiveType primType = arrObj->obj.clazz->elementClass->primitiveType;
-    //int len = array->length * dvmPrimitiveTypeWidth(primType);
     bool release, copyBack;
     u1* result;
 
index 2f57046..5bf3ec0 100644 (file)
@@ -293,10 +293,12 @@ static RefTypeId classObjectToRefTypeId(ClassObject* clazz)
 {
     return (RefTypeId) registerObject((Object*) clazz, kRefTypeId, true);
 }
+#if 0
 static RefTypeId classObjectToRefTypeIdNoReg(ClassObject* clazz)
 {
     return (RefTypeId) registerObject((Object*) clazz, kRefTypeId, false);
 }
+#endif
 static ClassObject* refTypeIdToClassObject(RefTypeId id)
 {
     assert(objectIsRegistered(id, kRefTypeId) || !gDvm.debuggerConnected);
@@ -1340,7 +1342,6 @@ void dvmDbgOutputLineTable(RefTypeId refTypeId, MethodId methodId,
 {
     Method* method;
     u8 start, end;
-    int i;
     DebugCallbackContext context;
 
     memset (&context, 0, sizeof(DebugCallbackContext));
index 3b2ed16..61783e3 100644 (file)
--- a/vm/Dvm.mk
+++ b/vm/Dvm.mk
@@ -26,6 +26,7 @@
 #
 LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
 #LOCAL_CFLAGS += -DUSE_INDIRECT_REF
+LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter
 
 #
 # Optional features.  These may impact the size or performance of the VM.
index 13b051e..5e01dfc 100644 (file)
@@ -1109,7 +1109,7 @@ ArrayObject* dvmGetStackTrace(const Object* ostackData)
 {
     const ArrayObject* stackData = (const ArrayObject*) ostackData;
     const int* intVals;
-    int i, stackSize;
+    int stackSize;
 
     stackSize = stackData->length / 2;
     intVals = (const int*) stackData->contents;
index bea0a0f..7a531a5 100644 (file)
@@ -129,7 +129,7 @@ static inline void updateSlotAdd(IndirectRefTable* pRef, Object* obj, int slot)
 static inline void updateSlotRemove(IndirectRefTable* pRef, int slot)
 {
     if (pRef->slotData != NULL) {
-        IndirectRefSlot* pSlot = &pRef->slotData[slot];
+        //IndirectRefSlot* pSlot = &pRef->slotData[slot];
         //LOGI("+++ remove [%d] slot %d, serial now %d\n",
         //    pRef->kind, slot, pSlot->serial);
     }
@@ -144,7 +144,6 @@ IndirectRef dvmAddToIndirectRefTable(IndirectRefTable* pRef, u4 cookie,
     IRTSegmentState prevState;
     prevState.all = cookie;
     int topIndex = pRef->segmentState.parts.topIndex;
-    int bottomIndex = prevState.parts.topIndex;
 
     assert(obj != NULL);
     assert(dvmIsValidObject(obj));
@@ -195,7 +194,7 @@ IndirectRef dvmAddToIndirectRefTable(IndirectRefTable* pRef, u4 cookie,
         Object** pScan = &pRef->table[topIndex - 1];
         assert(*pScan != NULL);
         while (*--pScan != NULL) {
-            assert(pScan >= pRef->table + bottomIndex);
+            assert(pScan >= pRef->table + prevState.parts.topIndex);
         }
         updateSlotAdd(pRef, obj, pScan - pRef->table);
         result = dvmObjectToIndirectRef(pRef, obj, pScan - pRef->table,
index 6208db4..ece37f7 100644 (file)
--- a/vm/Init.c
+++ b/vm/Init.c
@@ -835,7 +835,6 @@ static int dvmProcessOptions(int argc, const char* const argv[],
             strncmp(argv[i], "-agentlib:jdwp=", 15) == 0)
         {
             const char* tail;
-            bool result = false;
 
             if (argv[i][1] == 'X')
                 tail = argv[i] + 10;
index 3842326..2323958 100644 (file)
@@ -225,7 +225,7 @@ static bool javaLangString_compareTo(u4 arg0, u4 arg1, u4 arg2, u4 arg3,
     ArrayObject* compArray;
     const u2* thisChars;
     const u2* compChars;
-    int i, minCount, countDiff;
+    int minCount, countDiff;
 
     thisCount = dvmGetFieldInt((Object*) arg0, STRING_FIELDOFF_COUNT);
     compCount = dvmGetFieldInt((Object*) arg1, STRING_FIELDOFF_COUNT);
@@ -251,6 +251,7 @@ static bool javaLangString_compareTo(u4 arg0, u4 arg1, u4 arg2, u4 arg3,
      */
     int otherRes = __memcmp16(thisChars, compChars, minCount);
 # ifdef CHECK_MEMCMP16
+    int i;
     for (i = 0; i < minCount; i++) {
         if (thisChars[i] != compChars[i]) {
             pResult->i = (s4) thisChars[i] - (s4) compChars[i];
@@ -273,6 +274,7 @@ static bool javaLangString_compareTo(u4 arg0, u4 arg1, u4 arg2, u4 arg3,
      * the characters that overlap, and if they're all the same then return
      * the difference in lengths.
      */
+    int i;
     for (i = 0; i < minCount; i++) {
         if (thisChars[i] != compChars[i]) {
             pResult->i = (s4) thisChars[i] - (s4) compChars[i];
@@ -324,7 +326,6 @@ static bool javaLangString_equals(u4 arg0, u4 arg1, u4 arg2, u4 arg3,
     ArrayObject* compArray;
     const u2* thisChars;
     const u2* compChars;
-    int i;
 
     /* quick length check */
     thisCount = dvmGetFieldInt((Object*) arg0, STRING_FIELDOFF_COUNT);
@@ -363,6 +364,7 @@ static bool javaLangString_equals(u4 arg0, u4 arg1, u4 arg2, u4 arg3,
      * meaningful comparison when the strings don't match (could also test
      * with palindromes).
      */
+    int i;
     //for (i = 0; i < thisCount; i++)
     for (i = thisCount-1; i >= 0; --i)
     {
index fbadf9c..a0d24d1 100644 (file)
@@ -276,7 +276,7 @@ tryArchive:
             if (newFile) {
                 u8 startWhen, extractWhen, endWhen;
                 bool result;
-                off_t dexOffset, fileLen;
+                off_t dexOffset;
 
                 dexOffset = lseek(fd, 0, SEEK_CUR);
                 result = (dexOffset > 0);
index 15b0294..0d84910 100644 (file)
--- a/vm/Jni.c
+++ b/vm/Jni.c
@@ -859,7 +859,6 @@ static jobject addGlobalReference(Object* obj)
     }
 #endif
 
-bail:
     dvmUnlockMutex(&gDvm.jniGlobalRefLock);
     return jobj;
 }
@@ -956,7 +955,7 @@ static jweak createWeakGlobalRef(JNIEnv* env, jobject jobj)
 
     JValue unused;
     dvmCallMethod(self, gDvm.methJavaLangRefPhantomReference_init, phantomObj,
-        &unused, jobj, NULL);
+        &unused, obj, NULL);
     dvmReleaseTrackedAlloc(phantomObj, self);
 
     if (dvmCheckException(self)) {
@@ -1248,8 +1247,6 @@ jobjectRefType dvmGetJNIRefType(JNIEnv* env, jobject jobj)
 #else
     ReferenceTable* pRefTable = getLocalRefTable(env);
     Thread* self = dvmThreadSelf();
-    //Object** top;
-    Object** ptr;
 
     if (dvmIsWeakGlobalRef(jobj)) {
         return JNIWeakGlobalRefType;
@@ -1975,7 +1972,7 @@ static jobject ToReflectedField(JNIEnv* env, jclass jcls, jfieldID fieldID,
 {
     JNI_ENTER();
     ClassObject* clazz = (ClassObject*) dvmDecodeIndirectRef(env, jcls);
-    Object* obj = dvmCreateReflectObjForField(jcls, (Field*) fieldID);
+    Object* obj = dvmCreateReflectObjForField(clazz, (Field*) fieldID);
     dvmReleaseTrackedAlloc(obj, NULL);
     jobject jobj = addLocalReference(env, obj);
     JNI_EXIT();
index 87f4c81..21b7fce 100644 (file)
--- a/vm/Misc.c
+++ b/vm/Misc.c
@@ -323,7 +323,7 @@ bool dvmIsBitSet(const BitVector* pBits, int num)
  */
 int dvmCountSetBits(const BitVector* pBits)
 {
-    int word, bit;
+    int word;
     int count = 0;
 
     for (word = 0; word < pBits->storageSize; word++) {
index 967482c..83f32b4 100644 (file)
@@ -213,7 +213,6 @@ static SharedLib* findSharedLibEntry(const char* pathName)
 static SharedLib* addSharedLibEntry(SharedLib* pLib)
 {
     u4 hash = dvmComputeUtf8Hash(pLib->pathName);
-    void* ent;
 
     /*
      * Do the lookup with the "add" flag set.  If we add it, we will get
index 6cc6e79..2c96a74 100644 (file)
@@ -30,6 +30,7 @@ struct PointerSet {
 /*
  * Verify that the set is in sorted order.
  */
+#ifndef NDEBUG
 static bool verifySorted(PointerSet* pSet)
 {
     const void* last = NULL;
@@ -44,7 +45,7 @@ static bool verifySorted(PointerSet* pSet)
 
     return true;
 }
-
+#endif
 
 /*
  * Allocate a new PointerSet.
@@ -181,7 +182,7 @@ bool dvmPointerSetAddEntry(PointerSet* pSet, const void* ptr)
  */
 bool dvmPointerSetRemoveEntry(PointerSet* pSet, const void* ptr)
 {
-    int i, where;
+    int where;
 
     if (!dvmPointerSetHas(pSet, ptr, &where))
         return false;
index b079988..bc5e05a 100644 (file)
@@ -278,7 +278,7 @@ static int dumpMarkedMethods(void* vclazz, void* vfp)
     FILE* fp = (FILE*) vfp;
     Method* meth;
     char* name;
-    int i, lineNum;
+    int i;
 
     dexStringCacheInit(&stringCache);
 
index 54ceb0b..efc1e89 100644 (file)
@@ -172,7 +172,6 @@ static void* stdioConverterThreadStart(void* arg)
      * Read until shutdown time.
      */
     while (!gDvm.haltStdioConverter) {
-        ssize_t actual;
         fd_set readfds;
         int maxFd, fdCount;
 
index 8b8c1f5..90df500 100644 (file)
--- a/vm/Sync.c
+++ b/vm/Sync.c
@@ -374,7 +374,7 @@ static void logContentionEvent(Thread *self, u4 waitMs, u4 samplePercent)
     u4 relativePc;
     char eventBuffer[132];
     const char *fileName;
-    char procName[33], *selfName, *ownerName;
+    char procName[33], *selfName;
     char *cp;
     size_t len;
     int fd;
@@ -430,7 +430,6 @@ static void logContentionEvent(Thread *self, u4 waitMs, u4 samplePercent)
  */
 static void lockMonitor(Thread* self, Monitor* mon)
 {
-    Thread *owner;
     ThreadStatus oldStatus;
     u4 waitThreshold, samplePercent;
     u8 waitStart, waitEnd, waitMs;
index 6410bb4..8a3fa53 100644 (file)
@@ -1723,7 +1723,6 @@ static void threadExitUncaughtException(Thread* self, Object* group)
 {
     Object* exception;
     Object* handlerObj;
-    ClassObject* throwable;
     Method* uncaughtHandler = NULL;
     InstField* threadHandler;
 
@@ -4104,6 +4103,7 @@ static void gcScanReferenceTable(ReferenceTable *refTable)
     }
 }
 
+#ifdef USE_INDIRECT_REF
 static void gcScanIndirectRefTable(IndirectRefTable* pRefTable)
 {
     Object** op = pRefTable->table;
@@ -4117,6 +4117,7 @@ static void gcScanIndirectRefTable(IndirectRefTable* pRefTable)
         op++;
     }
 }
+#endif
 
 /*
  * Scan a Thread and mark any objects it references.
index 3f0c7b5..31df823 100644 (file)
@@ -539,7 +539,6 @@ dvmHeapSourceShutdown(GcHeap **gcHeap)
 {
     if (*gcHeap != NULL && (*gcHeap)->heapSource != NULL) {
         HeapSource *hs;
-        size_t i;
 
         hs = (*gcHeap)->heapSource;
 
@@ -635,7 +634,7 @@ void dvmHeapSourceGetObjectBitmaps(HeapBitmap liveBits[], HeapBitmap markBits[],
 {
     HeapSource *hs = gHs;
     uintptr_t base, max;
-    size_t i, offset;
+    size_t i;
 
     HS_BOILERPLATE();
 
@@ -670,7 +669,7 @@ void dvmHeapSourceSwapBitmaps(void)
 void dvmMarkImmuneObjects(const char *immuneLimit)
 {
     char *dst, *src;
-    size_t i, offset, index, length;
+    size_t i, index, length;
 
     /*
      * Copy the contents of the live bit vector for immune object
index 91f5414..becce81 100644 (file)
@@ -114,7 +114,9 @@ typedef struct RegisterTable {
 
 
 /* fwd */
+#ifndef NDEBUG
 static void checkMergeTab(void);
+#endif
 static bool isInitMethod(const Method* meth);
 static RegType getInvocationThis(const RegType* insnRegs,\
     const int insnRegCount, const DecodedInstruction* pDecInsn,
@@ -540,10 +542,12 @@ static bool isInitMethod(const Method* meth)
 /*
  * Is this method a class initializer?
  */
+#if 0
 static bool isClassInitMethod(const Method* meth)
 {
     return (*meth->name == '<' && strcmp(meth->name+1, "clinit>") == 0);
 }
+#endif
 
 /*
  * Look up a class reference given as a simple string descriptor.
@@ -1338,8 +1342,6 @@ static ClassObject* getFieldClass(const Method* meth, const Field* field)
 static inline RegType getRegisterType(const RegType* insnRegs,
     const int insnRegCount, u4 vsrc, VerifyError* pFailure)
 {
-    RegType type;
-
     if (vsrc >= (u4) insnRegCount) {
         *pFailure = VERIFY_ERROR_GENERIC;
         return kRegTypeUnknown;
@@ -3105,10 +3107,7 @@ bool dvmVerifyCodeFlow(Method* meth, InsnFlags* insnFlags,
 {
     bool result = false;
     const int insnsSize = dvmGetMethodInsnsSize(meth);
-    const u2* insns = meth->insns;
     const bool generateRegisterMap = gDvm.generateRegisterMaps;
-    int i, offset;
-    bool isConditional;
     RegisterTable regTable;
 
     memset(&regTable, 0, sizeof(regTable));
@@ -3258,11 +3257,10 @@ static bool doCodeVerification(Method* meth, InsnFlags* insnFlags,
     RegisterTable* regTable, UninitInstanceMap* uninitMap)
 {
     const int insnsSize = dvmGetMethodInsnsSize(meth);
-    const u2* insns = meth->insns;
     RegType workRegs[meth->registersSize + kExtraRegs];
     bool result = false;
     bool debugVerbose = false;
-    int insnIdx, startGuess, prevAddr;
+    int insnIdx, startGuess;
 
     /*
      * Begin by marking the first instruction as "changed".
@@ -3520,7 +3518,6 @@ static bool verifyInstruction(Method* meth, InsnFlags* insnFlags,
     const DexFile* pDexFile = meth->clazz->pDvmDex->pDexFile;
     RegType entryRegs[meth->registersSize + kExtraRegs];
     ClassObject* resClass;
-    const char* className;
     int branchTarget = 0;
     const int insnRegCount = meth->registersSize;
     RegType tmpType;
@@ -4062,7 +4059,6 @@ static bool verifyInstruction(Method* meth, InsnFlags* insnFlags,
     case OP_IF_NE:
         {
             RegType type1, type2;
-            bool tmpResult;
 
             type1 = getRegisterType(workRegs, insnRegCount, decInsn.vA,
                         &failure);
@@ -4488,7 +4484,6 @@ aput_1nr_common:
         goto iget_1nr_common;
 iget_1nr_common:
         {
-            ClassObject* fieldClass;
             InstField* instField;
             RegType objType, fieldType;
 
@@ -4521,7 +4516,6 @@ iget_1nr_common:
     case OP_IGET_WIDE_VOLATILE:
         {
             RegType dstType;
-            ClassObject* fieldClass;
             InstField* instField;
             RegType objType;
 
@@ -4609,7 +4603,6 @@ iget_1nr_common:
 iput_1nr_common:
         {
             RegType srcType, fieldType, objType;
-            ClassObject* fieldClass;
             InstField* instField;
 
             srcType = getRegisterType(workRegs, insnRegCount, decInsn.vA,
@@ -4665,7 +4658,6 @@ iput_1nr_common:
             checkWidePair(tmpType, typeHi, &failure);
         }
         if (VERIFY_OK(failure)) {
-            ClassObject* fieldClass;
             InstField* instField;
             RegType objType;
 
@@ -5125,7 +5117,6 @@ sput_1nr_common:
                  * do this for all registers that have the same object
                  * instance in them, not just the "this" register.
                  */
-                int uidx = regTypeToUninitIndex(thisType);
                 markRefsAsInitialized(workRegs, insnRegCount, uninitMap,
                     thisType, &failure);
                 if (!VERIFY_OK(failure))
@@ -5683,7 +5674,6 @@ sput_1nr_common:
      */
     if ((nextFlags & kInstrCanThrow) != 0 && dvmInsnIsInTry(insnFlags, insnIdx))
     {
-        DexFile* pDexFile = meth->clazz->pDvmDex->pDexFile;
         const DexCode* pCode = dvmGetMethodCode(meth);
         DexCatchIterator iterator;
 
index 5756cd0..b3ddcd1 100644 (file)
@@ -667,7 +667,6 @@ bool dvmContinueOptimization(int fd, off_t dexOffset, long dexLength,
     optHdr.flags = headerFlags;
     optHdr.checksum = optChecksum;
 
-    ssize_t actual;
     lseek(fd, 0, SEEK_SET);
     if (sysWriteFully(fd, &optHdr, sizeof(optHdr), "DexOpt opt header") != 0)
         goto bail;
@@ -1239,11 +1238,10 @@ bail:
 static int writeDependencies(int fd, u4 modWhen, u4 crc)
 {
     u1* buf = NULL;
-    ssize_t actual;
     int result = -1;
     ssize_t bufLen;
     ClassPathEntry* cpe;
-    int i, numDeps;
+    int numDeps;
 
     /*
      * Count up the number of completed entries in the bootclasspath.
@@ -1307,7 +1305,6 @@ static int writeDependencies(int fd, u4 modWhen, u4 crc)
  */
 static bool writeChunk(int fd, u4 type, const void* data, size_t size)
 {
-    ssize_t actual;
     union {             /* save a syscall by grouping these together */
         char raw[8];
         struct {
index 8f4ee7f..9309a11 100644 (file)
@@ -120,7 +120,7 @@ static bool verifyMethod(Method* meth, int verifyFlags)
     bool result = false;
     UninitInstanceMap* uninitMap = NULL;
     InsnFlags* insnFlags = NULL;
-    int i, newInstanceCount;
+    int newInstanceCount;
 
     /*
      * If there aren't any instructions, make sure that's expected, then
@@ -495,7 +495,6 @@ static bool verifyInstructions(const Method* meth, InsnFlags* insnFlags,
         int width = dvmInsnGetWidth(insnFlags, i);
         OpCode opcode = *insns & 0xff;
         InstructionFlags opFlags = dexGetInstrFlags(gDvm.instrFlags, opcode);
-        int offset, absOffset;
 
         if ((opFlags & gcMask) != 0) {
             /*
index 354389f..82d50cd 100644 (file)
@@ -36,8 +36,6 @@ struct InlineSub {
 
 
 /* fwd */
-static void optimizeLoadedClasses(DexFile* pDexFile);
-static void optimizeClass(ClassObject* clazz);
 static bool optimizeMethod(Method* method);
 static void rewriteInstField(Method* method, u2* insns, OpCode newOpc);
 static bool rewriteVirtualInvoke(Method* method, u2* insns, OpCode newOpc);
@@ -562,7 +560,6 @@ static void rewriteInstField(Method* method, u2* insns, OpCode newOpc)
     ClassObject* clazz = method->clazz;
     u2 fieldIdx = insns[1];
     InstField* field;
-    int byteOffset;
 
     field = dvmOptResolveInstField(clazz, fieldIdx, NULL);
     if (field == NULL) {
index ec7ba0f..308db87 100644 (file)
@@ -644,6 +644,7 @@ static void markUsedConstants(DexFile* pDexFile, const char* classDescriptor,
  *
  * Run through the instructions in this method, altering the constants used.
  */
+#if DVM_RESOLVER_CACHE == DVM_RC_EXPANDING
 static void updateUsedConstants(DexFile* pDexFile, const char* classDescriptor,
     DexMethod* pDexMethod, void* arg)
 {
@@ -666,6 +667,7 @@ static void updateUsedConstants(DexFile* pDexFile, const char* classDescriptor,
         //printf(" (no code)\n");
     }
 }
+#endif
 
 /*
  * Count up the bits and show a count.
@@ -682,9 +684,9 @@ static void showBitCount(const char* label, int setCount, int maxCount)
 static void summarizeResults(DvmDex* pDvmDex, ScanResults* pResults)
 {
     DexFile* pDexFile = pDvmDex->pDexFile;
+#if 0
     int i;
 
-#if 0
     for (i = 0; i < (int) pDvmDex->pDexFile->pHeader->typeIdsSize; i++) {
         const DexTypeId* pDexTypeId;
         const char* classDescr;
@@ -890,6 +892,7 @@ static bool constructReducingDataChunk(IndexMapSet* pIndexMapSet)
  * Construct an "expanding" chunk, with maps that convert instructions
  * with reduced constants back to their full original values.
  */
+#if DVM_RESOLVER_CACHE == DVM_RC_EXPANDING
 static bool constructExpandingDataChunk(IndexMapSet* pIndexMapSet)
 {
     int chunkLen = 0;
@@ -939,6 +942,7 @@ static bool constructExpandingDataChunk(IndexMapSet* pIndexMapSet)
 
     return true;
 }
+#endif
 
 /*
  * Construct the "chunk" of data that will be appended to the optimized DEX
@@ -963,7 +967,6 @@ static IndexMapSet* createIndexMapSet(const DexFile* pDexFile,
     ScanResults* pResults)
 {
     IndexMapSet* pIndexMapSet;
-    int setCount;
     bool okay = true;
 
     pIndexMapSet = calloc(1, sizeof(*pIndexMapSet));
index a42d93a..8ab37f0 100644 (file)
 /* verbose logging */
 #define REGISTER_MAP_VERBOSE    false
 
+//#define REGISTER_MAP_STATS
 
 // fwd
 static void outputTypeVector(const RegType* regs, int insnRegCount, u1* data);
 static bool verifyMap(VerifierData* vdata, const RegisterMap* pMap);
 static int compareMaps(const RegisterMap* pMap1, const RegisterMap* pMap2);
 
+#ifdef REGISTER_MAP_STATS
 static void computeMapStats(RegisterMap* pMap, const Method* method);
+#endif
 static RegisterMap* compressMapDifferential(const RegisterMap* pMap,\
     const Method* meth);
 static RegisterMap* uncompressMapDifferential(const RegisterMap* pMap);
 
-
-//#define REGISTER_MAP_STATS
 #ifdef REGISTER_MAP_STATS
 /*
  * Generate some statistics on the register maps we create and use.
@@ -471,7 +472,6 @@ static bool verifyMap(VerifierData* vdata, const RegisterMap* pMap)
     if (false) {
         const char* cd = "Landroid/net/http/Request;";
         const char* mn = "readResponse";
-        const char* sg = "(Landroid/net/http/AndroidHttpClientConnection;)V";
         if (strcmp(vdata->method->clazz->descriptor, cd) == 0 &&
             strcmp(vdata->method->name, mn) == 0)
         {
@@ -508,7 +508,6 @@ static bool verifyMap(VerifierData* vdata, const RegisterMap* pMap)
             dvmAbort();
         }
 
-        const u1* dataStart = rawMap;
         const RegType* regs = vdata->addrRegs[addr];
         if (regs == NULL) {
             LOGE("GLITCH: addr %d has no data\n", addr);
@@ -1243,9 +1242,9 @@ Compact8 encoding method.
 /*
  * Compute some stats on an uncompressed register map.
  */
+#ifdef REGISTER_MAP_STATS
 static void computeMapStats(RegisterMap* pMap, const Method* method)
 {
-#ifdef REGISTER_MAP_STATS
     MapStats* pStats = (MapStats*) gDvm.registerMapStats;
     const u1 format = dvmRegisterMapGetFormat(pMap);
     const u2 numEntries = dvmRegisterMapGetNumEntries(pMap);
@@ -1361,9 +1360,8 @@ static void computeMapStats(RegisterMap* pMap, const Method* method)
         prevAddr = addr;
         prevData = dataStart;
     }
-#endif
 }
-
+#endif
 
 /*
  * Compute the difference between two bit vectors.
index 39d6dc8..16f128e 100644 (file)
@@ -113,7 +113,6 @@ bail:
 bool dvmSetTryFlags(const Method* meth, InsnFlags* insnFlags)
 {
     u4 insnsSize = dvmGetMethodInsnsSize(meth);
-    DexFile* pDexFile = meth->clazz->pDvmDex->pDexFile;
     const DexCode* pCode = dvmGetMethodCode(meth);
     u4 triesSize = pCode->triesSize;
     const DexTry* pTries;
@@ -311,7 +310,6 @@ bool dvmCheckBranchTarget(const Method* meth, InsnFlags* insnFlags,
     int curOffset, bool selfOkay)
 {
     const int insnCount = dvmGetMethodInsnsSize(meth);
-    const u2* insns = meth->insns + curOffset;
     int offset, absOffset;
     bool isConditional;
 
@@ -411,7 +409,6 @@ bool dvmGetBranchTarget(const Method* meth, InsnFlags* insnFlags,
     int curOffset, int* pOffset, bool* pConditional)
 {
     const u2* insns = meth->insns + curOffset;
-    int tmp;
 
     switch (*insns & 0xff) {
     case OP_GOTO:
index d842859..3e27e5a 100644 (file)
@@ -59,7 +59,7 @@ u4 dvmPlatformInvokeHints(const DexProto* proto)
     const char* sig = dexProtoGetShorty(proto);
     int padFlags, jniHints;
     char sigByte;
-    int stackOffset, padMask, hints;
+    int stackOffset, padMask;
 
     stackOffset = padFlags = 0;
     padMask = 0x00000001;
index 2f72ef5..63f7512 100644 (file)
@@ -41,6 +41,7 @@ static CompilerWorkOrder workDequeue(void)
     gDvmJit.compilerQueueLength--;
     if (gDvmJit.compilerQueueLength == 0) {
         int cc = pthread_cond_signal(&gDvmJit.compilerQueueEmpty);
+        assert(cc == 0);
     }
 
     /* Remember the high water mark of the queue length */
@@ -506,9 +507,6 @@ fail:
 
 static void *compilerThreadStart(void *arg)
 {
-    int ret;
-    struct timespec ts;
-
     dvmChangeStatus(NULL, THREAD_VMWAIT);
 
     /*
index 0f90c9e..fe04c67 100644 (file)
@@ -1168,8 +1168,6 @@ void dvmCompilerDoConstantPropagation(CompilationUnit *cUnit, BasicBlock *bb)
         int dfAttributes =
             dvmCompilerDataFlowAttributes[mir->dalvikInsn.opCode];
 
-        int numUses = 0;
-
         DecodedInstruction *dInsn = &mir->dalvikInsn;
 
         if (!(dfAttributes & DF_HAS_DEFS)) continue;
index d97001f..db03b1b 100644 (file)
@@ -185,13 +185,13 @@ static inline bool isUnconditionalBranch(MIR *insn)
 /*
  * dvmHashTableLookup() callback
  */
+#if defined(WITH_JIT_TUNING)
 static int compareMethod(const CompilerMethodStats *m1,
                          const CompilerMethodStats *m2)
 {
     return (int) m1->method - (int) m2->method;
 }
 
-#if defined(WITH_JIT_TUNING)
 /*
  * Analyze each method whose traces are ever compiled. Collect a variety of
  * statistics like the ratio of exercised vs overall code and code bloat
index ef76c50..0ceaa9f 100644 (file)
@@ -263,11 +263,9 @@ static void updateRangeCheckInfo(CompilationUnit *cUnit, int arrayReg,
 /* Returns true if the loop body cannot throw any exceptions */
 static bool doLoopBodyCodeMotion(CompilationUnit *cUnit)
 {
-    BasicBlock *entry = cUnit->blockList[0];
     BasicBlock *loopBody = cUnit->blockList[1];
     MIR *mir;
     bool loopBodyCanThrow = false;
-    int numDalvikRegs = cUnit->method->registersSize;
 
     for (mir = loopBody->firstMIRInsn; mir; mir = mir->next) {
         DecodedInstruction *dInsn = &mir->dalvikInsn;
@@ -321,7 +319,6 @@ static bool doLoopBodyCodeMotion(CompilationUnit *cUnit)
             int useIdx = refIdx + 1;
             int subNRegArray =
                 dvmConvertSSARegToDalvik(cUnit, mir->ssaRep->uses[refIdx]);
-            int arrayReg = DECODE_REG(subNRegArray);
             int arraySub = DECODE_SUB(subNRegArray);
 
             /*
@@ -352,7 +349,6 @@ static bool doLoopBodyCodeMotion(CompilationUnit *cUnit)
 
 static void dumpHoistedChecks(CompilationUnit *cUnit)
 {
-    ArrayAccessInfo *arrayAccessInfo;
     LoopAnalysis *loopAnalysis = cUnit->loopAnalysis;
     unsigned int i;
 
@@ -379,7 +375,6 @@ static void genHoistedChecks(CompilationUnit *cUnit)
     unsigned int i;
     BasicBlock *entry = cUnit->blockList[0];
     LoopAnalysis *loopAnalysis = cUnit->loopAnalysis;
-    ArrayAccessInfo *arrayAccessInfo;
     int globalMaxC = 0;
     int globalMinC = 0;
     /* Should be loop invariant */
@@ -461,7 +456,6 @@ static void genHoistedChecks(CompilationUnit *cUnit)
 /* Main entry point to do loop optimization */
 void dvmCompilerLoopOpt(CompilationUnit *cUnit)
 {
-    int numDalvikReg = cUnit->method->registersSize;
     LoopAnalysis *loopAnalysis = dvmCompilerNew(sizeof(LoopAnalysis), true);
 
     assert(cUnit->blockList[0]->blockType == kEntryBlock);
index 1a3e27e..608b4b3 100644 (file)
@@ -124,7 +124,6 @@ void dvmCompilerRegAlloc(CompilationUnit *cUnit)
     int seqNum = 0;
     LiveRange *ranges;
     RegLocation *loc;
-    int *ssaToDalvikMap = (int *) cUnit->ssaToDalvikMap->elemList;
 
     /* Allocate the location map */
     loc = (RegLocation*)dvmCompilerNew(cUnit->numSSARegs * sizeof(*loc), true);
index cb5a702..1aff02b 100644 (file)
@@ -159,7 +159,6 @@ static int dumpMethodStats(void *compilerMethodStats, void *totalMethodStats)
         (CompilerMethodStats *) compilerMethodStats;
     CompilerMethodStats *totalStats =
         (CompilerMethodStats *) totalMethodStats;
-    const Method *method = methodStats->method;
 
     totalStats->dalvikSize += methodStats->dalvikSize;
     totalStats->compiledDalvikSize += methodStats->compiledDalvikSize;
@@ -172,7 +171,8 @@ static int dumpMethodStats(void *compilerMethodStats, void *totalMethodStats)
     /* If over 3/4 of the Dalvik code is compiled, print something */
     if (methodStats->compiledDalvikSize >= limit) {
         LOGD("Method stats: %s%s, %d/%d (compiled/total Dalvik), %d (native)",
-             method->clazz->descriptor, method->name,
+             methodStats->method->clazz->descriptor,
+             methodStats->method->name,
              methodStats->compiledDalvikSize,
              methodStats->dalvikSize,
              methodStats->nativeSize);
index b0478f4..31e7c0b 100644 (file)
@@ -239,7 +239,6 @@ void dvmDumpLIRInsn(LIR *arg, unsigned char *baseAddr)
     char opName[256];
     int offset = lir->generic.offset;
     int dest = lir->operands[0];
-    u2 *cPtr = (u2*)baseAddr;
     const bool dumpNop = false;
 
     /* Handle pseudo-ops individually, and all regular insns as a group */
index 05d311b..3c00ece 100644 (file)
@@ -1420,6 +1420,7 @@ void* dvmJitChain(void* tgtAddr, u4* branchAddr)
  * Attempt to enqueue a work order to patch an inline cache for a predicted
  * chaining cell for virtual/interface calls.
  */
+#if !defined(WITH_SELF_VERIFICATION)
 static bool inlineCachePatchEnqueue(PredictedChainingCell *cellAddr,
                                     PredictedChainingCell *newContent)
 {
@@ -1474,6 +1475,7 @@ static bool inlineCachePatchEnqueue(PredictedChainingCell *cellAddr,
     dvmUnlockMutex(&gDvmJit.compilerICPatchLock);
     return result;
 }
+#endif
 
 /*
  * This method is called from the invoke templates for virtual and interface
@@ -1641,8 +1643,6 @@ u4* dvmJitUnchain(void* codeAddr)
     int cellSize;
     u4* pChainCells;
     u4* pStart;
-    u4 thumb1;
-    u4 thumb2;
     u4 newInst;
     int i,j;
     PredictedChainingCell *predChainCell;
@@ -2246,7 +2246,6 @@ void dvmSelfVerificationMemOpDecode(int lr, int* sp)
         //LOGD("*** THUMB2 - Addr: 0x%x Insn: 0x%x", lr, insn);
 
         int opcode12 = (insn >> 20) & 0xFFF;
-        int opcode6 = (insn >> 6) & 0x3F;
         int opcode4 = (insn >> 8) & 0xF;
         int imm2 = (insn >> 4) & 0x3;
         int imm8 = insn & 0xFF;
index 515e8af..711431e 100644 (file)
@@ -197,7 +197,6 @@ static void selfVerificationBranchInsert(LIR *currentLIR, ArmOpCode opCode,
 static void selfVerificationBranchInsertPass(CompilationUnit *cUnit)
 {
     ArmLIR *thisLIR;
-    ArmLIR *branchLIR = dvmCompilerNew(sizeof(ArmLIR), true);
     TemplateOpCode opCode = TEMPLATE_MEM_OP_DECODE;
 
     for (thisLIR = (ArmLIR *) cUnit->firstLIRInsn;
@@ -237,7 +236,6 @@ static inline ArmLIR *genTrap(CompilationUnit *cUnit, int dOffset,
 /* Load a wide field from an object instance */
 static void genIGetWide(CompilationUnit *cUnit, MIR *mir, int fieldOffset)
 {
-    DecodedInstruction *dInsn = &mir->dalvikInsn;
     RegLocation rlObj = dvmCompilerGetSrc(cUnit, mir, 0);
     RegLocation rlDest = dvmCompilerGetDestWide(cUnit, mir, 0, 1);
     RegLocation rlResult;
@@ -262,7 +260,6 @@ static void genIGetWide(CompilationUnit *cUnit, MIR *mir, int fieldOffset)
 /* Store a wide field to an object instance */
 static void genIPutWide(CompilationUnit *cUnit, MIR *mir, int fieldOffset)
 {
-    DecodedInstruction *dInsn = &mir->dalvikInsn;
     RegLocation rlSrc = dvmCompilerGetSrcWide(cUnit, mir, 0, 1);
     RegLocation rlObj = dvmCompilerGetSrc(cUnit, mir, 2);
     rlObj = loadValue(cUnit, rlObj, kCoreReg);
@@ -287,9 +284,7 @@ static void genIPutWide(CompilationUnit *cUnit, MIR *mir, int fieldOffset)
 static void genIGet(CompilationUnit *cUnit, MIR *mir, OpSize size,
                     int fieldOffset)
 {
-    int regPtr;
     RegLocation rlResult;
-    DecodedInstruction *dInsn = &mir->dalvikInsn;
     RegLocation rlObj = dvmCompilerGetSrc(cUnit, mir, 0);
     RegLocation rlDest = dvmCompilerGetDest(cUnit, mir, 0);
     rlObj = loadValue(cUnit, rlObj, kCoreReg);
@@ -312,12 +307,10 @@ static void genIGet(CompilationUnit *cUnit, MIR *mir, OpSize size,
 static void genIPut(CompilationUnit *cUnit, MIR *mir, OpSize size,
                     int fieldOffset)
 {
-    DecodedInstruction *dInsn = &mir->dalvikInsn;
     RegLocation rlSrc = dvmCompilerGetSrc(cUnit, mir, 0);
     RegLocation rlObj = dvmCompilerGetSrc(cUnit, mir, 1);
     rlObj = loadValue(cUnit, rlObj, kCoreReg);
     rlSrc = loadValue(cUnit, rlSrc, kAnyReg);
-    int regPtr;
     genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, mir->offset,
                  NULL);/* null object? */
 
@@ -1185,6 +1178,7 @@ static void genInvokeVirtualCommon(CompilationUnit *cUnit, MIR *mir,
  * The return LIR is a branch based on the comparison result. The actual branch
  * target will be setup in the caller.
  */
+#if 0
 static ArmLIR *genCheckPredictedChain(CompilationUnit *cUnit,
                                           ArmLIR *predChainingCell,
                                           ArmLIR *retChainingCell,
@@ -1235,6 +1229,7 @@ static ArmLIR *genCheckPredictedChain(CompilationUnit *cUnit,
 
     return opCondBranch(cUnit, kArmCondEq);
 }
+#endif
 
 /* Geneate a branch to go back to the interpreter */
 static void genPuntToInterp(CompilationUnit *cUnit, unsigned int offset)
@@ -2183,8 +2178,7 @@ static bool handleFmt22c(CompilationUnit *cUnit, MIR *mir)
              * "len < 0": bail to the interpreter to re-execute the
              * instruction
              */
-            ArmLIR *pcrLabel =
-                genRegImmCheck(cUnit, kArmCondMi, r1, 0, mir->offset, NULL);
+            genRegImmCheck(cUnit, kArmCondMi, r1, 0, mir->offset, NULL);
             loadConstant(cUnit, r2, ALLOC_DONT_TRACK);
             opReg(cUnit, kOpBlx, r3);
             dvmCompilerClobberCallRegs(cUnit);
@@ -2653,10 +2647,6 @@ static bool handleFmt31t(CompilationUnit *cUnit, MIR *mir)
             dvmCompilerFlushAllRegs(cUnit);   /* Everything to home location */
             loadValueDirectFixed(cUnit, rlSrc, r1);
             dvmCompilerLockAllTemps(cUnit);
-            const u2 *switchData =
-                cUnit->method->insns + mir->offset + mir->dalvikInsn.vB;
-            u2 size = switchData[1];
-
             if (dalvikOpCode == OP_PACKED_SWITCH) {
                 LOAD_FUNC_ADDR(cUnit, r4PC, (int)findPackedSwitchIndex);
             } else {
@@ -2848,7 +2838,6 @@ static bool handleFmt35c_3rc(CompilationUnit *cUnit, MIR *mir, BasicBlock *bb,
         case OP_INVOKE_INTERFACE:
         case OP_INVOKE_INTERFACE_RANGE: {
             ArmLIR *predChainingCell = &labelList[bb->taken->id];
-            int methodIndex = dInsn->vB;
 
             /* Ensure that nothing is both live and dirty */
             dvmCompilerFlushAllRegs(cUnit);
@@ -3219,8 +3208,6 @@ static bool handleExecuteInline(CompilationUnit *cUnit, MIR *mir)
             const InlineOperation* inLineTable = dvmGetInlineOpsTable();
             int offset = offsetof(InterpState, retval);
             int operation = dInsn->vB;
-            int tReg1;
-            int tReg2;
             switch (operation) {
                 case INLINE_EMPTYINLINEMETHOD:
                     return false;  /* Nop */
@@ -3473,7 +3460,6 @@ static void genHoistedChecksForCountUpLoop(CompilationUnit *cUnit, MIR *mir)
     DecodedInstruction *dInsn = &mir->dalvikInsn;
     const int lenOffset = offsetof(ArrayObject, length);
     const int maxC = dInsn->arg[0];
-    const int minC = dInsn->arg[1];
     int regLength;
     RegLocation rlArray = cUnit->regLocation[mir->dalvikInsn.vA];
     RegLocation rlIdxEnd = cUnit->regLocation[mir->dalvikInsn.vC];
@@ -3522,7 +3508,6 @@ static void genHoistedChecksForCountDownLoop(CompilationUnit *cUnit, MIR *mir)
     const int lenOffset = offsetof(ArrayObject, length);
     const int regLength = dvmCompilerAllocTemp(cUnit);
     const int maxC = dInsn->arg[0];
-    const int minC = dInsn->arg[1];
     RegLocation rlArray = cUnit->regLocation[mir->dalvikInsn.vA];
     RegLocation rlIdxInit = cUnit->regLocation[mir->dalvikInsn.vB];
 
index 824e1a0..157bd1f 100644 (file)
@@ -112,7 +112,6 @@ static void loadValueDirectWideFixed(CompilationUnit *cUnit, RegLocation rlSrc,
 static RegLocation loadValue(CompilationUnit *cUnit, RegLocation rlSrc,
                              RegisterClass opKind)
 {
-    RegisterInfo *pReg;
     rlSrc = dvmCompilerEvalLoc(cUnit, rlSrc, opKind, false);
     if (rlSrc.location == kLocDalvikFrame) {
         loadValueDirect(cUnit, rlSrc, rlSrc.lowReg);
@@ -129,7 +128,6 @@ static RegLocation loadValue(CompilationUnit *cUnit, RegLocation rlSrc,
 static void storeValue(CompilationUnit *cUnit, RegLocation rlDest,
                        RegLocation rlSrc)
 {
-    RegisterInfo *pRegLo;
     LIR *defStart;
     LIR *defEnd;
     assert(!rlDest.wide);
@@ -179,8 +177,6 @@ static void storeValue(CompilationUnit *cUnit, RegLocation rlDest,
 static RegLocation loadValueWide(CompilationUnit *cUnit, RegLocation rlSrc,
                                  RegisterClass opKind)
 {
-    RegisterInfo *pRegLo;
-    RegisterInfo *pRegHi;
     assert(rlSrc.wide);
     rlSrc = dvmCompilerEvalLoc(cUnit, rlSrc, opKind, false);
     if (rlSrc.location == kLocDalvikFrame) {
@@ -202,11 +198,8 @@ static RegLocation loadValueWide(CompilationUnit *cUnit, RegLocation rlSrc,
 static void storeValueWide(CompilationUnit *cUnit, RegLocation rlDest,
                        RegLocation rlSrc)
 {
-    RegisterInfo *pRegLo;
-    RegisterInfo *pRegHi;
     LIR *defStart;
     LIR *defEnd;
-    bool srcFP = FPREG(rlSrc.lowReg) && FPREG(rlSrc.highReg);
     assert(FPREG(rlSrc.lowReg)==FPREG(rlSrc.highReg));
     assert(rlDest.wide);
     assert(rlSrc.wide);
index 9149646..b5bcf99 100644 (file)
@@ -183,7 +183,6 @@ static bool genConversion(CompilationUnit *cUnit, MIR *mir)
 static bool genInlineSqrt(CompilationUnit *cUnit, MIR *mir)
 {
     ArmLIR *branch;
-    DecodedInstruction *dInsn = &mir->dalvikInsn;
     RegLocation rlSrc = dvmCompilerGetSrcWide(cUnit, mir, 0, 1);
     RegLocation rlDest = inlinedTargetWide(cUnit, mir, true);
     rlSrc = loadValueWide(cUnit, rlSrc, kFPReg);
@@ -212,7 +211,6 @@ static bool genCmpFP(CompilationUnit *cUnit, MIR *mir, RegLocation rlDest,
 {
     bool isDouble;
     int defaultResult;
-    bool ltNaNBias;
     RegLocation rlResult;
 
     switch(mir->dalvikInsn.opCode) {
index 85dfa8e..729486c 100644 (file)
@@ -78,8 +78,6 @@ static void applyLoadStoreElimination(CompilationUnit *cUnit,
             continue;
         }
         if (isDalvikStore(thisLIR)) {
-            int dRegId = DECODE_ALIAS_INFO_REG(thisLIR->aliasInfo);
-            int dRegIdHi = dRegId + DECODE_ALIAS_INFO_WIDE(thisLIR->aliasInfo);
             int nativeRegId = thisLIR->operands[0];
             ArmLIR *checkLIR;
             int sinkDistance = 0;
@@ -208,7 +206,6 @@ static void applyLoadHoisting(CompilationUnit *cUnit,
 
         if (isDalvikLoad(thisLIR)) {
             int dRegId = DECODE_ALIAS_INFO_REG(thisLIR->aliasInfo);
-            int dRegIdHi = dRegId + DECODE_ALIAS_INFO_WIDE(thisLIR->aliasInfo);
             int nativeRegId = thisLIR->operands[0];
             ArmLIR *checkLIR;
             int hoistDistance = 0;
index e357ba6..80ce968 100644 (file)
@@ -463,14 +463,6 @@ extern void dvmCompilerLockTemp(CompilationUnit *cUnit, int reg)
     dvmCompilerAbort(cUnit);
 }
 
-static void lockArgRegs(CompilationUnit *cUnit)
-{
-    dvmCompilerLockTemp(cUnit, r0);
-    dvmCompilerLockTemp(cUnit, r1);
-    dvmCompilerLockTemp(cUnit, r2);
-    dvmCompilerLockTemp(cUnit, r3);
-}
-
 /* Clobber all regs that might be used by an external C call */
 extern void dvmCompilerClobberCallRegs(CompilationUnit *cUnit)
 {
@@ -698,12 +690,6 @@ extern void dvmCompilerMarkPair(CompilationUnit *cUnit, int lowReg, int highReg)
     infoHi->partner = lowReg;
 }
 
-static void markRegSingle(CompilationUnit *cUnit, int reg)
-{
-    RegisterInfo *info = getRegInfo(cUnit, reg);
-    info->pair = false;
-}
-
 extern void dvmCompilerMarkClean(CompilationUnit *cUnit, int reg)
 {
     RegisterInfo *info = getRegInfo(cUnit, reg);
@@ -722,13 +708,6 @@ extern void dvmCompilerMarkInUse(CompilationUnit *cUnit, int reg)
           info->inUse = true;
 }
 
-/* Return true if live & dirty */
-static bool isDirty(CompilationUnit *cUnit, int reg)
-{
-    RegisterInfo *info = getRegInfo(cUnit, reg);
-    return (info && info->live && info->dirty);
-}
-
 void copyRegInfo(CompilationUnit *cUnit, int newReg, int oldReg)
 {
     RegisterInfo *newInfo = getRegInfo(cUnit, newReg);
@@ -870,7 +849,6 @@ static RegLocation evalLocWide(CompilationUnit *cUnit, RegLocation loc,
 extern RegLocation dvmCompilerEvalLoc(CompilationUnit *cUnit, RegLocation loc,
                                       int regClass, bool update)
 {
-    RegisterInfo *infoLo = NULL;
     int newReg;
     if (loc.wide)
         return evalLocWide(cUnit, loc, regClass, update);
index 0141a0f..c7b52fd 100644 (file)
  */
 
 static int coreTemps[] = {r0, r1, r2, r3, r4PC, r7, r8, r9, r10, r11, r12};
-static int corePreserved[] = {};
 static int fpTemps[] = {fr16, fr17, fr18, fr19, fr20, fr21, fr22, fr23,
                         fr24, fr25, fr26, fr27, fr28, fr29, fr30, fr31};
-static int fpPreserved[] = {};
 
 static int encodeImmSingle(int value)
 {
@@ -579,7 +577,6 @@ static ArmLIR *opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest,
 static ArmLIR *opRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
                         int value)
 {
-    ArmLIR *res;
     bool neg = (value < 0);
     int absValue = (neg) ? -value : value;
     bool shortForm = (((absValue & 0xff) == absValue) && LOWREG(rDestSrc1));
@@ -813,7 +810,6 @@ static ArmLIR *loadBaseDispBody(CompilationUnit *cUnit, MIR *mir, int rBase,
     ArmOpCode opCode = kThumbBkpt;
     bool shortForm = false;
     bool thumb2Form = (displacement < 4092 && displacement >= 0);
-    int shortMax = 128;
     bool allLowRegs = (LOWREG(rBase) && LOWREG(rDest));
     int encodedDisp = displacement;
 
@@ -948,7 +944,6 @@ static ArmLIR *storeBaseDispBody(CompilationUnit *cUnit, int rBase,
     ArmOpCode opCode = kThumbBkpt;
     bool shortForm = false;
     bool thumb2Form = (displacement < 4092 && displacement >= 0);
-    int shortMax = 128;
     bool allLowRegs = (LOWREG(rBase) && LOWREG(rSrc));
     int encodedDisp = displacement;
 
index 1782bec..de75be7 100644 (file)
@@ -87,7 +87,6 @@ static void genLong3Addr(CompilationUnit *cUnit, MIR *mir, OpKind firstOp,
 
 void dvmCompilerInitializeRegAlloc(CompilationUnit *cUnit)
 {
-    int i;
     int numTemps = sizeof(coreTemps)/sizeof(int);
     int numFPTemps = sizeof(fpTemps)/sizeof(int);
     RegisterPool *pool = dvmCompilerNew(sizeof(*pool), true);
@@ -193,7 +192,6 @@ static ArmLIR *genExportPC(CompilationUnit *cUnit, MIR *mir)
 static void genMonitorEnter(CompilationUnit *cUnit, MIR *mir)
 {
     RegLocation rlSrc = dvmCompilerGetSrc(cUnit, mir, 0);
-    bool enter = (mir->dalvikInsn.opCode == OP_MONITOR_ENTER);
     ArmLIR *target;
     ArmLIR *hopTarget;
     ArmLIR *branch;
index 535c117..cde4a40 100644 (file)
@@ -366,10 +366,9 @@ static void dvmBreakpointSetFlush(BreakpointSet* pSet, ClassObject* clazz)
             LOGV("Flushing breakpoint at %p for %s\n",
                 pBreak->addr, clazz->descriptor);
             if (instructionIsMagicNop(pBreak->addr)) {
-                const Method* method = pBreak->method;
                 LOGV("Refusing to flush breakpoint on %04x at %s.%s + 0x%x\n",
-                    *pBreak->addr, method->clazz->descriptor,
-                    method->name, pBreak->addr - method->insns);
+                    *pBreak->addr, pBreak->method->clazz->descriptor,
+                    pBreak->method->name, pBreak->addr - pBreak->method->insns);
             } else {
                 dvmDexChangeDex1(clazz->pDvmDex, (u1*)pBreak->addr,
                     OP_BREAKPOINT);
@@ -815,7 +814,7 @@ s4 dvmInterpHandlePackedSwitch(const u2* switchData, s4 testVal)
 s4 dvmInterpHandleSparseSwitch(const u2* switchData, s4 testVal)
 {
     const int kInstrLen = 3;
-    u2 ident, size;
+    u2 size;
     const s4* keys;
     const s4* entries;
 
index 3d0d96c..58d28cd 100644 (file)
@@ -621,7 +621,7 @@ static JitEntry *lookupAndAdd(const u2* dPC, bool callerLocked)
  */
 int dvmCheckJit(const u2* pc, Thread* self, InterpState* interpState)
 {
-    int flags,i,len;
+    int flags, len;
     int switchInterp = false;
     bool debugOrProfile = dvmDebuggerOrProfilerActive();
 
@@ -630,8 +630,6 @@ int dvmCheckJit(const u2* pc, Thread* self, InterpState* interpState)
     interpState->lastPC = pc;
 
     switch (interpState->jitState) {
-        char* nopStr;
-        int target;
         int offset;
         DecodedInstruction decInsn;
         case kJitTSelect:
index 1ebbcf0..11a9a32 100644 (file)
@@ -429,8 +429,6 @@ static ClassObject* callPrep(Thread* self, const Method* method, Object* obj,
 void dvmCallMethod(Thread* self, const Method* method, Object* obj,
     JValue* pResult, ...)
 {
-    JValue result;
-
     va_list args;
     va_start(args, pResult);
     dvmCallMethodV(self, method, obj, false, pResult, args);
@@ -535,7 +533,9 @@ void dvmCallMethodV(Thread* self, const Method* method, Object* obj,
         dvmInterpret(self, method, pResult);
     }
 
+#ifndef NDEBUG
 bail:
+#endif
     dvmPopFrame(self);
 }
 
@@ -867,9 +867,9 @@ int dvmComputeExactFrameDepth(const void* fp)
 int dvmComputeVagueFrameDepth(Thread* thread, const void* fp)
 {
     const u1* interpStackStart = thread->interpStackStart;
-    const u1* interpStackBottom = interpStackStart - thread->interpStackSize;
 
-    assert((u1*) fp >= interpStackBottom && (u1*) fp < interpStackStart);
+    assert((u1*) fp >= interpStackStart - thread->interpStackSize);
+    assert((u1*) fp < interpStackStart);
     return interpStackStart - (u1*) fp;
 }
 
index 996d7ad..9037599 100644 (file)
@@ -206,7 +206,6 @@ JdwpError dvmJdwpRegisterEvent(JdwpState* state, JdwpEvent* pEvent)
     state->eventList = pEvent;
     state->numEvents++;
 
-bail:
     unlockEventMutex(state);
 
     return err;
@@ -425,8 +424,6 @@ static bool patternMatch(const char* pattern, const char* target)
             return false;
         return strcmp(pattern+1, target + (targetLen-patLen)) == 0;
     } else if (pattern[patLen-1] == '*') {
-        int i;
-
         return strncmp(pattern, target, patLen-1) == 0;
     } else {
         return strcmp(pattern, target) == 0;
index 53b5d26..06d76ed 100644 (file)
@@ -240,7 +240,6 @@ static JdwpError handleVM_ClassesBySignature(JdwpState* state,
     u4 numClasses;
     size_t strLen;
     RefTypeId refTypeId;
-    int i;
 
     classDescriptor = readNewUtf8String(&buf, &strLen);
     LOGV("  Req for class by signature '%s'\n", classDescriptor);
@@ -430,8 +429,6 @@ static JdwpError handleVM_CreateString(JdwpState* state,
 static JdwpError handleVM_Capabilities(JdwpState* state,
     const u1* buf, int dataLen, ExpandBuf* pReply)
 {
-    int i;
-
     expandBufAdd1(pReply, false);   /* canWatchFieldModification */
     expandBufAdd1(pReply, false);   /* canWatchFieldAccess */
     expandBufAdd1(pReply, false);   /* canGetBytecodes */
@@ -745,7 +742,6 @@ static JdwpError handleRT_ClassLoader(JdwpState* state,
     const u1* buf, int dataLen, ExpandBuf* pReply)
 {
     RefTypeId refTypeId;
-    ObjectId classLoaderId;
 
     refTypeId = dvmReadRefTypeId(&buf);
 
@@ -762,7 +758,6 @@ static JdwpError handleRT_FieldsWithGeneric(JdwpState* state,
     const u1* buf, int dataLen, ExpandBuf* pReply)
 {
     RefTypeId refTypeId;
-    int i, numFields;
 
     refTypeId = dvmReadRefTypeId(&buf);
     LOGV("  Req for fields in refTypeId=0x%llx\n", refTypeId);
@@ -785,7 +780,6 @@ static JdwpError handleRT_MethodsWithGeneric(JdwpState* state,
     const u1* buf, int dataLen, ExpandBuf* pReply)
 {
     RefTypeId refTypeId;
-    int i;
 
     refTypeId = dvmReadRefTypeId(&buf);
 
@@ -887,7 +881,6 @@ static JdwpError handleCT_NewInstance(JdwpState* state,
     ObjectId threadId;
     MethodId methodId;
     ObjectId objectId;
-    u4 numArgs;
 
     classId = dvmReadRefTypeId(&buf);
     threadId = dvmReadObjectId(&buf);
@@ -997,7 +990,6 @@ static JdwpError handleOR_GetValues(JdwpState* state,
         u1 fieldTag;
         int width;
         u1* ptr;
-        const char* fieldName;
 
         fieldId = dvmReadFieldId(&buf);
 
@@ -1420,7 +1412,6 @@ static JdwpError handleTGR_Children(JdwpState* state,
 {
     ObjectId threadGroupId;
     u4 threadCount;
-    ObjectId threadId;
     ObjectId* pThreadIds;
     ObjectId* walker;
     int i;
@@ -1510,8 +1501,6 @@ static JdwpError handleAR_SetValues(JdwpState* state,
     ObjectId arrayId;
     u4 firstIndex;
     u4 values;
-    u1 tag;
-    int i;
 
     arrayId = dvmReadObjectId(&buf);
     firstIndex = read4BE(&buf);
index ef24618..015f1c6 100644 (file)
@@ -40,8 +40,6 @@ static void* jdwpThreadStart(void* arg);
 JdwpState* dvmJdwpStartup(const JdwpStartupParams* pParams)
 {
     JdwpState* state = NULL;
-    int i, sleepIter;
-    u8 startWhen;
 
     /* comment this out when debugging JDWP itself */
     android_setMinPriority(LOG_TAG, ANDROID_LOG_DEBUG);
@@ -253,7 +251,6 @@ static void* jdwpThreadStart(void* arg)
      */
     while (state->run) {
         bool first;
-        int cc;
 
         if (state->params.server) {
             /*
index 42cd189..f5eebca 100644 (file)
@@ -270,6 +270,7 @@ static bool isConnected(JdwpState* state)
 /*
  * Returns "true" if the fd is ready, "false" if not.
  */
+#if 0
 static bool isFdReadable(int sock)
 {
     fd_set readfds;
@@ -291,6 +292,7 @@ static bool isFdReadable(int sock)
     LOGE("WEIRD: odd behavior in select (count=%d)\n", count);
     return false;
 }
+#endif
 
 #if 0
 /*
@@ -390,8 +392,7 @@ static bool establishConnection(JdwpState* state)
         struct sockaddr     addrPlain;
     } addr;
     struct hostent* pEntry;
-    char auxBuf[128];
-    int cc, h_errno;
+    int h_errno;
 
     assert(state != NULL && state->netState != NULL);
     assert(!state->params.server);
@@ -405,7 +406,8 @@ static bool establishConnection(JdwpState* state)
 //#warning "forcing non-R"
 #ifdef HAVE_GETHOSTBYNAME_R
     struct hostent he;
-    cc = gethostbyname_r(state->params.host, &he, auxBuf, sizeof(auxBuf),
+    char auxBuf[128];
+    int cc = gethostbyname_r(state->params.host, &he, auxBuf, sizeof(auxBuf),
             &pEntry, &h_errno);
     if (cc != 0) {
         LOGW("gethostbyname_r('%s') failed: %s\n",
@@ -536,6 +538,7 @@ static void consumeBytes(JdwpNetState* netState, int count)
 /*
  * Dump the contents of a packet to stdout.
  */
+#if 0
 static void dumpPacket(const unsigned char* packetBuf)
 {
     const unsigned char* buf = packetBuf;
@@ -567,6 +570,7 @@ static void dumpPacket(const unsigned char* packetBuf)
     if (dataLen > 0)
         dvmPrintHexDumpDbg(buf, dataLen, LOG_TAG);
 }
+#endif
 
 /*
  * Handle a packet.  Returns "false" if we encounter a connection-fatal error.
index 46e3e19..bcc6b99 100644 (file)
@@ -1251,7 +1251,7 @@ static void updateDebugger(const Method* method, const u2* pc, const u4* fp,
      */
     const StepControl* pCtrl = &gDvm.stepControl;
     if (pCtrl->active && pCtrl->thread == self) {
-        int line, frameDepth;
+        int frameDepth;
         bool doStop = false;
         const char* msg = NULL;
 
index 6716aba..7ac4a02 100644 (file)
@@ -60,7 +60,7 @@ static void updateDebugger(const Method* method, const u2* pc, const u4* fp,
      */
     const StepControl* pCtrl = &gDvm.stepControl;
     if (pCtrl->active && pCtrl->thread == self) {
-        int line, frameDepth;
+        int frameDepth;
         bool doStop = false;
         const char* msg = NULL;
 
index 95e01aa..fc95d30 100644 (file)
@@ -111,7 +111,6 @@ static void Dalvik_dalvik_system_DexFile_openDexFile(const u4* args,
 {
     StringObject* sourceNameObj = (StringObject*) args[0];
     StringObject* outputNameObj = (StringObject*) args[1];
-    int flags = args[2];
     DexOrJar* pDexOrJar = NULL;
     JarFile* pJarFile;
     RawDexFile* pRawDexFile;
index f8e8250..0aa811d 100644 (file)
@@ -225,7 +225,6 @@ static int setrlimitsFromArray(ArrayObject* rlimits)
 static void Dalvik_dalvik_system_Zygote_fork(const u4* args, JValue* pResult)
 {
     pid_t pid;
-    int err;
 
     if (!gDvm.zygote) {
         dvmThrowException("Ljava/lang/IllegalStateException;",
index 2d4e4b3..adec8d1 100644 (file)
@@ -85,7 +85,6 @@ static void Dalvik_java_lang_VMClassLoader_findLoadedClass(const u4* args,
     ClassObject* clazz = NULL;
     char* name = NULL;
     char* descriptor = NULL;
-    char* cp;
 
     if (nameObj == NULL) {
         dvmThrowException("Ljava/lang/NullPointerException;", NULL);
index 459fd35..b23b53c 100644 (file)
@@ -213,7 +213,6 @@ static void Dalvik_java_lang_VMThread_setPriority(const u4* args,
  */
 static void Dalvik_java_lang_VMThread_sleep(const u4* args, JValue* pResult)
 {
-    Thread* self = dvmThreadSelf();
     dvmThreadSleep(GET_ARG_LONG(args,0), args[2]);
     RETURN_VOID();
 }
index 05eccdc..a34b983 100644 (file)
@@ -2187,9 +2187,7 @@ void dvmMakeCodeReadOnly(Method* meth)
 static int computeJniArgInfo(const DexProto* proto)
 {
     const char* sig = dexProtoGetShorty(proto);
-    int returnType, padFlags, jniArgInfo;
-    char sigByte;
-    int stackOffset, padMask;
+    int returnType, jniArgInfo;
     u4 hints;
 
     /* The first shorty character is the return type. */
index fb4b83f..c2f5131 100644 (file)
@@ -295,7 +295,6 @@ static Method* resolveAmbiguousMethod(const ClassObject* referrer, u4 methodIdx)
     Method* resMethod;
     const DexMethodId* pMethodId;
     const char* name;
-    const char* signature;
 
     /* if we've already resolved this method, return it */
     resMethod = dvmDexGetResolvedMethod(referrer->pDvmDex, methodIdx);
@@ -804,7 +803,6 @@ static Object* processEncodedAnnotation(const ClassObject* clazz,
     const u1** pPtr)
 {
     Thread* self = dvmThreadSelf();
-    const DexFile* pDexFile = clazz->pDvmDex->pDexFile;
     Object* newAnno = NULL;
     ArrayObject* elementArray = NULL;
     const ClassObject* annoClass;
@@ -1023,7 +1021,6 @@ static bool skipAnnotationValue(const ClassObject* clazz, const u1** pPtr)
  */
 static bool skipEncodedAnnotation(const ClassObject* clazz, const u1** pPtr)
 {
-    const DexFile* pDexFile = clazz->pDvmDex->pDexFile;
     const u1* ptr;
     u4 size;
 
@@ -1148,7 +1145,6 @@ static Object* getAnnotationValue(const ClassObject* clazz,
     int expectedType, const char* debugAnnoName)
 {
     const u1* ptr;
-    Object* obj;
     AnnotationValue avalue;
 
     /* find the annotation */
@@ -1894,7 +1890,6 @@ static const DexAnnotationSetItem* findAnnotationSetForField(const Field* field)
     DexFile* pDexFile = clazz->pDvmDex->pDexFile;
     const DexAnnotationsDirectoryItem* pAnnoDir;
     const DexFieldAnnotationsItem* pFieldList;
-    const DexAnnotationSetItem* pAnnoSet = NULL;
 
     pAnnoDir = getAnnoDirectory(pDexFile, clazz);
     if (pAnnoDir == NULL)
@@ -1941,8 +1936,6 @@ ArrayObject* dvmGetFieldAnnotations(const Field* field)
 {
     ClassObject* clazz = field->clazz;
     ArrayObject* annoArray = NULL;
-    DexFile* pDexFile = clazz->pDvmDex->pDexFile;
-    const DexAnnotationsDirectoryItem* pAnnoDir;
     const DexAnnotationSetItem* pAnnoSet = NULL;
 
     pAnnoSet = findAnnotationSetForField(field);
index 4270894..4b95e36 100644 (file)
@@ -428,7 +428,6 @@ bail:
 static int copyWithoutDuplicates(Method** allMethods, int allCount,
     Method** outMethods, ArrayObject* throwLists)
 {
-    Method* best;
     int outCount = 0;
     int i, j;
 
@@ -939,7 +938,6 @@ static void proxyInvoker(const u4* args, JValue* pResult,
     Object* handler;
     Method* invoke;
     ClassObject* returnType;
-    int hOffset;
     JValue invokeResult;
 
     /*
index 38b1ed0..7fc07b5 100644 (file)
@@ -1093,10 +1093,8 @@ DataObject* dvmWrapPrimitive(JValue value, ClassObject* returnType)
 bool dvmUnwrapPrimitive(Object* value, ClassObject* returnType,
     JValue* pResult)
 {
-    JValue result;
     PrimitiveType typeIndex = returnType->primitiveType;
     PrimitiveType valueIndex;
-    //const u4* dataPtr;
 
     if (typeIndex == PRIM_NOT) {
         if (value != NULL && !dvmInstanceof(value->clazz, returnType)) {
index 7233b15..26de141 100644 (file)
@@ -61,7 +61,7 @@ static void dumpIterator(HashTable* pTab)
     for (dvmHashIterBegin(pTab, &iter); !dvmHashIterDone(&iter);
         dvmHashIterNext(&iter))
     {
-        const char* str = (const char*) dvmHashIterData(&iter);
+        //const char* str = (const char*) dvmHashIterData(&iter);
         //printf("  '%s'\n", str);
         // (should verify strings)
         count++;