From c6e164428117699c508ecbc7d1ee1c7c50415078 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 22 Aug 2007 20:24:25 -0600 Subject: [PATCH] fix bug in calculating GC footprint in new heap pool code --- src/machine.cpp | 6 +++++- src/machine.h | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/machine.cpp b/src/machine.cpp index d2046e815c..c7d9761708 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -114,7 +114,7 @@ killZombies(Thread* t, Thread* o) unsigned footprint(Thread* t) { - unsigned n = t->heapIndex; + unsigned n = t->heapOffset + t->heapIndex; if (t->large) { n += extendedSize @@ -366,6 +366,7 @@ postCollect(Thread* t) #endif t->heap = t->defaultHeap; + t->heapOffset = 0; t->heapIndex = 0; if (t->large) { @@ -1333,6 +1334,7 @@ Thread::Thread(Machine* m, object javaThread, Thread* parent): sp(0), frame(-1), heapIndex(0), + heapOffset(0), protector(0), runnable(this) #ifdef VM_STRESS @@ -1622,6 +1624,8 @@ allocate2(Thread* t, unsigned sizeInBytes) (t->vm->system->tryAllocate(Thread::HeapSizeInBytes)); if (t->heap) { t->vm->heapPool[t->vm->heapPoolIndex++] = t->heap; + t->heapOffset += t->heapIndex; + t->heapIndex = 0; } } diff --git a/src/machine.h b/src/machine.h index ea6035df1f..07af002c86 100644 --- a/src/machine.h +++ b/src/machine.h @@ -1098,7 +1098,7 @@ class Machine { dispose(); } - static const unsigned HeapPoolSize = 16; + static const unsigned HeapPoolSize = 8; void dispose(); @@ -1223,6 +1223,7 @@ class Thread { unsigned sp; int frame; unsigned heapIndex; + unsigned heapOffset; Protector* protector; Runnable runnable; object* heap;