L2_PHI_PSEUDO_OPERATION
The L2_PHI_PSEUDO_OPERATION occurs at the start of a L2BasicBlock. It's a convenient fiction that allows an L2ControlFlowGraph to be in Static Single Assignment form (SSA), where each L2Register has exactly one instruction that writes to it.
The vector of source registers are in the same order as the corresponding predecessors of the containing L2BasicBlock. The runtime effect would be to select from that vector, based on the predecessor from which control arrives, and move that register's value to the destination register. However, that's a fiction, and the phi operation is instead removed during the transition of the control flow graph out of SSA, being replaced by move instructions along each incoming edge.
Author
Mark van Gulik
Parameters
The L2NamedOperandType that describes the read source of this move.
The L2NamedOperandType that describes the write destination of this move.
Properties
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.
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.
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.
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.
Answer whether this operation causes unconditional control flow jump to another L2BasicBlock.
Answer whether execution of this instruction causes a variable to be read.
Answer whether execution of this instruction causes a variable to be written.
The named operand types that this operation expects.
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.
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
Produce a sensible textual rendition of the specified L2Instruction.
Answer the L2WriteOperand from this phi function. This should only be used when generating phi moves (which takes the L2ControlFlowGraph out of Static Single Assignment form).
Write the given L2Operation's equivalent effect through the given L2Regenerator, with the given already-transformed L2Operands.
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.
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.
Generate an L2_PHI_PSEUDO_OPERATION and any additional moves to ensure the given set of related L2SemanticValues are populated with values from the given sources.
We don't need to do anything for phi instructions, since the generator framework itself handles it. This includes forcing creation of phi instructions when an L2SemanticValue is present in every incoming edge.
Extract the constant A_RawFunction that's enclosed by the function produced or passed along by this instruction.
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.
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.
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.
Answer the list of L2SplitConditions which, if true, would allow better code to be regenerated. The L2Optimizer checks if any of these are true on edges leading to ancestor phis, and if so, it may perform code splitting to avoid erasing that information prematurely through a control flow merge.
Is the enclosing L2Instruction an entry point into its L2Chunk?
Answer the named operand types that this L2Operation operation expects.
Examine the instruction and answer the predecessor L2BasicBlocks that supply a value from the specified register.
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.
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.
Output the instruction compactly to the builder.
Answer the List of L2ReadOperands for this phi function. The order is correlated to the instruction's blocks predecessorEdges.
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.
Translate the specified L2Instruction into corresponding JVM instructions.
Update an L2_PHI_PSEUDO_OPERATION instruction that's in a loop head basic block.
One of this phi function's predecessors has been removed because it's dead code. Clean up its vector of inputs by removing the specified index.