mirror of
https://github.com/corda/corda.git
synced 2025-06-01 15:10:54 +00:00
fix fixed object tracking in heap.cpp
This commit is contained in:
parent
4d1af63ed2
commit
80815d35f7
45
src/heap.cpp
45
src/heap.cpp
@ -440,17 +440,23 @@ class Fixie {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove() {
|
void remove(Context* c) {
|
||||||
if (handle) *handle = next;
|
if (handle) {
|
||||||
if (next) next->handle = handle;
|
assert(c, *handle == this);
|
||||||
|
*handle = next;
|
||||||
|
}
|
||||||
|
if (next) {
|
||||||
|
next->handle = handle;
|
||||||
|
}
|
||||||
|
handle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void move(Fixie** handle) {
|
void move(Context* c, Fixie** handle) {
|
||||||
if (DebugFixies) {
|
if (DebugFixies) {
|
||||||
fprintf(stderr, "move fixie %p\n", this);
|
fprintf(stderr, "move fixie %p\n", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
remove();
|
remove(c);
|
||||||
add(handle);
|
add(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -802,9 +808,9 @@ sweepFixies(Context* c)
|
|||||||
|
|
||||||
c->untenuredFixieFootprint = 0;
|
c->untenuredFixieFootprint = 0;
|
||||||
|
|
||||||
for (Fixie** p = &(c->visitedFixies); *p;) {
|
while (c->visitedFixies) {
|
||||||
Fixie* f = *p;
|
Fixie* f = c->visitedFixies;
|
||||||
*p = f->next;
|
f->remove(c);
|
||||||
|
|
||||||
if (not f->immortal()) {
|
if (not f->immortal()) {
|
||||||
++ f->age;
|
++ f->age;
|
||||||
@ -825,14 +831,14 @@ sweepFixies(Context* c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (f->dirty) {
|
if (f->dirty) {
|
||||||
f->move(&(c->dirtyTenuredFixies));
|
f->add(&(c->dirtyTenuredFixies));
|
||||||
} else {
|
} else {
|
||||||
f->move(&(c->tenuredFixies));
|
f->add(&(c->tenuredFixies));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
c->untenuredFixieFootprint += f->totalSize();
|
c->untenuredFixieFootprint += f->totalSize();
|
||||||
|
|
||||||
f->move(&(c->fixies));
|
f->add(&(c->fixies));
|
||||||
}
|
}
|
||||||
|
|
||||||
f->marked = false;
|
f->marked = false;
|
||||||
@ -926,7 +932,7 @@ update3(Context* c, void* o, bool* needsVisit)
|
|||||||
fprintf(stderr, "mark fixie %p\n", f);
|
fprintf(stderr, "mark fixie %p\n", f);
|
||||||
}
|
}
|
||||||
f->marked = true;
|
f->marked = true;
|
||||||
f->move(&(c->markedFixies));
|
f->move(c, &(c->markedFixies));
|
||||||
}
|
}
|
||||||
*needsVisit = false;
|
*needsVisit = false;
|
||||||
return o;
|
return o;
|
||||||
@ -966,7 +972,7 @@ markDirty(Context* c, Fixie* f)
|
|||||||
{
|
{
|
||||||
if (not f->dirty) {
|
if (not f->dirty) {
|
||||||
f->dirty = true;
|
f->dirty = true;
|
||||||
f->move(&(c->dirtyTenuredFixies));
|
f->move(c, &(c->dirtyTenuredFixies));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,7 +981,7 @@ markClean(Context* c, Fixie* f)
|
|||||||
{
|
{
|
||||||
if (f->dirty) {
|
if (f->dirty) {
|
||||||
f->dirty = false;
|
f->dirty = false;
|
||||||
f->move(&(c->tenuredFixies));
|
f->move(c, &(c->tenuredFixies));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1007,7 +1013,7 @@ updateHeapMap(Context* c, void* p, void* target, unsigned offset, void* result)
|
|||||||
f, offset, f->body() + offset);
|
f, offset, f->body() + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
markDirty(c, f);
|
f->dirty = true;
|
||||||
markBit(f->mask(), offset);
|
markBit(f->mask(), offset);
|
||||||
}
|
}
|
||||||
} else if (seg->contains(p)) {
|
} else if (seg->contains(p)) {
|
||||||
@ -1399,7 +1405,6 @@ visitDirtyFixies(Context* c, Fixie** p)
|
|||||||
assert(c, wasDirty);
|
assert(c, wasDirty);
|
||||||
|
|
||||||
if (clean) {
|
if (clean) {
|
||||||
*p = f->next;
|
|
||||||
markClean(c, f);
|
markClean(c, f);
|
||||||
} else {
|
} else {
|
||||||
p = &(f->next);
|
p = &(f->next);
|
||||||
@ -1410,9 +1415,9 @@ visitDirtyFixies(Context* c, Fixie** p)
|
|||||||
void
|
void
|
||||||
visitMarkedFixies(Context* c)
|
visitMarkedFixies(Context* c)
|
||||||
{
|
{
|
||||||
for (Fixie** p = &(c->markedFixies); *p;) {
|
while (c->markedFixies) {
|
||||||
Fixie* f = *p;
|
Fixie* f = c->markedFixies;
|
||||||
*p = f->next;
|
f->remove(c);
|
||||||
|
|
||||||
if (DebugFixies) {
|
if (DebugFixies) {
|
||||||
fprintf(stderr, "visit fixie %p\n", f);
|
fprintf(stderr, "visit fixie %p\n", f);
|
||||||
@ -1435,7 +1440,7 @@ visitMarkedFixies(Context* c)
|
|||||||
|
|
||||||
c->client->walk(f->body(), &w);
|
c->client->walk(f->body(), &w);
|
||||||
|
|
||||||
f->move(&(c->visitedFixies));
|
f->add(&(c->visitedFixies));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user