aboutsummaryrefslogtreecommitdiffstats
path: root/iseq.c
diff options
context:
space:
mode:
authortarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-11 12:50:38 +0000
committertarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-11 12:50:38 +0000
commit44916ec448373c56b02a8430da7f87af7febfe0f (patch)
tree94e8ea351d2be63dac3c3918b4005a12f6e9b79f /iseq.c
parentac8c23f1b5494a968d299b4b625449348f385eca (diff)
downloadruby-44916ec448373c56b02a8430da7f87af7febfe0f.tar.gz
* compile.c (iseq_compile_each): share InlineCache during same
instance variable accesses. Reducing memory consumption, rasing cache hit rate and rasing branch prediction hit rate are expected. A part of [Bug #12274]. * iseq.h (struct iseq_compile_data): introduce instance variable IC table for sharing. * iseq.c (prepare_iseq_build, compile_data_free): construct/destruct above table. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/iseq.c b/iseq.c
index 184e56d08d..2a4d58e611 100644
--- a/iseq.c
+++ b/iseq.c
@@ -58,6 +58,8 @@ compile_data_free(struct iseq_compile_data *compile_data)
ruby_xfree(cur);
cur = next;
}
+ st_free_table(compile_data->ivar_cache_table);
+
ruby_xfree(compile_data);
}
}
@@ -298,6 +300,8 @@ prepare_iseq_build(rb_iseq_t *iseq,
ISEQ_COMPILE_DATA(iseq)->option = option;
ISEQ_COMPILE_DATA(iseq)->last_coverable_line = -1;
+ ISEQ_COMPILE_DATA(iseq)->ivar_cache_table = st_init_numtable();
+
if (option->coverage_enabled) {
VALUE coverages = rb_get_coverages();
if (RTEST(coverages)) {