diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-10-04 18:56:32 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-10-04 18:56:32 -0300 |
commit | a1ef58b3a5986293ed0b7acef50073d94c7f932f (patch) | |
tree | a2bb5ad195001c03caeec9b536a1f8d97acba693 /ldebug.c | |
parent | 283e7455ffe32235eaf790ebd3c40c7970b7a833 (diff) | |
download | lua-a1ef58b3a5986293ed0b7acef50073d94c7f932f.tar.gz lua-a1ef58b3a5986293ed0b7acef50073d94c7f932f.tar.bz2 lua-a1ef58b3a5986293ed0b7acef50073d94c7f932f.zip |
eplicit 1-bit opcode operand 'k'
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.130 2017/07/10 17:35:12 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.131 2017/10/04 15:49:24 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 | */ |
@@ -402,7 +402,7 @@ static const char *getobjname (Proto *p, int lastpc, int reg, | |||
402 | ** Find a "name" for the constant 'c'. | 402 | ** Find a "name" for the constant 'c'. |
403 | */ | 403 | */ |
404 | static void kname (Proto *p, int c, const char **name) { | 404 | static void kname (Proto *p, int c, const char **name) { |
405 | TValue *kvalue = &p->k[INDEXK(c)]; | 405 | TValue *kvalue = &p->k[c]; |
406 | *name = (ttisstring(kvalue)) ? svalue(kvalue) : "?"; | 406 | *name = (ttisstring(kvalue)) ? svalue(kvalue) : "?"; |
407 | } | 407 | } |
408 | 408 | ||
@@ -418,17 +418,17 @@ static void rname (Proto *p, int pc, int c, const char **name) { | |||
418 | 418 | ||
419 | 419 | ||
420 | /* | 420 | /* |
421 | ** Find a "name" for the R/K index 'c'. | 421 | ** Find a "name" for a 'C' value in an RK instruction. |
422 | */ | 422 | */ |
423 | static void rkname (Proto *p, int pc, int c, const char **name) { | 423 | static void rkname (Proto *p, int pc, Instruction i, const char **name) { |
424 | if (ISK(c)) /* is 'c' a constant? */ | 424 | int c = GETARG_C(i); /* key index */ |
425 | kname(p, INDEXK(c), name); | 425 | if (GETARG_k(i)) /* is 'c' a constant? */ |
426 | kname(p, c, name); | ||
426 | else /* 'c' is a register */ | 427 | else /* 'c' is a register */ |
427 | rname(p, pc, c, name); | 428 | rname(p, pc, c, name); |
428 | } | 429 | } |
429 | 430 | ||
430 | 431 | ||
431 | |||
432 | static int filterpc (int pc, int jmptarget) { | 432 | static int filterpc (int pc, int jmptarget) { |
433 | if (pc < jmptarget) /* is code conditional (inside a jump)? */ | 433 | if (pc < jmptarget) /* is code conditional (inside a jump)? */ |
434 | return -1; /* cannot know who sets that register */ | 434 | return -1; /* cannot know who sets that register */ |
@@ -549,8 +549,7 @@ static const char *gxf (Proto *p, int pc, Instruction i, int isup) { | |||
549 | break; | 549 | break; |
550 | } | 550 | } |
551 | case OP_SELF: { | 551 | case OP_SELF: { |
552 | int k = GETARG_C(i); /* key index */ | 552 | rkname(p, pc, i, name); |
553 | rkname(p, pc, k, name); | ||
554 | return "method"; | 553 | return "method"; |
555 | } | 554 | } |
556 | default: break; /* go through to return NULL */ | 555 | default: break; /* go through to return NULL */ |