From 3a5abaf58a9f8b3210fd4848d506eabc972f29ba Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 12 Sep 2012 17:23:19 -0600 Subject: [PATCH] fix incorrect reporting of fixie collection status in heap.cpp (part 2) My earlier fix (f8e8609) was almost -- but not quite -- sufficient. It asked the heap to mark the dead fixies too early, so some of them were marked dead even though they ultimately survived, causing us to clear weak JNI references when we shouldn't. --- src/machine.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/machine.cpp b/src/machine.cpp index 6ae39f7b30..24fd6c0a8e 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -273,6 +273,8 @@ killZombies(Thread* t, Thread* o) unsigned footprint(Thread* t) { + expect(t, t->criticalLevel == 0); + unsigned n = t->heapOffset + t->heapIndex + t->backupHeapIndex; for (Thread* c = t->child; c; c = c->peer) { @@ -592,6 +594,8 @@ postVisit(Thread* t, Heap::Visitor* v) m->tenuredWeakReferences = firstNewTenuredWeakReference; } + m->heap->postVisit(); + for (Reference* r = m->jniReferences; r; r = r->next) { if (r->weak) { if (m->heap->status(r->target) == Heap::Unreachable) { @@ -2693,8 +2697,6 @@ class HeapClient: public Heap::Client { virtual void visitRoots(Heap::Visitor* v) { ::visitRoots(m, v); - m->heap->postVisit(); - postVisit(m->rootThread, v); }