Skip to content

Commit

Permalink
Use luaC_objbarrierback macro
Browse files Browse the repository at this point in the history
This macro, which was introduced in version 5.4.5, does exactly what
the pallene_barrierback_unboxed function used to do.
  • Loading branch information
hugomg committed Sep 10, 2024
1 parent 6de8cdb commit 1508644
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion src/pallene/coder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ local function opt_gc_barrier(typ, value, parent)
local tmpl = "luaC_barrierback(L, obj2gco($p), &$v);"
return util.render(tmpl, { p = parent, v = value })
else
local tmpl = "pallene_barrierback_unboxed(L, obj2gco($p), obj2gco($v));"
local tmpl = "luaC_objbarrierback(L, obj2gco($p), obj2gco($v));"
return util.render(tmpl, { p = parent, v = value })
end
else
Expand Down
13 changes: 0 additions & 13 deletions src/pallene/pallenelib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ static int pallene_is_record(const TValue *v, const TValue *meta_table);
static int pallene_bvalue(TValue *obj);
static void pallene_setbvalue(TValue *obj, int b);
/* Garbage Collection */
static void pallene_barrierback_unboxed(lua_State *L, GCObject *p, GCObject *v);
/* Runtime errors */
static l_noret pallene_runtime_tag_check_error(lua_State *L, const char* file, int line,
const char *expected_type_name, const TValue *received_type, const char *description_fmt, ...);
Expand Down Expand Up @@ -181,16 +178,6 @@ static void pallene_setbvalue(TValue *obj, int b)
}
}
/* We must call a GC write barrier whenever we set "v" as an element of "p", in order to preserve
* the color invariants of the incremental GC. This function is a specialization of luaC_barrierback
* for when we already know the type of the child object and have an untagged pointer to it. */
static void pallene_barrierback_unboxed(lua_State *L, GCObject *p, GCObject *v)
{
if (isblack(p) && iswhite(v)) {
luaC_barrierback_(L, p);
}
}
static l_noret pallene_runtime_tag_check_error(
lua_State *L,
const char* file,
Expand Down

0 comments on commit 1508644

Please sign in to comment.