thread_safety 0.1.1 → 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 -8
- data/exe/thread_safety +2 -1
- data/ext/extconf.rb +26 -1
- 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 +80 -9
- /data/ext/{darray.h → gc-4.0/darray.h} +0 -0
data/ext/{gc → gc-3.4/gc}/gc.h
RENAMED
|
@@ -19,20 +19,20 @@ struct rb_gc_vm_context {
|
|
|
19
19
|
|
|
20
20
|
struct rb_execution_context_struct *ec;
|
|
21
21
|
};
|
|
22
|
-
#endif
|
|
23
22
|
|
|
24
23
|
typedef int (*vm_table_foreach_callback_func)(VALUE value, void *data);
|
|
25
24
|
typedef int (*vm_table_update_callback_func)(VALUE *value, void *data);
|
|
26
25
|
|
|
26
|
+
|
|
27
27
|
enum rb_gc_vm_weak_tables {
|
|
28
28
|
RB_GC_VM_CI_TABLE,
|
|
29
29
|
RB_GC_VM_OVERLOADED_CME_TABLE,
|
|
30
30
|
RB_GC_VM_GLOBAL_SYMBOLS_TABLE,
|
|
31
|
-
|
|
32
|
-
RB_GC_VM_GENERIC_FIELDS_TABLE,
|
|
31
|
+
RB_GC_VM_GENERIC_IV_TABLE,
|
|
33
32
|
RB_GC_VM_FROZEN_STRINGS_TABLE,
|
|
34
33
|
RB_GC_VM_WEAK_TABLE_COUNT
|
|
35
34
|
};
|
|
35
|
+
#endif
|
|
36
36
|
|
|
37
37
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
38
38
|
unsigned int rb_gc_vm_lock(void);
|
|
@@ -44,7 +44,6 @@ void rb_gc_vm_unlock_no_barrier(unsigned int lev);
|
|
|
44
44
|
void rb_gc_vm_barrier(void);
|
|
45
45
|
size_t rb_gc_obj_optimal_size(VALUE obj);
|
|
46
46
|
void rb_gc_mark_children(void *objspace, VALUE obj);
|
|
47
|
-
void rb_gc_vm_weak_table_foreach(vm_table_foreach_callback_func callback, vm_table_update_callback_func update_callback, void *data, bool weak_only, enum rb_gc_vm_weak_tables table);
|
|
48
47
|
void rb_gc_update_object_references(void *objspace, VALUE obj);
|
|
49
48
|
void rb_gc_update_vm_references(void *objspace);
|
|
50
49
|
void rb_gc_event_hook(VALUE obj, rb_event_flag_t event);
|
|
@@ -71,7 +70,6 @@ size_t rb_obj_memsize_of(VALUE obj);
|
|
|
71
70
|
void rb_gc_prepare_heap_process_object(VALUE obj);
|
|
72
71
|
bool ruby_free_at_exit_p(void);
|
|
73
72
|
bool rb_memerror_reentered(void);
|
|
74
|
-
bool rb_obj_id_p(VALUE);
|
|
75
73
|
|
|
76
74
|
#if USE_MODULAR_GC
|
|
77
75
|
bool rb_gc_event_hook_required_p(rb_event_flag_t event);
|
|
@@ -79,6 +77,7 @@ void *rb_gc_get_ractor_newobj_cache(void);
|
|
|
79
77
|
void rb_gc_initialize_vm_context(struct rb_gc_vm_context *context);
|
|
80
78
|
void rb_gc_worker_thread_set_vm_context(struct rb_gc_vm_context *context);
|
|
81
79
|
void rb_gc_worker_thread_unset_vm_context(struct rb_gc_vm_context *context);
|
|
80
|
+
void rb_gc_vm_weak_table_foreach(vm_table_foreach_callback_func callback, vm_table_update_callback_func update_callback, void *data, enum rb_gc_vm_weak_tables table);
|
|
82
81
|
#endif
|
|
83
82
|
RUBY_SYMBOL_EXPORT_END
|
|
84
83
|
|
|
@@ -10,14 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
#include "ruby/ruby.h"
|
|
12
12
|
|
|
13
|
-
#ifndef RB_GC_OBJECT_METADATA_ENTRY_DEFINED
|
|
14
|
-
# define RB_GC_OBJECT_METADATA_ENTRY_DEFINED
|
|
15
|
-
struct rb_gc_object_metadata_entry {
|
|
16
|
-
ID name;
|
|
17
|
-
VALUE val;
|
|
18
|
-
};
|
|
19
|
-
#endif
|
|
20
|
-
|
|
21
13
|
#ifdef BUILDING_MODULAR_GC
|
|
22
14
|
# define GC_IMPL_FN
|
|
23
15
|
#else
|
|
@@ -35,14 +27,14 @@ struct rb_gc_object_metadata_entry {
|
|
|
35
27
|
// Bootup
|
|
36
28
|
GC_IMPL_FN void *rb_gc_impl_objspace_alloc(void);
|
|
37
29
|
GC_IMPL_FN void rb_gc_impl_objspace_init(void *objspace_ptr);
|
|
30
|
+
GC_IMPL_FN void rb_gc_impl_objspace_free(void *objspace_ptr);
|
|
38
31
|
GC_IMPL_FN void *rb_gc_impl_ractor_cache_alloc(void *objspace_ptr, void *ractor);
|
|
32
|
+
GC_IMPL_FN void rb_gc_impl_ractor_cache_free(void *objspace_ptr, void *cache);
|
|
39
33
|
GC_IMPL_FN void rb_gc_impl_set_params(void *objspace_ptr);
|
|
40
34
|
GC_IMPL_FN void rb_gc_impl_init(void);
|
|
41
35
|
GC_IMPL_FN size_t *rb_gc_impl_heap_sizes(void *objspace_ptr);
|
|
42
36
|
// Shutdown
|
|
43
37
|
GC_IMPL_FN void rb_gc_impl_shutdown_free_objects(void *objspace_ptr);
|
|
44
|
-
GC_IMPL_FN void rb_gc_impl_objspace_free(void *objspace_ptr);
|
|
45
|
-
GC_IMPL_FN void rb_gc_impl_ractor_cache_free(void *objspace_ptr, void *cache);
|
|
46
38
|
// GC
|
|
47
39
|
GC_IMPL_FN void rb_gc_impl_start(void *objspace_ptr, bool full_mark, bool immediate_mark, bool immediate_sweep, bool compact);
|
|
48
40
|
GC_IMPL_FN bool rb_gc_impl_during_gc_p(void *objspace_ptr);
|
|
@@ -116,7 +108,7 @@ GC_IMPL_FN VALUE rb_gc_impl_stat(void *objspace_ptr, VALUE hash_or_sym);
|
|
|
116
108
|
GC_IMPL_FN VALUE rb_gc_impl_stat_heap(void *objspace_ptr, VALUE heap_name, VALUE hash_or_sym);
|
|
117
109
|
GC_IMPL_FN const char *rb_gc_impl_active_gc_name(void);
|
|
118
110
|
// Miscellaneous
|
|
119
|
-
GC_IMPL_FN
|
|
111
|
+
GC_IMPL_FN size_t rb_gc_impl_obj_flags(void *objspace_ptr, VALUE obj, ID* flags, size_t max);
|
|
120
112
|
GC_IMPL_FN bool rb_gc_impl_pointer_to_heap_p(void *objspace_ptr, const void *ptr);
|
|
121
113
|
GC_IMPL_FN bool rb_gc_impl_garbage_object_p(void *objspace_ptr, VALUE obj);
|
|
122
114
|
GC_IMPL_FN void rb_gc_impl_set_event_hook(void *objspace_ptr, const rb_event_flag_t event);
|