Change the bitmap callback signature to have a void return value.

Previously, a bitmap callback could abort the bitmap traversal by
returning false.  All of the bitmap callbacks used in the garbage
collector are hardwired to return true.  This change eliminates the
early termination facility and its attendant complexity.

Change-Id: I5490dd74b56b9700ec1b7e657637fae5eb4cc339
diff --git a/vm/alloc/HeapBitmap.c b/vm/alloc/HeapBitmap.c
index 1f4a9c9..4df30e7 100644
--- a/vm/alloc/HeapBitmap.c
+++ b/vm/alloc/HeapBitmap.c
@@ -92,11 +92,8 @@
  * the current XorWalk.  <finger> will be set to ULONG_MAX when the
  * end of the bitmap is reached.
  */
-bool
-dvmHeapBitmapXorWalk(const HeapBitmap *hb1, const HeapBitmap *hb2,
-        bool (*callback)(size_t numPtrs, void **ptrs,
-                         const void *finger, void *arg),
-        void *callbackArg)
+void dvmHeapBitmapXorWalk(const HeapBitmap *hb1, const HeapBitmap *hb2,
+                          BitmapCallback *callback, void *callbackArg)
 {
     static const size_t kPointerBufSize = 128;
     void *pointerBuf[kPointerBufSize];
@@ -106,12 +103,8 @@
 
 #define FLUSH_POINTERBUF(finger_) \
     do { \
-        if (!callback(pb - pointerBuf, (void **)pointerBuf, \
-                (void *)(finger_), callbackArg)) \
-        { \
-            LOGW("dvmHeapBitmapXorWalk: callback failed\n"); \
-            return false; \
-        } \
+        (*callback)(pb - pointerBuf, (void **)pointerBuf, \
+                    (void *)(finger_), callbackArg); \
         pb = pointerBuf; \
     } while (false)
 
@@ -151,17 +144,17 @@
         LOGW("dvmHeapBitmapXorWalk: bitmaps cover different heaps "
                 "(0x%08x != 0x%08x)\n",
                 (uintptr_t)hb1->base, (uintptr_t)hb2->base);
-        return false;
+        return;
     }
     if (hb1->bitsLen != hb2->bitsLen) {
         LOGW("dvmHeapBitmapXorWalk: size of bitmaps differ (%zd != %zd)\n",
                 hb1->bitsLen, hb2->bitsLen);
-        return false;
+        return;
     }
     if (hb1->max < hb1->base && hb2->max < hb2->base) {
         /* Easy case; both are obviously empty.
          */
-        return true;
+        return;
     }
 
     /* First, walk along the section of the bitmaps that may be the same.
@@ -216,9 +209,6 @@
         FLUSH_POINTERBUF(finalFinger);
         assert(finalFinger > longHb->max);
     }
-
-    return true;
-
 #undef FLUSH_POINTERBUF
 #undef DECODE_BITS
 }
@@ -227,11 +217,8 @@
  * Similar to dvmHeapBitmapXorWalk(), but visit the set bits
  * in a single bitmap.
  */
-bool
-dvmHeapBitmapWalk(const HeapBitmap *hb,
-        bool (*callback)(size_t numPtrs, void **ptrs,
-                         const void *finger, void *arg),
-        void *callbackArg)
+void dvmHeapBitmapWalk(const HeapBitmap *hb,
+                       BitmapCallback *callback, void *callbackArg)
 {
     /* Create an empty bitmap with the same extent as <hb>.
      * Don't actually allocate any memory.
@@ -239,6 +226,5 @@
     HeapBitmap emptyHb = *hb;
     emptyHb.max = emptyHb.base - 1; // empty
     emptyHb.bits = (void *)1;       // non-NULL but intentionally bad
-
-    return dvmHeapBitmapXorWalk(hb, &emptyHb, callback, callbackArg);
+    dvmHeapBitmapXorWalk(hb, &emptyHb, callback, callbackArg);
 }
diff --git a/vm/alloc/HeapBitmap.h b/vm/alloc/HeapBitmap.h
index 2a4fe2c..5571b02 100644
--- a/vm/alloc/HeapBitmap.h
+++ b/vm/alloc/HeapBitmap.h
@@ -80,6 +80,8 @@
 };
 typedef struct HeapBitmap HeapBitmap;
 
+typedef void BitmapCallback(size_t numPtrs, void **ptrs,
+                            const void *finger, void *arg);
 
 /*
  * Initialize a HeapBitmap so that it points to a bitmap large
@@ -111,19 +113,15 @@
  * the current XorWalk.  <finger> will be set to ULONG_MAX when the
  * end of the bitmap is reached.
  */
-bool dvmHeapBitmapXorWalk(const HeapBitmap *hb1, const HeapBitmap *hb2,
-        bool (*callback)(size_t numPtrs, void **ptrs,
-                         const void *finger, void *arg),
-        void *callbackArg);
+void dvmHeapBitmapXorWalk(const HeapBitmap *hb1, const HeapBitmap *hb2,
+                          BitmapCallback *callback, void *callbackArg);
 
 /*
  * Similar to dvmHeapBitmapXorWalk(), but visit the set bits
  * in a single bitmap.
  */
-bool dvmHeapBitmapWalk(const HeapBitmap *hb,
-        bool (*callback)(size_t numPtrs, void **ptrs,
-                         const void *finger, void *arg),
-        void *callbackArg);
+void dvmHeapBitmapWalk(const HeapBitmap *hb,
+                       BitmapCallback *callback, void *callbackArg);
 
 /*
  * Return true iff <obj> is within the range of pointers that this
diff --git a/vm/alloc/MarkSweep.c b/vm/alloc/MarkSweep.c
index 94179e4..0266ada 100644
--- a/vm/alloc/MarkSweep.c
+++ b/vm/alloc/MarkSweep.c
@@ -654,10 +654,10 @@
 static uintptr_t gLastFinger = 0;
 #endif
 
-static bool
-scanBitmapCallback(size_t numPtrs, void **ptrs, const void *finger, void *arg)
+static void scanBitmapCallback(size_t numPtrs, void **ptrs,
+                               const void *finger, void *arg)
 {
-    GcMarkContext *ctx = (GcMarkContext *)arg;
+    GcMarkContext *ctx = arg;
     size_t i;
 
 #ifndef NDEBUG
@@ -669,8 +669,6 @@
     for (i = 0; i < numPtrs; i++) {
         scanObject(*ptrs++, ctx);
     }
-
-    return true;
 }
 
 /* Given bitmaps with the root set marked, find and mark all
@@ -959,8 +957,8 @@
     markContext->finger = NULL;
 }
 
-static bool
-sweepBitmapCallback(size_t numPtrs, void **ptrs, const void *finger, void *arg)
+static void sweepBitmapCallback(size_t numPtrs, void **ptrs,
+                                const void *finger, void *arg)
 {
     const ClassObject *const classJavaLangClass = gDvm.classJavaLangClass;
     const bool overwriteFree = gDvm.overwriteFree;
@@ -998,8 +996,6 @@
     // TODO: dvmHeapSourceFreeList has a loop, just like the above
     // does. Consider collapsing the two loops to save overhead.
     dvmHeapSourceFreeList(numPtrs, ptrs);
-
-    return true;
 }
 
 /* Returns true if the given object is unmarked.  Ignores the low bits
diff --git a/vm/alloc/Verify.c b/vm/alloc/Verify.c
index f71b0f1..47d28d8 100644
--- a/vm/alloc/Verify.c
+++ b/vm/alloc/Verify.c
@@ -56,7 +56,7 @@
 /*
  * Helper function to call dvmVerifyObject from a bitmap walker.
  */
-static bool verifyBitmapCallback(size_t numPtrs, void **ptrs,
+static void verifyBitmapCallback(size_t numPtrs, void **ptrs,
                                  const void *finger, void *arg)
 {
     size_t i;
@@ -64,7 +64,6 @@
     for (i = 0; i < numPtrs; i++) {
         dvmVerifyObject(ptrs[i]);
     }
-    return true;
 }
 
 /*