summaryrefslogtreecommitdiff
path: root/src/lj_crecord.c
diff options
context:
space:
mode:
authorMike Pall <mike>2011-03-10 01:41:58 +0100
committerMike Pall <mike>2011-03-10 01:41:58 +0100
commit3f26e3a89d54dfb761ca02fc89aaf15326f5f514 (patch)
treedd795b23fd364f9ccee1d70c120eed74c5f95026 /src/lj_crecord.c
parent1c9981ae4c9618c046756333fcc6d33c9492f2ae (diff)
downloadluajit-3f26e3a89d54dfb761ca02fc89aaf15326f5f514.tar.gz
luajit-3f26e3a89d54dfb761ca02fc89aaf15326f5f514.tar.bz2
luajit-3f26e3a89d54dfb761ca02fc89aaf15326f5f514.zip
FFI: Fix and optimize recording of cdata[cdata].
Diffstat (limited to 'src/lj_crecord.c')
-rw-r--r--src/lj_crecord.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c
index d689b81b..c93cece3 100644
--- a/src/lj_crecord.c
+++ b/src/lj_crecord.c
@@ -503,10 +503,17 @@ void LJ_FASTCALL recff_cdata_index(jit_State *J, RecordFFData *rd)
503 IRType t; 503 IRType t;
504 if (ctype_isenum(ctk->info)) ctk = ctype_child(cts, ctk); 504 if (ctype_isenum(ctk->info)) ctk = ctype_child(cts, ctk);
505 if (ctype_isinteger(ctk->info) && (t = crec_ct2irt(ctk)) != IRT_CDATA) { 505 if (ctype_isinteger(ctk->info) && (t = crec_ct2irt(ctk)) != IRT_CDATA) {
506 idx = emitir(IRT(IR_ADD, IRT_PTR), idx, lj_ir_kintp(J, sizeof(GCcdata))); 506 if (ctk->size == 8) {
507 idx = emitir(IRT(IR_XLOAD, t), idx, 0); 507 idx = emitir(IRT(IR_FLOAD, t), idx, IRFL_CDATA_INT64);
508 if (!LJ_64 && (t == IRT_I64 || t == IRT_U64)) { 508 } else {
509 idx = emitconv(idx, IRT_INT, t, 0); 509 idx = emitir(IRT(IR_ADD, IRT_PTR), idx,
510 lj_ir_kintp(J, sizeof(GCcdata)));
511 idx = emitir(IRT(IR_XLOAD, t), idx, 0);
512 }
513 if (LJ_64 && ctk->size < sizeof(intptr_t) && !(ctk->info & CTF_UNSIGNED))
514 idx = emitconv(idx, IRT_INTP, IRT_INT, IRCONV_SEXT);
515 if (!LJ_64 && ctk->size > sizeof(intptr_t)) {
516 idx = emitconv(idx, IRT_INTP, t, 0);
510 lj_needsplit(J); 517 lj_needsplit(J);
511 } 518 }
512 goto integer_key; 519 goto integer_key;