** Mark all values stored in marked open upvalues from non-marked threads. ** (Values from marked threads were already marked when traversing the ** thread.) Remove from the list threads that no longer have upvalues and ** not-marked threads. */
| 310 | ** not-marked threads. |
| 311 | */ |
| 312 | static void remarkupvals (global_State *g) { |
| 313 | lua_State *thread; |
| 314 | lua_State **p = &g->twups; |
| 315 | while ((thread = *p) != NULL) { |
| 316 | lua_assert(!isblack(thread)); /* threads are never black */ |
| 317 | if (isgray(thread) && thread->openupval != NULL) |
| 318 | p = &thread->twups; /* keep marked thread with upvalues in the list */ |
| 319 | else { /* thread is not marked or without upvalues */ |
| 320 | UpVal *uv; |
| 321 | *p = thread->twups; /* remove thread from the list */ |
| 322 | thread->twups = thread; /* mark that it is out of list */ |
| 323 | for (uv = thread->openupval; uv != NULL; uv = uv->u.open.next) { |
| 324 | if (uv->u.open.touched) { |
| 325 | markvalue(g, uv->v); /* remark upvalue's value */ |
| 326 | uv->u.open.touched = 0; |
| 327 | } |
| 328 | } |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | |
| 334 | /* |