From 81cb951b08f47e72d36ee76e0199e6b3432f0128 Mon Sep 17 00:00:00 2001 From: Joel Dice <git@seibutsu.mailsnare.net> Date: Thu, 9 Oct 2008 17:14:52 -0600 Subject: [PATCH] fix stack corruption due to spurious pop events generated for jsr bytecodes --- src/compile.cpp | 6 +++--- src/compiler.cpp | 6 ++++-- src/compiler.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/compile.cpp b/src/compile.cpp index bebc0f68f8..c31644438e 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -851,9 +851,9 @@ class Frame { pushedLong(); } - void pop(unsigned count) { + void pop(unsigned count, bool isEvent = true) { popped(count); - c->popped(count); + c->popped(count, isEvent); } Compiler::Operand* popInt() { @@ -2805,7 +2805,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip, compile(t, frame, newIp); if (UNLIKELY(t->exception)) return; - frame->pop(1); + frame->pop(1, false); } break; case l2d: { diff --git a/src/compiler.cpp b/src/compiler.cpp index 3b5ac10435..bf6c4f0d4e 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -2794,8 +2794,10 @@ class MyCompiler: public Compiler { } } - virtual void popped(unsigned count) { - appendPop(&c, count, true); + virtual void popped(unsigned count, bool isEvent) { + if (isEvent) { + appendPop(&c, count, true); + } for (unsigned i = count; i;) { Stack* s = c.state->stack; diff --git a/src/compiler.h b/src/compiler.h index 621f941019..2433b3caba 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -69,7 +69,7 @@ class Compiler { virtual void push(unsigned size, Operand* value) = 0; virtual Operand* pop(unsigned size) = 0; virtual void pushed(unsigned count) = 0; - virtual void popped(unsigned count) = 0; + virtual void popped(unsigned count, bool isEvent) = 0; virtual Operand* peek(unsigned size, unsigned index) = 0; virtual Operand* call(Operand* address,