Skip to content

Commit ce9076c

Browse files
committed
BodyInterp needs to cope with trace instr
1 parent d34c4d7 commit ce9076c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

core/src/main/java/org/jruby/ir/interpreter/BodyInterpreterEngine.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.jruby.ir.instructions.ReturnBase;
1515
import org.jruby.ir.instructions.RuntimeHelperCall;
1616
import org.jruby.ir.instructions.SearchConstInstr;
17+
import org.jruby.ir.instructions.TraceInstr;
1718
import org.jruby.ir.instructions.specialized.OneOperandArgNoBlockCallInstr;
1819
import org.jruby.ir.instructions.specialized.OneOperandArgNoBlockNoResultCallInstr;
1920
import org.jruby.ir.operands.Operand;
@@ -187,6 +188,17 @@ public IRubyObject interpret(ThreadContext context, IRubyObject self, Interprete
187188
setResult(temp, currDynScope, gfi.getResult(), result);
188189
break;
189190
}
191+
case TRACE: {
192+
if (context.runtime.hasEventHooks()) {
193+
TraceInstr trace = (TraceInstr) instr;
194+
// FIXME: Try and statically generate END linenumber instead of hacking it.
195+
int linenumber = trace.getLinenumber() == -1 ? context.getLine()+1 : trace.getLinenumber();
196+
197+
context.trace(trace.getEvent(), trace.getName(), context.getFrameKlazz(),
198+
trace.getFilename(), linenumber);
199+
}
200+
break;
201+
}
190202
default:
191203
if (instr.getOperation().opClass == OpClass.BRANCH_OP) {
192204
ipc = instr.interpretAndGetNewIPC(context, currDynScope, currScope, self, temp, ipc);

0 commit comments

Comments
 (0)