lua/lgc.c File Reference

#include <string.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"

Go to the source code of this file.

Data Structures

struct  GCState

Defines

#define lgc_c
#define setbit(x, b)   ((x) |= (1<<(b)))
#define resetbit(x, b)   ((x) &= cast(lu_byte, ~(1<<(b))))
#define testbit(x, b)   ((x) & (1<<(b)))
#define unmark(x)   resetbit((x)->gch.marked, 0)
#define ismarked(x)   ((x)->gch.marked & ((1<<4)|1))
#define stringmark(s)   setbit((s)->tsv.marked, 0)
#define isfinalized(u)   (!testbit((u)->uv.marked, 1))
#define markfinalized(u)   resetbit((u)->uv.marked, 1)
#define KEYWEAKBIT   1
#define VALUEWEAKBIT   2
#define KEYWEAK   (1<<KEYWEAKBIT)
#define VALUEWEAK   (1<<VALUEWEAKBIT)
#define markobject(st, o)
#define condmarkobject(st, o, c)
#define markvalue(st, t)

Functions

static void reallymarkobject (GCState *st, GCObject *o)
static void marktmu (GCState *st)
size_t luaC_separateudata (lua_State *L)
static void removekey (Node *n)
static void traversetable (GCState *st, Table *h)
static void traverseproto (GCState *st, Proto *f)
static void traverseclosure (GCState *st, Closure *cl)
static void checkstacksizes (lua_State *L, StkId max)
static void traversestack (GCState *st, lua_State *L1)
static void propagatemarks (GCState *st)
static int valismarked (const TObject *o)
static void cleartablekeys (GCObject *l)
static void cleartablevalues (GCObject *l)
static void freeobj (lua_State *L, GCObject *o)
static int sweeplist (lua_State *L, GCObject **p, int limit)
static void sweepstrings (lua_State *L, int all)
static void checkSizes (lua_State *L, size_t deadmem)
static void do1gcTM (lua_State *L, Udata *udata)
void luaC_callGCTM (lua_State *L)
void luaC_sweep (lua_State *L, int all)
static void markroot (GCState *st, lua_State *L)
static size_t mark (lua_State *L)
void luaC_collectgarbage (lua_State *L)
void luaC_link (lua_State *L, GCObject *o, lu_byte tt)


Define Documentation

#define condmarkobject ( st,
o,
 ) 

Value:

{ checkconsistency(o); \
  if (iscollectable(o) && !ismarked(gcvalue(o)) && (c)) \
    reallymarkobject(st,gcvalue(o)); }

Definition at line 66 of file lgc.c.

Referenced by traversetable().

#define isfinalized (  )     (!testbit((u)->uv.marked, 1))

Definition at line 52 of file lgc.c.

Referenced by luaC_separateudata().

#define ismarked (  )     ((x)->gch.marked & ((1<<4)|1))

Definition at line 47 of file lgc.c.

Referenced by luaC_separateudata(), and reallymarkobject().

#define KEYWEAK   (1<<KEYWEAKBIT)

Definition at line 58 of file lgc.c.

Referenced by cleartablekeys(), and traversetable().

#define KEYWEAKBIT   1

Definition at line 56 of file lgc.c.

Referenced by traversetable().

#define lgc_c

Definition at line 9 of file lgc.c.

#define markfinalized (  )     resetbit((u)->uv.marked, 1)

Definition at line 53 of file lgc.c.

Referenced by luaC_callGCTM(), and luaC_separateudata().

#define markobject ( st,
 ) 

Value:

Definition at line 63 of file lgc.c.

Referenced by markroot(), traverseclosure(), traversestack(), and traversetable().

#define markvalue ( st,
 ) 

Value:

{ if (!ismarked(valtogco(t))) \
                reallymarkobject(st, valtogco(t)); }

Definition at line 70 of file lgc.c.

Referenced by markroot(), reallymarkobject(), traverseclosure(), traverseproto(), and traversetable().

#define resetbit ( x,
 )     ((x) &= cast(lu_byte, ~(1<<(b))))

Definition at line 43 of file lgc.c.

#define setbit ( x,
 )     ((x) |= (1<<(b)))

Definition at line 42 of file lgc.c.

Referenced by reallymarkobject().

#define stringmark (  )     setbit((s)->tsv.marked, 0)

Definition at line 49 of file lgc.c.

Referenced by traverseproto(), and valismarked().

#define testbit ( x,
 )     ((x) & (1<<(b)))

Definition at line 44 of file lgc.c.

Referenced by valismarked().

#define unmark (  )     resetbit((x)->gch.marked, 0)

Definition at line 46 of file lgc.c.

Referenced by luaC_callGCTM(), marktmu(), and sweeplist().

#define VALUEWEAK   (1<<VALUEWEAKBIT)

Definition at line 59 of file lgc.c.

Referenced by cleartablevalues(), and traversetable().

#define VALUEWEAKBIT   2

Definition at line 57 of file lgc.c.

Referenced by traversetable().


Function Documentation

static void checkSizes ( lua_State L,
size_t  deadmem 
) [static]

Definition at line 436 of file lgc.c.

References cast, G, LUA_MINBUFFER, luaS_resize(), luaZ_resizebuffer, luaZ_sizebuffer, and MINSTRTABSIZE.

Referenced by luaC_collectgarbage().

static void checkstacksizes ( lua_State L,
StkId  max 
) [static]

static void cleartablekeys ( GCObject l  )  [static]

Definition at line 335 of file lgc.c.

References Table::gclist, gcotoh, gkey, gnode, KEYWEAK, lua_assert, Table::marked, removekey(), sizenode, and valismarked().

Referenced by mark().

static void cleartablevalues ( GCObject l  )  [static]

static void do1gcTM ( lua_State L,
Udata udata 
) [static]

Definition at line 452 of file lgc.c.

References fasttm, luaD_call(), Udata::metatable, setobj2s, setuvalue, TM_GC, lua_State::top, and Udata::uv.

Referenced by luaC_callGCTM().

static void freeobj ( lua_State L,
GCObject o 
) [static]

void luaC_callGCTM ( lua_State L  ) 

void luaC_collectgarbage ( lua_State L  ) 

Definition at line 535 of file lgc.c.

References checkSizes(), luaC_callGCTM(), luaC_sweep(), and mark().

void luaC_link ( lua_State L,
GCObject o,
lu_byte  tt 
)

size_t luaC_separateudata ( lua_State L  ) 

Definition at line 124 of file lgc.c.

References fasttm, G, GCObject::gch, gcotou, isfinalized, ismarked, lua_assert, markfinalized, GCheader::next, sizeudata, TM_GC, and GCheader::tt.

Referenced by lua_close(), and mark().

void luaC_sweep ( lua_State L,
int  all 
)

Definition at line 485 of file lgc.c.

References G, sweeplist(), and sweepstrings().

Referenced by close_state(), and luaC_collectgarbage().

static size_t mark ( lua_State L  )  [static]

static void markroot ( GCState st,
lua_State L 
) [static]

Definition at line 494 of file lgc.c.

References defaultmeta, GCState::g, global_State::mainthread, markobject, markvalue, registry, and traversestack().

Referenced by mark().

static void marktmu ( GCState st  )  [static]

Definition at line 112 of file lgc.c.

References GCState::g, GCObject::gch, GCheader::next, reallymarkobject(), global_State::tmudata, and unmark.

Referenced by mark().

static void propagatemarks ( GCState st  )  [static]

static void reallymarkobject ( GCState st,
GCObject o 
) [static]

static void removekey ( Node n  )  [static]

Definition at line 156 of file lgc.c.

References gkey, gval, iscollectable, setnilvalue, and setttype.

Referenced by cleartablekeys(), and cleartablevalues().

static int sweeplist ( lua_State L,
GCObject **  p,
int  limit 
) [static]

Definition at line 404 of file lgc.c.

References freeobj(), GCObject::gch, GCheader::marked, GCheader::next, and unmark.

Referenced by luaC_sweep(), and sweepstrings().

static void sweepstrings ( lua_State L,
int  all 
) [static]

Definition at line 426 of file lgc.c.

References G, and sweeplist().

Referenced by luaC_sweep().

static void traverseclosure ( GCState st,
Closure cl 
) [static]

static void traverseproto ( GCState st,
Proto f 
) [static]

static void traversestack ( GCState st,
lua_State L1 
) [static]

static void traversetable ( GCState st,
Table h 
) [static]

static int valismarked ( const TObject o  )  [static]


Generated on Fri Dec 12 13:02:11 2008 for rpm by  doxygen 1.5.6