summaryrefslogtreecommitdiff
path: root/insns.def
diff options
context:
space:
mode:
Diffstat (limited to 'insns.def')
-rw-r--r--insns.def12
1 files changed, 11 insertions, 1 deletions
diff --git a/insns.def b/insns.def
index 161dc38e2e..96023a4adf 100644
--- a/insns.def
+++ b/insns.def
@@ -847,11 +847,21 @@ defined
*/
DEFINE_INSN
trace
-(rb_num_t nf)
+(rb_num_t nf, VALUE coverage)
()
()
{
rb_event_flag_t flag = nf;
+ if (coverage) {
+ long line = rb_sourceline() - 1;
+ if (RARRAY_PTR(coverage)[line] == Qnil) {
+ rb_bug("bug");
+ }
+ long 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 */);
}