@@ -4175,7 +4175,6 @@ gc_sweep_page(rb_objspace_t *objspace, rb_heap_t *heap, struct gc_sweep_context
41754175 }
41764176#endif
41774177 RUBY_ATOMIC_SET (sweep_page -> before_sweep , 0 );
4178- sweep_page -> free_slots = 0 ;
41794178
41804179 p = (uintptr_t )sweep_page -> start ;
41814180 bits = sweep_page -> mark_bits ;
@@ -4203,9 +4202,9 @@ gc_sweep_page(rb_objspace_t *objspace, rb_heap_t *heap, struct gc_sweep_context
42034202 bits_t * age_bits = sweep_page -> age_bits ;
42044203 for (int i = 0 ; i < bitmap_plane_count ; i ++ ) {
42054204 bits_t unmarked = ~bits [i ] & slot_mask ;
4206- RUBY_ATOMIC_VALUE_AND ( wb_unprotected_bits [i ], ~unmarked ) ;
4207- RUBY_ATOMIC_VALUE_AND ( age_bits [i * 2 ], ~unmarked ) ;
4208- RUBY_ATOMIC_VALUE_AND ( age_bits [i * 2 + 1 ], ~unmarked ) ;
4205+ wb_unprotected_bits [i ] &= ~unmarked ;
4206+ age_bits [i * 2 ] &= ~unmarked ;
4207+ age_bits [i * 2 + 1 ] &= ~unmarked ;
42094208 }
42104209 }
42114210
@@ -5246,7 +5245,6 @@ gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap)
52465245 }
52475246 else if (free_slots > 0 ) {
52485247 GC_ASSERT (free_slots < sweep_page -> total_slots );
5249- // These are just for statistics, not used in calculations
52505248 heap -> freed_slots += ctx .freed_slots ;
52515249 heap -> empty_slots += ctx .empty_slots ;
52525250
@@ -5269,6 +5267,7 @@ gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap)
52695267 }
52705268 }
52715269 else {
5270+ GC_ASSERT (free_slots == 0 );
52725271 sweep_page -> free_next = NULL ;
52735272 }
52745273 }
0 commit comments