summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-09 06:17:21 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-09 06:17:21 +0000
commitcdd77289afc9e2b18f33bed1c4ecb1d3e02bd8f0 (patch)
tree1c257c1e56fcf58a29bf5902dcfe3c199c79e85a
parent3cfa84d562d85f4ba8e4ad2aea08ef606c9b68a5 (diff)
compile.c (iseq_compile_each0): remove irrelevant tracecoverage
This change removes tracecoverage instructions on a line that has any NODE but is non-significant, such as, just one literal. This fixes the following failure that occurs only when coverage is enabled: 1) Failure: TestISeq#test_to_a_lines [.../ruby/test/ruby/test_iseq.rb:56]: <[3, 4, 7, 9]> expected but was <[3, 4, 5, 6, 7, 8, 9]>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 3d94cf1bad..6d9d0f4180 100644
--- a/compile.c
+++ b/compile.c
@@ -7169,6 +7169,18 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
return COMPILE_NG;
}
+ /* remove tracecoverage instruction if there is no relevant instruction */
+ if (IS_TRACE(ret->last) && ((TRACE*) ret->last)->event == RUBY_EVENT_LINE) {
+ LINK_ELEMENT *insn = ret->last->prev;
+ if (IS_INSN(insn) &&
+ IS_INSN_ID(insn, tracecoverage) &&
+ FIX2LONG(OPERAND_AT(insn, 0)) == RUBY_EVENT_COVERAGE_LINE
+ ) {
+ ELEM_REMOVE(insn); /* remove tracecovearge */
+ RARRAY_ASET(ISEQ_LINE_COVERAGE(iseq), line - 1, Qnil);
+ }
+ }
+
debug_node_end();
return COMPILE_OK;
}