Skip to content

Commit 7e39ed6

Browse files
casperisfinebyroot
andauthored
Enable write barrier protection on Resource (#469)
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. Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
1 parent 293a390 commit 7e39ed6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/semian/resource.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,13 @@ ms_to_timespec(long ms, struct timespec *ts)
359359
ts->tv_nsec = (ms % 1000) * 1000000;
360360
}
361361

362-
static inline void
362+
static void
363363
semian_resource_mark(void *ptr)
364364
{
365365
/* noop */
366366
}
367367

368-
static inline void
368+
static void
369369
semian_resource_free(void *ptr)
370370
{
371371
semian_resource_t *res = (semian_resource_t *) ptr;
@@ -376,7 +376,7 @@ semian_resource_free(void *ptr)
376376
xfree(res);
377377
}
378378

379-
static inline size_t
379+
static size_t
380380
semian_resource_memsize(const void *ptr)
381381
{
382382
return sizeof(semian_resource_t);
@@ -390,5 +390,5 @@ semian_resource_type = {
390390
semian_resource_free,
391391
semian_resource_memsize
392392
},
393-
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
393+
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
394394
};

0 commit comments

Comments
 (0)