Make rb_gc_impl_set_measure_total_time return void

This commit is contained in:
Peter Zhu 2024-09-17 10:41:47 -04:00
parent b203e667c9
commit 5307c65c76
Notes: git 2024-09-17 20:36:09 +00:00
4 changed files with 5 additions and 6 deletions

2
gc.c
View file

@ -634,7 +634,7 @@ typedef struct gc_function_map {
VALUE (*object_id)(void *objspace_ptr, VALUE obj); VALUE (*object_id)(void *objspace_ptr, VALUE obj);
VALUE (*object_id_to_ref)(void *objspace_ptr, VALUE object_id); VALUE (*object_id_to_ref)(void *objspace_ptr, VALUE object_id);
// Statistics // Statistics
VALUE (*set_measure_total_time)(void *objspace_ptr, VALUE flag); void (*set_measure_total_time)(void *objspace_ptr, VALUE flag);
VALUE (*get_measure_total_time)(void *objspace_ptr); VALUE (*get_measure_total_time)(void *objspace_ptr);
unsigned long long (*get_total_time)(void *objspace_ptr); unsigned long long (*get_total_time)(void *objspace_ptr);
size_t (*gc_count)(void *objspace_ptr); size_t (*gc_count)(void *objspace_ptr);

3
gc.rb
View file

@ -331,7 +331,8 @@ module GC
# Note that \GC time measurement can cause some performance overhead. # Note that \GC time measurement can cause some performance overhead.
def self.measure_total_time=(flag) def self.measure_total_time=(flag)
Primitive.cstmt! %{ Primitive.cstmt! %{
return rb_gc_impl_set_measure_total_time(rb_gc_get_objspace(), flag); rb_gc_impl_set_measure_total_time(rb_gc_get_objspace(), flag);
return flag;
} }
end end

View file

@ -1533,14 +1533,12 @@ rb_gc_impl_get_total_time(void *objspace_ptr)
return marking_time + sweeping_time; return marking_time + sweeping_time;
} }
VALUE void
rb_gc_impl_set_measure_total_time(void *objspace_ptr, VALUE flag) rb_gc_impl_set_measure_total_time(void *objspace_ptr, VALUE flag)
{ {
rb_objspace_t *objspace = objspace_ptr; rb_objspace_t *objspace = objspace_ptr;
objspace->flags.measure_gc = RTEST(flag) ? TRUE : FALSE; objspace->flags.measure_gc = RTEST(flag) ? TRUE : FALSE;
return flag;
} }
VALUE VALUE

View file

@ -85,7 +85,7 @@ GC_IMPL_FN void rb_gc_impl_shutdown_call_finalizer(void *objspace_ptr);
GC_IMPL_FN VALUE rb_gc_impl_object_id(void *objspace_ptr, VALUE obj); GC_IMPL_FN VALUE rb_gc_impl_object_id(void *objspace_ptr, VALUE obj);
GC_IMPL_FN VALUE rb_gc_impl_object_id_to_ref(void *objspace_ptr, VALUE object_id); GC_IMPL_FN VALUE rb_gc_impl_object_id_to_ref(void *objspace_ptr, VALUE object_id);
// Statistics // Statistics
GC_IMPL_FN VALUE rb_gc_impl_set_measure_total_time(void *objspace_ptr, VALUE flag); GC_IMPL_FN void rb_gc_impl_set_measure_total_time(void *objspace_ptr, VALUE flag);
GC_IMPL_FN VALUE rb_gc_impl_get_measure_total_time(void *objspace_ptr); GC_IMPL_FN VALUE rb_gc_impl_get_measure_total_time(void *objspace_ptr);
GC_IMPL_FN unsigned long long rb_gc_impl_get_total_time(void *objspace_ptr); GC_IMPL_FN unsigned long long rb_gc_impl_get_total_time(void *objspace_ptr);
GC_IMPL_FN size_t rb_gc_impl_gc_count(void *objspace_ptr); GC_IMPL_FN size_t rb_gc_impl_gc_count(void *objspace_ptr);