public final class FrameStateBuilder extends Object implements IntrinsicContext.SideEffectsState
Modifier and Type | Field and Description |
---|---|
private boolean |
canVerifyKind |
private static ValueNode[] |
EMPTY_ARRAY |
private static MonitorIdNode[] |
EMPTY_MONITOR_ARRAY |
private StructuredGraph |
graph |
protected ValueNode[] |
locals |
private ValueNode[] |
lockedObjects |
private ResolvedJavaMethod |
method |
private MonitorIdNode[] |
monitorIds |
private FrameState |
outerFrameState |
private BytecodeParser |
parser |
private boolean |
rethrowException |
private List<StateSplit> |
sideEffects
The closest
side-effect predecessors. |
protected ValueNode[] |
stack |
private int |
stackSize |
Modifier | Constructor and Description |
---|---|
|
FrameStateBuilder(BytecodeParser parser,
ResolvedJavaMethod method,
StructuredGraph graph)
Creates a new frame state builder for the given method and the given target graph.
|
private |
FrameStateBuilder(FrameStateBuilder other) |
Modifier and Type | Method and Description |
---|---|
void |
addSideEffect(StateSplit sideEffect)
Records a side effect for the current program point.
|
private static ValueNode[] |
allocateArray(int length) |
void |
cleanDeletedNodes()
Phi nodes are recursively deleted in
propagateDelete(com.oracle.graal.nodes.calc.FloatingNode) . |
void |
clearLocals()
Clears all local variables.
|
void |
clearNonLiveLocals(BciBlockMapping.BciBlock block,
LocalLiveness liveness,
boolean liveIn) |
void |
clearStack()
Clears all values on this stack.
|
boolean |
contains(ValueNode value) |
FrameStateBuilder |
copy() |
private BytecodePosition |
create(BytecodePosition o,
int bci,
BytecodeParser parent) |
FrameState |
create(int bci,
BytecodeParser parent,
boolean duringCall,
Kind[] pushedSlotKinds,
ValueNode[] pushedValues) |
FrameState |
create(int bci,
StateSplit forStateSplit) |
BytecodePosition |
createBytecodePosition(int bci) |
private ValueNode |
createLoopPhi(AbstractMergeNode block,
ValueNode value) |
private ValuePhiNode |
createValuePhi(ValueNode currentValue,
ValueNode otherValue,
AbstractMergeNode block) |
void |
disableKindVerification() |
boolean |
equals(Object otherObject) |
private static boolean |
equals(ValueNode[] a,
ValueNode[] b,
int length) |
ResolvedJavaMethod |
getMethod() |
int |
hashCode() |
private static int |
hashCode(Object[] a,
int length) |
void |
initializeForMethodStart(boolean eagerResolve,
ParameterPlugin[] parameterPlugins) |
void |
initializeFromArgumentsArray(ValueNode[] arguments) |
void |
insertLoopPhis(LocalLiveness liveness,
int loopId,
LoopBeginNode loopBegin,
boolean forcePhis) |
void |
insertLoopProxies(LoopExitNode loopExit,
FrameStateBuilder loopEntryState) |
void |
insertProxies(Function<ValueNode,ValueNode> proxyFunction) |
boolean |
isAfterSideEffect()
Determines if the current program point is preceded by one or more side effects.
|
boolean |
isCompatibleWith(FrameStateBuilder other) |
ValueNode |
loadLocal(int i,
Kind slotKind)
Loads the local variable at the specified index, checking that the returned value is non-null
and that two-stack values are properly handled.
|
int |
localsSize()
Returns the size of the local variables.
|
int |
lockDepth(boolean includeParents) |
void |
merge(AbstractMergeNode block,
FrameStateBuilder other) |
private ValueNode |
merge(ValueNode currentValue,
ValueNode otherValue,
AbstractMergeNode block) |
MonitorIdNode |
peekMonitorId() |
ValueNode |
pop(Kind slotKind)
Pops an instruction off the stack with the expected type.
|
ValueNode[] |
popArguments(int argSize)
Pop the specified number of slots off of this stack and return them as an array of
instructions.
|
ValueNode |
popLock()
Removes a locked monitor from this frame state.
|
private void |
propagateDelete(FloatingNode node) |
void |
push(Kind slotKind,
ValueNode x)
Pushes an instruction onto the stack with the expected type.
|
void |
pushLock(ValueNode object,
MonitorIdNode monitorId)
Adds a locked monitor to this frame state.
|
void |
pushReturn(Kind slotKind,
ValueNode x) |
boolean |
rethrowException() |
void |
setRethrowException(boolean b) |
Iterable<StateSplit> |
sideEffects()
Gets the side effects preceding the current program point.
|
void |
stackOp(int opcode)
Performs a raw stack operation as defined in the Java bytecode specification.
|
int |
stackSize()
Gets the current size (height) of the stack.
|
void |
storeLocal(int i,
Kind slotKind,
ValueNode x)
Stores a given local variable at the specified index.
|
String |
toString() |
void |
traceState() |
private boolean |
verifyKind(Kind slotKind,
ValueNode x) |
private ValueNode |
xpeek() |
private ValueNode |
xpop() |
private void |
xpush(ValueNode x) |
private static final ValueNode[] EMPTY_ARRAY
private static final MonitorIdNode[] EMPTY_MONITOR_ARRAY
private final BytecodeParser parser
private final ResolvedJavaMethod method
private int stackSize
private ValueNode[] lockedObjects
private boolean canVerifyKind
private boolean rethrowException
BytecodeFrame.rethrowException
private MonitorIdNode[] monitorIds
private final StructuredGraph graph
private FrameState outerFrameState
private List<StateSplit> sideEffects
side-effect
predecessors. There will be more
than one when the current block contains no side-effects but merging predecessor blocks do.public FrameStateBuilder(BytecodeParser parser, ResolvedJavaMethod method, StructuredGraph graph)
method
- the method whose frame is simulatedgraph
- the target graph of Graal nodes created by the builderprivate FrameStateBuilder(FrameStateBuilder other)
public void disableKindVerification()
public void initializeFromArgumentsArray(ValueNode[] arguments)
public void initializeForMethodStart(boolean eagerResolve, ParameterPlugin[] parameterPlugins)
private static ValueNode[] allocateArray(int length)
public ResolvedJavaMethod getMethod()
public FrameState create(int bci, StateSplit forStateSplit)
public FrameState create(int bci, BytecodeParser parent, boolean duringCall, Kind[] pushedSlotKinds, ValueNode[] pushedValues)
pushedValues
- if non-null, values to push(Kind, ValueNode)
to the stack before
creating the FrameState
public BytecodePosition createBytecodePosition(int bci)
private BytecodePosition create(BytecodePosition o, int bci, BytecodeParser parent)
public FrameStateBuilder copy()
public boolean isCompatibleWith(FrameStateBuilder other)
public void cleanDeletedNodes()
propagateDelete(com.oracle.graal.nodes.calc.FloatingNode)
. However, this does not cover
frame state builder objects, since these are not nodes and not in the usage list of the phi
node. Therefore, we clean the frame state builder manually here, before we parse a block.public void merge(AbstractMergeNode block, FrameStateBuilder other)
private ValueNode merge(ValueNode currentValue, ValueNode otherValue, AbstractMergeNode block)
private ValuePhiNode createValuePhi(ValueNode currentValue, ValueNode otherValue, AbstractMergeNode block)
private void propagateDelete(FloatingNode node)
public void insertLoopPhis(LocalLiveness liveness, int loopId, LoopBeginNode loopBegin, boolean forcePhis)
public void insertLoopProxies(LoopExitNode loopExit, FrameStateBuilder loopEntryState)
public void insertProxies(Function<ValueNode,ValueNode> proxyFunction)
private ValueNode createLoopPhi(AbstractMergeNode block, ValueNode value)
public void pushLock(ValueNode object, MonitorIdNode monitorId)
object
- the object whose monitor will be locked.public ValueNode popLock()
public MonitorIdNode peekMonitorId()
public int lockDepth(boolean includeParents)
public void clearNonLiveLocals(BciBlockMapping.BciBlock block, LocalLiveness liveness, boolean liveIn)
public void clearLocals()
public boolean rethrowException()
BytecodeFrame.rethrowException
public void setRethrowException(boolean b)
BytecodeFrame.rethrowException
public int localsSize()
public int stackSize()
private boolean verifyKind(Kind slotKind, ValueNode x)
public ValueNode loadLocal(int i, Kind slotKind)
i
- the index of the local variable to loadslotKind
- the kind of the local variable from the point of view of the bytecodespublic void storeLocal(int i, Kind slotKind, ValueNode x)
i
- the index at which to storeslotKind
- the kind of the local variable from the point of view of the bytecodesx
- the instruction which produces the value for the localpublic void push(Kind slotKind, ValueNode x)
slotKind
- the kind of the stack element from the point of view of the bytecodesx
- the instruction to push onto the stackpublic void pushReturn(Kind slotKind, ValueNode x)
public ValueNode pop(Kind slotKind)
slotKind
- the kind of the stack element from the point of view of the bytecodespublic ValueNode[] popArguments(int argSize)
public void clearStack()
public void stackOp(int opcode)
opcode
- The Java bytecode.public boolean isAfterSideEffect()
IntrinsicContext.SideEffectsState
isAfterSideEffect
in interface IntrinsicContext.SideEffectsState
public Iterable<StateSplit> sideEffects()
IntrinsicContext.SideEffectsState
sideEffects
in interface IntrinsicContext.SideEffectsState
public void addSideEffect(StateSplit sideEffect)
IntrinsicContext.SideEffectsState
addSideEffect
in interface IntrinsicContext.SideEffectsState
public void traceState()