FFI: Always specialize to the field name for struct access.

This commit is contained in:
Mike Pall 2010-12-09 22:48:01 +01:00
parent 870bcd7640
commit 09e2bdbb0a

View File

@ -352,6 +352,8 @@ void LJ_FASTCALL recff_cdata_index(jit_State *J, RecordFFData *rd)
} }
} else if (tref_isstr(idx)) { } else if (tref_isstr(idx)) {
GCstr *name = strV(&rd->argv[1]); GCstr *name = strV(&rd->argv[1]);
/* Always specialize to the field name. */
emitir(IRTG(IR_EQ, IRT_STR), idx, lj_ir_kstr(J, name));
if (ctype_isstruct(ct->info)) { if (ctype_isstruct(ct->info)) {
CTSize fofs; CTSize fofs;
CType *fct = lj_ctype_getfield(cts, ct, name, &fofs); CType *fct = lj_ctype_getfield(cts, ct, name, &fofs);