Class JitControlFlowModel.JitBlock
- All Implemented Interfaces:
CountsPcodeOps
- 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 PcodeProgram
PcodeProgram.MyAppender, PcodeProgram.MyFormatter -
Field Summary
Fields inherited from class PcodeProgram
code, language, userops -
Constructor Summary
ConstructorsChangeConstructorDescriptionJitBlock(PcodeProgram program, List<PcodeOp> code) Construct a new block -
Method Summary
ChangeModifier 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 StringgetHead()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 blockbooleanhasJumpTo(Predicate<JitControlFlowModel.BlockFlow> predicate) Check if there is an internal non-fall-through branch to this blockintReturns the number of instructions counted.start()Get the sequence number of the first optoString()intReturns the number of trailing p-code ops counted.REMOVEDbooleanRemovedMethods inherited from class PcodeProgram
execute, format, format, fromInject, fromInstruction, fromInstruction, getCode, getLanguage, getUseropName, getUseropNumber
-
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:PcodeProgramFor display purposes, get the header above the frame, usually the class name- Overrides:
getHeadin classPcodeProgram- Returns:
- the frame's display header
-
toString
- Overrides:
toStringin classPcodeProgram
-
first
-
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 MODIFIED
return type: JitBlock → BlockFlow-ghidra.pcode.emu.jit.analysis.JitControlFlowModel.JitBlock getFallFrom()+ghidra.pcode.emu.jit.analysis.JitControlFlowModel.BlockFlow getFallFrom()If this block has fall through, find the block into which it falls- Returns:
- the block, or
null
-
hasJumpTo
Check if there is an internal non-fall-through branch to this blockThis is used by the
JitCodeGeneratorto determine whether or not a block's bytecode needs to be labeled.- Parameters:
predicate- additional predicate to test the flow- 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()Returns the number of instructions counted.This 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.
- Specified by:
instructionCountin interfaceCountsPcodeOps- Returns:
- the number of instructions counted
- See Also:
-
trailingOpCount
public int trailingOpCount()Description copied from interface:CountsPcodeOpsReturns the number of trailing p-code ops counted.This represents partial execution of an instruction. Though
CountsPcodeOps.instructionCount()does count the partial instruction, this indicates how much of that instruction was counted. This should provide enough information to replay an execution to exactly the same p-code op step.- Specified by:
trailingOpCountin interfaceCountsPcodeOps- Returns:
- the number of trailing p-code ops counted
-