diff options
author | Mike Pall <mike> | 2010-12-15 19:47:01 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-12-15 19:48:20 +0100 |
commit | fbcc925a2d0f64e352d359626c1cb410b2cb5883 (patch) | |
tree | b4f8e7143141f3bace03f54b31b3ddc8d2d7f4d3 /src/lj_crecord.c | |
parent | badff4ed0ad5ed8650f6fa55ab56e86b990ba397 (diff) | |
download | luajit-fbcc925a2d0f64e352d359626c1cb410b2cb5883.tar.gz luajit-fbcc925a2d0f64e352d359626c1cb410b2cb5883.tar.bz2 luajit-fbcc925a2d0f64e352d359626c1cb410b2cb5883.zip |
FFI: Fix auto-deref of pointers to structs.
Diffstat (limited to 'src/lj_crecord.c')
-rw-r--r-- | src/lj_crecord.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c index 0d8c02a5..3ee39ece 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c | |||
@@ -363,9 +363,17 @@ void LJ_FASTCALL recff_cdata_index(jit_State *J, RecordFFData *rd) | |||
363 | GCstr *name = strV(&rd->argv[1]); | 363 | GCstr *name = strV(&rd->argv[1]); |
364 | /* Always specialize to the field name. */ | 364 | /* Always specialize to the field name. */ |
365 | emitir(IRTG(IR_EQ, IRT_STR), idx, lj_ir_kstr(J, name)); | 365 | emitir(IRTG(IR_EQ, IRT_STR), idx, lj_ir_kstr(J, name)); |
366 | if (ctype_isstruct(ct->info)) { | 366 | if (ctype_isptr(ct->info)) { /* Automatically perform '->'. */ |
367 | CType *cct = ctype_rawchild(cts, ct); | ||
368 | if (ctype_isstruct(cct->info)) { | ||
369 | ct = cct; | ||
370 | goto index_struct; | ||
371 | } | ||
372 | } else if (ctype_isstruct(ct->info)) { | ||
367 | CTSize fofs; | 373 | CTSize fofs; |
368 | CType *fct = lj_ctype_getfield(cts, ct, name, &fofs); | 374 | CType *fct; |
375 | index_struct: | ||
376 | fct = lj_ctype_getfield(cts, ct, name, &fofs); | ||
369 | if (fct) { | 377 | if (fct) { |
370 | if (ctype_isconstval(fct->info)) { | 378 | if (ctype_isconstval(fct->info)) { |
371 | if (fct->size >= 0x80000000u && | 379 | if (fct->size >= 0x80000000u && |