Correctly account for heap_pages_final_slots so it does not underflow
rb_objspace_call_finalizer creates zombies, but does not do the correct accounting (it should increment heap_pages_final_slots whenever it creates a zombie). When we do correct accounting, heap_pages_final_slots should never underflow (the check for underflow was introduced in 39725a4db6b121c7779b2b34f7da9d9339415a1c).
The implementation moves the accounting from the functions that call make_zombie into make_zombie itself, which reduces code duplication.
Correctly account for heap_pages_final_slots so it does not underflow
rb_objspace_call_finalizer
creates zombies, but does not do the correct accounting (it should incrementheap_pages_final_slots
whenever it creates a zombie). When we do correct accounting,heap_pages_final_slots
should never underflow (the check for underflow was introduced in 39725a4db6b121c7779b2b34f7da9d9339415a1c).The implementation moves the accounting from the functions that call
make_zombie
intomake_zombie
itself, which reduces code duplication.