summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorUrabe, Shyouhei <shyouhei@ruby-lang.org>2018-10-11 11:47:49 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-09-04 14:08:40 +0900
commit2a6457b5b7d67378528235cee7b9cb93fed00204 (patch)
tree259635fccbca1b111074c5c0f3f2e81f235fec6f /include
parentccad34f4533ffe532fea796def06808dc5a85877 (diff)
add rb_funcallv_with_cc()
Why not cache the method entry at each caller site. The void** is in fact a method entry, but this struct is hidden from ruby.h so intentionally left opaque.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/1981
Diffstat (limited to 'include')
-rw-r--r--include/ruby/ruby.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 53d4eabc0a..67ef3f4df2 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -1892,6 +1892,10 @@ VALUE rb_funcallv_public(VALUE, ID, int, const VALUE*);
#define rb_funcall3 rb_funcallv_public
VALUE rb_funcall_passing_block(VALUE, ID, int, const VALUE*);
VALUE rb_funcall_with_block(VALUE, ID, int, const VALUE*, VALUE);
+#if GCC_VERSION_SINCE(3, 3, 0)
+__attribute__((__nonnull__ (1))) /* TODO: should check using configure */
+#endif
+VALUE rb_funcallv_with_cc(void**, VALUE, ID, int, const VALUE*);
int rb_scan_args(int, const VALUE*, const char*, ...);
VALUE rb_call_super(int, const VALUE*);
VALUE rb_current_receiver(void);
@@ -2607,10 +2611,19 @@ __extension__({ \
const VALUE rb_funcall_args[] = {__VA_ARGS__}; \
const int rb_funcall_nargs = \
(int)(sizeof(rb_funcall_args) / sizeof(VALUE)); \
- rb_funcallv(recv, mid, \
+ static void *rb_funcall_opaque_cc = NULL; \
+ rb_funcallv_with_cc(&rb_funcall_opaque_cc, \
+ recv, mid, \
rb_varargs_argc_check(rb_funcall_argc, rb_funcall_nargs), \
rb_funcall_nargs ? rb_funcall_args : NULL); \
})
+
+# define rb_funcallv(recv, mid, argc, argv) \
+__extension__({ \
+ static void *rb_funcallv_opaque_cc = NULL; \
+ rb_funcallv_with_cc(&rb_funcallv_opaque_cc, \
+ recv, mid, argc,argv); \
+ })
#endif
#ifndef RUBY_DONT_SUBST