diff options
Diffstat (limited to 'src/lj_record.c')
-rw-r--r-- | src/lj_record.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lj_record.c b/src/lj_record.c index c0aea106..ee62179b 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -1445,6 +1445,16 @@ TRef lj_record_idx(jit_State *J, RecordIndex *ix) | |||
1445 | return 0; /* No result yet. */ | 1445 | return 0; /* No result yet. */ |
1446 | } | 1446 | } |
1447 | } | 1447 | } |
1448 | #if LJ_HASBUFFER | ||
1449 | /* The index table of buffer objects is treated as immutable. */ | ||
1450 | if (ix->mt == TREF_NIL && !ix->val && | ||
1451 | tref_isudata(ix->tab) && udataV(&ix->tabv)->udtype == UDTYPE_BUFFER && | ||
1452 | tref_istab(ix->mobj) && tref_isstr(ix->key) && tref_isk(ix->key)) { | ||
1453 | cTValue *val = lj_tab_getstr(tabV(&ix->mobjv), strV(&ix->keyv)); | ||
1454 | TRef tr = lj_record_constify(J, val); | ||
1455 | if (tr) return tr; /* Specialize to the value, i.e. a method. */ | ||
1456 | } | ||
1457 | #endif | ||
1448 | /* Otherwise retry lookup with metaobject. */ | 1458 | /* Otherwise retry lookup with metaobject. */ |
1449 | ix->tab = ix->mobj; | 1459 | ix->tab = ix->mobj; |
1450 | copyTV(J->L, &ix->tabv, &ix->mobjv); | 1460 | copyTV(J->L, &ix->tabv, &ix->mobjv); |