Ver Fonte

'MAXSTACK' -> 'MAXREGS' and moved to 'lcode.c' (there is no reason
to change that constant...)

Roberto Ierusalimschy há 10 anos atrás
pai
commit
491103708e
2 ficheiros alterados com 7 adições e 7 exclusões
  1. 6 2
      lcode.c
  2. 1 5
      llimits.h

+ 6 - 2
lcode.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.c,v 2.90 2014/05/08 18:58:46 roberto Exp roberto $
+** $Id: lcode.c,v 2.91 2014/10/25 11:50:46 roberto Exp roberto $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -27,6 +27,10 @@
 #include "lvm.h"
 
 
+/* Maximum number of registers in a Lua function */
+#define MAXREGS		250
+
+
 /* test for x == -0 */
 #if defined(signbit)
 #define isminuszero(x)	((x) == 0.0 && signbit(x))
@@ -280,7 +284,7 @@ int luaK_codek (FuncState *fs, int reg, int k) {
 void luaK_checkstack (FuncState *fs, int n) {
   int newstack = fs->freereg + n;
   if (newstack > fs->f->maxstacksize) {
-    if (newstack >= MAXSTACK)
+    if (newstack >= MAXREGS)
       luaX_syntaxerror(fs->ls, "function or expression too complex");
     fs->f->maxstacksize = cast_byte(newstack);
   }

+ 1 - 5
llimits.h

@@ -1,5 +1,5 @@
 /*
-** $Id: llimits.h,v 1.120 2014/07/18 18:29:12 roberto Exp roberto $
+** $Id: llimits.h,v 1.121 2014/10/25 11:50:46 roberto Exp roberto $
 ** Limits, basic types, and some other 'installation-dependent' definitions
 ** See Copyright Notice in lua.h
 */
@@ -156,10 +156,6 @@ typedef lu_int32 Instruction;
 
 
 
-/* maximum stack for a Lua function */
-#define MAXSTACK	250
-
-
 
 /* minimum size for the string table (must be power of 2) */
 #if !defined(MINSTRTABSIZE)