aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-23 09:16:51 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-23 09:16:51 +0000
commit3de227bdcbcabc9040d0a7a7a0d6a24393e50753 (patch)
treebfbd8c553d8a2460d97de63ea19b76a1ba4db022
parent973ba3e8e24f4497aebcbd3819fc9c0f38a7909f (diff)
downloadruby-3de227bdcbcabc9040d0a7a7a0d6a24393e50753.tar.gz
* vm_insnhelper.c (vm_getivar): specify inline instead of static inline.
vm_getivar is called by vm_call_ivar and vm_getinstancevariable. At least with GCC 4.8 and 5.3 on Linux, they are inlining it into vm_call_ivar but not vm_getinstancevariable. By `inline`, they correctly inline it and gains performance. Speedup ratio: compare with the result of `ruby 2.4.0dev (2016-04-23 trunk 54727) [x86_64-linux]' (greater is better) name built-ruby loop_whileloop 1.001 vm1_ivar* 1.189 vm1_ivar_set* 1.024 Note tha `inline`'s meaning is different between old GCC and C99. Old GCC's inline means C99's extern inline. https://gcc.gnu.org/onlinedocs/gcc/Inline.html Since Ruby specify -std=iso9899:1999, it works like C99. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog20
-rw-r--r--vm_insnhelper.c2
2 files changed, 21 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index dc2141ed94..55d7102d1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+Sat Apr 23 18:01:21 2016 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_getivar): specify inline instead of static inline.
+ vm_getivar is called by vm_call_ivar and vm_getinstancevariable.
+ At least with GCC 4.8 and 5.3 on Linux, they are inlining it into
+ vm_call_ivar but not vm_getinstancevariable.
+ By `inline`, they correctly inline it and gains performance.
+
+ Speedup ratio: compare with the result of `ruby 2.4.0dev (2016-04-23
+ trunk 54727) [x86_64-linux]' (greater is better)
+ name built-ruby
+ loop_whileloop 1.001
+ vm1_ivar* 1.189
+ vm1_ivar_set* 1.024
+
+ Note tha `inline`'s meaning is different between old GCC
+ and C99. Old GCC's inline means C99's extern inline.
+ https://gcc.gnu.org/onlinedocs/gcc/Inline.html
+ Since Ruby specify -std=iso9899:1999, it works like C99.
+
Sat Apr 23 16:11:39 2016 NARUSE, Yui <naruse@ruby-lang.org>
* include/ruby/ruby.h (rb_mul_size_overflow): use UNLIKELY
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 0f27c9ee23..7015d0417c 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -774,7 +774,7 @@ vm_search_const_defined_class(const VALUE cbase, ID id)
#define USE_IC_FOR_IVAR 1
#endif
-static inline VALUE
+inline VALUE
vm_getivar(VALUE obj, ID id, IC ic, struct rb_call_cache *cc, int is_attr)
{
#if USE_IC_FOR_IVAR