diff options
Diffstat (limited to 'src/buildvm_x86.dasc')
-rw-r--r-- | src/buildvm_x86.dasc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc index 242f8d6d..effd0737 100644 --- a/src/buildvm_x86.dasc +++ b/src/buildvm_x86.dasc | |||
@@ -1167,9 +1167,17 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse) | |||
1167 | | mov L:FCARG1, L:RB | 1167 | | mov L:FCARG1, L:RB |
1168 | | mov SAVE_PC, PC | 1168 | | mov SAVE_PC, PC |
1169 | | call extern lj_meta_len@8 // (lua_State *L, TValue *o) | 1169 | | call extern lj_meta_len@8 // (lua_State *L, TValue *o) |
1170 | | // TValue * (metamethod) returned in eax (RC). | 1170 | | // NULL (retry) or TValue * (metamethod) returned in eax (RC). |
1171 | | mov BASE, L:RB->base | 1171 | | mov BASE, L:RB->base |
1172 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | ||
1173 | | test RC, RC | ||
1174 | | jne ->vmeta_binop // Binop call for compatibility. | ||
1175 | | movzx RD, PC_RD | ||
1176 | | mov TAB:FCARG1, [BASE+RD*8] | ||
1177 | | jmp ->BC_LEN_Z | ||
1178 | #else | ||
1172 | | jmp ->vmeta_binop // Binop call for compatibility. | 1179 | | jmp ->vmeta_binop // Binop call for compatibility. |
1180 | #endif | ||
1173 | | | 1181 | | |
1174 | |//-- Call metamethod ---------------------------------------------------- | 1182 | |//-- Call metamethod ---------------------------------------------------- |
1175 | | | 1183 | | |
@@ -4244,6 +4252,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) | |||
4244 | |2: | 4252 | |2: |
4245 | | checktab RD, ->vmeta_len | 4253 | | checktab RD, ->vmeta_len |
4246 | | mov TAB:FCARG1, [BASE+RD*8] | 4254 | | mov TAB:FCARG1, [BASE+RD*8] |
4255 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | ||
4256 | | mov TAB:RB, TAB:FCARG1->metatable | ||
4257 | | cmp TAB:RB, 0 | ||
4258 | | jnz >9 | ||
4259 | |3: | ||
4260 | #endif | ||
4261 | |->BC_LEN_Z: | ||
4247 | | mov RB, BASE // Save BASE. | 4262 | | mov RB, BASE // Save BASE. |
4248 | | call extern lj_tab_len@4 // (GCtab *t) | 4263 | | call extern lj_tab_len@4 // (GCtab *t) |
4249 | | // Length of table returned in eax (RD). | 4264 | | // Length of table returned in eax (RD). |
@@ -4260,6 +4275,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) | |||
4260 | | mov BASE, RB // Restore BASE. | 4275 | | mov BASE, RB // Restore BASE. |
4261 | | movzx RA, PC_RA | 4276 | | movzx RA, PC_RA |
4262 | | jmp <1 | 4277 | | jmp <1 |
4278 | #ifdef LUAJIT_ENABLE_LUA52COMPAT | ||
4279 | |9: // Check for __len. | ||
4280 | | test byte TAB:RB->nomm, 1<<MM_len | ||
4281 | | jnz <3 | ||
4282 | | jmp ->vmeta_len // 'no __len' flag NOT set: check. | ||
4283 | #endif | ||
4263 | break; | 4284 | break; |
4264 | 4285 | ||
4265 | /* -- Binary ops -------------------------------------------------------- */ | 4286 | /* -- Binary ops -------------------------------------------------------- */ |