L2_SAVE_ALL_AND_PC_TO_INT
Extract the given "reference" edge's target level two offset as an Int, then follow the fall-through edge. The int value will be used in the fall-through code to assemble a continuation, which, when returned into, will start at the reference edge target. Note that the L2 offset of the reference edge is not known until just before JVM code generation.
This is a special operation, in that during final JVM code generation it saves all objects in a register dump (ContinuationRegisterDumpDescriptor), and the L2_ENTER_L2_CHUNK at the reference target will restore them.
Author
Mark van Gulik
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, the 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.
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 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.
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.
Is the enclosing L2Instruction an entry point into its L2Chunk?
Answer the named operand types that this L2Operation operation expects.
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.
From the given L2Instruction, extract the edge that indicates the L2 offset to capture as an Int in the second argument. The conversion of the edge to an int occurs very late, in translateToJVM, as does the decision about which registers should be captured in the register dump – and restored when the L2_ENTER_L2_CHUNK at the referenced edge's target is reached.
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.
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.