diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-04-17 14:35:54 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-04-17 14:35:54 -0300 |
commit | beee01b170c5fea9ed4527b28b9221d2df1baaba (patch) | |
tree | 82263b6e128ffe09fe3da63de16c626522320dfc /lstate.h | |
parent | 6473f965ca699719b3b9908008f15da48cc2e6f1 (diff) | |
download | lua-beee01b170c5fea9ed4527b28b9221d2df1baaba.tar.gz lua-beee01b170c5fea9ed4527b28b9221d2df1baaba.tar.bz2 lua-beee01b170c5fea9ed4527b28b9221d2df1baaba.zip |
re-implementation of refs through weak tables
Diffstat (limited to 'lstate.h')
-rw-r--r-- | lstate.h | 22 |
1 files changed, 3 insertions, 19 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 1.54 2001/03/02 17:27:50 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.55 2001/03/07 18:09:25 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -32,20 +32,6 @@ | |||
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | 34 | ||
35 | /* | ||
36 | ** marks for Reference array | ||
37 | */ | ||
38 | #define NONEXT -1 /* to end the free list */ | ||
39 | #define HOLD -2 | ||
40 | #define COLLECTED -3 | ||
41 | #define LOCK -4 | ||
42 | |||
43 | |||
44 | struct Ref { | ||
45 | TObject o; | ||
46 | int st; /* can be LOCK, HOLD, COLLECTED, or next (for free list) */ | ||
47 | }; | ||
48 | |||
49 | 35 | ||
50 | struct lua_longjmp; /* defined in ldo.c */ | 36 | struct lua_longjmp; /* defined in ldo.c */ |
51 | struct TM; /* defined in ltm.h */ | 37 | struct TM; /* defined in ltm.h */ |
@@ -70,13 +56,11 @@ typedef struct global_State { | |||
70 | stringtable strt; /* hash table for strings */ | 56 | stringtable strt; /* hash table for strings */ |
71 | stringtable udt; /* hash table for udata */ | 57 | stringtable udt; /* hash table for udata */ |
72 | Hash *type2tag; /* hash table from type names to tags */ | 58 | Hash *type2tag; /* hash table from type names to tags */ |
59 | Hash *registry; /* (strong) registry table */ | ||
60 | Hash *weakregistry; /* weakregistry table */ | ||
73 | struct TM *TMtable; /* table for tag methods */ | 61 | struct TM *TMtable; /* table for tag methods */ |
74 | int sizeTM; /* size of TMtable */ | 62 | int sizeTM; /* size of TMtable */ |
75 | int ntag; /* number of tags in TMtable */ | 63 | int ntag; /* number of tags in TMtable */ |
76 | struct Ref *refArray; /* locked objects */ | ||
77 | int nref; /* first unused element in refArray */ | ||
78 | int sizeref; /* size of refArray */ | ||
79 | int refFree; /* list of free positions in refArray */ | ||
80 | lu_mem GCthreshold; | 64 | lu_mem GCthreshold; |
81 | lu_mem nblocks; /* number of `bytes' currently allocated */ | 65 | lu_mem nblocks; /* number of `bytes' currently allocated */ |
82 | } global_State; | 66 | } global_State; |