Skip to content

Commit 176ae3c

Browse files
committed
Add more necessary USE_PARALLEL_SWEEP guards
test-all still not working when configured without --enable-parallel-sweep
1 parent ded22e3 commit 176ae3c

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
@@ -152,18 +152,22 @@ rb_gc_vm_unlock(unsigned int lev, const char *file, int line)
152152
rb_vm_lock_leave(&lev, file, line);
153153
}
154154

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

163165
unsigned int
164166
rb_gc_cr_lock(const char *file, int line)
165167
{
168+
#if USE_PARALLEL_SWEEP
166169
GC_ASSERT(!is_sweep_thread_p());
170+
#endif
167171
unsigned int lev;
168172
rb_vm_lock_enter_cr(GET_RACTOR(), &lev, file, line);
169173
return lev;
@@ -172,7 +176,9 @@ rb_gc_cr_lock(const char *file, int line)
172176
void
173177
rb_gc_cr_unlock(unsigned int lev, const char *file, int line)
174178
{
179+
#if USE_PARALLEL_SWEEP
175180
GC_ASSERT(!is_sweep_thread_p());
181+
#endif
176182
rb_vm_lock_leave_cr(GET_RACTOR(), &lev, file, line);
177183
}
178184

@@ -2503,6 +2509,7 @@ obj_free_object_id(VALUE obj, bool in_user_gc_thread)
25032509
return true;
25042510
}
25052511

2512+
#if USE_PARALLEL_SWEEP
25062513
bool
25072514
rb_gc_obj_free_concurrency_safe_vm_weak_references(VALUE obj)
25082515
{
@@ -2527,6 +2534,7 @@ rb_gc_obj_free_concurrency_safe_vm_weak_references(VALUE obj)
25272534
}
25282535
return result;
25292536
}
2537+
#endif
25302538

25312539
void
25322540
rb_gc_obj_free_vm_weak_references(VALUE obj)

0 commit comments

Comments
 (0)