From 6c283b2f4f8398322e7a9a62ec8e131852b4e015 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 20 Aug 2002 17:03:05 -0300 Subject: new simetric format for ABC instructions, to avoid exchanging operands for `commutative' operators --- ldebug.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'ldebug.c') diff --git a/ldebug.c b/ldebug.c index d4d0eb00..55c53f9d 100644 --- a/ldebug.c +++ b/ldebug.c @@ -1,5 +1,5 @@ /* -** $Id: ldebug.c,v 1.131 2002/08/08 20:08:41 roberto Exp roberto $ +** $Id: ldebug.c,v 1.132 2002/08/12 17:23:12 roberto Exp roberto $ ** Debug Interface ** See Copyright Notice in lua.h */ @@ -269,6 +269,11 @@ static int checkopenop (const Proto *pt, int pc) { } +static int checkRK (const Proto *pt, int r) { + return (r < pt->maxstacksize || (r >= MAXSTACK && r-MAXSTACK < pt->sizek)); +} + + static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { int pc; int last; /* stores position of last instruction that changed `reg' */ @@ -285,11 +290,13 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { case iABC: { b = GETARG_B(i); c = GETARG_C(i); - if (testOpMode(op, OpModeBreg)) + if (testOpMode(op, OpModeBreg)) { checkreg(pt, b); - if (testOpMode(op, OpModeCreg)) - check(c < pt->maxstacksize || - (c >= MAXSTACK && c-MAXSTACK < pt->sizek)); + } + else if (testOpMode(op, OpModeBrk)) + check(checkRK(pt, b)); + if (testOpMode(op, OpModeCrk)) + check(checkRK(pt, c)); break; } case iABx: { @@ -496,7 +503,7 @@ void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { } -void luaG_aritherror (lua_State *L, StkId p1, const TObject *p2) { +void luaG_aritherror (lua_State *L, const TObject *p1, const TObject *p2) { TObject temp; if (luaV_tonumber(p1, &temp) == NULL) p2 = p1; /* first operand is wrong */ -- cgit v1.2.3-55-g6feb