diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-07 17:21:34 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-07 17:21:34 -0300 |
commit | d9e61e8ceafe8c3f6ad936979719ca7c446ce228 (patch) | |
tree | 0808ada3d7b7219022b9002503894c76c7253df6 /lobject.h | |
parent | 397905ef8694ec716a51acebc993bb625340d388 (diff) | |
download | lua-d9e61e8ceafe8c3f6ad936979719ca7c446ce228.tar.gz lua-d9e61e8ceafe8c3f6ad936979719ca7c446ce228.tar.bz2 lua-d9e61e8ceafe8c3f6ad936979719ca7c446ce228.zip |
new algorithm for traversing in GC to avoid deep recursion calls
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 1.69 2000/06/28 20:20:36 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.70 2000/06/30 14:35:17 roberto Exp roberto $ |
3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -110,15 +110,15 @@ typedef struct TString { | |||
110 | ** Function Prototypes | 110 | ** Function Prototypes |
111 | */ | 111 | */ |
112 | typedef struct Proto { | 112 | typedef struct Proto { |
113 | struct Proto *next; | ||
114 | int marked; | ||
115 | struct TString **kstr; /* strings used by the function */ | ||
116 | int nkstr; /* size of `kstr' */ | ||
117 | Number *knum; /* Number numbers used by the function */ | 113 | Number *knum; /* Number numbers used by the function */ |
118 | int nknum; /* size of `knum' */ | 114 | int nknum; /* size of `knum' */ |
115 | struct TString **kstr; /* strings used by the function */ | ||
116 | int nkstr; /* size of `kstr' */ | ||
119 | struct Proto **kproto; /* functions defined inside the function */ | 117 | struct Proto **kproto; /* functions defined inside the function */ |
120 | int nkproto; /* size of `kproto' */ | 118 | int nkproto; /* size of `kproto' */ |
121 | Instruction *code; /* ends with opcode ENDCODE */ | 119 | Instruction *code; /* ends with opcode ENDCODE */ |
120 | struct Proto *next; | ||
121 | int marked; | ||
122 | int *lines; /* source line that generated each opcode */ | 122 | int *lines; /* source line that generated each opcode */ |
123 | int lineDefined; | 123 | int lineDefined; |
124 | TString *source; | 124 | TString *source; |
@@ -139,12 +139,12 @@ typedef struct LocVar { | |||
139 | ** Closures | 139 | ** Closures |
140 | */ | 140 | */ |
141 | typedef struct Closure { | 141 | typedef struct Closure { |
142 | struct Closure *next; | ||
143 | int marked; | ||
144 | union { | 142 | union { |
145 | lua_CFunction c; /* C functions */ | 143 | lua_CFunction c; /* C functions */ |
146 | struct Proto *l; /* Lua functions */ | 144 | struct Proto *l; /* Lua functions */ |
147 | } f; | 145 | } f; |
146 | struct Closure *next; | ||
147 | struct Closure *mark; /* marked closures (point to itself when not marked) */ | ||
148 | int nupvalues; | 148 | int nupvalues; |
149 | TObject upvalue[1]; | 149 | TObject upvalue[1]; |
150 | } Closure; | 150 | } Closure; |
@@ -157,15 +157,21 @@ typedef struct Node { | |||
157 | } Node; | 157 | } Node; |
158 | 158 | ||
159 | typedef struct Hash { | 159 | typedef struct Hash { |
160 | int htag; | ||
161 | Node *node; | 160 | Node *node; |
161 | int htag; | ||
162 | int size; | 162 | int size; |
163 | Node *firstfree; /* this position is free; all positions after it are full */ | 163 | Node *firstfree; /* this position is free; all positions after it are full */ |
164 | struct Hash *next; | 164 | struct Hash *next; |
165 | int marked; | 165 | struct Hash *mark; /* marked tables (point to itself when not marked) */ |
166 | } Hash; | 166 | } Hash; |
167 | 167 | ||
168 | 168 | ||
169 | /* unmarked tables and closures are represented by pointing `mark' to | ||
170 | ** themselves | ||
171 | */ | ||
172 | #define ismarked(x) ((x)->mark != (x)) | ||
173 | |||
174 | |||
169 | /* | 175 | /* |
170 | ** informations about a call (for debugging) | 176 | ** informations about a call (for debugging) |
171 | */ | 177 | */ |