003 File Manager
Current Path:
/usr/src/contrib/lua/src
usr
/
src
/
contrib
/
lua
/
src
/
📁
..
📄
Makefile
(7.34 KB)
📄
lapi.c
(34.08 KB)
📄
lapi.h
(1.27 KB)
📄
lauxlib.c
(30.94 KB)
📄
lauxlib.h
(8.64 KB)
📄
lbaselib.c
(14.44 KB)
📄
lcode.c
(49.85 KB)
📄
lcode.h
(3.71 KB)
📄
lcorolib.c
(4.57 KB)
📄
lctype.c
(2.4 KB)
📄
lctype.h
(2.07 KB)
📄
ldblib.c
(12.94 KB)
📄
ldebug.c
(24.61 KB)
📄
ldebug.h
(1.87 KB)
📄
ldo.c
(27.19 KB)
📄
ldo.h
(2.77 KB)
📄
ldump.c
(4.66 KB)
📄
lfunc.c
(8.95 KB)
📄
lfunc.h
(1.72 KB)
📄
lgc.c
(54.47 KB)
📄
lgc.h
(5.87 KB)
📄
linit.c
(1.58 KB)
📄
liolib.c
(21.25 KB)
📄
ljumptab.h
(1.62 KB)
📄
llex.c
(16.38 KB)
📄
llex.h
(2.35 KB)
📄
llimits.h
(8.72 KB)
📄
lmathlib.c
(18.43 KB)
📄
lmem.c
(5.83 KB)
📄
lmem.h
(3.29 KB)
📄
loadlib.c
(22.39 KB)
📄
lobject.c
(18.45 KB)
📄
lobject.h
(21.49 KB)
📄
lopcodes.c
(4.03 KB)
📄
lopcodes.h
(12.38 KB)
📄
lopnames.h
(1.12 KB)
📄
loslib.c
(11.53 KB)
📄
lparser.c
(54.72 KB)
📄
lparser.h
(5.8 KB)
📄
lprefix.h
(828 B)
📄
lstate.c
(10.73 KB)
📄
lstate.h
(13.24 KB)
📄
lstring.c
(7.32 KB)
📄
lstring.h
(1.57 KB)
📄
lstrlib.c
(52.83 KB)
📄
ltable.c
(29.89 KB)
📄
ltable.h
(1.92 KB)
📄
ltablib.c
(12.82 KB)
📄
ltm.c
(7.97 KB)
📄
ltm.h
(2.84 KB)
📄
lua.c
(18.46 KB)
📄
lua.h
(15.4 KB)
📄
lua.hpp
(191 B)
📄
luac.c
(14.79 KB)
📄
luaconf.h.dist
(20.27 KB)
📄
lualib.h
(1.16 KB)
📄
lundump.c
(7.68 KB)
📄
lundump.h
(863 B)
📄
lutf8lib.c
(7.9 KB)
📄
lvm.c
(55.76 KB)
📄
lvm.h
(4.25 KB)
📄
lzio.c
(1.29 KB)
📄
lzio.h
(1.4 KB)
Editing: lgc.h
/* ** $Id: lgc.h $ ** Garbage Collector ** See Copyright Notice in lua.h */ #ifndef lgc_h #define lgc_h #include "lobject.h" #include "lstate.h" /* ** Collectable objects may have one of three colors: white, which means ** the object is not marked; gray, which means the object is marked, but ** its references may be not marked; and black, which means that the ** object and all its references are marked. The main invariant of the ** garbage collector, while marking objects, is that a black object can ** never point to a white one. Moreover, any gray object must be in a ** "gray list" (gray, grayagain, weak, allweak, ephemeron) so that it ** can be visited again before finishing the collection cycle. (Open ** upvalues are an exception to this rule.) These lists have no meaning ** when the invariant is not being enforced (e.g., sweep phase). */ /* ** Possible states of the Garbage Collector */ #define GCSpropagate 0 #define GCSenteratomic 1 #define GCSatomic 2 #define GCSswpallgc 3 #define GCSswpfinobj 4 #define GCSswptobefnz 5 #define GCSswpend 6 #define GCScallfin 7 #define GCSpause 8 #define issweepphase(g) \ (GCSswpallgc <= (g)->gcstate && (g)->gcstate <= GCSswpend) /* ** macro to tell when main invariant (white objects cannot point to black ** ones) must be kept. During a collection, the sweep ** phase may break the invariant, as objects turned white may point to ** still-black objects. The invariant is restored when sweep ends and ** all objects are white again. */ #define keepinvariant(g) ((g)->gcstate <= GCSatomic) /* ** some useful bit tricks */ #define resetbits(x,m) ((x) &= cast_byte(~(m))) #define setbits(x,m) ((x) |= (m)) #define testbits(x,m) ((x) & (m)) #define bitmask(b) (1<<(b)) #define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) #define l_setbit(x,b) setbits(x, bitmask(b)) #define resetbit(x,b) resetbits(x, bitmask(b)) #define testbit(x,b) testbits(x, bitmask(b)) /* ** Layout for bit use in 'marked' field. First three bits are ** used for object "age" in generational mode. Last bit is used ** by tests. */ #define WHITE0BIT 3 /* object is white (type 0) */ #define WHITE1BIT 4 /* object is white (type 1) */ #define BLACKBIT 5 /* object is black */ #define FINALIZEDBIT 6 /* object has been marked for finalization */ #define TESTBIT 7 #define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) #define iswhite(x) testbits((x)->marked, WHITEBITS) #define isblack(x) testbit((x)->marked, BLACKBIT) #define isgray(x) /* neither white nor black */ \ (!testbits((x)->marked, WHITEBITS | bitmask(BLACKBIT))) #define tofinalize(x) testbit((x)->marked, FINALIZEDBIT) #define otherwhite(g) ((g)->currentwhite ^ WHITEBITS) #define isdeadm(ow,m) ((m) & (ow)) #define isdead(g,v) isdeadm(otherwhite(g), (v)->marked) #define changewhite(x) ((x)->marked ^= WHITEBITS) #define nw2black(x) \ check_exp(!iswhite(x), l_setbit((x)->marked, BLACKBIT)) #define luaC_white(g) cast_byte((g)->currentwhite & WHITEBITS) /* object age in generational mode */ #define G_NEW 0 /* created in current cycle */ #define G_SURVIVAL 1 /* created in previous cycle */ #define G_OLD0 2 /* marked old by frw. barrier in this cycle */ #define G_OLD1 3 /* first full cycle as old */ #define G_OLD 4 /* really old object (not to be visited) */ #define G_TOUCHED1 5 /* old object touched this cycle */ #define G_TOUCHED2 6 /* old object touched in previous cycle */ #define AGEBITS 7 /* all age bits (111) */ #define getage(o) ((o)->marked & AGEBITS) #define setage(o,a) ((o)->marked = cast_byte(((o)->marked & (~AGEBITS)) | a)) #define isold(o) (getage(o) > G_SURVIVAL) #define changeage(o,f,t) \ check_exp(getage(o) == (f), (o)->marked ^= ((f)^(t))) /* Default Values for GC parameters */ #define LUAI_GENMAJORMUL 100 #define LUAI_GENMINORMUL 20 /* wait memory to double before starting new cycle */ #define LUAI_GCPAUSE 200 /* ** some gc parameters are stored divided by 4 to allow a maximum value ** up to 1023 in a 'lu_byte'. */ #define getgcparam(p) ((p) * 4) #define setgcparam(p,v) ((p) = (v) / 4) #define LUAI_GCMUL 100 /* how much to allocate before next GC step (log2) */ #define LUAI_GCSTEPSIZE 13 /* 8 KB */ /* ** Check whether the declared GC mode is generational. While in ** generational mode, the collector can go temporarily to incremental ** mode to improve performance. This is signaled by 'g->lastatomic != 0'. */ #define isdecGCmodegen(g) (g->gckind == KGC_GEN || g->lastatomic != 0) /* ** Does one step of collection when debt becomes positive. 'pre'/'pos' ** allows some adjustments to be done only when needed. macro ** 'condchangemem' is used only for heavy tests (forcing a full ** GC cycle on every opportunity) */ #define luaC_condGC(L,pre,pos) \ { if (G(L)->GCdebt > 0) { pre; luaC_step(L); pos;}; \ condchangemem(L,pre,pos); } /* more often than not, 'pre'/'pos' are empty */ #define luaC_checkGC(L) luaC_condGC(L,(void)0,(void)0) #define luaC_barrier(L,p,v) ( \ (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \ luaC_barrier_(L,obj2gco(p),gcvalue(v)) : cast_void(0)) #define luaC_barrierback(L,p,v) ( \ (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) ? \ luaC_barrierback_(L,p) : cast_void(0)) #define luaC_objbarrier(L,p,o) ( \ (isblack(p) && iswhite(o)) ? \ luaC_barrier_(L,obj2gco(p),obj2gco(o)) : cast_void(0)) LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o); LUAI_FUNC void luaC_freeallobjects (lua_State *L); LUAI_FUNC void luaC_step (lua_State *L); LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz); LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); LUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o); LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); LUAI_FUNC void luaC_changemode (lua_State *L, int newmode); #endif
Upload File
Create Folder