commit 4a67e48611c1ffaa6d474e443c3c89849c8b6e5f
parent 5cdec7d124e46c1409df8033f1b795a996dd00e4
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 8 Jun 2009 16:35:35 -0300
new macro 'condmovestack' instead of 'condhardstacktests'
Diffstat:
4 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/ldo.h b/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);}
diff --git a/lgc.c b/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);
}
}
diff --git a/lgc.h b/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))) \
diff --git a/llimits.h b/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