diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2026-05-16 09:19:05 -0400 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2026-05-16 10:11:28 -0400 |
| commit | ad1415546716a13d00fc7f0435a86b018a1a6731 (patch) | |
| tree | 933e868ffde0f8c444bb98d9cbeeec86db2b9ea4 | |
| parent | 4c0b5717831ee7d24bfdd32fbae405427f0eceb7 (diff) | |
Move GC object suffix to gc.h
| -rw-r--r-- | gc/default/default.c | 15 | ||||
| -rw-r--r-- | gc/gc.h | 23 |
2 files changed, 26 insertions, 12 deletions
diff --git a/gc/default/default.c b/gc/default/default.c index fa39ecc832..e51331b8bd 100644 --- a/gc/default/default.c +++ b/gc/default/default.c @@ -96,15 +96,6 @@ # include <mach/mach_port.h> #endif -#ifndef VM_CHECK_MODE -# define VM_CHECK_MODE RUBY_DEBUG -#endif - -// From ractor_core.h -#ifndef RACTOR_CHECK_MODE -# define RACTOR_CHECK_MODE (VM_CHECK_MODE || RUBY_DEBUG) && (SIZEOF_UINT64_T == SIZEOF_VALUE) -#endif - #ifndef RUBY_DEBUG_LOG # define RUBY_DEBUG_LOG(...) #endif @@ -691,10 +682,10 @@ typedef struct rb_objspace { #define HEAP_PAGE_ALIGN_LOG 16 #endif -#if RACTOR_CHECK_MODE || GC_DEBUG +#if RB_GC_OBJ_HAS_SUFFIX || GC_DEBUG struct rvalue_overhead { -# if RACTOR_CHECK_MODE - uint32_t _ractor_belonging_id; +# ifdef RB_GC_OBJ_HAS_SUFFIX + struct rb_gc_obj_suffix suffix; # endif # if GC_DEBUG const char *file; @@ -10,9 +10,32 @@ * first introduced for [Feature #20470]. */ #include "ruby/ruby.h" +#include "ruby/assert.h" #include "ruby/thread_native.h" +#ifndef VM_CHECK_MODE +# define VM_CHECK_MODE RUBY_DEBUG +#endif + +// From ractor_core.h +#ifndef RACTOR_CHECK_MODE +# define RACTOR_CHECK_MODE (VM_CHECK_MODE || RUBY_DEBUG) && (SIZEOF_UINT64_T == SIZEOF_VALUE) +#endif + +#if RACTOR_CHECK_MODE +void rb_ractor_setup_belonging(VALUE obj); + +struct rb_gc_obj_suffix { + uint32_t _ractor_belonging_id; +}; + +# define RB_GC_OBJ_HAS_SUFFIX 1 +# define RB_GC_OBJ_SUFFIX_SIZE (sizeof(struct rb_gc_obj_suffix)) +#else +# define RB_GC_OBJ_SUFFIX_SIZE 0 +#endif + struct rb_gc_vm_context { rb_nativethread_lock_t lock; |
