mirror of
https://github.com/corda/corda.git
synced 2025-01-23 21:08:48 +00:00
avoid inserting redundant stack sync events
This commit is contained in:
parent
ddada5551d
commit
281bdb1fab
@ -325,6 +325,8 @@ class Event {
|
|||||||
|
|
||||||
virtual void compile(Context* c) = 0;
|
virtual void compile(Context* c) = 0;
|
||||||
|
|
||||||
|
virtual bool needsStackSync() { return true; };
|
||||||
|
|
||||||
Event* next;
|
Event* next;
|
||||||
Stack* stack;
|
Stack* stack;
|
||||||
CodePromise* promises;
|
CodePromise* promises;
|
||||||
@ -379,7 +381,7 @@ clearSites(Context* c, Value* v)
|
|||||||
void
|
void
|
||||||
nextRead(Context* c, Value* v)
|
nextRead(Context* c, Value* v)
|
||||||
{
|
{
|
||||||
// fprintf(stderr, "pop read %p from %p\n", v->reads, v);
|
// fprintf(stderr, "pop read %p from %p; next: %p\n", v->reads, v, v->reads->next);
|
||||||
|
|
||||||
v->reads = v->reads->next;
|
v->reads = v->reads->next;
|
||||||
if (v->reads == 0) {
|
if (v->reads == 0) {
|
||||||
@ -1220,6 +1222,8 @@ class BranchEvent: public Event {
|
|||||||
nextRead(c, address);
|
nextRead(c, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool needsStackSync() { return false; };
|
||||||
|
|
||||||
UnaryOperation type;
|
UnaryOperation type;
|
||||||
Value* address;
|
Value* address;
|
||||||
};
|
};
|
||||||
@ -1488,7 +1492,7 @@ class StackSyncEvent: public Event {
|
|||||||
s->syncSite = stackSyncSite(c, i, s->size);
|
s->syncSite = stackSyncSite(c, i, s->size);
|
||||||
insertRead(c, this, previous, s->value, s->size * BytesPerWord,
|
insertRead(c, this, previous, s->value, s->size * BytesPerWord,
|
||||||
s->syncSite);
|
s->syncSite);
|
||||||
s->pushEvent->active = false;
|
if (s->pushEvent) s->pushEvent->active = false;
|
||||||
i += s->size;
|
i += s->size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1514,6 +1518,8 @@ class StackSyncEvent: public Event {
|
|||||||
nextRead(c, r->value);
|
nextRead(c, r->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool needsStackSync() { return false; };
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1718,9 +1724,11 @@ updateJunctions(Context* c)
|
|||||||
LogicalInstruction* p = c->logicalCode + ip;
|
LogicalInstruction* p = c->logicalCode + ip;
|
||||||
if (p->lastEvent) {
|
if (p->lastEvent) {
|
||||||
// fprintf(stderr, "update junction at %d, predecessor %d\n", j->logicalIp, ip);
|
// fprintf(stderr, "update junction at %d, predecessor %d\n", j->logicalIp, ip);
|
||||||
p->lastEvent = p->lastEvent->next
|
if (p->lastEvent->needsStackSync()) {
|
||||||
= new (c->zone->allocate(sizeof(StackSyncEvent)))
|
p->lastEvent = p->lastEvent->next
|
||||||
StackSyncEvent(c, p->lastEvent);
|
= new (c->zone->allocate(sizeof(StackSyncEvent)))
|
||||||
|
StackSyncEvent(c, p->lastEvent);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user