public final class LIRInsertionBuffer extends Object
The buffer uses internal data structures to store the enqueued updates. To avoid allocations, a
buffer can be re-used. Call the methods in the following order: LIRInsertionBuffer.init(java.util.List<org.graalvm.compiler.lir.LIRInstruction>)
, LIRInsertionBuffer.append(int, org.graalvm.compiler.lir.LIRInstruction)
,
LIRInsertionBuffer.append(int, org.graalvm.compiler.lir.LIRInstruction)
, ..., LIRInsertionBuffer.finish()
, LIRInsertionBuffer.init(java.util.List<org.graalvm.compiler.lir.LIRInstruction>)
, ...
Note: This class does not depend on LIRInstruction, so we could make it a generic utility class.
Constructor and Description |
---|
LIRInsertionBuffer() |
Modifier and Type | Method and Description |
---|---|
void |
append(int index,
LIRInstruction op)
Enqueue a new instruction that will be appended to the instruction list when
LIRInsertionBuffer.finish() is called. |
void |
finish()
Append all enqueued instructions to the instruction list.
|
void |
init(List<LIRInstruction> newLir)
Initialize this buffer.
|
boolean |
initialized() |
List<LIRInstruction> |
lirList() |
public void init(List<LIRInstruction> newLir)
LIRInsertionBuffer.append(int, org.graalvm.compiler.lir.LIRInstruction)
.public boolean initialized()
public List<LIRInstruction> lirList()
public void append(int index, LIRInstruction op)
LIRInsertionBuffer.finish()
is called. The new instruction is added before the existing
instruction with the given index. This method can only be called with increasing values of
index, e.g., once an instruction was appended with index 4, subsequent instructions can only
be appended with index 4 or higher.public void finish()
LIRInsertionBuffer.init(List)
can
be called again to re-use this buffer.