Skip to content

Commit 680c740

Browse files
committed
Remove some redundant code
1 parent 12de1e3 commit 680c740

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

gc/default/default.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
#else
127127
#define psweep_debug(...) (void)0
128128
#endif
129-
#define PSWEEP_LOCK_STATS 1
129+
#define PSWEEP_LOCK_STATS 0
130130
#define PSWEEP_COLLECT_TIMINGS 0
131131

132132
#ifndef GC_HEAP_FREE_SLOTS
@@ -4554,10 +4554,8 @@ gc_pre_sweep_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *pa
45544554
int total_slots = page->total_slots;
45554555
psweep_debug(1, "[sweep] gc_pre_sweep_page(heap:%p page:%p) start\n", heap, page);
45564556
GC_ASSERT(page->heap == heap);
4557-
page->pre_deferred_free_slots = 0;
4558-
memset(page->deferred_free_bits, 0, sizeof(page->deferred_free_bits));
4559-
page->pre_zombie_slots = 0;
4560-
page->pre_freed_malloc_bytes = 0;
4557+
GC_ASSERT(page->pre_deferred_free_slots == 0);
4558+
GC_ASSERT(page->pre_freed_malloc_bytes == 0);
45614559
current_sweep_thread_page = page;
45624560

45634561
int bitmap_plane_count = CEILDIV(total_slots, BITS_BITLENGTH);
@@ -4602,6 +4600,8 @@ gc_pre_sweep_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *pa
46024600
#endif
46034601

46044602
#if USE_MALLOC_INCREASE_LOCAL
4603+
// flush to sweep_page->pre_freed_malloc_bytes instead of malloc_increase because it's clamped at 0 right now and
4604+
// we don't want to decrease it too quickly
46054605
malloc_increase_local_flush(objspace);
46064606
#endif
46074607
current_sweep_thread_page = NULL;
@@ -9958,13 +9958,7 @@ bad_malloc_during_gc_p(rb_objspace_t *objspace)
99589958
* (since ractors can run while another thread is sweeping) and when we
99599959
* have the GVL (since if we don't have the GVL, we'll try to acquire the
99609960
* GVL which will block and ensure the other thread finishes GC). */
9961-
if (is_sweep_thread_p()) {
9962-
fprintf(stderr, "ERROR: bad malloc/calloc call family during GC in sweep thread!\n");
9963-
return true;
9964-
}
9965-
else {
9966-
return during_gc && !dont_gc_val() && !rb_gc_multi_ractor_p() && ruby_thread_has_gvl_p();
9967-
}
9961+
return during_gc && !dont_gc_val() && !rb_gc_multi_ractor_p() && ruby_thread_has_gvl_p();
99689962
}
99699963

99709964
static inline void *

0 commit comments

Comments
 (0)