diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-20 17:03:05 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-08-20 17:03:05 -0300 |
| commit | 6c283b2f4f8398322e7a9a62ec8e131852b4e015 (patch) | |
| tree | 608d5b61b14dfdb91cc5cf72637e876337cffcb8 /ldebug.c | |
| parent | 576bded5137babb9c669ccff5aedf19ed65a7598 (diff) | |
| download | lua-6c283b2f4f8398322e7a9a62ec8e131852b4e015.tar.gz lua-6c283b2f4f8398322e7a9a62ec8e131852b4e015.tar.bz2 lua-6c283b2f4f8398322e7a9a62ec8e131852b4e015.zip | |
new simetric format for ABC instructions, to avoid exchanging operands
for `commutative' operators
Diffstat (limited to 'ldebug.c')
| -rw-r--r-- | ldebug.c | 19 |
1 files changed, 13 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.131 2002/08/08 20:08:41 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.132 2002/08/12 17:23:12 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -269,6 +269,11 @@ static int checkopenop (const Proto *pt, int pc) { | |||
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | 271 | ||
| 272 | static int checkRK (const Proto *pt, int r) { | ||
| 273 | return (r < pt->maxstacksize || (r >= MAXSTACK && r-MAXSTACK < pt->sizek)); | ||
| 274 | } | ||
| 275 | |||
| 276 | |||
| 272 | static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | 277 | static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { |
| 273 | int pc; | 278 | int pc; |
| 274 | int last; /* stores position of last instruction that changed `reg' */ | 279 | 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) { | |||
| 285 | case iABC: { | 290 | case iABC: { |
| 286 | b = GETARG_B(i); | 291 | b = GETARG_B(i); |
| 287 | c = GETARG_C(i); | 292 | c = GETARG_C(i); |
| 288 | if (testOpMode(op, OpModeBreg)) | 293 | if (testOpMode(op, OpModeBreg)) { |
| 289 | checkreg(pt, b); | 294 | checkreg(pt, b); |
| 290 | if (testOpMode(op, OpModeCreg)) | 295 | } |
| 291 | check(c < pt->maxstacksize || | 296 | else if (testOpMode(op, OpModeBrk)) |
| 292 | (c >= MAXSTACK && c-MAXSTACK < pt->sizek)); | 297 | check(checkRK(pt, b)); |
| 298 | if (testOpMode(op, OpModeCrk)) | ||
| 299 | check(checkRK(pt, c)); | ||
| 293 | break; | 300 | break; |
| 294 | } | 301 | } |
| 295 | case iABx: { | 302 | case iABx: { |
| @@ -496,7 +503,7 @@ void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { | |||
| 496 | } | 503 | } |
| 497 | 504 | ||
| 498 | 505 | ||
| 499 | void luaG_aritherror (lua_State *L, StkId p1, const TObject *p2) { | 506 | void luaG_aritherror (lua_State *L, const TObject *p1, const TObject *p2) { |
| 500 | TObject temp; | 507 | TObject temp; |
| 501 | if (luaV_tonumber(p1, &temp) == NULL) | 508 | if (luaV_tonumber(p1, &temp) == NULL) |
| 502 | p2 = p1; /* first operand is wrong */ | 509 | p2 = p1; /* first operand is wrong */ |
