From 8ecee7b81c70a8f61d984b6fb2e37fa3ecbd79f9 Mon Sep 17 00:00:00 2001 From: Carl Shapiro Date: Thu, 11 Mar 2010 20:50:08 -0800 Subject: [PATCH] Eliminate unused heap bitmap functions. This is mostly the "list" code which is no longer needed. Change-Id: I3636a4a6a36e55d2ad080571cdb6c23a16f98aaf --- vm/alloc/HeapBitmap.c | 85 --------------------------------------------------- vm/alloc/HeapBitmap.h | 78 ---------------------------------------------- 2 files changed, 163 deletions(-) diff --git a/vm/alloc/HeapBitmap.c b/vm/alloc/HeapBitmap.c index e2cf117b8..b42fc0161 100644 --- a/vm/alloc/HeapBitmap.c +++ b/vm/alloc/HeapBitmap.c @@ -78,46 +78,6 @@ dvmHeapBitmapInit(HeapBitmap *hb, const void *base, size_t maxSize, } /* - * Initialize so that it covers the same extent as . - */ -bool -dvmHeapBitmapInitFromTemplate(HeapBitmap *hb, const HeapBitmap *templateBitmap, - const char *name) -{ - return dvmHeapBitmapInit(hb, - (void *)templateBitmap->base, HB_MAX_OFFSET(templateBitmap), name); -} - -/* - * Initialize the bitmaps in so that they cover the same extent as - * the corresponding bitmaps in . - */ -bool -dvmHeapBitmapInitListFromTemplates(HeapBitmap out[], HeapBitmap templates[], - size_t numBitmaps, const char *name) -{ - size_t i; - char fullName[PATH_MAX]; - - fullName[sizeof(fullName)-1] = '\0'; - for (i = 0; i < numBitmaps; i++) { - bool ok; - - /* If two ashmem regions have the same name, only one gets - * the name when looking at the maps. - */ - snprintf(fullName, sizeof(fullName)-1, "%s/%zd", name, i); - - ok = dvmHeapBitmapInitFromTemplate(&out[i], &templates[i], fullName); - if (!ok) { - dvmHeapBitmapDeleteList(out, i); - return false; - } - } - return true; -} - -/* * Clean up any resources associated with the bitmap. */ void @@ -132,19 +92,6 @@ dvmHeapBitmapDelete(HeapBitmap *hb) } /* - * Clean up any resources associated with the bitmaps. - */ -void -dvmHeapBitmapDeleteList(HeapBitmap hbs[], size_t numBitmaps) -{ - size_t i; - - for (i = 0; i < numBitmaps; i++) { - dvmHeapBitmapDelete(&hbs[i]); - } -} - -/* * Fill the bitmap with zeroes. Returns the bitmap's memory to * the system as a side-effect. */ @@ -380,35 +327,3 @@ dvmHeapBitmapWalk(const HeapBitmap *hb, return dvmHeapBitmapXorWalk(hb, &emptyHb, callback, callbackArg); } - -/* - * Similar to dvmHeapBitmapXorWalkList(), but visit the set bits - * in a single list of bitmaps. Regardless of the order of the array, - * the bitmaps will be visited in address order, so that finger will - * increase monotonically. - */ -bool dvmHeapBitmapWalkList(const HeapBitmap hbs[], size_t numBitmaps, - bool (*callback)(size_t numPtrs, void **ptrs, - const void *finger, void *arg), - void *callbackArg) -{ - size_t indexList[numBitmaps]; - size_t i; - - /* Sort the bitmaps by address. - */ - createSortedBitmapIndexList(hbs, numBitmaps, indexList); - - /* Walk each bitmap, lowest address first. - */ - for (i = 0; i < numBitmaps; i++) { - bool ok; - - ok = dvmHeapBitmapWalk(&hbs[indexList[i]], callback, callbackArg); - if (!ok) { - return false; - } - } - - return true; -} diff --git a/vm/alloc/HeapBitmap.h b/vm/alloc/HeapBitmap.h index b9f81645c..ec82a7a52 100644 --- a/vm/alloc/HeapBitmap.h +++ b/vm/alloc/HeapBitmap.h @@ -86,29 +86,11 @@ bool dvmHeapBitmapInit(HeapBitmap *hb, const void *base, size_t maxSize, const char *name); /* - * Initialize so that it covers the same extent as . - */ -bool dvmHeapBitmapInitFromTemplate(HeapBitmap *hb, - const HeapBitmap *templateBitmap, const char *name); - -/* - * Initialize the bitmaps in so that they cover the same extent as - * the corresponding bitmaps in . - */ -bool dvmHeapBitmapInitListFromTemplates(HeapBitmap out[], - HeapBitmap templates[], size_t numBitmaps, const char *name); - -/* * Clean up any resources associated with the bitmap. */ void dvmHeapBitmapDelete(HeapBitmap *hb); /* - * Clean up any resources associated with the bitmaps. - */ -void dvmHeapBitmapDeleteList(HeapBitmap hbs[], size_t numBitmaps); - -/* * Fill the bitmap with zeroes. Returns the bitmap's memory to * the system as a side-effect. */ @@ -160,22 +142,6 @@ bool dvmHeapBitmapWalkList(const HeapBitmap hbs[], size_t numBitmaps, bool (*callback)(size_t numPtrs, void **ptrs, const void *finger, void *arg), void *callbackArg); -/* - * Return true iff is within the range of pointers that - * have had corresponding bits set in this bitmap. - */ -HB_INLINE_PROTO( - bool - dvmHeapBitmapMayContainObject(const HeapBitmap *hb, - const void *obj) -) -{ - const uintptr_t p = (const uintptr_t)obj; - - assert((p & (HB_OBJECT_ALIGNMENT - 1)) == 0); - - return p >= hb->base && p <= hb->max; -} /* * Return true iff is within the range of pointers that this @@ -251,29 +217,6 @@ HB_INLINE_PROTO( } /* - * Like dvmHeapBitmapSetAndReturnObjectBit(), but sets/returns the bit - * in the appropriate bitmap. Results are undefined if is not - * covered by any bitmap. - */ -HB_INLINE_PROTO( - unsigned long int - dvmHeapBitmapSetAndReturnObjectBitInList(HeapBitmap hbs[], - size_t numBitmaps, const void *obj) -) -{ - size_t i; - - for (i = 0; i < numBitmaps; i++) { - if (dvmHeapBitmapCoversAddress(&hbs[i], obj)) { - return dvmHeapBitmapSetAndReturnObjectBit(&hbs[i], obj); - } - } - - assert(!"object not covered by any bitmap"); - return false; -} - -/* * Sets the bit corresponding to , and widens the range of seen * pointers if necessary. Does no range checking. */ @@ -320,27 +263,6 @@ HB_INLINE_PROTO( } } -/* - * Looks through the list of bitmaps and returns the current value of the - * bit corresponding to , which may be covered by any of the bitmaps. - * Does no range checking. - */ -HB_INLINE_PROTO( - long - dvmHeapBitmapIsObjectBitSetInList(const HeapBitmap hbs[], size_t numBitmaps, - const void *obj) -) -{ - size_t i; - - for (i = 0; i < numBitmaps; i++) { - if (dvmHeapBitmapCoversAddress(&hbs[i], obj)) { - return dvmHeapBitmapIsObjectBitSet(&hbs[i], obj); - } - } - return false; -} - #undef HB_INLINE_PROTO #endif // _DALVIK_HEAP_BITMAP -- 2.11.0