Move RUBY_ATOMIC_VALUE_LOAD to ruby_atomic.h

Deduplicates RUBY_ATOMIC_VALUE_LOAD by moving it to ruby_atomic.h.
This commit is contained in:
Peter Zhu 2025-06-25 09:25:52 -04:00
parent ec071c849f
commit aed7a95f9d
4 changed files with 2 additions and 6 deletions

2
gc.c
View file

@ -1851,8 +1851,6 @@ static const rb_data_type_t id2ref_tbl_type = {
.flags = RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FREE_IMMEDIATELY .flags = RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FREE_IMMEDIATELY
}; };
#define RUBY_ATOMIC_VALUE_LOAD(x) (VALUE)(RUBY_ATOMIC_PTR_LOAD(x))
static VALUE static VALUE
class_object_id(VALUE klass) class_object_id(VALUE klass)
{ {

View file

@ -3,6 +3,8 @@
#include "ruby/atomic.h" #include "ruby/atomic.h"
#define RUBY_ATOMIC_VALUE_LOAD(x) (VALUE)(RUBY_ATOMIC_PTR_LOAD(x))
/* shim macros only */ /* shim macros only */
#define ATOMIC_ADD(var, val) RUBY_ATOMIC_ADD(var, val) #define ATOMIC_ADD(var, val) RUBY_ATOMIC_ADD(var, val)
#define ATOMIC_CAS(var, oldval, newval) RUBY_ATOMIC_CAS(var, oldval, newval) #define ATOMIC_CAS(var, oldval, newval) RUBY_ATOMIC_CAS(var, oldval, newval)

View file

@ -525,8 +525,6 @@ rb_shape_alloc_new_child(ID id, rb_shape_t *shape, enum shape_type shape_type)
return new_shape; return new_shape;
} }
#define RUBY_ATOMIC_VALUE_LOAD(x) (VALUE)(RUBY_ATOMIC_PTR_LOAD(x))
static rb_shape_t * static rb_shape_t *
get_next_shape_internal_atomic(rb_shape_t *shape, ID id, enum shape_type shape_type, bool *variation_created, bool new_variations_allowed) get_next_shape_internal_atomic(rb_shape_t *shape, ID id, enum shape_type shape_type, bool *variation_created, bool new_variations_allowed)
{ {

View file

@ -645,8 +645,6 @@ fstring_table_probe_next(struct fstring_table_probe *probe)
} }
#endif #endif
#define RUBY_ATOMIC_VALUE_LOAD(x) (VALUE)(RUBY_ATOMIC_PTR_LOAD(x))
static void static void
fstring_insert_on_resize(struct fstring_table_struct *table, VALUE hash_code, VALUE value) fstring_insert_on_resize(struct fstring_table_struct *table, VALUE hash_code, VALUE value)
{ {