aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-23 12:17:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-23 12:17:36 +0000
commit8c3d9d99d6955a93a4d9176536a454ccbab96186 (patch)
tree4360d375fa710e716d256705c5a738244d4da9dc
parent12ef609f5e1cc9487541f4e4a0c7a543a91a6b6c (diff)
downloadruby-8c3d9d99d6955a93a4d9176536a454ccbab96186.tar.gz
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--vm_insnhelper.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 0f27c9ee23..b6059a4554 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
+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, struct rb_call_cache *cc, int is_attr)
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_control_frame_t *reg_cfp, struct rb_calling_in
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