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

public Class BSwitchInstr

extends MultiBranchInstr
Class Inheritance
Imports
org.jruby.RubyFixnum, .RubySymbol, org.jruby.ir.IRVisitor, .Operation, org.jruby.ir.operands.Fixnum, .Label, .Operand, .Symbol, org.jruby.ir.persistence.IRReaderDecoder, .IRWriterEncoder, org.jruby.ir.transformations.inlining.CloneInfo, org.jruby.parser.StaticScope, org.jruby.runtime.DynamicScope, .Helpers, .ThreadContext, org.jruby.runtime.builtin.IRubyObject, java.util.Arrays

Represents a multiple-target jump instruction based on a switch-like table

Field Summary

Modifier and TypeField and Description
private final Label
private final Class<T>
private final Operand[]
private final int[]
private Operand
private final Label
private final Label[]

Constructor Summary

AccessConstructor and Description
public
BSwitchInstr(int[] jumps, Operand[] jumpOperands, Operand operand, Label rubyCase, Label[] targets, Label elseTarget, Class<T> expectedClass)

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 BSwitchInstr
public void
public Operand
public Label
public Class<T>
public int[]
public Label[]
public Operand[]
public Label
public Label[]
public int
private static boolean
jumpsAreSorted(final int[] jumps)

public void
public void

Field Detail

elseTargetback to summary
private final Label elseTarget
expectedClassback to summary
private final Class<T> expectedClass
jumpOperandsback to summary
private final Operand[] jumpOperands
jumpsback to summary
private final int[] jumps
operandback to summary
private Operand operand
rubyCaseback to summary
private final Label rubyCase
targetsback to summary
private final Label[] targets

Constructor Detail

BSwitchInstrback to summary
public BSwitchInstr(int[] jumps, Operand[] jumpOperands, Operand operand, Label rubyCase, Label[] targets, Label elseTarget, Class<T> expectedClass)

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 BSwitchInstr decode(IRReaderDecoder d)
encodeback to summary
public void encode(IRWriterEncoder e)

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

Annotations
@Override
getCaseOperandback to summary
public Operand getCaseOperand()
getElseTargetback to summary
public Label getElseTarget()
getExpectedClassback to summary
public Class<T> getExpectedClass()
getJumpsback to summary
public int[] getJumps()
getJumpTargetsback to summary
public Label[] getJumpTargets()

Implements abstract org.jruby.ir.instructions.MultiBranchInstr.getJumpTargets.

Annotations
@Override
getOperandsback to summary
public Operand[] getOperands()

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

Annotations
@Override
getRubyCaseLabelback to summary
public Label getRubyCaseLabel()
getTargetsback to summary
public Label[] getTargets()
interpretAndGetNewIPCback to summary
public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc)

Overrides org.jruby.ir.instructions.Instr.interpretAndGetNewIPC.

Annotations
@Override
jumpsAreSortedback to summary
private static boolean jumpsAreSorted(final int[] jumps)
setOperandback to summary
public void setOperand(int i, Operand operand)

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

Annotations
@Override
visitback to summary
public void visit(IRVisitor visitor)

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

Annotations
@Override