Top Description Fields Constructors Methods
org.jruby.ir.instructions

public Class ToggleBacktraceInstr

extends NoOperandInstr
Class Inheritance
Imports
org.jruby.ir.IRVisitor, .Operation, org.jruby.ir.persistence.IRReaderDecoder, .IRWriterEncoder, org.jruby.ir.transformations.inlining.CloneInfo

This instruction toggles a single per thread field which specifies whether an exception being thrown needs to generate backtrace info. At any point after toggling this to be false (no backtrace) you may encounter a nested exception which does require a backtrace. This nested exception will toggle back to needing an exception. In theory, we could restore this field as we unwind frames but largely this optimization only occurs in very simple scenarios. Also important to note this is only requesting for a backtrace or not. If you request no backtrace but the error is not a StandardError exception it will still be required to generate a backtrace.

Field Summary

Modifier and TypeField and Description
private final boolean

Constructor Summary

AccessConstructor and Description
public
ToggleBacktraceInstr(boolean requiresBacktrace)

Method Summary

Modifier and TypeMethod and Description
public Instr
clone(CloneInfo
This object manages renaming of variables and labels, handles args and return values.
info
)

Implements abstract org.jruby.ir.instructions.Instr.clone.

Clone the instruction for use in an inlining context (either when a scope is inlined into another scope, or when a block has to be cloned because its associated call belongs to an inlined scope).

public static ToggleBacktraceInstr
public void
public boolean
public String[]
public void
Inherited from org.jruby.ir.instructions.NoOperandInstr:
getOperandssetOperand

Field Detail

requiresBacktraceback to summary
private final boolean requiresBacktrace

Constructor Detail

ToggleBacktraceInstrback to summary
public ToggleBacktraceInstr(boolean requiresBacktrace)

Method Detail

cloneback to summary
public Instr clone(CloneInfo info)

Implements abstract org.jruby.ir.instructions.Instr.clone.

Doc from org.jruby.ir.instructions.Instr.clone.

Clone the instruction for use in an inlining context (either when a scope is inlined into another scope, or when a block has to be cloned because its associated call belongs to an inlined scope). This might renaming variables and labels to eliminate naming conflicts. The implementation might vary on the cloning mode.

Parameters
info:CloneInfo

This object manages renaming of variables and labels, handles args and return values.

Returns:Instr

a new instruction that can be used in the target scope.

Annotations
@Override
decodeback to summary
public static ToggleBacktraceInstr decode(IRReaderDecoder d)
encodeback to summary
public void encode(IRWriterEncoder e)

Overrides org.jruby.ir.instructions.Instr.encode.

Annotations
@Override
requiresBacktraceback to summary
public boolean requiresBacktrace()
toStringNonOperandArgsback to summary
public String[] toStringNonOperandArgs()

Overrides org.jruby.ir.instructions.Instr.toStringNonOperandArgs.

visitback to summary
public void visit(IRVisitor visitor)

Overrides org.jruby.ir.instructions.Instr.visit.

Annotations
@Override