summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-08 16:11:30 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-08 16:11:30 +0000
commit578148c6a75842d25a872a39f22cafc05634821b (patch)
tree79814917c2fba8a0fdc38ca2a6faeec7f773e328
parente125cea12932fe97bee4d79c3a04151f4380f398 (diff)
downloadruby-578148c6a75842d25a872a39f22cafc05634821b.tar.gz
ruby-578148c6a75842d25a872a39f22cafc05634821b.tar.xz
ruby-578148c6a75842d25a872a39f22cafc05634821b.zip
* compile.c (ADD_TRACE): fire coverage event in ensure clause.
[ruby-dev:39303] * iseq.h, iseq.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--compile.c3
-rw-r--r--iseq.c1
-rw-r--r--iseq.h1
4 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a03a1434d..3b6c9647c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Oct 9 01:07:34 2009 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * compile.c (ADD_TRACE): fire coverage event in ensure clause.
+ [ruby-dev:39303]
+
+ * iseq.h, iseq.c: ditto.
+
Fri Oct 9 00:33:29 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
* lib/net/telnet.rb (cmd): Pass FailEOF options: patch by Brian
diff --git a/compile.c b/compile.c
index 87edfeb2c..d2a73daed 100644
--- a/compile.c
+++ b/compile.c
@@ -223,8 +223,9 @@ PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
#define ADD_TRACE(seq, line, event) \
do { \
if ((event) == RUBY_EVENT_LINE && iseq->coverage && \
- RARRAY_PTR(iseq->coverage)[(line) - 1] == Qnil) { \
+ (line) != iseq->compile_data->last_coverable_line) { \
RARRAY_PTR(iseq->coverage)[(line) - 1] = INT2FIX(0); \
+ iseq->compile_data->last_coverable_line = (line); \
ADD_INSN1(seq, line, trace, INT2FIX(RUBY_EVENT_COVERAGE)); \
} \
if (iseq->compile_data->option->trace_instruction) { \
diff --git a/iseq.c b/iseq.c
index 72f7f0c7b..ac5a93b3d 100644
--- a/iseq.c
+++ b/iseq.c
@@ -249,6 +249,7 @@ prepare_iseq_build(rb_iseq_t *iseq,
iseq->compile_data->storage_head->buff =
(char *)(&iseq->compile_data->storage_head->buff + 1);
iseq->compile_data->option = option;
+ iseq->compile_data->last_coverable_line = -1;
set_relation(iseq, parent);
diff --git a/iseq.h b/iseq.h
index 27271488c..d09cdd541 100644
--- a/iseq.h
+++ b/iseq.h
@@ -82,6 +82,7 @@ struct iseq_compile_data {
struct iseq_compile_data_storage *storage_head;
struct iseq_compile_data_storage *storage_current;
int last_line;
+ int last_coverable_line;
int flip_cnt;
int label_no;
int node_level;