Skip to content

Commit b53aada

Browse files
We can't actually hardcode these
because BASE_SLOT_SIZE changes on 32 bit, and when debug/devel symbols are added
1 parent 20d85bb commit b53aada

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

gc/default/default.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -841,13 +841,7 @@ heap_page_in_global_empty_pages_pool(rb_objspace_t *objspace, struct heap_page *
841841
#define GET_PAGE_HEADER(x) (&GET_PAGE_BODY(x)->header)
842842
#define GET_HEAP_PAGE(x) (GET_PAGE_HEADER(x)->page)
843843

844-
static const uint32_t slot_div_magics[HEAP_COUNT] = {
845-
0x06666667U,
846-
0x03333334U,
847-
0x0199999aU,
848-
0x00cccccdU,
849-
0x00666667U,
850-
};
844+
static uint32_t slot_div_magics[HEAP_COUNT];
851845

852846
static inline size_t
853847
slot_index_for_offset(size_t offset, uint32_t div_magic)
@@ -9517,6 +9511,7 @@ rb_gc_impl_objspace_init(void *objspace_ptr)
95179511
rb_heap_t *heap = &heaps[i];
95189512

95199513
heap->slot_size = (1 << i) * BASE_SLOT_SIZE;
9514+
slot_div_magics[i] = (uint32_t)(((uint64_t)1 << 32) / heap->slot_size + 1);
95209515

95219516
ccan_list_head_init(&heap->pages);
95229517
}

0 commit comments

Comments
 (0)