From 1508644defc58f4ea0d035ba8962e263c1accc19 Mon Sep 17 00:00:00 2001 From: Hugo Musso Gualandi Date: Tue, 10 Sep 2024 19:46:32 -0300 Subject: [PATCH] Use luaC_objbarrierback macro This macro, which was introduced in version 5.4.5, does exactly what the pallene_barrierback_unboxed function used to do. --- src/pallene/coder.lua | 2 +- src/pallene/pallenelib.lua | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/pallene/coder.lua b/src/pallene/coder.lua index f98c0be1..387a0d17 100644 --- a/src/pallene/coder.lua +++ b/src/pallene/coder.lua @@ -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 diff --git a/src/pallene/pallenelib.lua b/src/pallene/pallenelib.lua index a5a7a339..fd9b2037 100644 --- a/src/pallene/pallenelib.lua +++ b/src/pallene/pallenelib.lua @@ -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, ...); @@ -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,