ruby-changes:42654
From: naruse <ko1@a...>
Date: Sat, 23 Apr 2016 17:20:14 +0900 (JST)
Subject: [ruby-changes:42654] naruse:r54728 (trunk): * vm_insnhelper.c (vm_getivar): specify inline instead of static inline.
naruse 2016-04-23 18:16:51 +0900 (Sat, 23 Apr 2016) New Revision: 54728 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54728 Log: * 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. Modified files: trunk/ChangeLog trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 54727) +++ ChangeLog (revision 54728) @@ -1,3 +1,23 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Apr 23 18:01:21 2016 NARUSE, Yui <naruse@r...> + + * 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@r...> * include/ruby/ruby.h (rb_mul_size_overflow): use UNLIKELY Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 54727) +++ vm_insnhelper.c (revision 54728) @@ -774,7 +774,7 @@ vm_search_const_defined_class(const VALU https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L774 #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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/