diff options
author | Mike Pall <mike> | 2012-06-09 00:19:32 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-06-09 00:23:27 +0200 |
commit | e75561b70e470a19a8101349c48fe1137f0102fe (patch) | |
tree | 936391fea4b39d8b57ce834fd671cb80f94b91b4 /src | |
parent | cccf7638989275e57377e2e25595213caacb7da3 (diff) | |
download | luajit-e75561b70e470a19a8101349c48fe1137f0102fe.tar.gz luajit-e75561b70e470a19a8101349c48fe1137f0102fe.tar.bz2 luajit-e75561b70e470a19a8101349c48fe1137f0102fe.zip |
FFI: Fix address calculation for refs.
Fixes bug introduced in commit 5032e6d8.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_crecord.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c index 8859c3ee..3097cbf0 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c | |||
@@ -417,21 +417,23 @@ static TRef crec_ct_tv(jit_State *J, CType *d, TRef dp, TRef sp, cTValue *sval) | |||
417 | sid = argv2cdata(J, sp, sval)->typeid; | 417 | sid = argv2cdata(J, sp, sval)->typeid; |
418 | s = ctype_raw(cts, sid); | 418 | s = ctype_raw(cts, sid); |
419 | svisnz = cdataptr(cdataV(sval)); | 419 | svisnz = cdataptr(cdataV(sval)); |
420 | if (ctype_isref(s->info)) { | ||
421 | svisnz = *(void **)svisnz; | ||
422 | s = ctype_rawchild(cts, s); | ||
423 | sp = emitir(IRT(IR_FLOAD, IRT_PTR), sp, IRFL_CDATA_PTR); | ||
424 | } | ||
425 | if (ctype_isenum(s->info)) s = ctype_child(cts, s); | 420 | if (ctype_isenum(s->info)) s = ctype_child(cts, s); |
426 | t = crec_ct2irt(s); | 421 | t = crec_ct2irt(s); |
427 | if (ctype_isptr(s->info)) { | 422 | if (ctype_isptr(s->info)) { |
428 | sp = emitir(IRT(IR_FLOAD, t), sp, IRFL_CDATA_PTR); | 423 | sp = emitir(IRT(IR_FLOAD, t), sp, IRFL_CDATA_PTR); |
429 | goto doconv; | 424 | if (ctype_isref(s->info)) { |
430 | } else if (ctype_isinteger(s->info) && s->size == 8) { | 425 | svisnz = *(void **)svisnz; |
426 | s = ctype_rawchild(cts, s); | ||
427 | if (ctype_isenum(s->info)) s = ctype_child(cts, s); | ||
428 | t = crec_ct2irt(s); | ||
429 | } else { | ||
430 | goto doconv; | ||
431 | } | ||
432 | } else if (t == IRT_I64 || t == IRT_U64) { | ||
431 | sp = emitir(IRT(IR_FLOAD, t), sp, IRFL_CDATA_INT64); | 433 | sp = emitir(IRT(IR_FLOAD, t), sp, IRFL_CDATA_INT64); |
432 | lj_needsplit(J); | 434 | lj_needsplit(J); |
433 | goto doconv; | 435 | goto doconv; |
434 | } else if (ctype_isinteger(s->info) && s->size == 4) { | 436 | } else if (t == IRT_INT || t == IRT_U32) { |
435 | sp = emitir(IRT(IR_FLOAD, t), sp, IRFL_CDATA_INT); | 437 | sp = emitir(IRT(IR_FLOAD, t), sp, IRFL_CDATA_INT); |
436 | goto doconv; | 438 | goto doconv; |
437 | } else { | 439 | } else { |