diff options
author | Mike Pall <mike> | 2020-05-08 14:00:07 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2020-05-08 14:00:07 +0200 |
commit | d5e12d5174720fbd3c5fad4e02da5850b8433057 (patch) | |
tree | e6f53754f6086ed254cf2a8d0fcfbeee679696f1 /src | |
parent | 92c011b5117f237f2554c5745646ea566ce0d568 (diff) | |
parent | cc4bbec483d3f3250b519ccb7cc22f1a8e6fe6f0 (diff) | |
download | luajit-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.c | 2 | ||||
-rw-r--r-- | src/lj_carith.c | 11 | ||||
-rw-r--r-- | src/lj_carith.h | 1 | ||||
-rw-r--r-- | src/lj_crecord.c | 6 |
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 | ||
195 | LJLIB_CF(ffi_meta___len) LJLIB_REC(cdata_arith MM_len) | 195 | LJLIB_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 | ||
200 | LJLIB_CF(ffi_meta___lt) LJLIB_REC(cdata_arith MM_lt) | 200 | LJLIB_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. */ | ||
278 | int 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 | ||
13 | LJ_FUNC int lj_carith_op(lua_State *L, MMS mm); | 13 | LJ_FUNC int lj_carith_op(lua_State *L, MMS mm); |
14 | LJ_FUNC int lj_carith_len(lua_State *L); | ||
15 | 14 | ||
16 | #if LJ_32 | 15 | #if LJ_32 |
17 | LJ_FUNC uint64_t lj_carith_shl64(uint64_t x, int32_t sh); | 16 | LJ_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; |