From 5874de95e8df1d051001cf53614c1d245c1ac5ae Mon Sep 17 00:00:00 2001 From: mame Date: Tue, 1 Jul 2008 16:55:30 +0000 Subject: * Add coverage measurement constant COVERAGE__. This constant is not for casual use. Usage: (1) assign {} to COVERAGE__, (2) require or load Ruby source file, and (3) COVERAGE__["sourcefilepath"] will return an array whose elements represent number of executions per line of source code. * vm_core.h: add field of coverage array to iseq. * iseq.c (prepare_iseq_build): ditto. * insns.def (trace): update coverage array. * parse.y (coverage): create and initialize coverage array. * compile.h (ADD_TRACE): add trace instruction to update covearge array. * thread.c (clear_coverage): delete coverage array when forking. Otherwise, double count of coverage may occur. * lib/coverage.rb: sample coverage measurement tool. * error.c: distinguish explicitly between parse_in_eval and mild_compile_error. * load.c: ditto. * vm_eval.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- load.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'load.c') diff --git a/load.c b/load.c index 88db04bdfd..b9c8a3743d 100644 --- a/load.c +++ b/load.c @@ -240,8 +240,8 @@ rb_load(VALUE fname, int wrap) rb_thread_t *th = GET_THREAD(); volatile VALUE wrapper = th->top_wrapper; volatile VALUE self = th->top_self; - volatile int parse_in_eval; volatile int loaded = Qfalse; + volatile int mild_compile_error; #ifndef __GNUC__ rb_thread_t *volatile th0 = th; #endif @@ -267,19 +267,19 @@ rb_load(VALUE fname, int wrap) rb_extend_object(th->top_self, th->top_wrapper); } - parse_in_eval = th->parse_in_eval; + mild_compile_error = th->mild_compile_error; PUSH_TAG(); state = EXEC_TAG(); if (state == 0) { NODE *node; VALUE iseq; - th->parse_in_eval++; + th->mild_compile_error++; node = (NODE *)rb_load_file(RSTRING_PTR(fname)); - th->parse_in_eval--; loaded = Qtrue; iseq = rb_iseq_new(node, rb_str_new2(""), fname, Qfalse, ISEQ_TYPE_TOP); + th->mild_compile_error--; rb_iseq_eval(iseq); } POP_TAG(); @@ -288,7 +288,7 @@ rb_load(VALUE fname, int wrap) th = th0; fname = RB_GC_GUARD(fname); #endif - th->parse_in_eval = parse_in_eval; + th->mild_compile_error = mild_compile_error; th->top_self = self; th->top_wrapper = wrapper; -- cgit v1.2.3