Skip to content

Commit

Permalink
BodyInterp needs to cope with trace instr
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Feb 10, 2015
1 parent d34c4d7 commit ce9076c
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.jruby.ir.instructions.ReturnBase;
import org.jruby.ir.instructions.RuntimeHelperCall;
import org.jruby.ir.instructions.SearchConstInstr;
import org.jruby.ir.instructions.TraceInstr;
import org.jruby.ir.instructions.specialized.OneOperandArgNoBlockCallInstr;
import org.jruby.ir.instructions.specialized.OneOperandArgNoBlockNoResultCallInstr;
import org.jruby.ir.operands.Operand;
Expand Down Expand Up @@ -187,6 +188,17 @@ public IRubyObject interpret(ThreadContext context, IRubyObject self, Interprete
setResult(temp, currDynScope, gfi.getResult(), result);
break;
}
case TRACE: {
if (context.runtime.hasEventHooks()) {
TraceInstr trace = (TraceInstr) instr;
// FIXME: Try and statically generate END linenumber instead of hacking it.
int linenumber = trace.getLinenumber() == -1 ? context.getLine()+1 : trace.getLinenumber();

context.trace(trace.getEvent(), trace.getName(), context.getFrameKlazz(),
trace.getFilename(), linenumber);
}
break;
}
default:
if (instr.getOperation().opClass == OpClass.BRANCH_OP) {
ipc = instr.interpretAndGetNewIPC(context, currDynScope, currScope, self, temp, ipc);
Expand Down

0 comments on commit ce9076c

Please sign in to comment.