mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
fix build
This commit is contained in:
parent
86bec5e3b7
commit
b8dd495ada
@ -1816,14 +1816,13 @@ void
|
|||||||
saveStateAndCompile(MyThread* t, Frame* initialFrame, unsigned ip,
|
saveStateAndCompile(MyThread* t, Frame* initialFrame, unsigned ip,
|
||||||
bool exceptionHandler = false)
|
bool exceptionHandler = false)
|
||||||
{
|
{
|
||||||
Compiler::State* state = c->saveState();
|
Compiler::State* state = initialFrame->c->saveState();
|
||||||
compile(t, frame, ipTable[i], exceptionHandler);
|
compile(t, initialFrame, ip, exceptionHandler);
|
||||||
c->restoreState(state);
|
initialFrame->c->restoreState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
compile(MyThread* t, Frame* initialFrame, unsigned ip,
|
compile(MyThread* t, Frame* initialFrame, unsigned ip, bool exceptionHandler)
|
||||||
bool exceptionHandler = false)
|
|
||||||
{
|
{
|
||||||
uint8_t stackMap
|
uint8_t stackMap
|
||||||
[codeMaxStack(t, methodCode(t, initialFrame->context->method))];
|
[codeMaxStack(t, methodCode(t, initialFrame->context->method))];
|
||||||
@ -3857,7 +3856,7 @@ finish(MyThread* t, Context* context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// for debugging:
|
// for debugging:
|
||||||
if (false and
|
if (//false and
|
||||||
strcmp
|
strcmp
|
||||||
(reinterpret_cast<const char*>
|
(reinterpret_cast<const char*>
|
||||||
(&byteArrayBody(t, className(t, methodClass(t, context->method)), 0)),
|
(&byteArrayBody(t, className(t, methodClass(t, context->method)), 0)),
|
||||||
|
@ -32,6 +32,7 @@ class Event;
|
|||||||
class PushEvent;
|
class PushEvent;
|
||||||
class Read;
|
class Read;
|
||||||
class MultiRead;
|
class MultiRead;
|
||||||
|
class StubRead;
|
||||||
class Block;
|
class Block;
|
||||||
|
|
||||||
void NO_RETURN abort(Context*);
|
void NO_RETURN abort(Context*);
|
||||||
@ -106,6 +107,12 @@ class Stack: public Compiler::StackElement {
|
|||||||
Stack* next;
|
Stack* next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MultiReadPair {
|
||||||
|
public:
|
||||||
|
Value* value;
|
||||||
|
MultiRead* read;
|
||||||
|
};
|
||||||
|
|
||||||
class MyState: public Compiler::State {
|
class MyState: public Compiler::State {
|
||||||
public:
|
public:
|
||||||
MyState(Stack* stack, Value** locals, Event* predecessor,
|
MyState(Stack* stack, Value** locals, Event* predecessor,
|
||||||
@ -344,7 +351,7 @@ class CodePromise: public Promise {
|
|||||||
unsigned
|
unsigned
|
||||||
machineOffset(Context* c, int logicalIp)
|
machineOffset(Context* c, int logicalIp)
|
||||||
{
|
{
|
||||||
return c->logicalCode[n]->machineOffset->value();
|
return c->logicalCode[logicalIp]->machineOffset->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
class IpPromise: public Promise {
|
class IpPromise: public Promise {
|
||||||
@ -426,13 +433,19 @@ count(Cell* c)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class StubReadPair {
|
||||||
|
public:
|
||||||
|
Value* value;
|
||||||
|
StubRead* read;
|
||||||
|
};
|
||||||
|
|
||||||
class Event {
|
class Event {
|
||||||
public:
|
public:
|
||||||
Event(Context* c):
|
Event(Context* c):
|
||||||
next(0), stack(c->stack), locals(c->locals), promises(0),
|
next(0), stack(c->stack), locals(c->locals), promises(0),
|
||||||
reads(0), junctionSites(0), savedSites(0), predecessors(0),
|
reads(0), junctionSites(0), savedSites(0), predecessors(0),
|
||||||
successors(0), block(0), logicalInstruction(c->logicalCode[c->logicalIp]),
|
successors(0), block(0), logicalInstruction(c->logicalCode[c->logicalIp]),
|
||||||
state(c->state), junctionReads(0), junctionReadCount(0), readCount(0)
|
state(c->state), junctionReads(0), readCount(0)
|
||||||
{
|
{
|
||||||
assert(c, c->logicalIp >= 0);
|
assert(c, c->logicalIp >= 0);
|
||||||
|
|
||||||
@ -479,7 +492,6 @@ class Event {
|
|||||||
LogicalInstruction* logicalInstruction;
|
LogicalInstruction* logicalInstruction;
|
||||||
MyState* state;
|
MyState* state;
|
||||||
StubReadPair* junctionReads;
|
StubReadPair* junctionReads;
|
||||||
unsigned junctionReadCount;
|
|
||||||
unsigned readCount;
|
unsigned readCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1191,12 +1203,6 @@ multiRead(Context* c)
|
|||||||
return new (c->zone->allocate(sizeof(MultiRead))) MultiRead();
|
return new (c->zone->allocate(sizeof(MultiRead))) MultiRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
class MultiReadPair {
|
|
||||||
public:
|
|
||||||
Value* value;
|
|
||||||
MultiRead* read;
|
|
||||||
};
|
|
||||||
|
|
||||||
class StubRead: public Read {
|
class StubRead: public Read {
|
||||||
public:
|
public:
|
||||||
StubRead():
|
StubRead():
|
||||||
@ -1263,12 +1269,6 @@ stubRead(Context* c)
|
|||||||
return new (c->zone->allocate(sizeof(StubRead))) StubRead();
|
return new (c->zone->allocate(sizeof(StubRead))) StubRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
class StubReadPair {
|
|
||||||
public:
|
|
||||||
Value* value;
|
|
||||||
StubRead* read;
|
|
||||||
};
|
|
||||||
|
|
||||||
Site*
|
Site*
|
||||||
targetOrRegister(Context* c, Value* v)
|
targetOrRegister(Context* c, Value* v)
|
||||||
{
|
{
|
||||||
@ -2653,12 +2653,12 @@ populateSources(Context* c, Event* e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
addStubRead(Context* c, Value* v, StubReadPair* reads, unsigned* count)
|
addStubRead(Context* c, Value* v, StubReadPair** reads)
|
||||||
{
|
{
|
||||||
if (v) {
|
if (v) {
|
||||||
StubRead* r;
|
StubRead* r;
|
||||||
if (v->visited) {
|
if (v->visited) {
|
||||||
r = static_cast<StubRead*>(e->lastRead);
|
r = static_cast<StubRead*>(v->lastRead);
|
||||||
} else {
|
} else {
|
||||||
v->visited = true;
|
v->visited = true;
|
||||||
|
|
||||||
@ -2666,7 +2666,7 @@ addStubRead(Context* c, Value* v, StubReadPair* reads, unsigned* count)
|
|||||||
addRead(c, 0, v, r);
|
addRead(c, 0, v, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
StubReadPair* p = reads + ((*count)++);
|
StubReadPair* p = (*reads)++;
|
||||||
p->value = v;
|
p->value = v;
|
||||||
p->read = r;
|
p->read = r;
|
||||||
}
|
}
|
||||||
@ -2677,26 +2677,24 @@ populateJunctionReads(Context* c, Event* e)
|
|||||||
{
|
{
|
||||||
StubReadPair* reads = static_cast<StubReadPair*>
|
StubReadPair* reads = static_cast<StubReadPair*>
|
||||||
(c->zone->allocate(sizeof(StubReadPair) * frameFootprint(c, c->stack)));
|
(c->zone->allocate(sizeof(StubReadPair) * frameFootprint(c, c->stack)));
|
||||||
unsigned count = 0;
|
|
||||||
|
e->junctionReads = reads;
|
||||||
|
|
||||||
for (unsigned i = 0; i < c->localFootprint; ++i) {
|
for (unsigned i = 0; i < c->localFootprint; ++i) {
|
||||||
addStubRead(c, c->locals[i], reads, &count);
|
addStubRead(c, c->locals[i], &reads);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Stack* s = c->stack; s; s = s->next) {
|
for (Stack* s = c->stack; s; s = s->next) {
|
||||||
addStubRead(c, s->value, reads, &count);
|
addStubRead(c, s->value, &reads);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < count; ++i) {
|
for (StubReadPair* r = e->junctionReads; r < reads; ++r) {
|
||||||
reads[i]->value->visited = false;
|
r->value->visited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
e->junctionReads = reads;
|
|
||||||
e->junctionReadCount = count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
updateStubRead(Context* c, StubReadPair* p, Read* r)
|
updateStubRead(Context*, StubReadPair* p, Read* r)
|
||||||
{
|
{
|
||||||
if (p->read->read == 0) p->read->read = r;
|
if (p->read->read == 0) p->read->read = r;
|
||||||
}
|
}
|
||||||
@ -2705,7 +2703,6 @@ void
|
|||||||
updateJunctionReads(Context* c, Event* e, Event* successor)
|
updateJunctionReads(Context* c, Event* e, Event* successor)
|
||||||
{
|
{
|
||||||
StubReadPair* reads = e->junctionReads;
|
StubReadPair* reads = e->junctionReads;
|
||||||
unsigned count = 0;
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < c->localFootprint; ++i) {
|
for (unsigned i = 0; i < c->localFootprint; ++i) {
|
||||||
updateStubRead(c, reads++, successor->locals[i]->reads);
|
updateStubRead(c, reads++, successor->locals[i]->reads);
|
||||||
@ -2774,7 +2771,7 @@ compile(Context* c)
|
|||||||
MyState* state = e->state;
|
MyState* state = e->state;
|
||||||
if (state) {
|
if (state) {
|
||||||
for (unsigned i = 0; i < state->readCount; ++i) {
|
for (unsigned i = 0; i < state->readCount; ++i) {
|
||||||
MultiReadPair* p = state->reads[i];
|
MultiReadPair* p = state->reads + i;
|
||||||
p->value->reads = p->read->nextTarget();
|
p->value->reads = p->read->nextTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2782,7 +2779,7 @@ compile(Context* c)
|
|||||||
if (e->predecessors) {
|
if (e->predecessors) {
|
||||||
Event* predecessor = static_cast<Event*>(e->predecessors->value);
|
Event* predecessor = static_cast<Event*>(e->predecessors->value);
|
||||||
if (e->predecessors->next) {
|
if (e->predecessors->next) {
|
||||||
for (Cell* cell = e->predecessors->next; cell; cell = cell->next) {
|
for (Cell* cell = e->predecessors; cell->next; cell = cell->next) {
|
||||||
updateJunctionReads(c, static_cast<Event*>(cell->value), e);
|
updateJunctionReads(c, static_cast<Event*>(cell->value), e);
|
||||||
}
|
}
|
||||||
setSites(c, e, predecessor->junctionSites);
|
setSites(c, e, predecessor->junctionSites);
|
||||||
@ -2845,7 +2842,7 @@ void
|
|||||||
allocateTargets(Context* c, MyState* state)
|
allocateTargets(Context* c, MyState* state)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < state->readCount; ++i) {
|
for (unsigned i = 0; i < state->readCount; ++i) {
|
||||||
MultiReadPair* p = state->reads[i];
|
MultiReadPair* p = state->reads + i;
|
||||||
p->value->lastRead = p->read;
|
p->value->lastRead = p->read;
|
||||||
p->read->allocateTarget(c);
|
p->read->allocateTarget(c);
|
||||||
}
|
}
|
||||||
@ -2870,9 +2867,8 @@ MyState*
|
|||||||
saveState(Context* c)
|
saveState(Context* c)
|
||||||
{
|
{
|
||||||
MyState* state = new
|
MyState* state = new
|
||||||
(c->zone->allocate(sizeof(MyState))
|
(c->zone->allocate
|
||||||
+ (c->zone->allocate
|
(sizeof(MyState) + (sizeof(MultiReadPair) * frameFootprint(c, c->stack))))
|
||||||
(sizeof(MultiReadPair) * frameFootprint(c, c->stack))))
|
|
||||||
MyState(c->stack, c->locals, c->predecessor, c->logicalIp);
|
MyState(c->stack, c->locals, c->predecessor, c->logicalIp);
|
||||||
|
|
||||||
if (c->predecessor) {
|
if (c->predecessor) {
|
||||||
@ -2889,7 +2885,7 @@ saveState(Context* c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < count; ++i) {
|
for (unsigned i = 0; i < count; ++i) {
|
||||||
state->reads[i]->value->visited = false;
|
state->reads[i].value->visited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
state->readCount = count;
|
state->readCount = count;
|
||||||
@ -2910,7 +2906,7 @@ restoreState(Context* c, MyState* s)
|
|||||||
c->stack = s->stack;
|
c->stack = s->stack;
|
||||||
c->locals = s->locals;
|
c->locals = s->locals;
|
||||||
c->predecessor = s->predecessor;
|
c->predecessor = s->predecessor;
|
||||||
c->logicalIp = logicalIp;
|
c->logicalIp = s->logicalIp;
|
||||||
|
|
||||||
if (c->predecessor) {
|
if (c->predecessor) {
|
||||||
c->state = s;
|
c->state = s;
|
||||||
|
@ -63,6 +63,7 @@ class Compiler {
|
|||||||
|
|
||||||
virtual Operand* stackTop() = 0;
|
virtual Operand* stackTop() = 0;
|
||||||
|
|
||||||
|
virtual void push(unsigned size) = 0;
|
||||||
virtual void push(unsigned size, Operand* value) = 0;
|
virtual void push(unsigned size, Operand* value) = 0;
|
||||||
virtual Operand* pop(unsigned size) = 0;
|
virtual Operand* pop(unsigned size) = 0;
|
||||||
virtual void pushed() = 0;
|
virtual void pushed() = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user