diff options
author | Waldemar Celes <celes@tecgraf.puc-rio.br> | 1994-12-27 18:53:15 -0200 |
---|---|---|
committer | Waldemar Celes <celes@tecgraf.puc-rio.br> | 1994-12-27 18:53:15 -0200 |
commit | b8e76d9b5c86182998c0616627607181154a60b1 (patch) | |
tree | 2889f4baf5089cdfb76c608c1850199598145c60 | |
parent | dc97a07e19abaa6942c84c88d001e8cccd517d1d (diff) | |
download | lua-b8e76d9b5c86182998c0616627607181154a60b1.tar.gz lua-b8e76d9b5c86182998c0616627607181154a60b1.tar.bz2 lua-b8e76d9b5c86182998c0616627607181154a60b1.zip |
'lua_getsubscript' and 'lua_storesubscript' now run unprotected (to improve efficiency)
-rw-r--r-- | opcode.c | 20 |
1 files changed, 6 insertions, 14 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.27 1994/12/16 16:08:34 roberto Exp roberto $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 3.28 1994/12/20 21:20:36 roberto Exp celes $"; |
7 | 7 | ||
8 | #include <setjmp.h> | 8 | #include <setjmp.h> |
9 | #include <stdio.h> | 9 | #include <stdio.h> |
@@ -441,16 +441,10 @@ lua_Object lua_setfallback (char *name, lua_CFunction fallback) | |||
441 | */ | 441 | */ |
442 | lua_Object lua_getsubscript (void) | 442 | lua_Object lua_getsubscript (void) |
443 | { | 443 | { |
444 | static Byte code[2] = {PUSHINDEXED, RETCODE0}; | ||
445 | int status; | ||
446 | Object func; | ||
447 | tag(&func) = LUA_T_FUNCTION; bvalue(&func) = code; | ||
448 | adjustC(2); | 444 | adjustC(2); |
449 | status = do_protectedrun(&func, 1); | 445 | pushsubscript(); |
450 | if (status == 0) | 446 | CBase++; /* incorporate object in the stack */ |
451 | return (Ref(top-1)); | 447 | return (Ref(top-1)); |
452 | else | ||
453 | return LUA_NOOBJECT; | ||
454 | } | 448 | } |
455 | 449 | ||
456 | 450 | ||
@@ -487,11 +481,9 @@ void lua_endblock (void) | |||
487 | */ | 481 | */ |
488 | int lua_storesubscript (void) | 482 | int lua_storesubscript (void) |
489 | { | 483 | { |
490 | static Byte code[2] = {STOREINDEXED0, RETCODE0}; | ||
491 | Object func; | ||
492 | tag(&func) = LUA_T_FUNCTION; bvalue(&func) = code; | ||
493 | adjustC(3); | 484 | adjustC(3); |
494 | return(do_protectedrun(&func, 0)); | 485 | storesubscript(); |
486 | return 0; | ||
495 | } | 487 | } |
496 | 488 | ||
497 | /* | 489 | /* |