From ec37636ab36af36155faa4dbcfebaa161dcf394d Mon Sep 17 00:00:00 2001 From: Matt Valentine-House Date: Tue, 12 Sep 2023 10:53:57 +0100 Subject: [PATCH] Only sort the heap on platforms with compaction --- gc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gc.c b/gc.c index 9142a59bfc..75cc018a2d 100644 --- a/gc.c +++ b/gc.c @@ -5672,8 +5672,10 @@ gc_sweep_start_heap(rb_objspace_t *objspace, rb_heap_t *heap) __attribute__((noinline)) #endif +#if GC_CAN_COMPILE_COMPACTION static void gc_sort_heap_by_compare_func(rb_objspace_t *objspace, gc_compact_compare_func compare_func); static int compare_pinned_slots(const void *left, const void *right, void *d); +#endif static void gc_sweep_start(rb_objspace_t *objspace) @@ -5681,12 +5683,14 @@ gc_sweep_start(rb_objspace_t *objspace) gc_mode_transition(objspace, gc_mode_sweeping); objspace->rincgc.pooled_slots = 0; +#if GC_CAN_COMPILE_COMPACTION if (objspace->flags.during_compacting) { gc_sort_heap_by_compare_func( objspace, objspace->rcompactor.compare_func ? objspace->rcompactor.compare_func : compare_pinned_slots ); } +#endif for (int i = 0; i < SIZE_POOL_COUNT; i++) { rb_size_pool_t *size_pool = &size_pools[i];