Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use luaC_objbarrierback macro #633

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading