File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 644644rb_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)
15361535VALUE
15371536rb_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
Original file line number Diff line number Diff line change 11exclude ( :test_dump_all_full , "testing behaviour specific to default GC" )
22exclude ( :test_dump_flag_age , "testing behaviour specific to default GC" )
33exclude ( :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" )
55exclude ( :test_dump_objects_dumps_page_slot_sizes , "testing behaviour specific to default GC" )
You can’t perform that action at this time.
0 commit comments