fix bug in calculating GC footprint in new heap pool code

This commit is contained in:
Joel Dice 2007-08-22 20:24:25 -06:00
parent 00c611fcf9
commit c6e1644281
2 changed files with 7 additions and 2 deletions

View File

@ -114,7 +114,7 @@ killZombies(Thread* t, Thread* o)
unsigned unsigned
footprint(Thread* t) footprint(Thread* t)
{ {
unsigned n = t->heapIndex; unsigned n = t->heapOffset + t->heapIndex;
if (t->large) { if (t->large) {
n += extendedSize n += extendedSize
@ -366,6 +366,7 @@ postCollect(Thread* t)
#endif #endif
t->heap = t->defaultHeap; t->heap = t->defaultHeap;
t->heapOffset = 0;
t->heapIndex = 0; t->heapIndex = 0;
if (t->large) { if (t->large) {
@ -1333,6 +1334,7 @@ Thread::Thread(Machine* m, object javaThread, Thread* parent):
sp(0), sp(0),
frame(-1), frame(-1),
heapIndex(0), heapIndex(0),
heapOffset(0),
protector(0), protector(0),
runnable(this) runnable(this)
#ifdef VM_STRESS #ifdef VM_STRESS
@ -1622,6 +1624,8 @@ allocate2(Thread* t, unsigned sizeInBytes)
(t->vm->system->tryAllocate(Thread::HeapSizeInBytes)); (t->vm->system->tryAllocate(Thread::HeapSizeInBytes));
if (t->heap) { if (t->heap) {
t->vm->heapPool[t->vm->heapPoolIndex++] = t->heap; t->vm->heapPool[t->vm->heapPoolIndex++] = t->heap;
t->heapOffset += t->heapIndex;
t->heapIndex = 0;
} }
} }

View File

@ -1098,7 +1098,7 @@ class Machine {
dispose(); dispose();
} }
static const unsigned HeapPoolSize = 16; static const unsigned HeapPoolSize = 8;
void dispose(); void dispose();
@ -1223,6 +1223,7 @@ class Thread {
unsigned sp; unsigned sp;
int frame; int frame;
unsigned heapIndex; unsigned heapIndex;
unsigned heapOffset;
Protector* protector; Protector* protector;
Runnable runnable; Runnable runnable;
object* heap; object* heap;