public static LineNumberInstr decode(IRReaderDecoder d) { return d.getCurrentScope().getManager().newLineNumber(d.decodeInt()); }
public static LineNumberInstr decode(IRReaderDecoder d) { return d.getCurrentScope().getManager().newLineNumber(d.decodeInt()); }
public void addInstr(Instr instr) { if (needsLineNumInfo) { needsLineNumInfo = false; addInstr(manager.newLineNumber(_lastProcessedLineNum)); if (RubyInstanceConfig.FULL_TRACE_ENABLED) { addInstr(new TraceInstr(RubyEvent.LINE, methodNameFor(), getFileName(), _lastProcessedLineNum)); if (needsCodeCoverage()) { addInstr(new TraceInstr(RubyEvent.COVERAGE, methodNameFor(), getFileName(), _lastProcessedLineNum)); } } } // If we are building an ensure body, stash the instruction // in the ensure body's list. If not, add it to the scope directly. if (ensureBodyBuildStack.empty()) { if (instr instanceof ThreadPollInstr) scope.threadPollInstrsCount++; instr.computeScopeFlags(scope); if (hasListener()) manager.getIRScopeListener().addedInstr(scope, instr, instructions.size()); instructions.add(instr); } else { ensureBodyBuildStack.peek().addInstr(instr); } }
public void addInstr(Instr instr) { if (needsLineNumInfo) { needsLineNumInfo = false; addInstr(manager.newLineNumber(_lastProcessedLineNum)); if (RubyInstanceConfig.FULL_TRACE_ENABLED) { addInstr(new TraceInstr(RubyEvent.LINE, methodNameFor(), getFileName(), _lastProcessedLineNum)); if (needsCodeCoverage()) { addInstr(new TraceInstr(RubyEvent.COVERAGE, methodNameFor(), getFileName(), _lastProcessedLineNum)); } } } // If we are building an ensure body, stash the instruction // in the ensure body's list. If not, add it to the scope directly. if (ensureBodyBuildStack.empty()) { if (instr instanceof ThreadPollInstr) scope.threadPollInstrsCount++; instr.computeScopeFlags(scope); if (hasListener()) manager.getIRScopeListener().addedInstr(scope, instr, instructions.size()); instructions.add(instr); } else { ensureBodyBuildStack.peek().addInstr(instr); } }
public InterpreterContext buildEvalRoot(RootNode rootNode) { needsCodeCoverage = false; // Assuming there is no path into build eval root without actually being an eval. addInstr(manager.newLineNumber(scope.getLine())); prepareImplicitState(); // recv_self, add frame block, etc) addCurrentScopeAndModule(); // %current_scope/%current_module Operand returnValue = rootNode.getBodyNode() == null ? manager.getNil() : build(rootNode.getBodyNode()); addInstr(new ReturnInstr(returnValue)); return scope.allocateInterpreterContext(instructions); }
public InterpreterContext buildEvalRoot(RootNode rootNode) { needsCodeCoverage = false; // Assuming there is no path into build eval root without actually being an eval. addInstr(manager.newLineNumber(scope.getLine())); prepareImplicitState(); // recv_self, add frame block, etc) addCurrentScopeAndModule(); // %current_scope/%current_module Operand returnValue = rootNode.getBodyNode() == null ? manager.getNil() : build(rootNode.getBodyNode()); addInstr(new ReturnInstr(returnValue)); return scope.allocateInterpreterContext(instructions); }
private InterpreterContext buildModuleOrClassBody(Node bodyNode, int startLine, int endLine) { if (RubyInstanceConfig.FULL_TRACE_ENABLED) { addInstr(new TraceInstr(RubyEvent.CLASS, null, getFileName(), startLine)); } prepareImplicitState(); // recv_self, add frame block, etc) addCurrentScopeAndModule(); // %current_scope/%current_module Operand bodyReturnValue = build(bodyNode); if (RubyInstanceConfig.FULL_TRACE_ENABLED) { // This is only added when tracing is enabled because an 'end' will normally have no other instrs which can // raise after this point. When we add trace we need to add one so backtrace generated shows the 'end' line. addInstr(manager.newLineNumber(endLine)); addInstr(new TraceInstr(RubyEvent.END, null, getFileName(), endLine)); } addInstr(new ReturnInstr(bodyReturnValue)); return scope.allocateInterpreterContext(instructions); }
private InterpreterContext buildModuleOrClassBody(Node bodyNode, int startLine, int endLine) { if (RubyInstanceConfig.FULL_TRACE_ENABLED) { addInstr(new TraceInstr(RubyEvent.CLASS, null, getFileName(), startLine)); } prepareImplicitState(); // recv_self, add frame block, etc) addCurrentScopeAndModule(); // %current_scope/%current_module Operand bodyReturnValue = build(bodyNode); if (RubyInstanceConfig.FULL_TRACE_ENABLED) { // This is only added when tracing is enabled because an 'end' will normally have no other instrs which can // raise after this point. When we add trace we need to add one so backtrace generated shows the 'end' line. addInstr(manager.newLineNumber(endLine)); addInstr(new TraceInstr(RubyEvent.END, null, getFileName(), endLine)); } addInstr(new ReturnInstr(bodyReturnValue)); return scope.allocateInterpreterContext(instructions); }
addInstr(manager.newLineNumber(scope.getLine())); addInstr(new TraceInstr(RubyEvent.CALL, getName(), getFileName(), scope.getLine()));
addInstr(manager.newLineNumber(scope.getLine())); addInstr(new TraceInstr(RubyEvent.CALL, getName(), getFileName(), scope.getLine()));