Bläddra i källkod

cleaner definition for 'luaC_condGC', using 'pre'/'pos' parameters

Roberto Ierusalimschy 9 år sedan
förälder
incheckning
f7670781cf
2 ändrade filer med 9 tillägg och 9 borttagningar
  1. 5 4
      lgc.h
  2. 4 5
      lvm.c

+ 5 - 4
lgc.h

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lgc.h,v 2.86 2014/10/25 11:50:46 roberto Exp roberto $
+** $Id: lgc.h,v 2.87 2015/08/03 19:40:42 roberto Exp roberto $
 ** Garbage Collector
 ** Garbage Collector
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -101,9 +101,10 @@
 #define luaC_white(g)	cast(lu_byte, (g)->currentwhite & WHITEBITS)
 #define luaC_white(g)	cast(lu_byte, (g)->currentwhite & WHITEBITS)
 
 
 
 
-#define luaC_condGC(L,c) \
-	{if (G(L)->GCdebt > 0) {c;}; condchangemem(L);}
-#define luaC_checkGC(L)		luaC_condGC(L, luaC_step(L);)
+#define luaC_condGC(L,pre,pos) \
+	{if (G(L)->GCdebt > 0) { pre; luaC_step(L); pos;}; condchangemem(L);}
+
+#define luaC_checkGC(L)		luaC_condGC(L,,)
 
 
 
 
 #define luaC_barrier(L,p,v) (  \
 #define luaC_barrier(L,p,v) (  \

+ 4 - 5
lvm.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lvm.c,v 2.253 2015/09/17 15:51:05 roberto Exp roberto $
+** $Id: lvm.c,v 2.254 2015/10/20 17:41:35 roberto Exp roberto $
 ** Lua virtual machine
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -733,10 +733,9 @@ void luaV_finishOp (lua_State *L) {
 #define Protect(x)	{ {x;}; base = ci->u.l.base; }
 #define Protect(x)	{ {x;}; base = ci->u.l.base; }
 
 
 #define checkGC(L,c)  \
 #define checkGC(L,c)  \
-  Protect( luaC_condGC(L,{L->top = (c);  /* limit of live values */ \
-                          luaC_step(L); \
-                          L->top = ci->top;})  /* restore top */ \
-           luai_threadyield(L); )
+	{ luaC_condGC(L, L->top = (c),  /* limit of live values */ \
+                         Protect(L->top = ci->top));  /* restore top */ \
+           luai_threadyield(L); }
 
 
 
 
 #define vmdispatch(o)	switch(o)
 #define vmdispatch(o)	switch(o)