summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-22 05:24:50 (GMT)
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-22 05:24:50 (GMT)
commit33af0429ea875cd11d4ffbeff1c278d4cc10bb0e (patch)
treefbd4e91e2f4e601144b08dedd3236df5d6fc9e25 /iseq.c
parent84fd997fe6460e5fcccbae557e95068cf94cd55d (diff)
thread.c (rb_reset_coverages): remove coverage counters from all ISeqs
When coverage measurement is enabled, the compiler makes each iseq have a reference to the counter array of coverage. Even after coverage measurement is disabled, the reference is kept. And, if coverage measurement is restarted, a coverage hook will increase the counter. This is completely meaningless; it brings just overhead. To remove this meaninglessness, this change removes all the reference when coverage measuement is stopped. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/iseq.c b/iseq.c
index bb53518..68ca781 100644
--- a/iseq.c
+++ b/iseq.c
@@ -966,6 +966,25 @@ rb_iseq_coverage(const rb_iseq_t *iseq)
return ISEQ_COVERAGE(iseq);
}
+static int
+remove_coverage_i(void *vstart, void *vend, size_t stride, void *data)
+{
+ VALUE v = (VALUE)vstart;
+ for (; v != (VALUE)vend; v += stride) {
+ if (rb_obj_is_iseq(v)) {
+ rb_iseq_t *iseq = (rb_iseq_t *)v;
+ ISEQ_COVERAGE_SET(iseq, Qnil);
+ }
+ }
+ return 0;
+}
+
+void
+rb_iseq_remove_coverage_all()
+{
+ rb_objspace_each_objects(remove_coverage_i, NULL);
+}
+
/* define wrapper class methods (RubyVM::InstructionSequence) */
static void