Minor improvements to marking convenience functions.
* Refine the type signature of isMarked to improve its type safety.
* Remove the untagging operation from isUnmarked required by an
earlier string intern table implementation.
Change-Id: Ib3beace789b5c43ead25f6e2ad7b6dc3e2427e51
diff --git a/vm/alloc/MarkSweep.c b/vm/alloc/MarkSweep.c
index 1fb3f24..c82790f 100644
--- a/vm/alloc/MarkSweep.c
+++ b/vm/alloc/MarkSweep.c
@@ -39,10 +39,10 @@
typedef unsigned long Word;
const size_t kWordSize = sizeof(Word);
-/* Do not cast the result of this to a boolean; the only set bit
- * may be > 1<<8.
+/*
+ * Returns true if the given object is marked.
*/
-static long isMarked(const void *obj, const GcMarkContext *ctx)
+static bool isMarked(const Object *obj, const GcMarkContext *ctx)
{
return dvmHeapBitmapIsObjectBitSet(ctx->bitmap, obj);
}
@@ -985,10 +985,9 @@
* Returns true if the given object is unmarked. This assumes that
* the bitmaps have not yet been swapped.
*/
-static int isUnmarkedObject(void *object)
+static int isUnmarkedObject(void *obj)
{
- return !isMarked((void *)((uintptr_t)object & ~(HB_OBJECT_ALIGNMENT-1)),
- &gDvm.gcHeap->markContext);
+ return !isMarked((Object *)obj, &gDvm.gcHeap->markContext);
}
/*