aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-12-11 15:32:43 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-12-11 15:32:43 -0300
commit412e9a4d952d47631feddfa4ec25a520ec75b103 (patch)
tree0c687ad50875ead9bc0c07d2e53a3ab58ab17675
parent25a491fe349fc52b69ece2ecbcb0b0189decb36f (diff)
downloadlua-412e9a4d952d47631feddfa4ec25a520ec75b103.tar.gz
lua-412e9a4d952d47631feddfa4ec25a520ec75b103.tar.bz2
lua-412e9a4d952d47631feddfa4ec25a520ec75b103.zip
'luaH_fastseti' uses 'checknoTM'
The extra check in checknoTM (versus only checking whether there is a metatable) is cheap, and it is not that uncommon for a table to have a metatable without a __newindex metafield.
-rw-r--r--ltable.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ltable.h b/ltable.h
index 9c4eb937..e4aa98f0 100644
--- a/ltable.h
+++ b/ltable.h
@@ -58,7 +58,7 @@
58 { Table *h = t; lua_Unsigned u = l_castS2U(k) - 1u; \ 58 { Table *h = t; lua_Unsigned u = l_castS2U(k) - 1u; \
59 if ((u < h->asize)) { \ 59 if ((u < h->asize)) { \
60 lu_byte *tag = getArrTag(h, u); \ 60 lu_byte *tag = getArrTag(h, u); \
61 if (h->metatable == NULL || !tagisempty(*tag)) \ 61 if (checknoTM(h->metatable, TM_NEWINDEX) || !tagisempty(*tag)) \
62 { fval2arr(h, u, tag, val); hres = HOK; } \ 62 { fval2arr(h, u, tag, val); hres = HOK; } \
63 else hres = ~cast_int(u); } \ 63 else hres = ~cast_int(u); } \
64 else { hres = luaH_psetint(h, k, val); }} 64 else { hres = luaH_psetint(h, k, val); }}