Class JitControlFlowModel.JitBlock
- Enclosing class:
JitControlFlowModel
This follows the formal definition of a basic block, but at the p-code level. All flows into the block enter at its first op, and all flows out of the block exit at its last op. The block also contains information about these flows as well as branches out of the passage via this block.
-
Nested Class Summary
Nested classes/interfaces inherited from class ghidra.pcode.exec.PcodeProgram
PcodeProgram.MyAppender, PcodeProgram.MyFormatter
-
Field Summary
Fields inherited from class ghidra.pcode.exec.PcodeProgram
code, language, useropNames
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet internal branches leaving this blockGet branches leaving the passage from this blockGet internal branches entering this blockend()
Get the sequence number of the last opfirst()
Get the first p-code op in this blockGet (internal) flows leaving this blockflowsTo()
Get (internal) flows entering this blockIf this block has fall through, find the block into which it fallsprotected String
getHead()
For display purposes, get the header above the frame, usually the class namegetTargetBlock
(JitPassage.IntBranch branch) Get the target block for the given internal branch, assuming it's from this blockboolean
Check if there is an internal non-fall-through branch to this blockint
Get the number of instructions represented in this blockstart()
Get the sequence number of the first optoString()
int
Get the number of trailing ops in this blockMethods inherited from class ghidra.pcode.exec.PcodeProgram
execute, format, format, fromInject, fromInstruction, fromInstruction, getCode, getLanguage
-
Constructor Details
-
JitBlock
Construct a new block- Parameters:
program
- the program (i.e., passage) from which this block is derivedcode
- the subset of ops, in execution order, comprising this block
-
-
Method Details
-
getHead
Description copied from class:PcodeProgram
For display purposes, get the header above the frame, usually the class name- Overrides:
getHead
in classPcodeProgram
- Returns:
- the frame's display header
-
toString
- Overrides:
toString
in classPcodeProgram
-
first
Get the first p-code op in this block- Returns:
- the first p-code op
-
start
Get the sequence number of the first opThis is used for display and testing purposes only.
- Returns:
- the sequence number
-
end
Get the sequence number of the last opThis is used for display and testing purposes only.
- Returns:
- the sequence number
-
flowsFrom
Get (internal) flows leaving this block- Returns:
- the flows, keyed by branch
-
flowsTo
Get (internal) flows entering this block- Returns:
- the flows, keyed by branch
-
branchesFrom
Get internal branches leaving this block- Returns:
- the list of branches
-
branchesTo
Get internal branches entering this block- Returns:
- the list of branches
-
branchesOut
Get branches leaving the passage from this block- Returns:
- the list of branches
-
getFallFrom
If this block has fall through, find the block into which it falls- Returns:
- the block, or
null
-
hasJumpTo
public boolean hasJumpTo()Check if there is an internal non-fall-through branch to this blockThis is used by the
JitCodeGenerator
to determine whether or not a block's bytecode needs to be labeled.- Returns:
- true if this block is targeted by a branch
-
getTargetBlock
Get the target block for the given internal branch, assuming it's from this block- Parameters:
branch
- the branch- Returns:
- the target block or null
-
instructionCount
public int instructionCount()Get the number of instructions represented in this blockThis may get dicey as blocks are not necessarily split on instruction boundaries. Nevertheless, we seek to count the number of instructions executed at runtime, so that we can replay an execution, step in reverse, etc. What we actually do here is count the number of ops which are the first op produced by a decoded instruction.
- Returns:
- the instruction count
- See Also:
-
trailingOpCount
public int trailingOpCount()Get the number of trailing ops in this blockIt is possible a block represents only partial execution of an instruction. Though
instructionCount()
will count this partial instruction, we can tell how far we got into it by examining this value. With this, we should be able to replay an execution to exactly the same p-code op step.- Returns:
- the trailing op count
-