diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-01 18:13:22 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-07-01 18:13:22 +0000 |
commit | 9a61579c1658502a87f62c857ec29cd831d5db41 (patch) | |
tree | 4e0a94fae643781bef9670c5f058f12100e6eccc /insns.def | |
parent | ab109c36f19aeaef088e975fa1de3ca6e6cce6f0 (diff) |
* compile.h, insns.def: reduce insn operand of "trace".
* include/ruby/ruby.h: add RUBY_EVENT_COVERAGE event.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r-- | insns.def | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -847,23 +847,29 @@ defined */ DEFINE_INSN trace -(rb_num_t nf, VALUE coverage) +(rb_num_t nf) () () { rb_event_flag_t flag = nf; - if (coverage) { - long line = rb_sourceline() - 1; - long count; - if (RARRAY_PTR(coverage)[line] == Qnil) { - rb_bug("bug"); - } - count = FIX2LONG(RARRAY_PTR(coverage)[line]) + 1; - if (POSFIXABLE(count)) { - RARRAY_PTR(coverage)[line] = LONG2FIX(count); + + if (flag == RUBY_EVENT_COVERAGE) { + VALUE coverage = GET_ISEQ()->coverage; + if (coverage) { + long line = vm_get_sourceline(GET_CFP()) - 1; + long count; + if (RARRAY_PTR(coverage)[line] == Qnil) { + rb_bug("bug"); + } + count = FIX2LONG(RARRAY_PTR(coverage)[line]) + 1; + if (POSFIXABLE(count)) { + RARRAY_PTR(coverage)[line] = LONG2FIX(count); + } } } - EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */); + else { + EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */); + } } /**********************************************************/ |