浏览代码

error message ("too complex" -> "too many registers") + MAXREGS
changed to 255 (no reason not to use maximum allowed)

Roberto Ierusalimschy 10 年之前
父节点
当前提交
a1935b9cba
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      lcode.c

+ 5 - 4
lcode.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.c,v 2.99 2014/12/29 16:49:25 roberto Exp roberto $
+** $Id: lcode.c,v 2.100 2015/03/28 19:14:47 roberto Exp roberto $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -29,8 +29,8 @@
 #include "lvm.h"
 
 
-/* Maximum number of registers in a Lua function */
-#define MAXREGS		250
+/* Maximum number of registers in a Lua function (must fit in 8 bits) */
+#define MAXREGS		255
 
 
 #define hasjumps(e)	((e)->t != (e)->f)
@@ -279,7 +279,8 @@ void luaK_checkstack (FuncState *fs, int n) {
   int newstack = fs->freereg + n;
   if (newstack > fs->f->maxstacksize) {
     if (newstack >= MAXREGS)
-      luaX_syntaxerror(fs->ls, "function or expression too complex");
+      luaX_syntaxerror(fs->ls,
+        "function or expression needs too many registers");
     fs->f->maxstacksize = cast_byte(newstack);
   }
 }