more and better tools (assertions & inspectors) to check incremental GC

This commit is contained in:
Roberto Ierusalimschy
2004-02-16 16:09:52 -03:00
parent b3ce450529
commit 2aaf7394ad
8 changed files with 249 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lobject.h,v 1.162 2003/11/18 14:55:11 roberto Exp roberto $
** $Id: lobject.h,v 2.1 2003/12/10 12:13:36 roberto Exp roberto $
** Type definitions for Lua objects
** See Copyright Notice in lua.h
*/
@@ -99,9 +99,9 @@ typedef struct lua_TValue {
#define checkconsistency(obj) \
lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt))
#define checkliveness(L,obj) \
#define checkliveness(g,obj) \
lua_assert(!iscollectable(obj) || \
((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(G(L), (obj)->value.gc)))
((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc)))
/* Macros to set values */
@@ -122,32 +122,32 @@ typedef struct lua_TValue {
#define setsvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \
checkliveness(L,i_o); }
checkliveness(G(L),i_o); }
#define setuvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \
checkliveness(L,i_o); }
checkliveness(G(L),i_o); }
#define setthvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \
checkliveness(L,i_o); }
checkliveness(G(L),i_o); }
#define setclvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \
checkliveness(L,i_o); }
checkliveness(G(L),i_o); }
#define sethvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \
checkliveness(L,i_o); }
checkliveness(G(L),i_o); }
#define setptvalue(L,obj,x) \
{ TValue *i_o=(obj); \
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \
checkliveness(L,i_o); }
checkliveness(G(L),i_o); }
@@ -155,7 +155,7 @@ typedef struct lua_TValue {
#define setobj(L,obj1,obj2) \
{ const TValue *o2=(obj2); TValue *o1=(obj1); \
o1->tt=o2->tt; o1->value = o2->value; \
checkliveness(L,o1); }
checkliveness(G(L),o1); }
/*