mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Fix address calculation for refs.
Fixes bug introduced in commit 5032e6d8
.
This commit is contained in:
parent
cccf763898
commit
e75561b70e
@ -417,21 +417,23 @@ static TRef crec_ct_tv(jit_State *J, CType *d, TRef dp, TRef sp, cTValue *sval)
|
||||
sid = argv2cdata(J, sp, sval)->typeid;
|
||||
s = ctype_raw(cts, sid);
|
||||
svisnz = cdataptr(cdataV(sval));
|
||||
if (ctype_isref(s->info)) {
|
||||
svisnz = *(void **)svisnz;
|
||||
s = ctype_rawchild(cts, s);
|
||||
sp = emitir(IRT(IR_FLOAD, IRT_PTR), sp, IRFL_CDATA_PTR);
|
||||
}
|
||||
if (ctype_isenum(s->info)) s = ctype_child(cts, s);
|
||||
t = crec_ct2irt(s);
|
||||
if (ctype_isptr(s->info)) {
|
||||
sp = emitir(IRT(IR_FLOAD, t), sp, IRFL_CDATA_PTR);
|
||||
goto doconv;
|
||||
} else if (ctype_isinteger(s->info) && s->size == 8) {
|
||||
if (ctype_isref(s->info)) {
|
||||
svisnz = *(void **)svisnz;
|
||||
s = ctype_rawchild(cts, s);
|
||||
if (ctype_isenum(s->info)) s = ctype_child(cts, s);
|
||||
t = crec_ct2irt(s);
|
||||
} else {
|
||||
goto doconv;
|
||||
}
|
||||
} else if (t == IRT_I64 || t == IRT_U64) {
|
||||
sp = emitir(IRT(IR_FLOAD, t), sp, IRFL_CDATA_INT64);
|
||||
lj_needsplit(J);
|
||||
goto doconv;
|
||||
} else if (ctype_isinteger(s->info) && s->size == 4) {
|
||||
} else if (t == IRT_INT || t == IRT_U32) {
|
||||
sp = emitir(IRT(IR_FLOAD, t), sp, IRFL_CDATA_INT);
|
||||
goto doconv;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user