summaryrefslogtreecommitdiff
path: root/src/lj_crecord.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_crecord.c')
-rw-r--r--src/lj_crecord.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c
index 23b92831..791c177c 100644
--- a/src/lj_crecord.c
+++ b/src/lj_crecord.c
@@ -165,7 +165,7 @@ static void crec_ct_ct(jit_State *J, CType *d, CType *s, TRef dp, TRef sp)
165 /* fallthrough */ 165 /* fallthrough */
166 case CCX(I, F): 166 case CCX(I, F):
167 if (dt == IRT_CDATA || st == IRT_CDATA) goto err_nyi; 167 if (dt == IRT_CDATA || st == IRT_CDATA) goto err_nyi;
168 sp = emitconv(sp, dsize < 4 ? IRT_INT : dt, st, IRCONV_TRUNC); 168 sp = emitconv(sp, dsize < 4 ? IRT_INT : dt, st, IRCONV_TRUNC|IRCONV_ANY);
169 goto xstore; 169 goto xstore;
170 case CCX(I, P): 170 case CCX(I, P):
171 case CCX(I, A): 171 case CCX(I, A):
@@ -241,7 +241,7 @@ static void crec_ct_ct(jit_State *J, CType *d, CType *s, TRef dp, TRef sp)
241 if (st == IRT_CDATA) goto err_nyi; 241 if (st == IRT_CDATA) goto err_nyi;
242 /* The signed conversion is cheaper. x64 really has 47 bit pointers. */ 242 /* The signed conversion is cheaper. x64 really has 47 bit pointers. */
243 sp = emitconv(sp, (LJ_64 && dsize == 8) ? IRT_I64 : IRT_U32, 243 sp = emitconv(sp, (LJ_64 && dsize == 8) ? IRT_I64 : IRT_U32,
244 st, IRCONV_TRUNC); 244 st, IRCONV_TRUNC|IRCONV_ANY);
245 goto xstore; 245 goto xstore;
246 246
247 /* Destination is an array. */ 247 /* Destination is an array. */
@@ -401,11 +401,13 @@ void LJ_FASTCALL recff_cdata_index(jit_State *J, RecordFFData *rd)
401 if (tref_isnumber(idx)) { 401 if (tref_isnumber(idx)) {
402 /* The size of a ptrdiff_t is target-specific. */ 402 /* The size of a ptrdiff_t is target-specific. */
403#if LJ_64 403#if LJ_64
404 idx = emitir(IRT(IR_TOI64, IRT_INTP), idx, 404 if (tref_isnum(idx))
405 tref_isinteger(idx) ? IRTOINT_SEXT64 : IRTOINT_TRUNCI64); 405 idx = emitconv(idx, IRT_I64, IRT_NUM, IRCONV_TRUNC|IRCONV_ANY);
406 else
407 idx = emitconv(idx, IRT_I64, IRT_INT, IRCONV_SEXT);
406#else 408#else
407 if (!tref_isinteger(idx)) 409 if (tref_isnum(idx))
408 idx = emitir(IRT(IR_TOINT, IRT_INTP), idx, IRTOINT_ANY); 410 idx = emitconv(idx, IRT_INT, IRT_NUM, IRCONV_TRUNC|IRCONV_ANY);
409#endif 411#endif
410 if (ctype_ispointer(ct->info)) { 412 if (ctype_ispointer(ct->info)) {
411 CTSize sz = lj_ctype_size(cts, (sid = ctype_cid(ct->info))); 413 CTSize sz = lj_ctype_size(cts, (sid = ctype_cid(ct->info)));