[前][次][番号順一覧][スレッド一覧]

ruby-changes:42658

From: nobu <ko1@a...>
Date: Sat, 23 Apr 2016 20:20:59 +0900 (JST)
Subject: [ruby-changes:42658] nobu:r54732 (trunk): vm_insnhelper.c: getivar setivar optimization

nobu	2016-04-23 21:17:36 +0900 (Sat, 23 Apr 2016)

  New Revision: 54732

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54732

  Log:
    vm_insnhelper.c: getivar setivar optimization
    
    * vm_insnhelper.c (vm_getivar, vm_setivar): remove inline.
    
    * vm_insnhelper.c (vm_call_ivar, vm_call_attrset): tweak the order
      tail-call-optimization friendly.

  Modified files:
    trunk/vm_insnhelper.c
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 54731)
+++ vm_insnhelper.c	(revision 54732)
@@ -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
+static VALUE
 vm_getivar(VALUE obj, ID id, IC ic, struct rb_call_cache *cc, int is_attr)
 {
 #if USE_IC_FOR_IVAR
@@ -824,7 +824,7 @@ vm_getivar(VALUE obj, ID id, IC ic, stru https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L824
     return rb_ivar_get(obj, id);
 }
 
-static inline VALUE
+static VALUE
 vm_setivar(VALUE obj, ID id, VALUE val, IC ic, struct rb_call_cache *cc, int is_attr)
 {
 #if USE_IC_FOR_IVAR
@@ -1733,17 +1733,16 @@ vm_call_cfunc(rb_thread_t *th, rb_contro https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1733
 static VALUE
 vm_call_ivar(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
 {
-    VALUE val = vm_getivar(calling->recv, cc->me->def->body.attr.id, NULL, cc, 1);
     cfp->sp -= 1;
-    return val;
+    return vm_getivar(calling->recv, cc->me->def->body.attr.id, NULL, cc, 1);
 }
 
 static VALUE
 vm_call_attrset(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc)
 {
-    VALUE val = vm_setivar(calling->recv, cc->me->def->body.attr.id, *(cfp->sp - 1), NULL, cc, 1);
+    VALUE val = *(cfp->sp - 1);
     cfp->sp -= 2;
-    return val;
+    return vm_setivar(calling->recv, cc->me->def->body.attr.id, val, NULL, cc, 1);
 }
 
 static inline VALUE

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]