diff options
author | Mike Pall <mike> | 2010-12-08 02:02:21 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-12-08 02:02:21 +0100 |
commit | 2a917a9d83baa1fade1b5704705759e8840fa237 (patch) | |
tree | c8365e75205420c9af8de949c3712b39e71cdc44 /src | |
parent | d4d95ee2da57ea2c6f2fa68700b51f8f8251b83d (diff) | |
download | luajit-2a917a9d83baa1fade1b5704705759e8840fa237.tar.gz luajit-2a917a9d83baa1fade1b5704705759e8840fa237.tar.bz2 luajit-2a917a9d83baa1fade1b5704705759e8840fa237.zip |
FFI: Treat cdata metatable+methods as immutable in trace recorder.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_record.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lj_record.c b/src/lj_record.c index 967022f5..ae47f236 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -667,6 +667,19 @@ int lj_record_mm_lookup(jit_State *J, RecordIndex *ix, MMS mm) | |||
667 | ix->mt = TREF_NIL; | 667 | ix->mt = TREF_NIL; |
668 | return 0; /* No metamethod. */ | 668 | return 0; /* No metamethod. */ |
669 | } | 669 | } |
670 | #if LJ_HASFFI | ||
671 | /* The cdata metatable is treated as immutable. */ | ||
672 | if (tref_iscdata(ix->tab)) { | ||
673 | cTValue *mo = lj_tab_getstr(mt, mmname_str(J2G(J), mm)); | ||
674 | if (!mo || tvisnil(mo)) | ||
675 | return 0; /* No metamethod. */ | ||
676 | setfuncV(J->L, &ix->mobjv, funcV(mo)); | ||
677 | ix->mobj = lj_ir_kfunc(J, funcV(mo)); /* Immutable metamethod. */ | ||
678 | ix->mtv = mt; | ||
679 | ix->mt = TREF_NIL; /* Dummy value for comparison semantics. */ | ||
680 | return 1; /* Got cdata metamethod. */ | ||
681 | } | ||
682 | #endif | ||
670 | ix->mt = mix.tab = lj_ir_ktab(J, mt); | 683 | ix->mt = mix.tab = lj_ir_ktab(J, mt); |
671 | goto nocheck; | 684 | goto nocheck; |
672 | } | 685 | } |