Преглед изворни кода

new macro 'condmovestack' instead of 'condhardstacktests'

Roberto Ierusalimschy пре 16 година
родитељ
комит
4a67e48611
4 измењених фајлова са 11 додато и 13 уклоњено
  1. 2 3
      ldo.h
  2. 2 2
      lgc.c
  3. 3 5
      lgc.h
  4. 4 3
      llimits.h

+ 2 - 3
ldo.h

@@ -1,5 +1,5 @@
 /*
-** $Id: ldo.h,v 2.11 2009/03/10 17:14:37 roberto Exp roberto $
+** $Id: ldo.h,v 2.12 2009/04/17 14:28:06 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 */
@@ -15,8 +15,7 @@
 
 #define luaD_checkstack(L,n)	\
   if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
-    luaD_growstack(L, n); \
-  else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
+    luaD_growstack(L, n); else condmovestack(L);
 
 
 #define incr_top(L) {L->top++; luaD_checkstack(L,0);}

+ 2 - 2
lgc.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lgc.c,v 2.52 2009/04/29 17:09:41 roberto Exp roberto $
+** $Id: lgc.c,v 2.53 2009/05/21 20:06:11 roberto Exp roberto $
 ** Garbage Collector
 ** See Copyright Notice in lua.h
 */
@@ -551,7 +551,7 @@ static void sweepthread (lua_State *L, lua_State *L1, int alive) {
     if ((L1->stacksize - EXTRA_STACK) > goodsize)
       luaD_reallocstack(L1, goodsize);
     else 
-      condhardstacktests(luaD_reallocstack(L, L1->stacksize - EXTRA_STACK - 1));
+      condmovestack(L1);
   }
 }
 

+ 3 - 5
lgc.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lgc.h,v 2.19 2008/06/26 19:42:45 roberto Exp roberto $
+** $Id: lgc.h,v 2.20 2009/04/28 19:04:36 roberto Exp roberto $
 ** Garbage Collector
 ** See Copyright Notice in lua.h
 */
@@ -78,10 +78,8 @@
 #define luaC_white(g)	cast(lu_byte, (g)->currentwhite & WHITEBITS)
 
 
-#define luaC_checkGC(L) { \
-  condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \
-  if (G(L)->totalbytes >= G(L)->GCthreshold) \
-	luaC_step(L); }
+#define luaC_checkGC(L) \
+  {condmovestack(L); if (G(L)->totalbytes >= G(L)->GCthreshold) luaC_step(L);}
 
 
 #define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p)))  \

+ 4 - 3
llimits.h

@@ -1,5 +1,5 @@
 /*
-** $Id: llimits.h,v 1.69 2005/12/27 17:12:00 roberto Exp roberto $
+** $Id: llimits.h,v 1.70 2006/09/11 14:07:24 roberto Exp roberto $
 ** Limits, basic types, and some other `installation-dependent' definitions
 ** See Copyright Notice in lua.h
 */
@@ -120,9 +120,10 @@ typedef lu_int32 Instruction;
 ** macro to control inclusion of some hard tests on stack reallocation
 */
 #ifndef HARDSTACKTESTS
-#define condhardstacktests(x)	((void)0)
+#define condmovestack(L)	((void)0)
 #else
-#define condhardstacktests(x)	x
+#define condmovestack(L) /* realloc stack keeping its size */ \
+	luaD_reallocstack((L), (L)->stacksize - EXTRA_STACK - 1)
 #endif
 
 #endif