@@ -178,7 +178,7 @@ rb_gc_vm_barrier(void)
178
178
rb_vm_barrier ();
179
179
}
180
180
181
- #if USE_SHARED_GC
181
+ #if USE_MODULAR_GC
182
182
void *
183
183
rb_gc_get_ractor_newobj_cache (void )
184
184
{
@@ -617,9 +617,9 @@ rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val)
617
617
static const char * obj_type_name (VALUE obj );
618
618
#include "gc/default/default.c"
619
619
620
- #if USE_SHARED_GC && !defined(HAVE_DLOPEN )
621
- # error "Shared GC requires dlopen"
622
- #elif USE_SHARED_GC
620
+ #if USE_MODULAR_GC && !defined(HAVE_DLOPEN )
621
+ # error "Modular GC requires dlopen"
622
+ #elif USE_MODULAR_GC
623
623
#include <dlfcn.h>
624
624
625
625
typedef struct gc_function_map {
@@ -702,18 +702,18 @@ typedef struct gc_function_map {
702
702
// GC Identification
703
703
const char * (* active_gc_name )(void );
704
704
705
- bool external_gc_loaded_p ;
705
+ bool modular_gc_loaded_p ;
706
706
} rb_gc_function_map_t ;
707
707
708
708
static rb_gc_function_map_t rb_gc_functions ;
709
709
710
710
# define RUBY_GC_LIBRARY "RUBY_GC_LIBRARY"
711
711
712
712
static void
713
- ruby_external_gc_init (void )
713
+ ruby_modular_gc_init (void )
714
714
{
715
715
// Assert that the directory path ends with a /
716
- RUBY_ASSERT_ALWAYS (SHARED_GC_DIR [sizeof (SHARED_GC_DIR ) - 2 ] == '/' );
716
+ RUBY_ASSERT_ALWAYS (MODULAR_GC_DIR [sizeof (MODULAR_GC_DIR ) - 2 ] == '/' );
717
717
718
718
char * gc_so_file = getenv (RUBY_GC_LIBRARY );
719
719
@@ -737,14 +737,14 @@ ruby_external_gc_init(void)
737
737
}
738
738
}
739
739
740
- size_t gc_so_path_size = strlen (SHARED_GC_DIR "librubygc." DLEXT ) + strlen (gc_so_file ) + 1 ;
740
+ size_t gc_so_path_size = strlen (MODULAR_GC_DIR "librubygc." DLEXT ) + strlen (gc_so_file ) + 1 ;
741
741
gc_so_path = alloca (gc_so_path_size );
742
742
{
743
743
size_t gc_so_path_idx = 0 ;
744
744
#define GC_SO_PATH_APPEND (str ) do { \
745
745
gc_so_path_idx += strlcpy(gc_so_path + gc_so_path_idx, str, gc_so_path_size - gc_so_path_idx); \
746
746
} while (0)
747
- GC_SO_PATH_APPEND (SHARED_GC_DIR );
747
+ GC_SO_PATH_APPEND (MODULAR_GC_DIR );
748
748
GC_SO_PATH_APPEND ("librubygc." );
749
749
GC_SO_PATH_APPEND (gc_so_file );
750
750
GC_SO_PATH_APPEND (DLEXT );
@@ -754,19 +754,19 @@ ruby_external_gc_init(void)
754
754
755
755
handle = dlopen (gc_so_path , RTLD_LAZY | RTLD_GLOBAL );
756
756
if (!handle ) {
757
- fprintf (stderr , "ruby_external_gc_init : Shared library %s cannot be opened: %s\n" , gc_so_path , dlerror ());
757
+ fprintf (stderr , "ruby_modular_gc_init : Shared library %s cannot be opened: %s\n" , gc_so_path , dlerror ());
758
758
exit (1 );
759
759
}
760
760
761
- gc_functions .external_gc_loaded_p = true;
761
+ gc_functions .modular_gc_loaded_p = true;
762
762
}
763
763
764
- # define load_external_gc_func (name ) do { \
764
+ # define load_modular_gc_func (name ) do { \
765
765
if (handle) { \
766
766
const char *func_name = "rb_gc_impl_" #name; \
767
767
gc_functions.name = dlsym(handle, func_name); \
768
768
if (!gc_functions.name) { \
769
- fprintf(stderr, "ruby_external_gc_init : %s function not exported by library %s\n", func_name, gc_so_path); \
769
+ fprintf(stderr, "ruby_modular_gc_init : %s function not exported by library %s\n", func_name, gc_so_path); \
770
770
exit(1); \
771
771
} \
772
772
} \
@@ -776,85 +776,85 @@ ruby_external_gc_init(void)
776
776
} while (0)
777
777
778
778
// Bootup
779
- load_external_gc_func (objspace_alloc );
780
- load_external_gc_func (objspace_init );
781
- load_external_gc_func (objspace_free );
782
- load_external_gc_func (ractor_cache_alloc );
783
- load_external_gc_func (ractor_cache_free );
784
- load_external_gc_func (set_params );
785
- load_external_gc_func (init );
786
- load_external_gc_func (heap_sizes );
779
+ load_modular_gc_func (objspace_alloc );
780
+ load_modular_gc_func (objspace_init );
781
+ load_modular_gc_func (objspace_free );
782
+ load_modular_gc_func (ractor_cache_alloc );
783
+ load_modular_gc_func (ractor_cache_free );
784
+ load_modular_gc_func (set_params );
785
+ load_modular_gc_func (init );
786
+ load_modular_gc_func (heap_sizes );
787
787
// Shutdown
788
- load_external_gc_func (shutdown_free_objects );
788
+ load_modular_gc_func (shutdown_free_objects );
789
789
// GC
790
- load_external_gc_func (start );
791
- load_external_gc_func (during_gc_p );
792
- load_external_gc_func (prepare_heap );
793
- load_external_gc_func (gc_enable );
794
- load_external_gc_func (gc_disable );
795
- load_external_gc_func (gc_enabled_p );
796
- load_external_gc_func (config_set );
797
- load_external_gc_func (config_get );
798
- load_external_gc_func (stress_set );
799
- load_external_gc_func (stress_get );
790
+ load_modular_gc_func (start );
791
+ load_modular_gc_func (during_gc_p );
792
+ load_modular_gc_func (prepare_heap );
793
+ load_modular_gc_func (gc_enable );
794
+ load_modular_gc_func (gc_disable );
795
+ load_modular_gc_func (gc_enabled_p );
796
+ load_modular_gc_func (config_set );
797
+ load_modular_gc_func (config_get );
798
+ load_modular_gc_func (stress_set );
799
+ load_modular_gc_func (stress_get );
800
800
// Object allocation
801
- load_external_gc_func (new_obj );
802
- load_external_gc_func (obj_slot_size );
803
- load_external_gc_func (heap_id_for_size );
804
- load_external_gc_func (size_allocatable_p );
801
+ load_modular_gc_func (new_obj );
802
+ load_modular_gc_func (obj_slot_size );
803
+ load_modular_gc_func (heap_id_for_size );
804
+ load_modular_gc_func (size_allocatable_p );
805
805
// Malloc
806
- load_external_gc_func (malloc );
807
- load_external_gc_func (calloc );
808
- load_external_gc_func (realloc );
809
- load_external_gc_func (free );
810
- load_external_gc_func (adjust_memory_usage );
806
+ load_modular_gc_func (malloc );
807
+ load_modular_gc_func (calloc );
808
+ load_modular_gc_func (realloc );
809
+ load_modular_gc_func (free );
810
+ load_modular_gc_func (adjust_memory_usage );
811
811
// Marking
812
- load_external_gc_func (mark );
813
- load_external_gc_func (mark_and_move );
814
- load_external_gc_func (mark_and_pin );
815
- load_external_gc_func (mark_maybe );
816
- load_external_gc_func (mark_weak );
817
- load_external_gc_func (remove_weak );
812
+ load_modular_gc_func (mark );
813
+ load_modular_gc_func (mark_and_move );
814
+ load_modular_gc_func (mark_and_pin );
815
+ load_modular_gc_func (mark_maybe );
816
+ load_modular_gc_func (mark_weak );
817
+ load_modular_gc_func (remove_weak );
818
818
// Compaction
819
- load_external_gc_func (object_moved_p );
820
- load_external_gc_func (location );
819
+ load_modular_gc_func (object_moved_p );
820
+ load_modular_gc_func (location );
821
821
// Write barriers
822
- load_external_gc_func (writebarrier );
823
- load_external_gc_func (writebarrier_unprotect );
824
- load_external_gc_func (writebarrier_remember );
822
+ load_modular_gc_func (writebarrier );
823
+ load_modular_gc_func (writebarrier_unprotect );
824
+ load_modular_gc_func (writebarrier_remember );
825
825
// Heap walking
826
- load_external_gc_func (each_objects );
827
- load_external_gc_func (each_object );
826
+ load_modular_gc_func (each_objects );
827
+ load_modular_gc_func (each_object );
828
828
// Finalizers
829
- load_external_gc_func (make_zombie );
830
- load_external_gc_func (define_finalizer );
831
- load_external_gc_func (undefine_finalizer );
832
- load_external_gc_func (copy_finalizer );
833
- load_external_gc_func (shutdown_call_finalizer );
829
+ load_modular_gc_func (make_zombie );
830
+ load_modular_gc_func (define_finalizer );
831
+ load_modular_gc_func (undefine_finalizer );
832
+ load_modular_gc_func (copy_finalizer );
833
+ load_modular_gc_func (shutdown_call_finalizer );
834
834
// Object ID
835
- load_external_gc_func (object_id );
836
- load_external_gc_func (object_id_to_ref );
835
+ load_modular_gc_func (object_id );
836
+ load_modular_gc_func (object_id_to_ref );
837
837
// Forking
838
- load_external_gc_func (before_fork );
839
- load_external_gc_func (after_fork );
838
+ load_modular_gc_func (before_fork );
839
+ load_modular_gc_func (after_fork );
840
840
// Statistics
841
- load_external_gc_func (set_measure_total_time );
842
- load_external_gc_func (get_measure_total_time );
843
- load_external_gc_func (get_total_time );
844
- load_external_gc_func (gc_count );
845
- load_external_gc_func (latest_gc_info );
846
- load_external_gc_func (stat );
847
- load_external_gc_func (stat_heap );
841
+ load_modular_gc_func (set_measure_total_time );
842
+ load_modular_gc_func (get_measure_total_time );
843
+ load_modular_gc_func (get_total_time );
844
+ load_modular_gc_func (gc_count );
845
+ load_modular_gc_func (latest_gc_info );
846
+ load_modular_gc_func (stat );
847
+ load_modular_gc_func (stat_heap );
848
848
// Miscellaneous
849
- load_external_gc_func (obj_flags );
850
- load_external_gc_func (pointer_to_heap_p );
851
- load_external_gc_func (garbage_object_p );
852
- load_external_gc_func (set_event_hook );
853
- load_external_gc_func (copy_attributes );
849
+ load_modular_gc_func (obj_flags );
850
+ load_modular_gc_func (pointer_to_heap_p );
851
+ load_modular_gc_func (garbage_object_p );
852
+ load_modular_gc_func (set_event_hook );
853
+ load_modular_gc_func (copy_attributes );
854
854
//GC Identification
855
- load_external_gc_func (active_gc_name );
855
+ load_modular_gc_func (active_gc_name );
856
856
857
- # undef load_external_gc_func
857
+ # undef load_modular_gc_func
858
858
859
859
rb_gc_functions = gc_functions ;
860
860
}
@@ -944,8 +944,8 @@ static VALUE initial_stress = Qfalse;
944
944
void *
945
945
rb_objspace_alloc (void )
946
946
{
947
- #if USE_SHARED_GC
948
- ruby_external_gc_init ();
947
+ #if USE_MODULAR_GC
948
+ ruby_modular_gc_init ();
949
949
#endif
950
950
951
951
void * objspace = rb_gc_impl_objspace_alloc ();
@@ -2870,10 +2870,10 @@ rb_gc_copy_attributes(VALUE dest, VALUE obj)
2870
2870
}
2871
2871
2872
2872
int
2873
- rb_gc_external_gc_loaded_p (void )
2873
+ rb_gc_modular_gc_loaded_p (void )
2874
2874
{
2875
- #if USE_SHARED_GC
2876
- return rb_gc_functions .external_gc_loaded_p ;
2875
+ #if USE_MODULAR_GC
2876
+ return rb_gc_functions .modular_gc_loaded_p ;
2877
2877
#else
2878
2878
return false;
2879
2879
#endif
@@ -3298,7 +3298,7 @@ update_superclasses(void *objspace, VALUE obj)
3298
3298
extern rb_symbols_t ruby_global_symbols ;
3299
3299
#define global_symbols ruby_global_symbols
3300
3300
3301
- #if USE_SHARED_GC
3301
+ #if USE_MODULAR_GC
3302
3302
struct global_vm_table_foreach_data {
3303
3303
vm_table_foreach_callback_func callback ;
3304
3304
vm_table_update_callback_func update_callback ;
0 commit comments