Skip to content

Commit ce1ad1b

Browse files
committed
Standardize on the name "modular GC"
We have name fragmentation for this feature, including "shared GC", "modular GC", and "external GC". This commit standardizes the feature name to "modular GC" and the implementation to "GC library".
1 parent 26ab20f commit ce1ad1b

File tree

16 files changed

+176
-176
lines changed

16 files changed

+176
-176
lines changed

.github/workflows/ubuntu.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
- test_task: check
3535
configure: '--enable-shared --enable-load-relative'
3636
- test_task: check
37-
shared_gc: true
38-
configure: '--with-shared-gc=/home/runner/ruby_gc'
37+
modular_gc: true
38+
configure: '--with-modular-gc=/home/runner/ruby_gc'
3939
- test_task: test-bundler-parallel
4040
timeout: 50
4141
- test_task: test-bundled-gems
@@ -99,12 +99,12 @@ jobs:
9999

100100
- run: $SETARCH make
101101

102-
- name: Build shared GC
102+
- name: Build modular GC
103103
run: |
104104
echo "RUBY_GC_LIBRARY=default" >> $GITHUB_ENV
105-
make shared-gc SHARED_GC=default
106-
make distclean-shared-gc SHARED_GC=default
107-
if: ${{ matrix.shared_gc }}
105+
make modular-gc MODULAR_GC=default
106+
make distclean-modular-gc MODULAR_GC=default
107+
if: ${{ matrix.modular_gc }}
108108

109109
- run: |
110110
$SETARCH make golf

NEWS.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,13 @@ details of the default gems or bundled gems.
315315
* Array#each is rewritten in Ruby for better performance [[Feature #20182]].
316316
317317
* Alternative GC implementations can be loaded dynamically. Configure Ruby
318-
`--with-shared-gc` to enable. Alternative GC libraries can be loaded at runtime
318+
`--with-modular-gc` to enable. Alternative GC libraries can be loaded at runtime
319319
using the environment variable `RUBY_GC_LIBRARY`. [[Feature #20351]],
320320
[[Feature #20470]]
321321
322322
* An experimental GC library is provided based on MMTk. Configure Ruby
323-
`--with-shared-gc`, build as normal, then build the GC library: `make
324-
shared-gc SHARED_GC=mmtk`. Enable with `RUBY_GC_LIBRARY=mmtk`. This
323+
`--with-modular-gc`, build as normal, then build the GC library: `make
324+
modular-gc MODULAR_GC=mmtk`. Enable with `RUBY_GC_LIBRARY=mmtk`. This
325325
requires a working Rust compiler, and Cargo on the build machine.
326326
[[Feature #20860]]
327327

common.mk

+13-13
Original file line numberDiff line numberDiff line change
@@ -1944,23 +1944,23 @@ rewindable:
19441944

19451945
HELP_EXTRA_TASKS = ""
19461946

1947-
shared-gc-precheck:
1948-
shared-gc: probes.h shared-gc-precheck
1949-
$(Q) $(MAKEDIRS) $(shared_gc_dir)
1947+
modular-gc-precheck:
1948+
modular-gc: probes.h modular-gc-precheck
1949+
$(Q) $(MAKEDIRS) $(modular_gc_dir)
19501950
$(Q) $(RUNRUBY) $(srcdir)/ext/extmk.rb \
19511951
$(SCRIPT_ARGS) \
19521952
--make='$(MAKE)' --make-flags="V=$(V) MINIRUBY='$(MINIRUBY)'" \
19531953
--gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \
1954-
--ext-build-dir=gc --command-output=gc/$(SHARED_GC)/exts.mk -- \
1955-
configure gc/$(SHARED_GC)
1956-
$(CHDIR) gc/$(SHARED_GC) && $(exec) $(MAKE) TARGET_SO_DIR=./
1957-
$(CP) gc/$(SHARED_GC)/librubygc.$(SHARED_GC).$(DLEXT) $(shared_gc_dir)
1958-
1959-
clean-shared-gc:
1960-
- $(CHDIR) gc/$(SHARED_GC) && $(exec) $(MAKE) TARGET_SO_DIR=./ clean || $(NULLCMD)
1961-
distclean-shared-gc: clean-shared-gc
1962-
- $(CHDIR) gc/$(SHARED_GC) && $(exec) $(MAKE) TARGET_SO_DIR=./ distclean || $(NULLCMD)
1963-
$(RMDIRS) gc/$(SHARED_GC)
1954+
--ext-build-dir=gc --command-output=gc/$(MODULAR_GC)/exts.mk -- \
1955+
configure gc/$(MODULAR_GC)
1956+
$(CHDIR) gc/$(MODULAR_GC) && $(exec) $(MAKE) TARGET_SO_DIR=./
1957+
$(CP) gc/$(MODULAR_GC)/librubygc.$(MODULAR_GC).$(DLEXT) $(modular_gc_dir)
1958+
1959+
clean-modular-gc:
1960+
- $(CHDIR) gc/$(MODULAR_GC) && $(exec) $(MAKE) TARGET_SO_DIR=./ clean || $(NULLCMD)
1961+
distclean-modular-gc: clean-modular-gc
1962+
- $(CHDIR) gc/$(MODULAR_GC) && $(exec) $(MAKE) TARGET_SO_DIR=./ distclean || $(NULLCMD)
1963+
$(RMDIRS) gc/$(MODULAR_GC)
19641964

19651965
help: PHONY
19661966
$(MESSAGE_BEGIN) \

configure.ac

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ RUBY_M4_INCLUDE([ruby_replace_type.m4])dnl
4545
RUBY_M4_INCLUDE([ruby_require_funcs.m4])dnl
4646
RUBY_M4_INCLUDE([ruby_rm_recursive.m4])dnl
4747
RUBY_M4_INCLUDE([ruby_setjmp_type.m4])dnl
48-
RUBY_M4_INCLUDE([ruby_shared_gc.m4])dnl
48+
RUBY_M4_INCLUDE([ruby_modular_gc.m4])dnl
4949
RUBY_M4_INCLUDE([ruby_stack_grow_direction.m4])dnl
5050
RUBY_M4_INCLUDE([ruby_thread.m4])dnl
5151
RUBY_M4_INCLUDE([ruby_try_cflags.m4])dnl
@@ -3795,7 +3795,7 @@ AS_IF([test x"$gcov" = xyes], [
37953795
])
37963796

37973797
RUBY_SETJMP_TYPE
3798-
RUBY_SHARED_GC
3798+
RUBY_MODULAR_GC
37993799
}
38003800

38013801
[begin]_group "installation section" && {
@@ -4721,7 +4721,7 @@ config_summary "target OS" "$target_os"
47214721
config_summary "compiler" "$CC"
47224722
config_summary "with thread" "$THREAD_MODEL"
47234723
config_summary "with coroutine" "$coroutine_type"
4724-
config_summary "with shared GC" "$shared_gc_summary"
4724+
config_summary "with modular GC" "$modular_gc_summary"
47254725
config_summary "enable shared libs" "$ENABLE_SHARED"
47264726
config_summary "dynamic library ext" "$DLEXT"
47274727
config_summary "CFLAGS" "$cflags"

gc.c

+83-83
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ rb_gc_vm_barrier(void)
178178
rb_vm_barrier();
179179
}
180180

181-
#if USE_SHARED_GC
181+
#if USE_MODULAR_GC
182182
void *
183183
rb_gc_get_ractor_newobj_cache(void)
184184
{
@@ -617,9 +617,9 @@ rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val)
617617
static const char *obj_type_name(VALUE obj);
618618
#include "gc/default/default.c"
619619

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
623623
#include <dlfcn.h>
624624

625625
typedef struct gc_function_map {
@@ -702,18 +702,18 @@ typedef struct gc_function_map {
702702
// GC Identification
703703
const char *(*active_gc_name)(void);
704704

705-
bool external_gc_loaded_p;
705+
bool modular_gc_loaded_p;
706706
} rb_gc_function_map_t;
707707

708708
static rb_gc_function_map_t rb_gc_functions;
709709

710710
# define RUBY_GC_LIBRARY "RUBY_GC_LIBRARY"
711711

712712
static void
713-
ruby_external_gc_init(void)
713+
ruby_modular_gc_init(void)
714714
{
715715
// 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] == '/');
717717

718718
char *gc_so_file = getenv(RUBY_GC_LIBRARY);
719719

@@ -737,14 +737,14 @@ ruby_external_gc_init(void)
737737
}
738738
}
739739

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;
741741
gc_so_path = alloca(gc_so_path_size);
742742
{
743743
size_t gc_so_path_idx = 0;
744744
#define GC_SO_PATH_APPEND(str) do { \
745745
gc_so_path_idx += strlcpy(gc_so_path + gc_so_path_idx, str, gc_so_path_size - gc_so_path_idx); \
746746
} while (0)
747-
GC_SO_PATH_APPEND(SHARED_GC_DIR);
747+
GC_SO_PATH_APPEND(MODULAR_GC_DIR);
748748
GC_SO_PATH_APPEND("librubygc.");
749749
GC_SO_PATH_APPEND(gc_so_file);
750750
GC_SO_PATH_APPEND(DLEXT);
@@ -754,19 +754,19 @@ ruby_external_gc_init(void)
754754

755755
handle = dlopen(gc_so_path, RTLD_LAZY | RTLD_GLOBAL);
756756
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());
758758
exit(1);
759759
}
760760

761-
gc_functions.external_gc_loaded_p = true;
761+
gc_functions.modular_gc_loaded_p = true;
762762
}
763763

764-
# define load_external_gc_func(name) do { \
764+
# define load_modular_gc_func(name) do { \
765765
if (handle) { \
766766
const char *func_name = "rb_gc_impl_" #name; \
767767
gc_functions.name = dlsym(handle, func_name); \
768768
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); \
770770
exit(1); \
771771
} \
772772
} \
@@ -776,85 +776,85 @@ ruby_external_gc_init(void)
776776
} while (0)
777777

778778
// 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);
787787
// Shutdown
788-
load_external_gc_func(shutdown_free_objects);
788+
load_modular_gc_func(shutdown_free_objects);
789789
// 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);
800800
// 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);
805805
// 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);
811811
// 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);
818818
// 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);
821821
// 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);
825825
// 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);
828828
// 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);
834834
// 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);
837837
// 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);
840840
// 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);
848848
// 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);
854854
//GC Identification
855-
load_external_gc_func(active_gc_name);
855+
load_modular_gc_func(active_gc_name);
856856

857-
# undef load_external_gc_func
857+
# undef load_modular_gc_func
858858

859859
rb_gc_functions = gc_functions;
860860
}
@@ -944,8 +944,8 @@ static VALUE initial_stress = Qfalse;
944944
void *
945945
rb_objspace_alloc(void)
946946
{
947-
#if USE_SHARED_GC
948-
ruby_external_gc_init();
947+
#if USE_MODULAR_GC
948+
ruby_modular_gc_init();
949949
#endif
950950

951951
void *objspace = rb_gc_impl_objspace_alloc();
@@ -2870,10 +2870,10 @@ rb_gc_copy_attributes(VALUE dest, VALUE obj)
28702870
}
28712871

28722872
int
2873-
rb_gc_external_gc_loaded_p(void)
2873+
rb_gc_modular_gc_loaded_p(void)
28742874
{
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;
28772877
#else
28782878
return false;
28792879
#endif
@@ -3298,7 +3298,7 @@ update_superclasses(void *objspace, VALUE obj)
32983298
extern rb_symbols_t ruby_global_symbols;
32993299
#define global_symbols ruby_global_symbols
33003300

3301-
#if USE_SHARED_GC
3301+
#if USE_MODULAR_GC
33023302
struct global_vm_table_foreach_data {
33033303
vm_table_foreach_callback_func callback;
33043304
vm_table_update_callback_func update_callback;

gc/default/default.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "gc/gc.h"
3030
#include "gc/gc_impl.h"
3131

32-
#ifndef BUILDING_SHARED_GC
32+
#ifndef BUILDING_MODULAR_GC
3333
# include "probes.h"
3434
#endif
3535

@@ -8466,7 +8466,7 @@ gc_prof_timer_stop(rb_objspace_t *objspace)
84668466
}
84678467
}
84688468

8469-
#ifdef BUILDING_SHARED_GC
8469+
#ifdef BUILDING_MODULAR_GC
84708470
# define RUBY_DTRACE_GC_HOOK(name)
84718471
#else
84728472
# define RUBY_DTRACE_GC_HOOK(name) \

0 commit comments

Comments
 (0)