Skip to content

Commit a1bd341

Browse files
committed
Add more necessary USE_PARALLEL_SWEEP guards
test-all still not working when configured without --enable-parallel-sweep
1 parent 05dec1a commit a1bd341

7 files changed

Lines changed: 246 additions & 111 deletions

File tree

concurrent_set.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,10 +761,11 @@ VALUE
761761
rb_concurrent_set_delete_by_identity(VALUE *set_obj_ptr, VALUE key)
762762
{
763763
VALUE result;
764-
bool is_sweep_thread_p(void);
765764

766765
VALUE set_obj = rbimpl_atomic_value_load(set_obj_ptr, RBIMPL_ATOMIC_ACQUIRE);
767766

767+
#if USE_PARALLEL_SWEEP
768+
bool is_sweep_thread_p(void);
768769
if (is_sweep_thread_p()) {
769770
while (1) {
770771
bool lock_taken = resize_lock_rdlock();
@@ -783,7 +784,9 @@ rb_concurrent_set_delete_by_identity(VALUE *set_obj_ptr, VALUE key)
783784
if (lock_taken) resize_lock_rdunlock();
784785
}
785786
}
786-
else {
787+
else
788+
#endif
789+
{
787790
result = rb_concurrent_set_delete_by_identity_locked(set_obj, key);
788791
}
789792
return result;

error.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,16 +1117,20 @@ rb_bug_without_die(const char *fmt, ...)
11171117
va_end(args);
11181118
}
11191119

1120+
#if USE_PARALLEL_SWEEP
11201121
bool is_sweep_thread_p(void);
1122+
#endif
11211123

11221124
void
11231125
rb_bug(const char *fmt, ...)
11241126
{
11251127
va_list args;
11261128
va_start(args, fmt);
1129+
#if USE_PARALLEL_SWEEP
11271130
if (is_sweep_thread_p()) {
11281131
fprintf(stderr, "rb_bug() called from sweep_thread!\n");
11291132
}
1133+
#endif
11301134
rb_bug_without_die_internal(fmt, args);
11311135
va_end(args);
11321136
die();

gc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,22 @@ rb_gc_vm_unlock(unsigned int lev, const char *file, int line)
151151
rb_vm_lock_leave(&lev, file, line);
152152
}
153153

154+
#if USE_PARALLEL_SWEEP
154155
bool
155156
is_sweep_thread_p(void)
156157
{
157158
rb_vm_t *vm = GET_VM();
158159
if (!vm) return false;
159160
return vm->gc.sweep_thread == pthread_self();
160161
}
162+
#endif
161163

162164
unsigned int
163165
rb_gc_cr_lock(const char *file, int line)
164166
{
167+
#if USE_PARALLEL_SWEEP
165168
GC_ASSERT(!is_sweep_thread_p());
169+
#endif
166170
unsigned int lev;
167171
rb_vm_lock_enter_cr(GET_RACTOR(), &lev, file, line);
168172
return lev;
@@ -171,7 +175,9 @@ rb_gc_cr_lock(const char *file, int line)
171175
void
172176
rb_gc_cr_unlock(unsigned int lev, const char *file, int line)
173177
{
178+
#if USE_PARALLEL_SWEEP
174179
GC_ASSERT(!is_sweep_thread_p());
180+
#endif
175181
rb_vm_lock_leave_cr(GET_RACTOR(), &lev, file, line);
176182
}
177183

@@ -2497,6 +2503,7 @@ obj_free_object_id(VALUE obj, bool in_user_gc_thread)
24972503
return true;
24982504
}
24992505

2506+
#if USE_PARALLEL_SWEEP
25002507
bool
25012508
rb_gc_obj_free_concurrency_safe_vm_weak_references(VALUE obj)
25022509
{
@@ -2521,6 +2528,7 @@ rb_gc_obj_free_concurrency_safe_vm_weak_references(VALUE obj)
25212528
}
25222529
return result;
25232530
}
2531+
#endif
25242532

25252533
void
25262534
rb_gc_obj_free_vm_weak_references(VALUE obj)

0 commit comments

Comments
 (0)