diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-02-26 17:40:29 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-02-26 17:40:29 -0300 |
commit | 0fe2576a39633ab7873f9d4fd989f1e5203a5725 (patch) | |
tree | c759f10fb3565f924dad29874d85d9d1b139c3bf /lvm.c | |
parent | d08d237a49ff3cb961012b1de374914af6da3000 (diff) | |
download | lua-0fe2576a39633ab7873f9d4fd989f1e5203a5725.tar.gz lua-0fe2576a39633ab7873f9d4fd989f1e5203a5725.tar.bz2 lua-0fe2576a39633ab7873f9d4fd989f1e5203a5725.zip |
new instructions to optimize indexing on upvalues
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.102 2009/12/17 16:20:01 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.103 2010/01/15 16:23:58 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -362,7 +362,7 @@ void luaV_finishOp (lua_State *L) { | |||
362 | switch (op) { /* finish its execution */ | 362 | switch (op) { /* finish its execution */ |
363 | case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: | 363 | case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: |
364 | case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN: | 364 | case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN: |
365 | case OP_GETGLOBAL: case OP_GETTABLE: case OP_SELF: { | 365 | case OP_GETGLOBAL: case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: { |
366 | setobjs2s(L, base + GETARG_A(inst), --L->top); | 366 | setobjs2s(L, base + GETARG_A(inst), --L->top); |
367 | break; | 367 | break; |
368 | } | 368 | } |
@@ -403,7 +403,7 @@ void luaV_finishOp (lua_State *L) { | |||
403 | L->top = ci->top; /* adjust results */ | 403 | L->top = ci->top; /* adjust results */ |
404 | break; | 404 | break; |
405 | } | 405 | } |
406 | case OP_TAILCALL: case OP_SETGLOBAL: case OP_SETTABLE: | 406 | case OP_TAILCALL: case OP_SETGLOBAL: case OP_SETTABUP: case OP_SETTABLE: |
407 | break; | 407 | break; |
408 | default: lua_assert(0); | 408 | default: lua_assert(0); |
409 | } | 409 | } |
@@ -504,6 +504,11 @@ void luaV_execute (lua_State *L) { | |||
504 | Protect(luaV_gettable(L, &g, rb, ra)); | 504 | Protect(luaV_gettable(L, &g, rb, ra)); |
505 | continue; | 505 | continue; |
506 | } | 506 | } |
507 | case OP_GETTABUP: { | ||
508 | int b = GETARG_B(i); | ||
509 | Protect(luaV_gettable(L, cl->upvals[b]->v, RKC(i), ra)); | ||
510 | continue; | ||
511 | } | ||
507 | case OP_GETTABLE: { | 512 | case OP_GETTABLE: { |
508 | Protect(luaV_gettable(L, RB(i), RKC(i), ra)); | 513 | Protect(luaV_gettable(L, RB(i), RKC(i), ra)); |
509 | continue; | 514 | continue; |
@@ -516,6 +521,11 @@ void luaV_execute (lua_State *L) { | |||
516 | Protect(luaV_settable(L, &g, rb, ra)); | 521 | Protect(luaV_settable(L, &g, rb, ra)); |
517 | continue; | 522 | continue; |
518 | } | 523 | } |
524 | case OP_SETTABUP: { | ||
525 | int a = GETARG_A(i); | ||
526 | Protect(luaV_settable(L, cl->upvals[a]->v, RKB(i), RKC(i))); | ||
527 | continue; | ||
528 | } | ||
519 | case OP_SETUPVAL: { | 529 | case OP_SETUPVAL: { |
520 | UpVal *uv = cl->upvals[GETARG_B(i)]; | 530 | UpVal *uv = cl->upvals[GETARG_B(i)]; |
521 | setobj(L, uv->v, ra); | 531 | setobj(L, uv->v, ra); |