fix pushState and popState to work as intended

This commit is contained in:
Joel Dice 2008-04-27 15:58:29 -06:00
parent cc64668657
commit 8be4cf8fa6

View File

@ -75,9 +75,9 @@ class Stack {
class State { class State {
public: public:
State(State* s): State(State* next, Stack* stack):
stack(s ? s->stack : 0), stack(stack),
next(s) next(next)
{ } { }
Stack* stack; Stack* stack;
@ -159,7 +159,7 @@ class Context {
assembler(assembler), assembler(assembler),
zone(zone), zone(zone),
logicalIp(-1), logicalIp(-1),
state(new (zone->allocate(sizeof(State))) State(0)), state(new (zone->allocate(sizeof(State))) State(0, 0)),
logicalCode(0), logicalCode(0),
logicalCodeLength(0), logicalCodeLength(0),
stackOffset(0), stackOffset(0),
@ -1784,7 +1784,7 @@ void
pushState(Context* c) pushState(Context* c)
{ {
c->state = new (c->zone->allocate(sizeof(State))) c->state = new (c->zone->allocate(sizeof(State)))
State(c->state); State(c->state, c->state->stack);
} }
void void
@ -1802,7 +1802,7 @@ popState(Context* c)
saveStack(c); saveStack(c);
c->state = new (c->zone->allocate(sizeof(State))) c->state = new (c->zone->allocate(sizeof(State)))
State(c->state->next); State(c->state->next->next, c->state->next->stack);
resetStack(c); resetStack(c);
} }