misc/liblua/lgc.c
changeset 3697 d5b30d6373fc
parent 2812 0a24853de796
child 10017 de822cd3df3a
equal deleted inserted replaced
3695:c11abf387a7d 3697:d5b30d6373fc
   308       Proto *p = gco2p(o);
   308       Proto *p = gco2p(o);
   309       g->gray = p->gclist;
   309       g->gray = p->gclist;
   310       traverseproto(g, p);
   310       traverseproto(g, p);
   311       return sizeof(Proto) + sizeof(Instruction) * p->sizecode +
   311       return sizeof(Proto) + sizeof(Instruction) * p->sizecode +
   312                              sizeof(Proto *) * p->sizep +
   312                              sizeof(Proto *) * p->sizep +
   313                              sizeof(TValue) * p->sizek + 
   313                              sizeof(TValue) * p->sizek +
   314                              sizeof(int) * p->sizelineinfo +
   314                              sizeof(int) * p->sizelineinfo +
   315                              sizeof(LocVar) * p->sizelocvars +
   315                              sizeof(LocVar) * p->sizelocvars +
   316                              sizeof(TString *) * p->sizeupvalues;
   316                              sizeof(TString *) * p->sizeupvalues;
   317     }
   317     }
   318     default: lua_assert(0); return 0;
   318     default: lua_assert(0); return 0;
   695 void luaC_linkupval (lua_State *L, UpVal *uv) {
   695 void luaC_linkupval (lua_State *L, UpVal *uv) {
   696   global_State *g = G(L);
   696   global_State *g = G(L);
   697   GCObject *o = obj2gco(uv);
   697   GCObject *o = obj2gco(uv);
   698   o->gch.next = g->rootgc;  /* link upvalue into `rootgc' list */
   698   o->gch.next = g->rootgc;  /* link upvalue into `rootgc' list */
   699   g->rootgc = o;
   699   g->rootgc = o;
   700   if (isgray(o)) { 
   700   if (isgray(o)) {
   701     if (g->gcstate == GCSpropagate) {
   701     if (g->gcstate == GCSpropagate) {
   702       gray2black(o);  /* closed upvalues need barrier */
   702       gray2black(o);  /* closed upvalues need barrier */
   703       luaC_barrier(L, uv, uv->v);
   703       luaC_barrier(L, uv, uv->v);
   704     }
   704     }
   705     else {  /* sweep phase: sweep it (turning it into white) */
   705     else {  /* sweep phase: sweep it (turning it into white) */