mirror of
https://github.com/corda/corda.git
synced 2025-01-22 12:28:11 +00:00
ensure Heap::needsMark and Heap::mark work correctly during GC
This commit is contained in:
parent
4f794f533e
commit
6aff383ee1
13
src/heap.cpp
13
src/heap.cpp
@ -1790,7 +1790,7 @@ class MyHeap: public Heap {
|
|||||||
if (c.client->isFixed(p)) {
|
if (c.client->isFixed(p)) {
|
||||||
return fixie(p)->age >= FixieTenureThreshold;
|
return fixie(p)->age >= FixieTenureThreshold;
|
||||||
} else {
|
} 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) {
|
bool targetNeedsMark(void* target) {
|
||||||
return target
|
return target
|
||||||
and not c.gen2.contains(target)
|
and not c.gen2.contains(target)
|
||||||
|
and not c.nextGen2.contains(target)
|
||||||
and not immortalHeapContains(&c, target)
|
and not immortalHeapContains(&c, target)
|
||||||
and not (c.client->isFixed(target)
|
and not (c.client->isFixed(target)
|
||||||
and fixie(target)->age >= FixieTenureThreshold);
|
and fixie(target)->age >= FixieTenureThreshold);
|
||||||
@ -1828,10 +1829,18 @@ class MyHeap: public Heap {
|
|||||||
|
|
||||||
if (dirty) markDirty(&c, f);
|
if (dirty) markDirty(&c, f);
|
||||||
} else {
|
} 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) {
|
for (unsigned i = 0; i < count; ++i) {
|
||||||
void** target = static_cast<void**>(p) + offset + i;
|
void** target = static_cast<void**>(p) + offset + i;
|
||||||
if (targetNeedsMark(mask(*target))) {
|
if (targetNeedsMark(mask(*target))) {
|
||||||
c.heapMap.set(target);
|
map->set(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user