new function 'luaT_trybiniTM'

to handle tag methods for instructions with immediate integer arguments
This commit is contained in:
Roberto Ierusalimschy
2017-09-27 15:59:08 -03:00
parent 00e728af88
commit 1b10033583
3 changed files with 19 additions and 12 deletions

13
lvm.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.293 2017/09/19 18:38:14 roberto Exp roberto $
** $Id: lvm.c,v 2.294 2017/09/26 18:14:45 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -999,15 +999,8 @@ void luaV_execute (lua_State *L) {
else if (tonumberns(rb, nb)) {
setfltvalue(s2v(ra), luai_numadd(L, nb, cast_num(ic)));
}
else {
TValue aux; TValue *rc;
setivalue(&aux, ic);
if (GETARG_Bk(i)) { /* arguments were exchanged? */
rc = rb; rb = &aux; /* correct them */
}
else rc = &aux;
Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD));
}
else
Protect(luaT_trybiniTM(L, rb, ic, GETARG_Bk(i), ra, TM_ADD));
vmbreak;
}
vmcase(OP_ADD) {