Skip to content

Commit 05f3773

Browse files
committed
Manually inline rb_tr_gc_guard() in its only usage
1 parent d962d92 commit 05f3773

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

lib/cext/include/ruby/ruby.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ bool RB_TYPE_P(VALUE value, int type);
562562
#ifdef __GNUC__
563563
#define RB_GC_GUARD(v) \
564564
(*__extension__ ({ \
565-
volatile VALUE *rb_gc_guarded_ptr = rb_tr_gc_guard(&v); \
565+
polyglot_invoke(RUBY_CEXT, "rb_tr_gc_guard", v); \
566+
volatile VALUE *rb_gc_guarded_ptr = &v; \
566567
rb_gc_guarded_ptr; \
567568
}))
568569
#elif defined _MSC_VER

lib/cext/include/truffleruby/truffleruby-pre.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ extern void* (*rb_tr_unwrap)(VALUE obj);
5252
extern VALUE (*rb_tr_wrap)(void *obj);
5353
extern VALUE (*rb_tr_longwrap)(long obj);
5454

55-
// Needed for GC guarding
56-
57-
ALWAYS_INLINE(static VALUE* rb_tr_gc_guard(VALUE *ptr));
58-
static inline VALUE* rb_tr_gc_guard(VALUE *ptr) {
59-
polyglot_invoke(RUBY_CEXT, "rb_tr_gc_guard", *ptr);
60-
return ptr;
61-
}
6255

6356
#define RB_NIL_P(value) ((int)polyglot_as_boolean(polyglot_invoke(rb_tr_cext, "RB_NIL_P", value)))
6457

0 commit comments

Comments
 (0)