@@ -493,7 +493,32 @@ rb_gc_impl_ractor_cache_free(void *objspace_ptr, void *cache)
493
493
494
494
void rb_gc_impl_set_params (void * objspace_ptr ) { }
495
495
496
- void rb_gc_impl_init (void ) { }
496
+ static VALUE gc_verify_internal_consistency (VALUE self ) { return Qnil ; }
497
+ static VALUE gc_compact (VALUE self ) { return Qnil ; }
498
+ static VALUE gc_get_auto_compact (VALUE self ) { return Qnil ; }
499
+ static VALUE gc_set_auto_compact (VALUE self , VALUE val ) { return Qnil ; }
500
+ static VALUE gc_compact_stats (VALUE self ) { return Qnil ; }
501
+ static VALUE gc_verify_compaction_references (int argc , VALUE * argv , VALUE self ) { return Qnil ; }
502
+
503
+ void
504
+ rb_gc_impl_init (void )
505
+ {
506
+ VALUE gc_constants = rb_hash_new ();
507
+ rb_hash_aset (gc_constants , ID2SYM (rb_intern ("BASE_SLOT_SIZE" )), SIZET2NUM (sizeof (VALUE ) * 5 ));
508
+ // Pretend we have 5 size pools
509
+ rb_hash_aset (gc_constants , ID2SYM (rb_intern ("SIZE_POOL_COUNT" )), LONG2FIX (5 ));
510
+ OBJ_FREEZE (gc_constants );
511
+ rb_define_const (rb_mGC , "INTERNAL_CONSTANTS" , gc_constants );
512
+
513
+ // no-ops for compatibility
514
+ rb_define_singleton_method (rb_mGC , "verify_internal_consistency" , gc_verify_internal_consistency , 0 );
515
+
516
+ rb_define_singleton_method (rb_mGC , "compact" , gc_compact , 0 );
517
+ rb_define_singleton_method (rb_mGC , "auto_compact" , gc_get_auto_compact , 0 );
518
+ rb_define_singleton_method (rb_mGC , "auto_compact=" , gc_set_auto_compact , 1 );
519
+ rb_define_singleton_method (rb_mGC , "latest_compact_info" , gc_compact_stats , 0 );
520
+ rb_define_singleton_method (rb_mGC , "verify_compaction_references" , gc_verify_compaction_references , -1 );
521
+ }
497
522
498
523
void rb_gc_impl_initial_stress_set (VALUE flag ) { }
499
524
@@ -1043,7 +1068,11 @@ size_t rb_gc_impl_stat(void *objspace_ptr, VALUE hash_or_sym) { }
1043
1068
size_t rb_gc_impl_stat_heap (void * objspace_ptr , VALUE heap_name , VALUE hash_or_sym ) { }
1044
1069
1045
1070
// Miscellaneous
1046
- size_t rb_gc_impl_obj_flags (void * objspace_ptr , VALUE obj , ID * flags , size_t max ) { }
1071
+ size_t
1072
+ rb_gc_impl_obj_flags (void * objspace_ptr , VALUE obj , ID * flags , size_t max )
1073
+ {
1074
+ return 0 ;
1075
+ }
1047
1076
1048
1077
bool
1049
1078
rb_gc_impl_pointer_to_heap_p (void * objspace_ptr , const void * ptr )
0 commit comments