diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-09-19 18:17:52 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-09-19 18:17:52 -0300 |
| commit | 2079cfe8faa34ebe435d1ef0526b04d3e57b5349 (patch) | |
| tree | 617a80c97583dc9eff9a11a2db88049c49b65e1a /lvm.c | |
| parent | dfe03c7abea6a00925a56239dfaac5be2770396e (diff) | |
| download | lua-2079cfe8faa34ebe435d1ef0526b04d3e57b5349.tar.gz lua-2079cfe8faa34ebe435d1ef0526b04d3e57b5349.tar.bz2 lua-2079cfe8faa34ebe435d1ef0526b04d3e57b5349.zip | |
new way to code globals, using const table instead of putting global
index inside the opcode.
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 14 |
1 files changed, 11 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.1 1997/09/16 19:25:59 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.2 1997/09/19 18:40:32 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 | */ |
| @@ -326,8 +326,12 @@ StkId luaV_execute (Closure *cl, StkId base) | |||
| 326 | *luaD_stack.top++ = *((luaD_stack.stack+base) + (*pc++)); | 326 | *luaD_stack.top++ = *((luaD_stack.stack+base) + (*pc++)); |
| 327 | break; | 327 | break; |
| 328 | 328 | ||
| 329 | case PUSHGLOBALB: | ||
| 330 | luaV_getglobal(luaG_findsymbol(tsvalue(&func->consts[*pc++]))); | ||
| 331 | break; | ||
| 332 | |||
| 329 | case PUSHGLOBAL: | 333 | case PUSHGLOBAL: |
| 330 | luaV_getglobal(get_word(pc)); | 334 | luaV_getglobal(luaG_findsymbol(tsvalue(&func->consts[get_word(pc)]))); |
| 331 | break; | 335 | break; |
| 332 | 336 | ||
| 333 | case GETTABLE: | 337 | case GETTABLE: |
| @@ -369,8 +373,12 @@ StkId luaV_execute (Closure *cl, StkId base) | |||
| 369 | case SETLOCAL: | 373 | case SETLOCAL: |
| 370 | *((luaD_stack.stack+base) + (*pc++)) = *(--luaD_stack.top); break; | 374 | *((luaD_stack.stack+base) + (*pc++)) = *(--luaD_stack.top); break; |
| 371 | 375 | ||
| 376 | case SETGLOBALB: | ||
| 377 | luaV_setglobal(luaG_findsymbol(tsvalue(&func->consts[*pc++]))); | ||
| 378 | break; | ||
| 379 | |||
| 372 | case SETGLOBAL: | 380 | case SETGLOBAL: |
| 373 | luaV_setglobal(get_word(pc)); | 381 | luaV_setglobal(luaG_findsymbol(tsvalue(&func->consts[get_word(pc)]))); |
| 374 | break; | 382 | break; |
| 375 | 383 | ||
| 376 | case SETTABLE0: | 384 | case SETTABLE0: |
