From 417240b7fb987e364421d4c4bfd77dd5bfea10c4 Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 2 Dec 2015 08:05:36 +0000 Subject: * iseq.h: introduce ISEQ_COVERAGE() and ISEQ_COVERAGE_SET() macro. * compile.c: use them. * iseq.c: ditto. * iseq.c (rb_iseq_coverage): added. * thread.c (update_coverage): use rb_iseq_coverage(). * vm_core.h: rename coverage field name to support this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- iseq.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'iseq.c') diff --git a/iseq.c b/iseq.c index 269ca8a15c..66fd11f3f7 100644 --- a/iseq.c +++ b/iseq.c @@ -117,7 +117,7 @@ rb_iseq_mark(const rb_iseq_t *iseq) } if (iseq->variable_body) { - RUBY_MARK_UNLESS_NULL(iseq->variable_body->coverage); + RUBY_MARK_UNLESS_NULL(ISEQ_COVERAGE(iseq)); } if (ISEQ_COMPILE_DATA(iseq) != 0) { @@ -311,13 +311,13 @@ prepare_iseq_build(rb_iseq_t *iseq, ISEQ_COMPILE_DATA(iseq)->option = option; ISEQ_COMPILE_DATA(iseq)->last_coverable_line = -1; - RB_OBJ_WRITE(iseq, &iseq->variable_body->coverage, Qfalse); + ISEQ_COVERAGE_SET(iseq, Qfalse); if (!GET_THREAD()->parse_in_eval) { VALUE coverages = rb_get_coverages(); if (RTEST(coverages)) { - RB_OBJ_WRITE(iseq, &iseq->variable_body->coverage, rb_hash_lookup(coverages, path)); - if (NIL_P(iseq->variable_body->coverage)) RB_OBJ_WRITE(iseq, &iseq->variable_body->coverage, Qfalse); + ISEQ_COVERAGE_SET(iseq, rb_hash_lookup(coverages, path)); + if (NIL_P(ISEQ_COVERAGE(iseq))) ISEQ_COVERAGE_SET(iseq, Qfalse); } } @@ -699,6 +699,12 @@ rb_iseq_method_name(const rb_iseq_t *iseq) } } +VALUE +rb_iseq_coverage(const rb_iseq_t *iseq) +{ + return ISEQ_COVERAGE(iseq); +} + /* define wrapper class methods (RubyVM::InstructionSequence) */ static void -- cgit v1.2.3