[前][次][番号順一覧][スレッド一覧]

ruby-changes:47653

From: mame <ko1@a...>
Date: Thu, 7 Sep 2017 21:36:05 +0900 (JST)
Subject: [ruby-changes:47653] mame:r59769 (trunk): Remove unneeded trace instruction for coverage

mame	2017-09-07 21:36:01 +0900 (Thu, 07 Sep 2017)

  New Revision: 59769

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59769

  Log:
    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.

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 59768)
+++ compile.c	(revision 59769)
@@ -6593,6 +6593,11 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK https://github.com/ruby/ruby/blob/trunk/compile.c#L6593
 	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();

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]