diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-12-11 13:56:03 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-12-11 13:56:03 -0300 |
commit | 25a491fe349fc52b69ece2ecbcb0b0189decb36f (patch) | |
tree | 1d7e61274c587e0838e2ea1fa1905bbc4d74c5f8 /lvm.c | |
parent | b4b616bdf2beb161b89930cc71a06936e8531b2c (diff) | |
download | lua-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 'lvm.c')
-rw-r--r-- | lvm.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1382,10 +1382,10 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1382 | StkId ra = RA(i); | 1382 | StkId ra = RA(i); |
1383 | lu_byte tag; | 1383 | lu_byte tag; |
1384 | TValue *rb = vRB(i); | 1384 | TValue *rb = vRB(i); |
1385 | TValue *rc = RKC(i); | 1385 | TValue *rc = KC(i); |
1386 | TString *key = tsvalue(rc); /* key must be a string */ | 1386 | TString *key = tsvalue(rc); /* key must be a short string */ |
1387 | setobj2s(L, ra + 1, rb); | 1387 | setobj2s(L, ra + 1, rb); |
1388 | luaV_fastget(rb, key, s2v(ra), luaH_getstr, tag); | 1388 | luaV_fastget(rb, key, s2v(ra), luaH_getshortstr, tag); |
1389 | if (tagisempty(tag)) | 1389 | if (tagisempty(tag)) |
1390 | Protect(luaV_finishget(L, rb, rc, ra, tag)); | 1390 | Protect(luaV_finishget(L, rb, rc, ra, tag)); |
1391 | vmbreak; | 1391 | vmbreak; |