From c5a5279742774870f4f171a2c56a6595076a9882 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Fri, 3 Feb 2023 12:50:24 +0100 Subject: [PATCH] Enable write barrier protection on Resource Resources are not holding any references to Ruby objects as such they can be marked as WB protected without any change. This mean the Ruby garbage collect won't have to mark them on minor GC runs if the resource was promoted to oldgen. --- ext/semian/resource.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/semian/resource.c b/ext/semian/resource.c index b3a4d02f3..e35c5fc60 100644 --- a/ext/semian/resource.c +++ b/ext/semian/resource.c @@ -359,13 +359,13 @@ ms_to_timespec(long ms, struct timespec *ts) ts->tv_nsec = (ms % 1000) * 1000000; } -static inline void +static void semian_resource_mark(void *ptr) { /* noop */ } -static inline void +static void semian_resource_free(void *ptr) { semian_resource_t *res = (semian_resource_t *) ptr; @@ -376,7 +376,7 @@ semian_resource_free(void *ptr) xfree(res); } -static inline size_t +static size_t semian_resource_memsize(const void *ptr) { return sizeof(semian_resource_t); @@ -390,5 +390,5 @@ semian_resource_type = { semian_resource_free, semian_resource_memsize }, - NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY + NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED };