FFI: Treat function ctypes like pointers in comparisons.

This commit is contained in:
Mike Pall
2011-07-23 16:29:47 +02:00
parent b261d0ec04
commit d001d7b7ce
2 changed files with 10 additions and 1 deletions

View File

@@ -969,6 +969,10 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
tr = emitir(IRT(IR_FLOAD, t), tr, IRFL_CDATA_INT64);
lj_needsplit(J);
goto ok;
} else if (ctype_isfunc(ct->info)) {
tr = emitir(IRT(IR_FLOAD, IRT_PTR), tr, IRFL_CDATA_PTR);
ct = ctype_get(cts,
lj_ctype_intern(cts, CTINFO(CT_PTR, CTALIGN_PTR|id), CTSIZE_PTR));
} else {
tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCcdata)));
}