From 8be4cf8fa662956cc878a2429fe81658b7ac3fc7 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sun, 27 Apr 2008 15:58:29 -0600 Subject: [PATCH] fix pushState and popState to work as intended --- src/compiler.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler.cpp b/src/compiler.cpp index d24d98aca6..d411d3d1cb 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -75,9 +75,9 @@ class Stack { class State { public: - State(State* s): - stack(s ? s->stack : 0), - next(s) + State(State* next, Stack* stack): + stack(stack), + next(next) { } Stack* stack; @@ -159,7 +159,7 @@ class Context { assembler(assembler), zone(zone), logicalIp(-1), - state(new (zone->allocate(sizeof(State))) State(0)), + state(new (zone->allocate(sizeof(State))) State(0, 0)), logicalCode(0), logicalCodeLength(0), stackOffset(0), @@ -1784,7 +1784,7 @@ void pushState(Context* c) { c->state = new (c->zone->allocate(sizeof(State))) - State(c->state); + State(c->state, c->state->stack); } void @@ -1802,8 +1802,8 @@ popState(Context* c) saveStack(c); c->state = new (c->zone->allocate(sizeof(State))) - State(c->state->next); - + State(c->state->next->next, c->state->next->stack); + resetStack(c); }