diff options
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -240,16 +240,20 @@ struct iseq_compile_data_ensure_node_stack { #define ADD_SEND_R(seq, line, id, argc, block, flag, keywords) \ ADD_ELEM((seq), (LINK_ELEMENT *) new_insn_send(iseq, (line), (id), (VALUE)(argc), (block), (VALUE)(flag), (keywords))) -#define ADD_TRACE(seq, line, event) \ +#define ADD_TRACE_LINE_COVERAGE(seq, line) \ do { \ - if ((event) == RUBY_EVENT_LINE && ISEQ_COVERAGE(iseq) && \ + if (ISEQ_COVERAGE(iseq) && \ ISEQ_LINE_COVERAGE(iseq) && \ (line) > 0 && \ (line) != ISEQ_COMPILE_DATA(iseq)->last_coverable_line) { \ RARRAY_ASET(ISEQ_LINE_COVERAGE(iseq), (line) - 1, INT2FIX(0)); \ ISEQ_COMPILE_DATA(iseq)->last_coverable_line = (line); \ - ADD_INSN1((seq), (line), trace, INT2FIX(RUBY_EVENT_COVERAGE)); \ + ADD_INSN2((seq), (line), trace2, INT2FIX(RUBY_EVENT_COVERAGE), INT2FIX(COVERAGE_INDEX_LINES)); \ } \ + } while (0) + +#define ADD_TRACE(seq, line, event) \ + do { \ if (ISEQ_COMPILE_DATA(iseq)->option->trace_instruction) { \ ADD_INSN1((seq), (line), trace, INT2FIX(event)); \ } \ @@ -4844,6 +4848,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popp else { if (node->flags & NODE_FL_NEWLINE) { ISEQ_COMPILE_DATA(iseq)->last_line = line; + ADD_TRACE_LINE_COVERAGE(ret, line); ADD_TRACE(ret, line, RUBY_EVENT_LINE); saved_last_element = ret->last; } @@ -6594,7 +6599,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popp ((INSN *)saved_last_element)->insn_id == BIN(trace)) { POP_ELEMENT(ret); /* remove trace(coverage) */ - if (IS_INSN_ID(ret->last, trace) && + if (IS_INSN_ID(ret->last, trace2) && (FIX2LONG(OPERAND_AT(ret->last, 0)) & RUBY_EVENT_COVERAGE)) { POP_ELEMENT(ret); RARRAY_ASET(ISEQ_LINE_COVERAGE(iseq), line - 1, Qnil); |