lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, 22 Dec 2020 at 19:44, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>
> > I have ported the generational GC to Ravi, but Ravi's up-value model
> > is based on the reference counting approach in Lua 5.3. My question is
> > this:
> >
> > What should the age of an upvalue be set to in an upvalue barrier?
>
> I don't follow you here. If upvalues are reference counted, they should
> not have ages.
>

I meant the value pointed to by the up-value . This is the 5.3 code;

/*
** barrier for assignments to closed upvalues. Because upvalues are
** shared among closures, it is impossible to know the color of all
** closures pointing to it. So, we assume that the object being assigned
** must be marked.
*/
void luaC_upvalbarrier_ (lua_State *L, UpVal *uv) {
  global_State *g = G(L);
  GCObject *o = gcvalue(uv->v);
  lua_assert(!upisopen(uv));  /* ensured by macro luaC_upvalbarrier */
  if (keepinvariant(g))
    markobject(g, o);
}

My question is what age to set 'o' to.
In the early GC code I quoted, this was set to G_OLD0.

Regards