diff options
author | Andy McFadden <fadden@android.com> | 2010-12-10 15:34:00 -0800 |
---|---|---|
committer | Andy McFadden <fadden@android.com> | 2010-12-16 15:33:00 -0800 |
commit | 9fd527f3258381b33365cb18fd37c7864e2bbb40 (patch) | |
tree | ae144f104c1c44efdbc97c03a9b9797e558ea6d6 /vm/compiler | |
parent | bfac08e47db21634161398169e638d8b6fbd7373 (diff) | |
download | android_dalvik-9fd527f3258381b33365cb18fd37c7864e2bbb40.tar.gz android_dalvik-9fd527f3258381b33365cb18fd37c7864e2bbb40.tar.bz2 android_dalvik-9fd527f3258381b33365cb18fd37c7864e2bbb40.zip |
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
Diffstat (limited to 'vm/compiler')
-rw-r--r-- | vm/compiler/CompilerUtility.h | 6 | ||||
-rw-r--r-- | vm/compiler/MethodSSATransformation.c | 6 | ||||
-rw-r--r-- | vm/compiler/Utility.c | 17 |
3 files changed, 13 insertions, 16 deletions
diff --git a/vm/compiler/CompilerUtility.h b/vm/compiler/CompilerUtility.h index 3e65a2eb0..5dd1faf8d 100644 --- a/vm/compiler/CompilerUtility.h +++ b/vm/compiler/CompilerUtility.h @@ -63,9 +63,9 @@ void dvmGrowableListIteratorInit(GrowableList *gList, 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 48d5b5ce9..60eea334a 100644 --- a/vm/compiler/MethodSSATransformation.c +++ b/vm/compiler/MethodSSATransformation.c @@ -346,9 +346,9 @@ static void computeSuccLiveIn(BitVector *dest, 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 fe258331f..7be57efa2 100644 --- a/vm/compiler/Utility.c +++ b/vm/compiler/Utility.c @@ -269,13 +269,12 @@ void dvmCompilerDumpStats(void) * 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 @@ BitVector* dvmCompilerAllocBitVector(int startBits, bool expandable) * 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 @@ bool dvmCompilerSetBit(BitVector *pBits, int num) * 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(); } |