summaryrefslogtreecommitdiffstats
path: root/vm/compiler/Utility.c
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2010-12-10 15:34:00 -0800
committerAndy McFadden <fadden@android.com>2010-12-16 15:33:00 -0800
commit9fd527f3258381b33365cb18fd37c7864e2bbb40 (patch)
treeae144f104c1c44efdbc97c03a9b9797e558ea6d6 /vm/compiler/Utility.c
parentbfac08e47db21634161398169e638d8b6fbd7373 (diff)
downloadandroid_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/Utility.c')
-rw-r--r--vm/compiler/Utility.c17
1 files changed, 7 insertions, 10 deletions
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();
}