From 6aff383ee14f24de5811f6a2360e305971cb0a51 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Tue, 1 Sep 2009 18:31:18 -0600 Subject: [PATCH] ensure Heap::needsMark and Heap::mark work correctly during GC --- src/heap.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/heap.cpp b/src/heap.cpp index dbc66ba21a..d73d98cc89 100644 --- a/src/heap.cpp +++ b/src/heap.cpp @@ -1790,7 +1790,7 @@ class MyHeap: public Heap { if (c.client->isFixed(p)) { return fixie(p)->age >= FixieTenureThreshold; } else { - return c.gen2.contains(p); + return c.gen2.contains(p) or c.nextGen2.contains(p); } } @@ -1802,6 +1802,7 @@ class MyHeap: public Heap { bool targetNeedsMark(void* target) { return target and not c.gen2.contains(target) + and not c.nextGen2.contains(target) and not immortalHeapContains(&c, target) and not (c.client->isFixed(target) and fixie(target)->age >= FixieTenureThreshold); @@ -1828,10 +1829,18 @@ class MyHeap: public Heap { if (dirty) markDirty(&c, f); } else { + Segment::Map* map; + if (c.gen2.contains(p)) { + map = &(c.heapMap); + } else { + assert(&c, c.nextGen2.contains(p)); + map = &(c.nextHeapMap); + } + for (unsigned i = 0; i < count; ++i) { void** target = static_cast(p) + offset + i; if (targetNeedsMark(mask(*target))) { - c.heapMap.set(target); + map->set(target); } } }