Move return value of rb_gc_impl_config_set to gc.c

This commit is contained in:
Peter Zhu 2024-10-10 13:33:51 -04:00
parent ebbb093094
commit 3d8fe462df
Notes: git 2024-10-10 18:35:12 +00:00
3 changed files with 9 additions and 6 deletions

8
gc.c
View File

@ -588,7 +588,7 @@ typedef struct gc_function_map {
void (*gc_disable)(void *objspace_ptr, bool finish_current_gc); void (*gc_disable)(void *objspace_ptr, bool finish_current_gc);
bool (*gc_enabled_p)(void *objspace_ptr); bool (*gc_enabled_p)(void *objspace_ptr);
VALUE (*config_get)(void *objpace_ptr); VALUE (*config_get)(void *objpace_ptr);
VALUE (*config_set)(void *objspace_ptr, VALUE hash); void (*config_set)(void *objspace_ptr, VALUE hash);
void (*stress_set)(void *objspace_ptr, VALUE flag); void (*stress_set)(void *objspace_ptr, VALUE flag);
VALUE (*stress_get)(void *objspace_ptr); VALUE (*stress_get)(void *objspace_ptr);
// Object allocation // Object allocation
@ -3432,7 +3432,11 @@ gc_config_get(rb_execution_context_t *ec, VALUE self)
static VALUE static VALUE
gc_config_set(rb_execution_context_t *ec, VALUE self, VALUE hash) gc_config_set(rb_execution_context_t *ec, VALUE self, VALUE hash)
{ {
return rb_gc_impl_config_set(rb_gc_get_objspace(), hash); void *objspace = rb_gc_get_objspace();
rb_gc_impl_config_set(objspace, hash);
return rb_gc_impl_config_get(objspace);
} }
static VALUE static VALUE

View File

@ -7718,7 +7718,7 @@ gc_config_set_key(st_data_t key, st_data_t value, st_data_t data)
return ST_CONTINUE; return ST_CONTINUE;
} }
VALUE void
rb_gc_impl_config_set(void *objspace_ptr, VALUE hash) rb_gc_impl_config_set(void *objspace_ptr, VALUE hash)
{ {
rb_objspace_t *objspace = objspace_ptr; rb_objspace_t *objspace = objspace_ptr;
@ -7728,7 +7728,6 @@ rb_gc_impl_config_set(void *objspace_ptr, VALUE hash)
} }
rb_hash_stlike_foreach(hash, gc_config_set_key, (st_data_t)objspace); rb_hash_stlike_foreach(hash, gc_config_set_key, (st_data_t)objspace);
return rb_gc_impl_config_get(objspace_ptr);
} }
VALUE VALUE

View File

@ -45,7 +45,7 @@ GC_IMPL_FN bool rb_gc_impl_gc_enabled_p(void *objspace_ptr);
GC_IMPL_FN void rb_gc_impl_stress_set(void *objspace_ptr, VALUE flag); GC_IMPL_FN void rb_gc_impl_stress_set(void *objspace_ptr, VALUE flag);
GC_IMPL_FN VALUE rb_gc_impl_stress_get(void *objspace_ptr); GC_IMPL_FN VALUE rb_gc_impl_stress_get(void *objspace_ptr);
GC_IMPL_FN VALUE rb_gc_impl_config_get(void *objspace_ptr); GC_IMPL_FN VALUE rb_gc_impl_config_get(void *objspace_ptr);
GC_IMPL_FN VALUE rb_gc_impl_config_set(void *objspace_ptr, VALUE hash); GC_IMPL_FN void rb_gc_impl_config_set(void *objspace_ptr, VALUE hash);
// Object allocation // Object allocation
GC_IMPL_FN VALUE rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, bool wb_protected, size_t alloc_size); GC_IMPL_FN VALUE rb_gc_impl_new_obj(void *objspace_ptr, void *cache_ptr, VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, bool wb_protected, size_t alloc_size);
GC_IMPL_FN size_t rb_gc_impl_obj_slot_size(VALUE obj); GC_IMPL_FN size_t rb_gc_impl_obj_slot_size(VALUE obj);