Skip to content

Commit c41eadf

Browse files
committed
Reverse sync ruby/ruby@5001c19
1 parent 78db50e commit c41eadf

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

gc/mmtk/mmtk.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@ void
644644
rb_gc_impl_init(void)
645645
{
646646
VALUE gc_constants = rb_hash_new();
647-
rb_hash_aset(gc_constants, ID2SYM(rb_intern("BASE_SLOT_SIZE")), SIZET2NUM(sizeof(VALUE) * 5));
648647
rb_hash_aset(gc_constants, ID2SYM(rb_intern("RBASIC_SIZE")), SIZET2NUM(sizeof(struct RBasic)));
649648
rb_hash_aset(gc_constants, ID2SYM(rb_intern("RVALUE_OVERHEAD")), INT2NUM(0));
650649
rb_hash_aset(gc_constants, ID2SYM(rb_intern("RVARGC_MAX_ALLOCATE_SIZE")), LONG2FIX(MMTK_MAX_OBJ_SIZE));
@@ -1536,12 +1535,24 @@ rb_gc_impl_stat(void *objspace_ptr, VALUE hash_or_sym)
15361535
VALUE
15371536
rb_gc_impl_stat_heap(void *objspace_ptr, VALUE heap_name, VALUE hash_or_sym)
15381537
{
1538+
if (FIXNUM_P(heap_name) && SYMBOL_P(hash_or_sym)) {
1539+
int heap_idx = FIX2INT(heap_name);
1540+
if (heap_idx < 0 || heap_idx >= MMTK_HEAP_COUNT) {
1541+
rb_raise(rb_eArgError, "size pool index out of range");
1542+
}
1543+
1544+
if (hash_or_sym == ID2SYM(rb_intern("slot_size"))) {
1545+
return SIZET2NUM(heap_sizes[heap_idx]);
1546+
}
1547+
1548+
return Qundef;
1549+
}
1550+
15391551
if (RB_TYPE_P(hash_or_sym, T_HASH)) {
15401552
return hash_or_sym;
15411553
}
1542-
else {
1543-
return Qundef;
1544-
}
1554+
1555+
return Qundef;
15451556
}
15461557

15471558
// Miscellaneous
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
exclude(:test_dump_all_full, "testing behaviour specific to default GC")
22
exclude(:test_dump_flag_age, "testing behaviour specific to default GC")
33
exclude(:test_dump_flags, "testing behaviour specific to default GC")
4-
exclude(:test_dump_includes_slot_size, "can be removed when BASE_SLOT_SIZE is 32 bytes")
4+
exclude(:test_dump_includes_slot_size, "can be removed when pool 0 slot size is 32 bytes")
55
exclude(:test_dump_objects_dumps_page_slot_sizes, "testing behaviour specific to default GC")

0 commit comments

Comments
 (0)