new instruction 'OP_EQK' (for equality with constants)

This commit is contained in:
Roberto Ierusalimschy
2017-11-16 10:59:14 -02:00
parent 5440b42f43
commit 4c0e36a46e
4 changed files with 61 additions and 14 deletions

12
lvm.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.309 2017/11/08 19:01:02 roberto Exp roberto $
** $Id: lvm.c,v 2.310 2017/11/13 15:36:52 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -1358,6 +1358,16 @@ void luaV_execute (lua_State *L) {
donextjump(ci);
vmbreak;
}
vmcase(OP_EQK) {
TValue *rb = vRB(i);
TValue *rc = KC(i);
/* basic types do not use '__eq'; we can use raw equality */
if (luaV_equalobj(NULL, rb, rc) != GETARG_A(i))
pc++;
else
donextjump(ci);
vmbreak;
}
vmcase(OP_TEST) {
if (GETARG_C(i) ? l_isfalse(s2v(ra)) : !l_isfalse(s2v(ra)))
pc++;