aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2020-05-08 14:00:07 +0200
committerMike Pall <mike>2020-05-08 14:00:07 +0200
commitd5e12d5174720fbd3c5fad4e02da5850b8433057 (patch)
treee6f53754f6086ed254cf2a8d0fcfbeee679696f1 /src
parent92c011b5117f237f2554c5745646ea566ce0d568 (diff)
parentcc4bbec483d3f3250b519ccb7cc22f1a8e6fe6f0 (diff)
downloadluajit-d5e12d5174720fbd3c5fad4e02da5850b8433057.tar.gz
luajit-d5e12d5174720fbd3c5fad4e02da5850b8433057.tar.bz2
luajit-d5e12d5174720fbd3c5fad4e02da5850b8433057.zip
Merge branch 'master' into v2.1
Diffstat (limited to 'src')
-rw-r--r--src/lib_ffi.c2
-rw-r--r--src/lj_carith.c11
-rw-r--r--src/lj_carith.h1
-rw-r--r--src/lj_crecord.c6
4 files changed, 6 insertions, 14 deletions
diff --git a/src/lib_ffi.c b/src/lib_ffi.c
index 16fecacb..c2f73ed5 100644
--- a/src/lib_ffi.c
+++ b/src/lib_ffi.c
@@ -194,7 +194,7 @@ LJLIB_CF(ffi_meta___eq) LJLIB_REC(cdata_arith MM_eq)
194 194
195LJLIB_CF(ffi_meta___len) LJLIB_REC(cdata_arith MM_len) 195LJLIB_CF(ffi_meta___len) LJLIB_REC(cdata_arith MM_len)
196{ 196{
197 return lj_carith_len(L); 197 return ffi_arith(L);
198} 198}
199 199
200LJLIB_CF(ffi_meta___lt) LJLIB_REC(cdata_arith MM_lt) 200LJLIB_CF(ffi_meta___lt) LJLIB_REC(cdata_arith MM_lt)
diff --git a/src/lj_carith.c b/src/lj_carith.c
index cb7e8db6..cf71aaf5 100644
--- a/src/lj_carith.c
+++ b/src/lj_carith.c
@@ -265,7 +265,7 @@ int lj_carith_op(lua_State *L, MMS mm)
265{ 265{
266 CTState *cts = ctype_cts(L); 266 CTState *cts = ctype_cts(L);
267 CDArith ca; 267 CDArith ca;
268 if (carith_checkarg(L, cts, &ca)) { 268 if (carith_checkarg(L, cts, &ca) && mm != MM_len && mm != MM_concat) {
269 if (carith_int64(L, cts, &ca, mm) || carith_ptr(L, cts, &ca, mm)) { 269 if (carith_int64(L, cts, &ca, mm) || carith_ptr(L, cts, &ca, mm)) {
270 copyTV(L, &G(L)->tmptv2, L->top-1); /* Remember for trace recorder. */ 270 copyTV(L, &G(L)->tmptv2, L->top-1); /* Remember for trace recorder. */
271 return 1; 271 return 1;
@@ -274,15 +274,6 @@ int lj_carith_op(lua_State *L, MMS mm)
274 return lj_carith_meta(L, cts, &ca, mm); 274 return lj_carith_meta(L, cts, &ca, mm);
275} 275}
276 276
277/* No built-in functionality for length of cdata. */
278int lj_carith_len(lua_State *L)
279{
280 CTState *cts = ctype_cts(L);
281 CDArith ca;
282 carith_checkarg(L, cts, &ca);
283 return lj_carith_meta(L, cts, &ca, MM_len);
284}
285
286/* -- 64 bit bit operations helpers --------------------------------------- */ 277/* -- 64 bit bit operations helpers --------------------------------------- */
287 278
288#if LJ_64 279#if LJ_64
diff --git a/src/lj_carith.h b/src/lj_carith.h
index af6225ae..788718d9 100644
--- a/src/lj_carith.h
+++ b/src/lj_carith.h
@@ -11,7 +11,6 @@
11#if LJ_HASFFI 11#if LJ_HASFFI
12 12
13LJ_FUNC int lj_carith_op(lua_State *L, MMS mm); 13LJ_FUNC int lj_carith_op(lua_State *L, MMS mm);
14LJ_FUNC int lj_carith_len(lua_State *L);
15 14
16#if LJ_32 15#if LJ_32
17LJ_FUNC uint64_t lj_carith_shl64(uint64_t x, int32_t sh); 16LJ_FUNC uint64_t lj_carith_shl64(uint64_t x, int32_t sh);
diff --git a/src/lj_crecord.c b/src/lj_crecord.c
index 6e999cc9..e50fdbf7 100644
--- a/src/lj_crecord.c
+++ b/src/lj_crecord.c
@@ -1530,8 +1530,10 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
1530 } 1530 }
1531 { 1531 {
1532 TRef tr; 1532 TRef tr;
1533 if (!(tr = crec_arith_int64(J, sp, s, (MMS)rd->data)) && 1533 MMS mm = (MMS)rd->data;
1534 !(tr = crec_arith_ptr(J, sp, s, (MMS)rd->data)) && 1534 if ((mm == MM_len || mm == MM_concat ||
1535 (!(tr = crec_arith_int64(J, sp, s, mm)) &&
1536 !(tr = crec_arith_ptr(J, sp, s, mm)))) &&
1535 !(tr = crec_arith_meta(J, sp, s, cts, rd))) 1537 !(tr = crec_arith_meta(J, sp, s, cts, rd)))
1536 return; 1538 return;
1537 J->base[0] = tr; 1539 J->base[0] = tr;