From 482065f91a5ce62e3688c3363f4989c0418b9505 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 14 May 2008 16:36:22 -0600 Subject: [PATCH] fix code ordering bug in popNow() --- src/compiler.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/compiler.cpp b/src/compiler.cpp index dea5a710a3..5cac9b78ec 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -1677,6 +1677,10 @@ popNow(Context* c, Stack* stack, unsigned count, bool ignore) unsigned ignored = 0; for (unsigned i = count; i and s;) { if (s->pushed) { + removeSite(c, s->value, s->pushSite); + s->pushSite = 0; + s->pushed = false; + if (s->value->reads and (not ignore)) { ::ignore(c, ignored); @@ -1697,10 +1701,6 @@ popNow(Context* c, Stack* stack, unsigned count, bool ignore) ignored += s->size; } - - removeSite(c, s->value, s->pushSite); - s->pushSite = 0; - s->pushed = false; } else { if (DebugStack) { fprintf(stderr, "%p not pushed\n", s); @@ -1876,9 +1876,7 @@ readSource(Context* c, Stack* stack, Read* r) if (target and copyCost) { addSite(c, stack, r->size, r->value, target); - if (site) { - apply(c, Move, r->size, site, target); - } + apply(c, Move, r->size, site, target); return target; } else { return site;