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: init(java.util.List<com.oracle.graal.lir.LIRInstruction>)
, append(int, com.oracle.graal.lir.LIRInstruction)
,
append(int, com.oracle.graal.lir.LIRInstruction)
, ..., finish()
, init(java.util.List<com.oracle.graal.lir.LIRInstruction>)
, ...
Note: This class does not depend on LIRInstruction, so we could make it a generic utility class.
Modifier and Type | Field and Description |
---|---|
private int[] |
indexAndCount
List of insertion points.
|
private int |
indexAndCountSize |
private List<LIRInstruction> |
lir
The lir list where ops of this buffer should be inserted later (null when uninitialized).
|
private List<LIRInstruction> |
ops
The LIROps to be inserted.
|
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
finish() is called. |
private void |
appendNew(int index,
int count) |
private int |
countAt(int i) |
void |
finish()
Append all enqueued instructions to the instruction list.
|
private int |
indexAt(int i) |
void |
init(List<LIRInstruction> newLir)
Initialize this buffer.
|
boolean |
initialized() |
List<LIRInstruction> |
lirList() |
private int |
numberOfInsertionPoints() |
private void |
setCountAt(int i,
int value) |
private boolean |
verify() |
private List<LIRInstruction> lir
private int[] indexAndCount
private int indexAndCountSize
private final List<LIRInstruction> ops
public LIRInsertionBuffer()
public void init(List<LIRInstruction> newLir)
append(int, com.oracle.graal.lir.LIRInstruction)
.public boolean initialized()
public List<LIRInstruction> lirList()
public void append(int index, LIRInstruction op)
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()
init(List)
can
be called again to re-use this buffer.private void appendNew(int index, int count)
private void setCountAt(int i, int value)
private int numberOfInsertionPoints()
private int indexAt(int i)
private int countAt(int i)
private boolean verify()