Skip to content

Commit 4e789e1

Browse files
committed
Extract heap count to MMTK_HEAP_COUNT macro
1 parent 1794ea0 commit 4e789e1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

gc/mmtk/mmtk.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,9 @@ rb_gc_impl_init(void)
485485
rb_define_singleton_method(rb_mGC, "verify_compaction_references", rb_f_notimplement, -1);
486486
}
487487

488-
static size_t heap_sizes[6] = {
488+
#define MMTK_HEAP_COUNT 5
489+
490+
static size_t heap_sizes[MMTK_HEAP_COUNT + 1] = {
489491
40, 80, 160, 320, 640, 0
490492
};
491493

@@ -610,7 +612,7 @@ rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE klass, VALUE flags
610612
struct MMTk_ractor_cache *ractor_cache = cache_ptr;
611613

612614
if (alloc_size > 640) rb_bug("too big");
613-
for (int i = 0; i < 5; i++) {
615+
for (int i = 0; i < MMTK_HEAP_COUNT; i++) {
614616
if (alloc_size == heap_sizes[i]) break;
615617
if (alloc_size < heap_sizes[i]) {
616618
alloc_size = heap_sizes[i];

0 commit comments

Comments
 (0)