thread_safety 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ Allow RVALUE_OVERHEAD to be defined before including default.c
2
+
3
+ Ruby 4.0 added an #ifndef guard around the RVALUE_OVERHEAD definition,
4
+ but this wasn't backported to 3.4. This patch adds the same guard so
5
+ that thread_safety can define its own RVALUE_OVERHEAD value for storing
6
+ thread/fiber ownership data in each object slot.
7
+
8
+ --- a/gc/default/default.c
9
+ +++ b/gc/default/default.c
10
+ @@ -630,7 +630,9 @@ size_t rb_gc_impl_obj_slot_size(VALUE obj);
11
+ # define GET_RVALUE_OVERHEAD(obj) ((struct rvalue_overhead *)((uintptr_t)obj + rb_gc_impl_obj_slot_size(obj)))
12
+ #else
13
+ +# ifndef RVALUE_OVERHEAD
14
+ # define RVALUE_OVERHEAD 0
15
+ +# endif
16
+ #endif
17
+
18
+ #define BASE_SLOT_SIZE (sizeof(struct RBasic) + sizeof(VALUE[RBIMPL_RVALUE_EMBED_LEN_MAX]) + RVALUE_OVERHEAD)