new instructions to optimize indexing on upvalues
This commit is contained in:
16
lvm.c
16
lvm.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.c,v 2.102 2009/12/17 16:20:01 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 2.103 2010/01/15 16:23:58 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -362,7 +362,7 @@ void luaV_finishOp (lua_State *L) {
|
||||
switch (op) { /* finish its execution */
|
||||
case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV:
|
||||
case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN:
|
||||
case OP_GETGLOBAL: case OP_GETTABLE: case OP_SELF: {
|
||||
case OP_GETGLOBAL: case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: {
|
||||
setobjs2s(L, base + GETARG_A(inst), --L->top);
|
||||
break;
|
||||
}
|
||||
@@ -403,7 +403,7 @@ void luaV_finishOp (lua_State *L) {
|
||||
L->top = ci->top; /* adjust results */
|
||||
break;
|
||||
}
|
||||
case OP_TAILCALL: case OP_SETGLOBAL: case OP_SETTABLE:
|
||||
case OP_TAILCALL: case OP_SETGLOBAL: case OP_SETTABUP: case OP_SETTABLE:
|
||||
break;
|
||||
default: lua_assert(0);
|
||||
}
|
||||
@@ -504,6 +504,11 @@ void luaV_execute (lua_State *L) {
|
||||
Protect(luaV_gettable(L, &g, rb, ra));
|
||||
continue;
|
||||
}
|
||||
case OP_GETTABUP: {
|
||||
int b = GETARG_B(i);
|
||||
Protect(luaV_gettable(L, cl->upvals[b]->v, RKC(i), ra));
|
||||
continue;
|
||||
}
|
||||
case OP_GETTABLE: {
|
||||
Protect(luaV_gettable(L, RB(i), RKC(i), ra));
|
||||
continue;
|
||||
@@ -516,6 +521,11 @@ void luaV_execute (lua_State *L) {
|
||||
Protect(luaV_settable(L, &g, rb, ra));
|
||||
continue;
|
||||
}
|
||||
case OP_SETTABUP: {
|
||||
int a = GETARG_A(i);
|
||||
Protect(luaV_settable(L, cl->upvals[a]->v, RKB(i), RKC(i)));
|
||||
continue;
|
||||
}
|
||||
case OP_SETUPVAL: {
|
||||
UpVal *uv = cl->upvals[GETARG_B(i)];
|
||||
setobj(L, uv->v, ra);
|
||||
|
||||
Reference in New Issue
Block a user