diff options
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 | } |