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.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -6
- data/README.md +69 -2
- data/Rakefile +15 -3
- data/exe/thread_safety +1 -0
- data/ext/extconf.rb +18 -3
- data/ext/gc-3.4/darray.h +220 -0
- data/ext/gc-3.4/debug_counter.h +442 -0
- data/ext/{gc → gc-3.4/gc}/default/default.c +276 -278
- data/ext/{gc → gc-3.4/gc}/gc.h +4 -5
- data/ext/{gc → gc-3.4/gc}/gc_impl.h +3 -11
- data/ext/gc-3.4/internal/bits.h +667 -0
- data/ext/gc-3.4/internal/compilers.h +116 -0
- data/ext/gc-3.4/internal/hash.h +201 -0
- data/ext/gc-3.4/internal/sanitizers.h +327 -0
- data/ext/gc-3.4/internal/static_assert.h +25 -0
- data/ext/gc-3.4/internal/warnings.h +25 -0
- data/ext/gc-3.4/patches/0001-allow-rvalue-overhead-override.patch +18 -0
- data/ext/gc-4.0/gc/default/default.c +9629 -0
- data/ext/gc-4.0/gc/gc.h +262 -0
- data/ext/gc-4.0/gc/gc_impl.h +124 -0
- data/ext/thread_safety.c +127 -28
- data/lib/thread_safety/offense.rb +10 -18
- data/lib/thread_safety/patches.rb +12 -0
- data/lib/thread_safety/version.rb +1 -1
- data/lib/thread_safety.rb +8 -8
- metadata +78 -8
- /data/ext/{darray.h → gc-4.0/darray.h} +0 -0
|
@@ -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)
|