summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2025-09-24 02:34:45 +0900
committerKoichi Sasada <ko1@atdot.net>2025-10-23 13:08:26 +0900
commit45907b1b00d09ce2c40f5073ff540d8b63217d96 (patch)
treea2892e4cd0d6f8b37e081e56cf90d3725f91f4cc /internal
parent271be0a2258061be486e24dc61994a3f4155d669 (diff)
add SET_SHAREABLE macros
* `RB_OBJ_SET_SHAREABLE(obj)` makes obj shareable. All of reachable objects from `obj` should be shareable. * `RB_OBJ_SET_FROZEN_SHAREABLE(obj)` same as above but freeze `obj` before making it shareable. Also `rb_gc_verify_shareable(obj)` is introduced to check the `obj` does not violate shareable rule (an shareable object only refers shareable objects) strictly. The rule has some exceptions (some shareable objects can refer to unshareable objects, such as a Ractor object (which is a shareable object) can refer to the Ractor local objects. To handle such case, `check_shareable` flag is also introduced. `STRICT_VERIFY_SHAREABLE` macro is also introduced to verify the strict shareable rule at `SET_SHAREABLE`.
Diffstat (limited to 'internal')
-rw-r--r--internal/gc.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/gc.h b/internal/gc.h
index f0dc04fc58..7357bef732 100644
--- a/internal/gc.h
+++ b/internal/gc.h
@@ -351,4 +351,7 @@ ruby_sized_realloc_n(void *ptr, size_t new_count, size_t element_size, size_t ol
#define ruby_sized_xrealloc ruby_sized_xrealloc_inlined
#define ruby_sized_xrealloc2 ruby_sized_xrealloc2_inlined
#define ruby_sized_xfree ruby_sized_xfree_inlined
+
+void rb_gc_verify_shareable(VALUE);
+
#endif /* INTERNAL_GC_H */