aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-07 12:36:01 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-07 12:36:01 +0000
commit371f6a19a2fbe8d5f325bd66b58b90d5f7cefe5f (patch)
tree04a6ddbdb327cb110831976f6cdfae982b642ec2
parent56c13cdce54ccaabaade39ff736f05f8c3e2fc7c (diff)
downloadruby-371f6a19a2fbe8d5f325bd66b58b90d5f7cefe5f.tar.gz
Remove unneeded trace instruction for coverage
When no instruction is emitted in `iseq_compile_each0` (i.e., when the line has no significant code), trace instruction for `RUBY_EVENT_LINE` has been optimized out. But trace for `RUBY_EVENT_COVERAGE` has not been removed. Now, it is also removed. `TestISeq#test_to_a_lines` has failed a long time under coverage measurement (`make test-all COVERAGE=true`). This change makes it pass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 23816a6cfd..203dce4a96 100644
--- a/compile.c
+++ b/compile.c
@@ -6593,6 +6593,11 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popp
ret->last == saved_last_element &&
((INSN *)saved_last_element)->insn_id == BIN(trace)) {
POP_ELEMENT(ret);
+ /* remove trace(coverage) */
+ if (((INSN *)ret->last)->insn_id == BIN(trace)) {
+ POP_ELEMENT(ret);
+ RARRAY_ASET(ISEQ_LINE_COVERAGE(iseq), line - 1, Qnil);
+ }
}
debug_node_end();