Class ControlFlowGraph.InstructionContextImpl
java.lang.Object
org.apache.bcel.verifier.structurals.ControlFlowGraph.InstructionContextImpl
- All Implemented Interfaces:
InstructionContext
- Enclosing class:
ControlFlowGraph
private final class ControlFlowGraph.InstructionContextImpl
extends Object
implements InstructionContext
Objects of this class represent a node in a ControlFlowGraph. These nodes are instructions, not basic blocks.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List
<InstructionContext> The 'execution predecessors' - a list of type InstructionContext of those instances that have been execute()d before in that order.private final Map
<InstructionContext, Frame> The 'incoming' execution Frames.private final InstructionHandle
The InstructionHandle this InstructionContext is wrapped around.private final Map
<InstructionContext, Frame> The 'outgoing' execution Frames.private int
The TAG field is here for external temporary flagging, such as graph coloring. -
Constructor Summary
ConstructorsConstructorDescriptionCreates an InstructionHandleImpl object from an InstructionHandle. -
Method Summary
Modifier and TypeMethodDescriptionprivate InstructionHandle[]
A utility method that calculates the successors of a given InstructionHandle That means, a RET does have successors as defined here.boolean
execute
(Frame inFrame, ArrayList<InstructionContext> execPreds, InstConstraintVisitor icv, ExecutionVisitor ev) "Merges in" (vmspec2, page 146) the "incoming" frame situation; executes the instructions symbolically and therefore calculates the "outgoing" frame situation.private void
Extends the StructuralCodeConstraintException ("e") object with an at-the-end-extended message.Returns the exception handlers of this instruction.private String
Returns the control flow execution chain.Returns the InstructionHandle this InstructionContext is wrapped around.getOutFrame
(ArrayList<InstructionContext> execChain) Returns a clone of the "outgoing" frame situation with respect to the given ExecutionChain.Returns the usual control flow successors.int
getTag()
The getTag and setTag methods may be used for temporary flagging, such as graph coloring.Returns the InstructionContextImpl with an JSR/JSR_W that was last in the ExecutionChain, without a corresponding RET, i.e.private boolean
mergeInFrames
(Frame inFrame) Does the actual merging (vmspec2, page 146).void
setTag
(int tag) The getTag and setTag methods may be used for temporary flagging, such as graph coloring.toString()
Returns a simple String representation of this InstructionContext.
-
Field Details
-
TAG
private int TAGThe TAG field is here for external temporary flagging, such as graph coloring.- See Also:
-
instruction
The InstructionHandle this InstructionContext is wrapped around. -
inFrames
The 'incoming' execution Frames. -
outFrames
The 'outgoing' execution Frames. -
executionPredecessors
The 'execution predecessors' - a list of type InstructionContext of those instances that have been execute()d before in that order.
-
-
Constructor Details
-
InstructionContextImpl
Creates an InstructionHandleImpl object from an InstructionHandle. Creation of one per InstructionHandle suffices. Don't create more.
-
-
Method Details
-
_getSuccessors
A utility method that calculates the successors of a given InstructionHandle That means, a RET does have successors as defined here. A JsrInstruction has its target as its successor (opposed to its physical successor) as defined here. -
execute
public boolean execute(Frame inFrame, ArrayList<InstructionContext> execPreds, InstConstraintVisitor icv, ExecutionVisitor ev) "Merges in" (vmspec2, page 146) the "incoming" frame situation; executes the instructions symbolically and therefore calculates the "outgoing" frame situation. Returns: True iff the "incoming" frame situation changed after merging with "inFrame". The execPreds ArrayList must contain the InstructionContext objects executed so far in the correct order. This is just one execution path [out of many]. This is needed to correctly "merge" in the special case of a RET's successor. The InstConstraintVisitor and ExecutionVisitor instances must be set up correctly.- Specified by:
execute
in interfaceInstructionContext
- Returns:
- true - if and only if the "outgoing" frame situation changed from the one before execute()ing.
- See Also:
-
extendMessageWithFlow
Extends the StructuralCodeConstraintException ("e") object with an at-the-end-extended message. This extended message will then reflect the execution flow needed to get to the constraint violation that triggered the throwing of the "e" object. -
getExceptionHandlers
Returns the exception handlers of this instruction.- Specified by:
getExceptionHandlers
in interfaceInstructionContext
-
getExecutionChain
Returns the control flow execution chain. This is built while execute(Frame, ArrayList)-ing the code represented by the surrounding ControlFlowGraph. -
getInFrame
- Specified by:
getInFrame
in interfaceInstructionContext
-
getInstruction
Description copied from interface:InstructionContext
Returns the InstructionHandle this InstructionContext is wrapped around.- Specified by:
getInstruction
in interfaceInstructionContext
- Returns:
- The InstructionHandle this InstructionContext is wrapped around.
-
getOutFrame
Returns a clone of the "outgoing" frame situation with respect to the given ExecutionChain.- Specified by:
getOutFrame
in interfaceInstructionContext
- See Also:
-
getSuccessors
Description copied from interface:InstructionContext
Returns the usual control flow successors.- Specified by:
getSuccessors
in interfaceInstructionContext
- See Also:
-
getTag
public int getTag()Description copied from interface:InstructionContext
The getTag and setTag methods may be used for temporary flagging, such as graph coloring. Nothing in the InstructionContext object depends on the value of the tag. JustIce does not use it.- Specified by:
getTag
in interfaceInstructionContext
- See Also:
-
lastExecutionJSR
Returns the InstructionContextImpl with an JSR/JSR_W that was last in the ExecutionChain, without a corresponding RET, i.e. we were called by this one. Returns null if we were called from the top level. -
mergeInFrames
Does the actual merging (vmspec2, page 146). Returns true IFF this.inFrame was changed in course of merging with inFrame. -
setTag
public void setTag(int tag) Description copied from interface:InstructionContext
The getTag and setTag methods may be used for temporary flagging, such as graph coloring. Nothing in the InstructionContext object depends on the value of the tag. JustIce does not use it.- Specified by:
setTag
in interfaceInstructionContext
- See Also:
-
toString
Returns a simple String representation of this InstructionContext.
-