diff options
Diffstat (limited to '')
| -rw-r--r-- | opcode.c | 21 |
1 files changed, 15 insertions, 6 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_opcode="$Id: opcode.c,v 3.52 1996/01/09 20:22:44 roberto Exp roberto $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 3.53 1996/01/23 18:43:07 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | #include <setjmp.h> | 8 | #include <setjmp.h> |
| 9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
| @@ -374,6 +374,18 @@ static void storesubscript (void) | |||
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | 376 | ||
| 377 | static void getglobal (Word n) | ||
| 378 | { | ||
| 379 | *top = lua_table[n].object; | ||
| 380 | incr_top; | ||
| 381 | if (tag(top-1) == LUA_T_NIL) | ||
| 382 | { /* must call getglobal fallback */ | ||
| 383 | tag(top-1) = LUA_T_STRING; | ||
| 384 | tsvalue(top-1) = &lua_table[n].varname->ts; | ||
| 385 | callFB(FB_GETGLOBAL); | ||
| 386 | } | ||
| 387 | } | ||
| 388 | |||
| 377 | /* | 389 | /* |
| 378 | ** Traverse all objects on stack | 390 | ** Traverse all objects on stack |
| 379 | */ | 391 | */ |
| @@ -704,10 +716,8 @@ int lua_lock (void) | |||
| 704 | */ | 716 | */ |
| 705 | lua_Object lua_getglobal (char *name) | 717 | lua_Object lua_getglobal (char *name) |
| 706 | { | 718 | { |
| 707 | Word n = luaI_findsymbolbyname(name); | ||
| 708 | adjustC(0); | 719 | adjustC(0); |
| 709 | *top = s_object(n); | 720 | getglobal(luaI_findsymbolbyname(name)); |
| 710 | incr_top; | ||
| 711 | CBase++; /* incorporate object in the stack */ | 721 | CBase++; /* incorporate object in the stack */ |
| 712 | return Ref(top-1); | 722 | return Ref(top-1); |
| 713 | } | 723 | } |
| @@ -919,8 +929,7 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
| 919 | { | 929 | { |
| 920 | CodeWord code; | 930 | CodeWord code; |
| 921 | get_word(code,pc); | 931 | get_word(code,pc); |
| 922 | *top = s_object(code.w); | 932 | getglobal(code.w); |
| 923 | incr_top; | ||
| 924 | } | 933 | } |
| 925 | break; | 934 | break; |
| 926 | 935 | ||
