new macro 'condmovestack' instead of 'condhardstacktests'

This commit is contained in:
Roberto Ierusalimschy
2009-06-08 16:35:59 -03:00
parent 5cdec7d124
commit 4a67e48611
4 changed files with 11 additions and 13 deletions

5
ldo.h
View File

@@ -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 ** Stack and Call structure of Lua
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -15,8 +15,7 @@
#define luaD_checkstack(L,n) \ #define luaD_checkstack(L,n) \
if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
luaD_growstack(L, n); \ luaD_growstack(L, n); else condmovestack(L);
else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
#define incr_top(L) {L->top++; luaD_checkstack(L,0);} #define incr_top(L) {L->top++; luaD_checkstack(L,0);}

4
lgc.c
View File

@@ -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 ** Garbage Collector
** See Copyright Notice in lua.h ** 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) if ((L1->stacksize - EXTRA_STACK) > goodsize)
luaD_reallocstack(L1, goodsize); luaD_reallocstack(L1, goodsize);
else else
condhardstacktests(luaD_reallocstack(L, L1->stacksize - EXTRA_STACK - 1)); condmovestack(L1);
} }
} }

8
lgc.h
View File

@@ -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 ** Garbage Collector
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -78,10 +78,8 @@
#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) #define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS)
#define luaC_checkGC(L) { \ #define luaC_checkGC(L) \
condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ {condmovestack(L); if (G(L)->totalbytes >= G(L)->GCthreshold) luaC_step(L);}
if (G(L)->totalbytes >= G(L)->GCthreshold) \
luaC_step(L); }
#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ #define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \

View File

@@ -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 ** Limits, basic types, and some other `installation-dependent' definitions
** See Copyright Notice in lua.h ** 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 ** macro to control inclusion of some hard tests on stack reallocation
*/ */
#ifndef HARDSTACKTESTS #ifndef HARDSTACKTESTS
#define condhardstacktests(x) ((void)0) #define condmovestack(L) ((void)0)
#else #else
#define condhardstacktests(x) x #define condmovestack(L) /* realloc stack keeping its size */ \
luaD_reallocstack((L), (L)->stacksize - EXTRA_STACK - 1)
#endif #endif
#endif #endif