public final class FrameStateBuilder extends Object implements IntrinsicContext.SideEffectsState
| Modifier and Type | Field and Description |
|---|---|
protected ValueNode[] |
locals |
protected ValueNode[] |
stack |
| Constructor and Description |
|---|
FrameStateBuilder(GraphBuilderTool tool,
Bytecode code,
StructuredGraph graph,
boolean shouldRetainLocalVariables)
Creates a new frame state builder for the given code attribute, method and the given target
graph.
|
FrameStateBuilder(GraphBuilderTool tool,
ResolvedJavaMethod method,
StructuredGraph graph)
Creates a new frame state builder for the given method and the given target graph.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSideEffect(StateSplit sideEffect)
Records a side effect for the current program point.
|
void |
checkCompatibleWith(FrameStateBuilder other)
Checks invariants that must hold when merging
other into this frame state. |
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() |
FrameState |
create(int bci,
BytecodeParser parent,
boolean duringCall,
JavaKind[] pushedSlotKinds,
ValueNode[] pushedValues) |
FrameState |
create(int bci,
StateSplit forStateSplit) |
NodeSourcePosition |
createBytecodePosition(int bci) |
FrameState |
createInitialIntrinsicFrameState(ResolvedJavaMethod original) |
void |
disableKindVerification() |
boolean |
equals(Object otherObject) |
ResolvedJavaMethod |
getMethod() |
int |
hashCode() |
void |
inferPhiStamps(AbstractMergeNode block) |
void |
initializeForMethodStart(Assumptions assumptions,
boolean eagerResolve,
GraphBuilderConfiguration.Plugins plugins) |
void |
initializeFromArgumentsArray(ValueNode[] arguments) |
void |
insertLoopPhis(LocalLiveness liveness,
int loopId,
LoopBeginNode loopBegin,
boolean forcePhis,
boolean stampFromValueForForcedPhis) |
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.
|
ValueNode |
loadLocal(int i,
JavaKind 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) |
MonitorIdNode |
peekMonitorId() |
ValueNode |
peekObject() |
ValueNode |
pop(JavaKind 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.
|
void |
push(JavaKind 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(JavaKind slotKind,
ValueNode x) |
void |
replaceValue(ValueNode oldValue,
ValueNode newValue) |
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,
JavaKind slotKind,
ValueNode x)
Stores a given local variable at the specified index.
|
String |
toString() |
public FrameStateBuilder(GraphBuilderTool tool, ResolvedJavaMethod method, StructuredGraph graph)
method - the method whose frame is simulatedgraph - the target graph of Graal nodes created by the builderpublic FrameStateBuilder(GraphBuilderTool tool, Bytecode code, StructuredGraph graph, boolean shouldRetainLocalVariables)
code - the bytecode in which the frame existsgraph - the target graph of Graal nodes created by the buildershouldRetainLocalVariables - specifies if nonLiveLocals should be retained in state.public void disableKindVerification()
public void initializeFromArgumentsArray(ValueNode[] arguments)
public void initializeForMethodStart(Assumptions assumptions,
boolean eagerResolve,
GraphBuilderConfiguration.Plugins plugins)
public ResolvedJavaMethod getMethod()
public FrameState create(int bci, StateSplit forStateSplit)
public FrameState create(int bci, BytecodeParser parent, boolean duringCall, JavaKind[] pushedSlotKinds, ValueNode[] pushedValues)
pushedValues - if non-null, values to FrameStateBuilder.push(JavaKind, ValueNode) to the stack
before creating the FrameStatepublic NodeSourcePosition createBytecodePosition(int bci)
public FrameStateBuilder copy()
public void checkCompatibleWith(FrameStateBuilder other)
other into this frame state.other - PermanentBailoutException - if the frame states are incompatible with respect to their
locked objects. This indicates bytecode that has unstructured or unbalanced
locks.GraalError - if the frame states are incompatible in terms of FrameStateBuilder.rethrowException
or stack slotspublic void merge(AbstractMergeNode block, FrameStateBuilder other)
public void inferPhiStamps(AbstractMergeNode block)
public void insertLoopPhis(LocalLiveness liveness, int loopId, LoopBeginNode loopBegin, boolean forcePhis, boolean stampFromValueForForcedPhis)
public void insertLoopProxies(LoopExitNode loopExit, FrameStateBuilder loopEntryState)
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 boolean contains(ValueNode value)
public void clearNonLiveLocals(BciBlockMapping.BciBlock block, LocalLiveness liveness, boolean liveIn)
public void clearLocals()
public boolean rethrowException()
BytecodeFrame.rethrowExceptionpublic void setRethrowException(boolean b)
BytecodeFrame.rethrowExceptionpublic int localsSize()
public int stackSize()
public ValueNode loadLocal(int i, JavaKind 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,
JavaKind 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(JavaKind 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(JavaKind slotKind,
ValueNode x)
public ValueNode pop(JavaKind slotKind)
slotKind - the kind of the stack element from the point of view of the bytecodespublic ValueNode peekObject()
public ValueNode[] popArguments(int argSize)
public void clearStack()
public void stackOp(int opcode)
opcode - The Java bytecode.public boolean isAfterSideEffect()
IntrinsicContext.SideEffectsStateisAfterSideEffect in interface IntrinsicContext.SideEffectsStatepublic Iterable<StateSplit> sideEffects()
IntrinsicContext.SideEffectsStatesideEffects in interface IntrinsicContext.SideEffectsStatepublic void addSideEffect(StateSplit sideEffect)
IntrinsicContext.SideEffectsStateaddSideEffect in interface IntrinsicContext.SideEffectsStatepublic FrameState createInitialIntrinsicFrameState(ResolvedJavaMethod original)