diff options
Diffstat (limited to 'src/lj_crecord.c')
-rw-r--r-- | src/lj_crecord.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c index c688caa3..001cf600 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c | |||
@@ -759,7 +759,14 @@ static TRef crec_call_args(jit_State *J, RecordFFData *rd, | |||
759 | if (!(ctype_isnum(d->info) || ctype_isptr(d->info) || | 759 | if (!(ctype_isnum(d->info) || ctype_isptr(d->info) || |
760 | ctype_isenum(d->info))) | 760 | ctype_isenum(d->info))) |
761 | lj_trace_err(J, LJ_TRERR_NYICALL); | 761 | lj_trace_err(J, LJ_TRERR_NYICALL); |
762 | args[n] = crec_ct_tv(J, d, 0, J->base[n+1], &rd->argv[n+1]); | 762 | tr = crec_ct_tv(J, d, 0, J->base[n+1], &rd->argv[n+1]); |
763 | if (ctype_isinteger_or_bool(d->info) && d->size < 4) { | ||
764 | if ((d->info & CTF_UNSIGNED)) | ||
765 | tr = emitconv(tr, IRT_INT, d->size==1 ? IRT_U8 : IRT_U16, 0); | ||
766 | else | ||
767 | tr = emitconv(tr, IRT_INT, d->size==1 ? IRT_I8 : IRT_I16, IRCONV_SEXT); | ||
768 | } | ||
769 | args[n] = tr; | ||
763 | } | 770 | } |
764 | tr = args[0]; | 771 | tr = args[0]; |
765 | for (i = 1; i < n; i++) | 772 | for (i = 1; i < n; i++) |
@@ -799,6 +806,10 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd) | |||
799 | tr = emitir(IRT(IR_CALLXS, t), crec_call_args(J, rd, cts, ct), func); | 806 | tr = emitir(IRT(IR_CALLXS, t), crec_call_args(J, rd, cts, ct), func); |
800 | if (t == IRT_FLOAT || t == IRT_U32) { | 807 | if (t == IRT_FLOAT || t == IRT_U32) { |
801 | tr = emitconv(tr, IRT_NUM, t, 0); | 808 | tr = emitconv(tr, IRT_NUM, t, 0); |
809 | } else if (t == IRT_I8 || t == IRT_I16) { | ||
810 | tr = emitconv(tr, IRT_INT, t, IRCONV_SEXT); | ||
811 | } else if (t == IRT_U8 || t == IRT_U16) { | ||
812 | tr = emitconv(tr, IRT_INT, t, 0); | ||
802 | } else if (t == IRT_PTR || (LJ_64 && t == IRT_P32) || | 813 | } else if (t == IRT_PTR || (LJ_64 && t == IRT_P32) || |
803 | (t == IRT_I64 || t == IRT_U64)) { | 814 | (t == IRT_I64 || t == IRT_U64)) { |
804 | TRef trid = lj_ir_kint(J, ctype_cid(ct->info)); | 815 | TRef trid = lj_ir_kint(J, ctype_cid(ct->info)); |