Use BUILDING_SHARED_GC instead of RB_AMALGAMATED_DEFAULT_GC

We can use the BUILDING_SHARED_GC flag to check if we're building gc_impl.h
as a shared GC or building the default GC.
This commit is contained in:
Peter Zhu 2024-12-03 13:30:49 -05:00
parent f43585b02c
commit 62b51d9ad7
Notes: git 2024-12-04 15:26:07 +00:00
2 changed files with 3 additions and 4 deletions

1
gc.c
View File

@ -615,7 +615,6 @@ rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val)
#endif
static const char *obj_type_name(VALUE obj);
#define RB_AMALGAMATED_DEFAULT_GC
#include "gc/default/default.c"
#if USE_SHARED_GC && !defined(HAVE_DLOPEN)

View File

@ -10,6 +10,9 @@
*/
#include "ruby/ruby.h"
#ifdef BUILDING_SHARED_GC
# define GC_IMPL_FN
#else
// `GC_IMPL_FN` is an implementation detail of `!USE_SHARED_GC` builds
// to have the default GC in the same translation unit as gc.c for
// the sake of optimizer visibility. It expands to nothing unless
@ -18,10 +21,7 @@
// For the default GC, do not copy-paste this when implementing
// these functions. This takes advantage of internal linkage winning
// when appearing first. See C99 6.2.2p4.
#ifdef RB_AMALGAMATED_DEFAULT_GC
# define GC_IMPL_FN static
#else
# define GC_IMPL_FN
#endif
// Bootup