mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Fix pseudo type conversions for type punning.
This commit is contained in:
parent
095344ce7c
commit
c735293921
@ -740,21 +740,19 @@ retry:
|
|||||||
case ALIAS_MUST:
|
case ALIAS_MUST:
|
||||||
/* Emit conversion if the loaded type doesn't match the forwarded type. */
|
/* Emit conversion if the loaded type doesn't match the forwarded type. */
|
||||||
if (!irt_sametype(fins->t, IR(store->op2)->t)) {
|
if (!irt_sametype(fins->t, IR(store->op2)->t)) {
|
||||||
IRType st = irt_type(fins->t);
|
IRType dt = irt_type(fins->t), st = irt_type(IR(store->op2)->t);
|
||||||
if (st == IRT_I8 || st == IRT_I16) { /* Trunc + sign-extend. */
|
if (dt == IRT_I8 || dt == IRT_I16) { /* Trunc + sign-extend. */
|
||||||
st |= IRCONV_SEXT;
|
st = dt | IRCONV_SEXT;
|
||||||
} else if (st == IRT_U8 || st == IRT_U16) { /* Trunc + zero-extend. */
|
dt = IRT_INT;
|
||||||
} else if (st == IRT_INT) {
|
} else if (dt == IRT_U8 || dt == IRT_U16) { /* Trunc + zero-extend. */
|
||||||
st = irt_type(IR(store->op2)->t); /* Needs dummy CONV.int.*. */
|
st = dt;
|
||||||
} else { /* I64/U64 are boxed, U32 is hidden behind a CONV.num.u32. */
|
dt = IRT_INT;
|
||||||
goto store_fwd;
|
|
||||||
}
|
}
|
||||||
fins->ot = IRTI(IR_CONV);
|
fins->ot = IRT(IR_CONV, dt);
|
||||||
fins->op1 = store->op2;
|
fins->op1 = store->op2;
|
||||||
fins->op2 = (IRT_INT<<5)|st;
|
fins->op2 = (dt<<5)|st;
|
||||||
return RETRYFOLD;
|
return RETRYFOLD;
|
||||||
}
|
}
|
||||||
store_fwd:
|
|
||||||
return store->op2; /* Store forwarding. */
|
return store->op2; /* Store forwarding. */
|
||||||
}
|
}
|
||||||
ref = store->prev;
|
ref = store->prev;
|
||||||
|
Loading…
Reference in New Issue
Block a user