@@ -377,7 +377,7 @@ public void addInstr(Instr instr) {
377377 }
378378
379379 if (RubyInstanceConfig .FULL_TRACE_ENABLED ) {
380- addInstr (new TraceInstr (RubyEvent .LINE , methodNameFor (), getFileName (), lastProcessedLineNum + 1 ));
380+ addInstr (new TraceInstr (RubyEvent .LINE , getCurrentModuleVariable (), methodNameFor (), getFileName (), lastProcessedLineNum + 1 ));
381381 }
382382 }
383383
@@ -2791,7 +2791,7 @@ protected InterpreterContext defineMethodInner(DefNode defNode, IRScope parent,
27912791 addInstr (manager .newLineNumber (scope .getLine () + 1 ));
27922792 }
27932793
2794- addInstr (new TraceInstr (RubyEvent .CALL , getName (), getFileName (), scope .getLine () + 1 ));
2794+ addInstr (new TraceInstr (RubyEvent .CALL , getCurrentModuleVariable (), getName (), getFileName (), scope .getLine () + 1 ));
27952795
27962796 prepareImplicitState (); // recv_self, add frame block, etc)
27972797
@@ -2811,7 +2811,7 @@ protected InterpreterContext defineMethodInner(DefNode defNode, IRScope parent,
28112811 addInstr (new LineNumberInstr (defNode .getEndLine () + 1 ));
28122812 }
28132813
2814- addInstr (new TraceInstr (RubyEvent .RETURN , getName (), getFileName (), defNode .getEndLine () + 1 ));
2814+ addInstr (new TraceInstr (RubyEvent .RETURN , getCurrentModuleVariable (), getName (), getFileName (), defNode .getEndLine () + 1 ));
28152815
28162816 if (rv != null ) addInstr (new ReturnInstr (rv ));
28172817
@@ -3786,7 +3786,7 @@ private InterpreterContext buildIterInner(RubySymbol methodName, IterNode iterNo
37863786 boolean forNode = iterNode instanceof ForNode ;
37873787 prepareClosureImplicitState (); // recv_self, add frame block, etc)
37883788
3789- addInstr (new TraceInstr (RubyEvent .B_CALL , getName (), getFileName (), scope .getLine () + 1 ));
3789+ addInstr (new TraceInstr (RubyEvent .B_CALL , getCurrentModuleVariable (), getName (), getFileName (), scope .getLine () + 1 ));
37903790
37913791 if (!forNode ) addCurrentModule (); // %current_module
37923792 receiveBlockArgs (iterNode );
@@ -3800,7 +3800,7 @@ private InterpreterContext buildIterInner(RubySymbol methodName, IterNode iterNo
38003800 // Build closure body and return the result of the closure
38013801 Operand closureRetVal = iterNode .getBodyNode () == null ? manager .getNil () : build (iterNode .getBodyNode ());
38023802
3803- addInstr (new TraceInstr (RubyEvent .B_RETURN , getName (), getFileName (), iterNode .getEndLine () + 1 ));
3803+ addInstr (new TraceInstr (RubyEvent .B_RETURN , getCurrentModuleVariable (), getName (), getFileName (), iterNode .getEndLine () + 1 ));
38043804
38053805 // can be U_NIL if the node is an if node with returns in both branches.
38063806 if (closureRetVal != U_NIL ) addInstr (new ReturnInstr (closureRetVal ));
@@ -4580,7 +4580,7 @@ public Operand buildReturn(ReturnNode returnNode) {
45804580 } else {
45814581 retVal = processEnsureRescueBlocks (retVal );
45824582
4583- addInstr (new TraceInstr (RubyEvent .RETURN , getName (), getFileName (), returnNode .getLine () + 1 ));
4583+ addInstr (new TraceInstr (RubyEvent .RETURN , getCurrentModuleVariable (), getName (), getFileName (), returnNode .getLine () + 1 ));
45844584 addInstr (new ReturnInstr (retVal ));
45854585 }
45864586
@@ -4971,7 +4971,7 @@ private Operand[] adjustVariableDepth(Operand[] args, int depthFromSuper) {
49714971 }
49724972
49734973 private InterpreterContext buildModuleOrClassBody (Node bodyNode , int startLine , int endLine ) {
4974- addInstr (new TraceInstr (RubyEvent .CLASS , null , getFileName (), startLine + 1 ));
4974+ addInstr (new TraceInstr (RubyEvent .CLASS , getCurrentModuleVariable (), null , getFileName (), startLine + 1 ));
49754975
49764976 prepareImplicitState (); // recv_self, add frame block, etc)
49774977 addCurrentModule (); // %current_module
@@ -4981,7 +4981,7 @@ private InterpreterContext buildModuleOrClassBody(Node bodyNode, int startLine,
49814981 // This is only added when tracing is enabled because an 'end' will normally have no other instrs which can
49824982 // raise after this point. When we add trace we need to add one so backtrace generated shows the 'end' line.
49834983 addInstr (manager .newLineNumber (endLine ));
4984- addInstr (new TraceInstr (RubyEvent .END , null , getFileName (), endLine + 1 ));
4984+ addInstr (new TraceInstr (RubyEvent .END , getCurrentModuleVariable (), null , getFileName (), endLine + 1 ));
49854985
49864986 addInstr (new ReturnInstr (bodyReturnValue ));
49874987
0 commit comments