aboutsummaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-12-11 13:56:03 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-12-11 13:56:03 -0300
commit25a491fe349fc52b69ece2ecbcb0b0189decb36f (patch)
tree1d7e61274c587e0838e2ea1fa1905bbc4d74c5f8 /ldebug.c
parentb4b616bdf2beb161b89930cc71a06936e8531b2c (diff)
downloadlua-25a491fe349fc52b69ece2ecbcb0b0189decb36f.tar.gz
lua-25a491fe349fc52b69ece2ecbcb0b0189decb36f.tar.bz2
lua-25a491fe349fc52b69ece2ecbcb0b0189decb36f.zip
OP_SELF restricted to constant short strings
Optimize this opcode for the common case. For long names or method calls after too many constants, operation can be coded as a move followed by 'gettable'.
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/ldebug.c b/ldebug.c
index ee3ac17f..09ec197c 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -542,18 +542,6 @@ static void rname (const Proto *p, int pc, int c, const char **name) {
542 542
543 543
544/* 544/*
545** Find a "name" for a 'C' value in an RK instruction.
546*/
547static void rkname (const Proto *p, int pc, Instruction i, const char **name) {
548 int c = GETARG_C(i); /* key index */
549 if (GETARG_k(i)) /* is 'c' a constant? */
550 kname(p, c, name);
551 else /* 'c' is a register */
552 rname(p, pc, c, name);
553}
554
555
556/*
557** Check whether table being indexed by instruction 'i' is the 545** Check whether table being indexed by instruction 'i' is the
558** environment '_ENV' 546** environment '_ENV'
559*/ 547*/
@@ -600,7 +588,8 @@ static const char *getobjname (const Proto *p, int lastpc, int reg,
600 return isEnv(p, lastpc, i, 0); 588 return isEnv(p, lastpc, i, 0);
601 } 589 }
602 case OP_SELF: { 590 case OP_SELF: {
603 rkname(p, lastpc, i, name); 591 int k = GETARG_C(i); /* key index */
592 kname(p, k, name);
604 return "method"; 593 return "method";
605 } 594 }
606 default: break; /* go through to return NULL */ 595 default: break; /* go through to return NULL */