** open upvalues point to values in a thread, so those values should ** be marked when the thread is traversed except in the atomic phase ** (because then the value cannot be changed by the thread and the ** thread may not be traversed again) */
| 512 | ** thread may not be traversed again) |
| 513 | */ |
| 514 | static lu_mem traverseLclosure (global_State *g, LClosure *cl) { |
| 515 | int i; |
| 516 | markobjectN(g, cl->p); /* mark its prototype */ |
| 517 | for (i = 0; i < cl->nupvalues; i++) { /* mark its upvalues */ |
| 518 | UpVal *uv = cl->upvals[i]; |
| 519 | if (uv != NULL) { |
| 520 | if (upisopen(uv) && g->gcstate != GCSinsideatomic) |
| 521 | uv->u.open.touched = 1; /* can be marked in 'remarkupvals' */ |
| 522 | else |
| 523 | markvalue(g, uv->v); |
| 524 | } |
| 525 | } |
| 526 | return sizeLclosure(cl->nupvalues); |
| 527 | } |
| 528 | |
| 529 | |
| 530 | static lu_mem traversethread (global_State *g, lua_State *th) { |