瀏覽代碼

'lua_getsubscript' and 'lua_storesubscript' now run unprotected (to improve efficiency)

Waldemar Celes 31 年之前
父節點
當前提交
b8e76d9b5c
共有 1 個文件被更改,包括 6 次插入14 次删除
  1. 6 14
      opcode.c

+ 6 - 14
opcode.c

@@ -3,7 +3,7 @@
 ** TecCGraf - PUC-Rio
 */
 
-char *rcs_opcode="$Id: opcode.c,v 3.27 1994/12/16 16:08:34 roberto Exp roberto $";
+char *rcs_opcode="$Id: opcode.c,v 3.28 1994/12/20 21:20:36 roberto Exp celes $";
 
 #include <setjmp.h>
 #include <stdio.h>
@@ -441,16 +441,10 @@ lua_Object lua_setfallback (char *name, lua_CFunction fallback)
 */
 lua_Object lua_getsubscript (void)
 {
-  static Byte code[2] = {PUSHINDEXED, RETCODE0};
-  int status;
-  Object func;
-  tag(&func) = LUA_T_FUNCTION; bvalue(&func) = code;
   adjustC(2);
-  status = do_protectedrun(&func, 1);
-  if (status == 0)
-    return (Ref(top-1));
-  else
-    return LUA_NOOBJECT;
+  pushsubscript();
+  CBase++;  /* incorporate object in the stack */
+  return (Ref(top-1));
 }
 
 
@@ -487,11 +481,9 @@ void lua_endblock (void)
 */
 int lua_storesubscript (void)
 {
-  static Byte code[2] = {STOREINDEXED0, RETCODE0};
-  Object func;
-  tag(&func) = LUA_T_FUNCTION; bvalue(&func) = code;
   adjustC(3);
-  return(do_protectedrun(&func, 0));
+  storesubscript();
+  return 0;
 }
 
 /*