summaryrefslogtreecommitdiff
path: root/gc/mmtk/mmtk.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2025-06-02 16:31:28 -0400
committerPeter Zhu <[email protected]>2025-06-03 12:04:24 -0400
commitea8b53a53954c2f34b1093ae2547951ae0e1fe8c (patch)
tree93bdeae1cb7622eeed5fd59c9fb2e850db99fc0a /gc/mmtk/mmtk.c
parent5f247416b6b46b6f99c9f5229fab36ba721fd975 (diff)
Allow pass special constants to the write barrier
Some GC implementations want to always know when an object is written to, even if the written value is a special constant. Checking special constants in rb_obj_written was a micro-optimization that made assumptions about the GC implementation.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13497
Diffstat (limited to 'gc/mmtk/mmtk.c')
-rw-r--r--gc/mmtk/mmtk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gc/mmtk/mmtk.c b/gc/mmtk/mmtk.c
index 41e7f13972..9e4ee9f3de 100644
--- a/gc/mmtk/mmtk.c
+++ b/gc/mmtk/mmtk.c
@@ -750,6 +750,8 @@ rb_gc_impl_writebarrier(void *objspace_ptr, VALUE a, VALUE b)
{
struct MMTk_ractor_cache *cache = rb_gc_get_ractor_newobj_cache();
+ if (SPECIAL_CONST_P(b)) return;
+
mmtk_object_reference_write_post(cache->mutator, (MMTk_ObjectReference)a);
}