aboutsummaryrefslogtreecommitdiff
path: root/src/lj_gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_gc.c')
-rw-r--r--src/lj_gc.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c
index 7c224759..bd31eabf 100644
--- a/src/lj_gc.c
+++ b/src/lj_gc.c
@@ -217,13 +217,12 @@ static void gc_traverse_func(global_State *g, GCfunc *fn)
217/* Mark a trace. */ 217/* Mark a trace. */
218static void gc_marktrace(global_State *g, TraceNo traceno) 218static void gc_marktrace(global_State *g, TraceNo traceno)
219{ 219{
220 if (traceno && traceno != G2J(g)->curtrace) { 220 GCobj *o = obj2gco(traceref(G2J(g), traceno));
221 GCobj *o = obj2gco(traceref(G2J(g), traceno)); 221 lua_assert(traceno != G2J(g)->cur.traceno);
222 if (iswhite(o)) { 222 if (iswhite(o)) {
223 white2gray(o); 223 white2gray(o);
224 setgcrefr(o->gch.gclist, g->gc.gray); 224 setgcrefr(o->gch.gclist, g->gc.gray);
225 setgcref(g->gc.gray, o); 225 setgcref(g->gc.gray, o);
226 }
227 } 226 }
228} 227}
229 228
@@ -236,15 +235,15 @@ static void gc_traverse_trace(global_State *g, GCtrace *T)
236 if (ir->o == IR_KGC) 235 if (ir->o == IR_KGC)
237 gc_markobj(g, ir_kgc(ir)); 236 gc_markobj(g, ir_kgc(ir));
238 } 237 }
239 gc_marktrace(g, T->link); 238 if (T->link) gc_marktrace(g, T->link);
240 gc_marktrace(g, T->nextroot); 239 if (T->nextroot) gc_marktrace(g, T->nextroot);
241 gc_marktrace(g, T->nextside); 240 if (T->nextside) gc_marktrace(g, T->nextside);
242 gc_markobj(g, gcref(T->startpt)); 241 gc_markobj(g, gcref(T->startpt));
243} 242}
244 243
245/* The current trace is a GC root while not anchored in the prototype (yet). */ 244/* The current trace is a GC root while not anchored in the prototype (yet). */
246#define gc_traverse_curtrace(g) \ 245#define gc_traverse_curtrace(g) \
247 { if (G2J(g)->curtrace != 0) gc_traverse_trace(g, &G2J(g)->cur); } 246 { if (G2J(g)->cur.traceno != 0) gc_traverse_trace(g, &G2J(g)->cur); }
248#else 247#else
249#define gc_traverse_curtrace(g) UNUSED(g) 248#define gc_traverse_curtrace(g) UNUSED(g)
250#endif 249#endif
@@ -261,7 +260,7 @@ static void gc_traverse_proto(global_State *g, GCproto *pt)
261 for (i = 0; i < (ptrdiff_t)pt->sizevarinfo; i++) /* Mark names of locals. */ 260 for (i = 0; i < (ptrdiff_t)pt->sizevarinfo; i++) /* Mark names of locals. */
262 gc_mark_str(gco2str(gcref(proto_varinfo(pt)[i].name))); 261 gc_mark_str(gco2str(gcref(proto_varinfo(pt)[i].name)));
263#if LJ_HASJIT 262#if LJ_HASJIT
264 gc_marktrace(g, pt->trace); 263 if (pt->trace) gc_marktrace(g, pt->trace);
265#endif 264#endif
266} 265}
267 266