From 5307c65c76774f8a5964ccdb8ed94412962b5eaa Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 17 Sep 2024 10:41:47 -0400 Subject: [PATCH] Make rb_gc_impl_set_measure_total_time return void --- gc.c | 2 +- gc.rb | 3 ++- gc/default.c | 4 +--- gc/gc_impl.h | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gc.c b/gc.c index 87c613395d..df3c263fc5 100644 --- a/gc.c +++ b/gc.c @@ -634,7 +634,7 @@ typedef struct gc_function_map { VALUE (*object_id)(void *objspace_ptr, VALUE obj); VALUE (*object_id_to_ref)(void *objspace_ptr, VALUE object_id); // 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); unsigned long long (*get_total_time)(void *objspace_ptr); size_t (*gc_count)(void *objspace_ptr); diff --git a/gc.rb b/gc.rb index 4db1a178f9..1482a6bd72 100644 --- a/gc.rb +++ b/gc.rb @@ -331,7 +331,8 @@ module GC # Note that \GC time measurement can cause some performance overhead. def self.measure_total_time=(flag) 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 diff --git a/gc/default.c b/gc/default.c index 51bfb4b5e5..5eddeff0cf 100644 --- a/gc/default.c +++ b/gc/default.c @@ -1533,14 +1533,12 @@ rb_gc_impl_get_total_time(void *objspace_ptr) return marking_time + sweeping_time; } -VALUE +void rb_gc_impl_set_measure_total_time(void *objspace_ptr, VALUE flag) { rb_objspace_t *objspace = objspace_ptr; objspace->flags.measure_gc = RTEST(flag) ? TRUE : FALSE; - - return flag; } VALUE diff --git a/gc/gc_impl.h b/gc/gc_impl.h index 9f20597602..5e6d295477 100644 --- a/gc/gc_impl.h +++ b/gc/gc_impl.h @@ -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_to_ref(void *objspace_ptr, VALUE object_id); // 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 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);