ruby-changes:49596
From: mame <ko1@a...>
Date: Tue, 9 Jan 2018 15:17:26 +0900 (JST)
Subject: [ruby-changes:49596] mame:r61711 (trunk): compile.c (iseq_compile_each0): remove irrelevant tracecoverage
mame 2018-01-09 15:17:21 +0900 (Tue, 09 Jan 2018) New Revision: 61711 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61711 Log: 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]>. Modified files: trunk/compile.c Index: compile.c =================================================================== --- compile.c (revision 61710) +++ compile.c (revision 61711) @@ -7169,6 +7169,18 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK https://github.com/ruby/ruby/blob/trunk/compile.c#L7169 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; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/