summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-05 07:16:42 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-05 07:16:42 +0000
commit0a6816ecd79fac5dfb32eb237f4c31bb45c9460d (patch)
tree63c3def6ba4957dace4d3fba56f1da964b9750de /compile.c
parentaa87ae7a04b9c4845ef4326b63150027ed1036a9 (diff)
Revamp method coverage to support define_method
Traditionally, method coverage measurement was implemented by inserting `trace2` instruction to the head of method iseq. So, it just measured methods defined by `def` keyword. This commit drastically changes the measuring mechanism of method coverage; at `RUBY_EVENT_CALL`, it keeps a hash from rb_method_entry_t* to runs (i.e., it counts the runs per method entry), and at `Coverage.result`, it creates the result hash by enumerating all `rb_method_entry_t*` objects (by `ObjectSpace.each_object`). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/compile.c b/compile.c
index f9fe6aab53..4da76748c1 100644
--- a/compile.c
+++ b/compile.c
@@ -294,19 +294,6 @@ struct iseq_compile_data_ensure_node_stack {
ADD_INSN2((seq), (first_line), trace2, INT2FIX(RUBY_EVENT_COVERAGE), INT2FIX(counter_idx * 16 + COVERAGE_INDEX_BRANCHES)); \
} \
} while (0)
-#define ADD_TRACE_METHOD_COVERAGE(seq, line, method_name) \
- do { \
- if (ISEQ_COVERAGE(iseq) && \
- ISEQ_METHOD_COVERAGE(iseq) && \
- (line) > 0) { \
- VALUE methods = ISEQ_METHOD_COVERAGE(iseq); \
- long counter_idx = RARRAY_LEN(methods) / 3; \
- rb_ary_push(methods, ID2SYM(method_name)); \
- rb_ary_push(methods, INT2FIX(line)); \
- rb_ary_push(methods, INT2FIX(0)); \
- ADD_INSN2((seq), (line), trace2, INT2FIX(RUBY_EVENT_COVERAGE), INT2FIX(counter_idx * 16 + COVERAGE_INDEX_METHODS)); \
- } \
- } while (0)
static void iseq_add_getlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, int line, int idx, int level);
static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, int line, int idx, int level);
@@ -670,7 +657,6 @@ rb_iseq_compile_node(rb_iseq_t *iseq, const NODE *node)
case ISEQ_TYPE_METHOD:
{
ADD_TRACE(ret, RUBY_EVENT_CALL);
- ADD_TRACE_METHOD_COVERAGE(ret, FIX2INT(iseq->body->location.first_lineno), rb_intern_str(iseq->body->location.label));
CHECK(COMPILE(ret, "scoped node", node->nd_body));
ADD_TRACE(ret, RUBY_EVENT_RETURN);
break;