Skip to content

Commit 2f925b3

Browse files
committed
Remove MMTK_MAX_OBJ_SIZE
1 parent 11ea3a4 commit 2f925b3

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

gc/mmtk/mmtk.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,6 @@ void rb_gc_impl_set_params(void *objspace_ptr) { }
670670

671671
static VALUE gc_verify_internal_consistency(VALUE self) { return Qnil; }
672672

673-
#define MMTK_MAX_OBJ_SIZE 1024
674-
675673
static inline size_t
676674
rb_mmtk_align_obj_size(size_t object_size)
677675
{
@@ -685,8 +683,6 @@ rb_gc_impl_zjit_new_obj_fastpath(void *objspace_ptr, size_t alloc_size, VALUE fl
685683
#if USE_ZJIT && RB_GC_OBJ_SUFFIX_SIZE == 0
686684
struct objspace *objspace = objspace_ptr;
687685

688-
if (alloc_size > MMTK_MAX_OBJ_SIZE) return false;
689-
690686
size_t total_size = rb_mmtk_align_obj_size(alloc_size + sizeof(VALUE) + RB_GC_OBJ_SUFFIX_SIZE);
691687
size_t object_size = total_size - sizeof(VALUE) - RB_GC_OBJ_SUFFIX_SIZE;
692688
size_t value_size_shift = sizeof(VALUE) == 8 ? 3 : 2;
@@ -730,7 +726,6 @@ rb_gc_impl_init(void)
730726
rb_hash_aset(gc_constants, ID2SYM(rb_intern("RVALUE_SIZE")), SIZET2NUM(sizeof(struct RBasic) + sizeof(VALUE[RBIMPL_RVALUE_EMBED_LEN_MAX])));
731727
rb_hash_aset(gc_constants, ID2SYM(rb_intern("RBASIC_SIZE")), SIZET2NUM(sizeof(struct RBasic)));
732728
rb_hash_aset(gc_constants, ID2SYM(rb_intern("RVALUE_OVERHEAD")), INT2NUM(0));
733-
rb_hash_aset(gc_constants, ID2SYM(rb_intern("RVARGC_MAX_ALLOCATE_SIZE")), LONG2FIX(MMTK_MAX_OBJ_SIZE));
734729
// TODO: correctly set RVALUE_OLD_AGE when we have generational GC support
735730
rb_hash_aset(gc_constants, ID2SYM(rb_intern("RVALUE_OLD_AGE")), INT2FIX(0));
736731
OBJ_FREEZE(gc_constants);
@@ -960,8 +955,8 @@ rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE klass, VALUE flags
960955
struct objspace *objspace = objspace_ptr;
961956
struct MMTk_ractor_cache *ractor_cache = cache_ptr;
962957

963-
if (alloc_size == 0 || alloc_size > MMTK_MAX_OBJ_SIZE) {
964-
rb_bug("rb_gc_impl_new_obj: allocation size too large (size=%"PRIuSIZE")", alloc_size);
958+
if (alloc_size == 0) {
959+
rb_bug("rb_gc_impl_new_obj: allocation size is zero");
965960
}
966961

967962
// Layout: [hidden size header (sizeof(VALUE))][payload (alloc_size)][suffix (RB_GC_OBJ_SUFFIX_SIZE)]
@@ -1013,7 +1008,7 @@ rb_gc_impl_obj_slot_size(VALUE obj)
10131008
size_t
10141009
rb_gc_impl_size_slot_size(void *objspace_ptr, size_t size)
10151010
{
1016-
if (size == 0 || size > MMTK_MAX_OBJ_SIZE) {
1011+
if (size == 0) {
10171012
rb_bug("rb_gc_impl_size_slot_size: size too large (size=%"PRIuSIZE")", size);
10181013
}
10191014

@@ -1023,13 +1018,13 @@ rb_gc_impl_size_slot_size(void *objspace_ptr, size_t size)
10231018
bool
10241019
rb_gc_impl_size_allocatable_p(size_t size)
10251020
{
1026-
return size <= MMTK_MAX_OBJ_SIZE;
1021+
return true;
10271022
}
10281023

10291024
size_t
10301025
rb_gc_impl_max_allocation_size(void)
10311026
{
1032-
return MMTK_MAX_OBJ_SIZE;
1027+
return SIZE_T_MAX;
10331028
}
10341029

10351030
// Malloc

0 commit comments

Comments
 (0)