/* 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.  */
static void remarkupvals(global_State *g)
/* 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.  */
static void remarkupvals(global_State *g)
{
    lua_assert(!isblack(thread));
    if (isgray(thread) && thread->openupval != NULL)
      p = &thread->twups;
    else {
      UpVal *uv;
      *p = thread->twups;
      thread->twups = thread;
      for (uv = thread->openupval; uv != NULL; uv = uv->u.open.next) {
        if (uv->u.open.touched) {
          markvalue(g, uv->v);
          uv->u.open.touched = 0;
        }
      }
    }
  }
}