Skip to content

Commit cbac09c

Browse files
committed
Always inline rb_tr_wrap and rb_tr_unwrap in C for performance.
1 parent 1915b9a commit cbac09c

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,23 @@ typedef void *VALUE;
3131
typedef long SIGNED_VALUE;
3232
typedef VALUE ID;
3333

34-
// Wrapping and unwrapping of values.
35-
36-
VALUE rb_tr_wrap(VALUE);
37-
VALUE rb_tr_unwrap(VALUE);
38-
3934
// Support
4035

4136
extern void* rb_tr_cext;
4237
#define RUBY_CEXT ((void *)(&rb_tr_cext))
4338

4439
#define MUST_INLINE __attribute__((always_inline)) inline
4540

41+
// Wrapping and unwrapping of values.
42+
43+
MUST_INLINE VALUE rb_tr_wrap(VALUE object) {
44+
return polyglot_invoke(RUBY_CEXT, "rb_tr_wrap", object);
45+
}
46+
47+
MUST_INLINE VALUE rb_tr_unwrap(VALUE object) {
48+
return polyglot_invoke(RUBY_CEXT, "rb_tr_unwrap", object);
49+
}
50+
4651
#include <ruby/thread_native.h>
4752

4853
// Helpers

src/main/c/cext/ruby.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4623,11 +4623,3 @@ VALUE rb_syserr_new_str(int n, VALUE arg) {
46234623
VALUE rb_yield_values2(int argc, const VALUE *argv) {
46244624
rb_tr_error("rb_yield_values2 not implemented");
46254625
}
4626-
4627-
VALUE rb_tr_wrap(VALUE object) {
4628-
return polyglot_invoke(RUBY_CEXT, "rb_tr_wrap", object);
4629-
}
4630-
4631-
VALUE rb_tr_unwrap(VALUE object) {
4632-
return polyglot_invoke(RUBY_CEXT, "rb_tr_unwrap", object);
4633-
}

0 commit comments

Comments
 (0)