Progress on live-precise GC.

This implements computation of register liveness.  This is still a work
in progress.  The computation is disabled by default, and when enabled
it's not yet used during the generation of register maps.  The code
has not been thoughly tested.

While working on this I fiddled around with the verifier's verbose
debugging stuff a bit.

This also changes some stuff in BitVector.  Unsigned ints are now
prevalent, and functions like dvmSetBit abort rather than returning a
boolean value when an illegal operation is attempted.  (Some parallel
functions in the compiler were also updated.)

Bug 2534655

Change-Id: Iea161c6d63a310e1dbdac2aeeb7b7aeadda8807c
diff --git a/vm/compiler/CompilerUtility.h b/vm/compiler/CompilerUtility.h
index 3e65a2e..5dd1faf 100644
--- a/vm/compiler/CompilerUtility.h
+++ b/vm/compiler/CompilerUtility.h
@@ -63,9 +63,9 @@
 intptr_t dvmGrowableListIteratorNext(GrowableListIterator *iterator);
 intptr_t dvmGrowableListGetElement(const GrowableList *gList, size_t idx);
 
-BitVector* dvmCompilerAllocBitVector(int startBits, bool expandable);
-bool dvmCompilerSetBit(BitVector* pBits, int num);
-bool dvmCompilerClearBit(BitVector* pBits, int num);
+BitVector* dvmCompilerAllocBitVector(unsigned int startBits, bool expandable);
+bool dvmCompilerSetBit(BitVector* pBits, unsigned int num);
+bool dvmCompilerClearBit(BitVector* pBits, unsigned int num);
 void dvmCompilerMarkAllBits(BitVector *pBits, bool set);
 void dvmDebugBitVector(char *msg, const BitVector *bv, int length);
 void dvmDumpLIRInsn(struct LIR *lir, unsigned char *baseAddr);
diff --git a/vm/compiler/MethodSSATransformation.c b/vm/compiler/MethodSSATransformation.c
index 48d5b5c..60eea33 100644
--- a/vm/compiler/MethodSSATransformation.c
+++ b/vm/compiler/MethodSSATransformation.c
@@ -346,9 +346,9 @@
         dvmAbort();
     }
 
-    int i;
-    for (i = 0; i < dest->storageSize; i++) {
-        dest->storage[i] |= src1->storage[i] & ~src2->storage[i];
+    unsigned int idx;
+    for (idx = 0; idx < dest->storageSize; idx++) {
+        dest->storage[idx] |= src1->storage[idx] & ~src2->storage[idx];
     }
 }
 
diff --git a/vm/compiler/Utility.c b/vm/compiler/Utility.c
index fe25833..7be57ef 100644
--- a/vm/compiler/Utility.c
+++ b/vm/compiler/Utility.c
@@ -269,13 +269,12 @@
  * NOTE: this is the sister implementation of dvmAllocBitVector. In this version
  * memory is allocated from the compiler arena.
  */
-BitVector* dvmCompilerAllocBitVector(int startBits, bool expandable)
+BitVector* dvmCompilerAllocBitVector(unsigned int startBits, bool expandable)
 {
     BitVector* bv;
-    int count;
+    unsigned int count;
 
     assert(sizeof(bv->storage[0]) == 4);        /* assuming 32-bit units */
-    assert(startBits >= 0);
 
     bv = (BitVector*) dvmCompilerNew(sizeof(BitVector), false);
 
@@ -296,15 +295,14 @@
  * NOTE: this is the sister implementation of dvmSetBit. In this version
  * memory is allocated from the compiler arena.
  */
-bool dvmCompilerSetBit(BitVector *pBits, int num)
+bool dvmCompilerSetBit(BitVector *pBits, unsigned int num)
 {
-    assert(num >= 0);
-    if (num >= pBits->storageSize * (int)sizeof(u4) * 8) {
+    if (num >= pBits->storageSize * sizeof(u4) * 8) {
         if (!pBits->expandable)
             dvmAbort();
 
         /* Round up to word boundaries for "num+1" bits */
-        int newSize = (num + 1 + 31) >> 5;
+        unsigned int newSize = (num + 1 + 31) >> 5;
         assert(newSize > pBits->storageSize);
         u4 *newStorage = (u4*)dvmCompilerNew(newSize * sizeof(u4), false);
         memcpy(newStorage, pBits->storage, pBits->storageSize * sizeof(u4));
@@ -327,10 +325,9 @@
  * NOTE: this is the sister implementation of dvmClearBit. In this version
  * memory is allocated from the compiler arena.
  */
-bool dvmCompilerClearBit(BitVector *pBits, int num)
+bool dvmCompilerClearBit(BitVector *pBits, unsigned int num)
 {
-    assert(num >= 0);
-    if (num >= pBits->storageSize * (int)sizeof(u4) * 8) {
+    if (num >= pBits->storageSize * sizeof(u4) * 8) {
         LOGE("Trying to clear a bit that is not set in the vector yet!");
         dvmAbort();
     }