aboutsummaryrefslogtreecommitdiff
path: root/src/lj_carith.c
diff options
context:
space:
mode:
authorMike Pall <mike>2020-05-08 13:50:41 +0200
committerMike Pall <mike>2020-05-08 13:50:41 +0200
commitcc4bbec483d3f3250b519ccb7cc22f1a8e6fe6f0 (patch)
treed0194b811af58504b68e91f673e6e27852e82b5d /src/lj_carith.c
parent179cf2eb84fef2b9a524469c3c8cc49363b8fb10 (diff)
downloadluajit-cc4bbec483d3f3250b519ccb7cc22f1a8e6fe6f0.tar.gz
luajit-cc4bbec483d3f3250b519ccb7cc22f1a8e6fe6f0.tar.bz2
luajit-cc4bbec483d3f3250b519ccb7cc22f1a8e6fe6f0.zip
FFI: Always fall back to metamethods for cdata length/concat.
Thanks to Egor Skriptunoff.
Diffstat (limited to 'src/lj_carith.c')
-rw-r--r--src/lj_carith.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/lj_carith.c b/src/lj_carith.c
index b33b1f36..530d5ddb 100644
--- a/src/lj_carith.c
+++ b/src/lj_carith.c
@@ -263,7 +263,7 @@ int lj_carith_op(lua_State *L, MMS mm)
263{ 263{
264 CTState *cts = ctype_cts(L); 264 CTState *cts = ctype_cts(L);
265 CDArith ca; 265 CDArith ca;
266 if (carith_checkarg(L, cts, &ca)) { 266 if (carith_checkarg(L, cts, &ca) && mm != MM_len && mm != MM_concat) {
267 if (carith_int64(L, cts, &ca, mm) || carith_ptr(L, cts, &ca, mm)) { 267 if (carith_int64(L, cts, &ca, mm) || carith_ptr(L, cts, &ca, mm)) {
268 copyTV(L, &G(L)->tmptv2, L->top-1); /* Remember for trace recorder. */ 268 copyTV(L, &G(L)->tmptv2, L->top-1); /* Remember for trace recorder. */
269 return 1; 269 return 1;
@@ -272,15 +272,6 @@ int lj_carith_op(lua_State *L, MMS mm)
272 return lj_carith_meta(L, cts, &ca, mm); 272 return lj_carith_meta(L, cts, &ca, mm);
273} 273}
274 274
275/* No built-in functionality for length of cdata. */
276int lj_carith_len(lua_State *L)
277{
278 CTState *cts = ctype_cts(L);
279 CDArith ca;
280 carith_checkarg(L, cts, &ca);
281 return lj_carith_meta(L, cts, &ca, MM_len);
282}
283
284/* -- 64 bit integer arithmetic helpers ----------------------------------- */ 275/* -- 64 bit integer arithmetic helpers ----------------------------------- */
285 276
286#if LJ_32 && LJ_HASJIT 277#if LJ_32 && LJ_HASJIT