summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2023-09-12 10:53:57 +0100
committerMatt Valentine-House <matt@eightbitraptor.com>2023-09-18 14:34:38 +0100
commitec37636ab36af36155faa4dbcfebaa161dcf394d (patch)
treef04e4e62556c57cf6d1d00b69fec7f0d88b8ce9c
parent8792e421ce5e501f87bdb449fe885e3a436a88f0 (diff)
Only sort the heap on platforms with compaction
-rw-r--r--gc.c4
1 files changed, 4 insertions, 0 deletions
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];