diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-08-27 18:01:44 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-08-27 18:01:44 -0300 |
| commit | 8332d5c8a5059b85da1adaa3f0197d0f57afae81 (patch) | |
| tree | 8a2f59ff0803da3afbc7e8a409911c920d624e94 /lgc.c | |
| parent | 885961be1d8e3f703b54d1d19e6c63617cd2ed24 (diff) | |
| download | lua-8332d5c8a5059b85da1adaa3f0197d0f57afae81.tar.gz lua-8332d5c8a5059b85da1adaa3f0197d0f57afae81.tar.bz2 lua-8332d5c8a5059b85da1adaa3f0197d0f57afae81.zip | |
parser fully reentrant(!)
Diffstat (limited to 'lgc.c')
| -rw-r--r-- | lgc.c | 27 |
1 files changed, 18 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.c,v 1.175 2003/07/16 20:49:02 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.176 2003/07/29 19:25:37 roberto Exp roberto $ |
| 3 | ** Garbage Collector | 3 | ** Garbage Collector |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -176,20 +176,29 @@ static void traversetable (GCState *st, Table *h) { | |||
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | 178 | ||
| 179 | /* | ||
| 180 | ** All marks are conditional because a GC may happen while the | ||
| 181 | ** prototype is still being created | ||
| 182 | */ | ||
| 179 | static void traverseproto (GCState *st, Proto *f) { | 183 | static void traverseproto (GCState *st, Proto *f) { |
| 180 | int i; | 184 | int i; |
| 181 | stringmark(f->source); | 185 | if (f->source) stringmark(f->source); |
| 182 | for (i=0; i<f->sizek; i++) { /* mark literal strings */ | 186 | for (i=0; i<f->sizek; i++) { /* mark literal strings */ |
| 183 | if (ttisstring(f->k+i)) | 187 | if (ttisstring(f->k+i)) |
| 184 | stringmark(tsvalue(f->k+i)); | 188 | stringmark(tsvalue(f->k+i)); |
| 185 | } | 189 | } |
| 186 | for (i=0; i<f->sizeupvalues; i++) /* mark upvalue names */ | 190 | for (i=0; i<f->sizeupvalues; i++) { /* mark upvalue names */ |
| 187 | stringmark(f->upvalues[i]); | 191 | if (f->upvalues[i]) |
| 188 | for (i=0; i<f->sizep; i++) /* mark nested protos */ | 192 | stringmark(f->upvalues[i]); |
| 189 | markvalue(st, f->p[i]); | 193 | } |
| 190 | for (i=0; i<f->sizelocvars; i++) /* mark local-variable names */ | 194 | for (i=0; i<f->sizep; i++) { /* mark nested protos */ |
| 191 | stringmark(f->locvars[i].varname); | 195 | if (f->p[i]) |
| 192 | lua_assert(luaG_checkcode(f)); | 196 | markvalue(st, f->p[i]); |
| 197 | } | ||
| 198 | for (i=0; i<f->sizelocvars; i++) { /* mark local-variable names */ | ||
| 199 | if (f->locvars[i].varname) | ||
| 200 | stringmark(f->locvars[i].varname); | ||
| 201 | } | ||
| 193 | } | 202 | } |
| 194 | 203 | ||
| 195 | 204 | ||
