Skip to content

Commit

Permalink
Merge pull request #633 from pallene-lang/objbarrierback
Browse files Browse the repository at this point in the history
Replace `pallene_barrierback_unboxed` with Lua's `luaC_objbarrierback` macro
  • Loading branch information
singul4ri7y authored Sep 12, 2024
2 parents 6de8cdb + 1508644 commit 621c35a
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 621c35a

Please sign in to comment.