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/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();
}