L2Instruction
L2Instruction is the foundation for all instructions understood by the level two Avail interpreter. These instructions are model objects generated and manipulated by the L2Generator.
It used to be the case that the instructions were flattened into a stream of integers, operation followed by operands. That is no longer the case, as of 2013-05-01 MvG. Instead, the L2Instructions themselves are kept around for reoptimization and JVM code generation.
Author
Mark van Gulik
Todd L Smith
Parameters
The L2BasicBlock which will contain this instruction or null if none.
The L2Operation that this instruction performs.
The array of L2Operands on which this instruction operates. These must agree with the operation's array of L2NamedOperandTypes.
Constructors
Construct a new L2Instruction. The instruction will be added somewhere within the given L2Generator's current L2BasicBlock.
Construct a new L2Instruction.
Functions
Output this instruction to the given builder, invoking the given lambda with a boolean to turn warning style on or off, if tracked by the caller.
Check that this instruction's basicBlock has been set, and that each operand's instruction field has also been set.
Answer the L2BasicBlock to which this instruction belongs.
Evaluate the given function with each edge and its corresponding L2NamedOperandType.Purpose. An L2WriteOperand is only considered to take place if its L2NamedOperandType.Purpose is null, or if it is the same as the edge that is taken by this L2Instruction.
This instruction was just added to its L2BasicBlock.
This instruction was just added to its L2BasicBlock as part of an optimization pass.
This instruction was just removed from its L2BasicBlock's list of instructions, and needs to finish its removal by breaking back-pointers, plus whatever else specific operands need to do when they're no longer considered part of the code.
Evaluate the given function with each L2Operand and the L2NamedOperandType that it occupies.
Now that chunk optimization has completed, remove information from this instruction that will no longer be needed in the finished chunk. Note that during subsequent inlining of this chunk at a call site, the type and synonym information will be reconstructed without too much cost.
Replace all registers in this instruction using the registerRemap. If a register is not present as a key of that map, leave it alone. Do not assume SSA form.
Write the equivalent of this instruction through the given L2Regenerator. Certain types of L2Operations are transformed in ways specific to the kind of regenerator being used.
Translate the L2Instruction into corresponding JVM instructions.
Evaluate the given function with each L2WriteOperand having the given L2NamedOperandType.Purpose, which correlates with the Purpose along each outbound edge to indicate which writes have effect along which outbound edges.
Properties
The destination L2Registers.
Answer whether this instruction is an entry point, which uses the operation L2_ENTER_L2_CHUNK.
Determine if this instruction is a place-holding instruction that will be re-emitted as an arbitrary graph of instructions at some point, via L2Operation.generateReplacement.
The L2Operation whose execution this instruction represents.
Answer a List of this instruction's L2ReadOperands.
Answer whether this instruction should be emitted during final code generation (from the non-SSA L2ControlFlowGraph into a flat sequence of L2Instructions. Allow the operation to decide.
Answer all possible L2PcOperands within this instruction. These edges lead to other L2BasicBlocks, and carry a L2ValueManifest.
Answer a List of this instruction's L2WriteOperands.