L2_JUMP_IF_COMPARE_INT

Jump to the target if int1 is less than int2.

Author

Mark van Gulik

Todd L Smith

Parameters

opcode

The opcode number for this compare-and-branch.

opcodeName

The symbolic name of the opcode for this compare-and-branch.

computeRestrictions

A function for computing output ranges along the ifTrue and ifFalse edges. It takes the first operand's lower and upper bounds, and the second operand's lower and upper bound. These are in the i32 range, but are passed as a Long to simplify calculation. It then produces four integer range typess, restricting:

  1. the first operand if the condition holds,

  2. the second operand if the condition holds,

  3. the first operand if the condition fails,

  4. the second operand if the condition fails.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val altersControlFlow: Boolean

Answer whether execution of this instruction can divert the flow of control from the next instruction. An L2Operation either always falls through or always alters control.

Link copied to clipboard

Answer true if this instruction leads to multiple targets, multiple of which can be reached. This is not the same as a branch, in which only one will be reached for any circumstance of reaching this instruction. In particular, an L2_SAVE_ALL_AND_PC_TO_INT instruction jumps to its fall-through label, but after reification has saved the live register state, it gets restored again and winds up traversing the other edge.

Link copied to clipboard
open override val hasSideEffect: Boolean

Answer whether this L2Operation changes the state of the interpreter in any way other than by writing to its destination registers. Most operations are computational and don't have side effects.

Link copied to clipboard
open val isMove: Boolean

Answer whether this operation is a move between (compatible) registers.

Link copied to clipboard
open val isPhi: Boolean

Answer whether this operation is a phi-function. This is a convenient fiction that allows control flow to merge while in SSA form.

Link copied to clipboard

Answer whether this operation is a placeholder, and should be replaced using the L2Regenerator. Placeholder instructions (like L2_VIRTUAL_CREATE_LABEL) are free to be moved through much of the control flow graph, even though the subgraphs they eventually get replaced by would be too complex to move. The mobility of placeholder instructions is essential to postponing stack reification and label creation into off-ramps (reification Zones) as much as possible.

Link copied to clipboard

Answer whether this operation causes unconditional control flow jump to another L2BasicBlock.

Link copied to clipboard

Answer whether execution of this instruction causes a variable to be read.

Link copied to clipboard

Answer whether execution of this instruction causes a variable to be written.

Link copied to clipboard

Initialize the name from the constructor argument, or produce a default if it was unspecified or null.

Link copied to clipboard
Link copied to clipboard

The bitwise-or of the masks of HiddenVariables that are read by L2Instructions using this operation. Note that all reads are considered to happen before all writes.

Link copied to clipboard

The bitwise-or of the masks of HiddenVariables that are overwritten by L2Instructions using this operation. Note that all reads are considered to happen before all writes.

Functions

Link copied to clipboard
open override fun appendToWithWarnings(instruction: L2Instruction, desiredTypes: Set<L2OperandType>, builder: StringBuilder, warningStyleChange: (Boolean) -> Unit)

Produce a sensible textual rendition of the specified L2Instruction.

Link copied to clipboard
fun compareAndBranch(generator: L2Generator, int1Reg: L2ReadIntOperand, int2Reg: L2ReadIntOperand, ifTrue: L2PcOperand, ifFalse: L2PcOperand)

Compare the int register values and branch to one target or the other. Restrict the possible values as much as possible along both branches. Convert the branch to an unconditional jump if possible.

Link copied to clipboard
open fun emitTransformedInstruction(transformedOperands: Array<L2Operand>, regenerator: L2Regenerator)

Write the given L2Operation's equivalent effect through the given L2Regenerator, with the given already-transformed L2Operands.

Link copied to clipboard
open fun extractFunctionOuter(instruction: L2Instruction, functionRegister: L2ReadBoxedOperand, outerIndex: Int, outerType: A_Type, generator: L2Generator): L2ReadBoxedOperand

Emit code to extract the specified outer value from the function produced by this instruction. The new code is appended to the provided list of instructions, which may be at a code generation position unrelated to the receiver. The extracted outer variable will be written to the provided target register.

Link copied to clipboard

Produce an L2ReadBoxedOperand that provides the specified index of the tuple in the given register. If the source of that index is not readily available, generate code to produce it from the tuple, and answer the resulting L2ReadBoxedOperand.

Link copied to clipboard
open fun generateReplacement(instruction: L2Instruction, regenerator: L2Regenerator)

Generate code to replace this L2Instruction. Leave the generator in a state that ensures any L2SemanticValues that would have been written by the old instruction are instead written by the new code. Leave the code regenerator at the point where subsequent instructions of the rebuilt block will be re-emitted, whether that's in the same block or not.

Link copied to clipboard

Extract the constant A_RawFunction that's enclosed by the function produced or passed along by this instruction.

Link copied to clipboard
open fun hasSideEffect(instruction: L2Instruction): Boolean

Answer whether the given L2Instruction (whose operation must be the receiver) changes the state of the interpreter in any way other than by writing to its destination registers. Most operations are computational and don't have side effects.

Link copied to clipboard
open override fun instructionWasAdded(instruction: L2Instruction, manifest: L2ValueManifest)

This is the operation for the given instruction, which was just added to its basic block. Do any post-processing appropriate for having added the instruction. Its operands have already had their instruction fields set to the given instruction.

Link copied to clipboard

This is the operation for the given instruction, which was just inserted into its basic block as part of an optimization pass. Do any post-processing appropriate for having inserted the instruction.

Link copied to clipboard
open fun isEntryPoint(instruction: L2Instruction): Boolean

Is the enclosing L2Instruction an entry point into its L2Chunk?

Link copied to clipboard

Answer the named operand types that this L2Operation operation expects.

Link copied to clipboard

If this instruction is an attempt to execute a primitive, answer the register into which the primitive's result will be written if successful. Otherwise answer null.

Link copied to clipboard
open fun shouldEmit(instruction: L2Instruction): Boolean

Answer whether an instruction using this operation should be emitted during final code generation. For example, a move between registers with the same finalIndex can be left out during code generation, although it can't actually be removed before then.

Link copied to clipboard
fun simpleAppendTo(instruction: L2Instruction, builder: StringBuilder)

Output the instruction compactly to the builder.

Link copied to clipboard
open override fun targetEdges(instruction: L2Instruction): List<L2PcOperand>

Extract the operands which are L2PcOperands. These are what lead to other L2BasicBlocks. They also carry an edge-specific array of slots, and edge-specific TypeRestrictions for registers.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun translateToJVM(translator: JVMTranslator, method: MethodVisitor, instruction: L2Instruction)

Translate the specified L2Instruction into corresponding JVM instructions.