Class BranchLeaveMatching
java.lang.Object
net.covers1624.coffeegrinder.bytecode.matching.BranchLeaveMatching
Created by covers1624 on 19/4/21.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancompatibleExitInstruction(@Nullable Instruction exit1, @Nullable Instruction exit2) Returns true if exit1 and exit2 are both exit instructions (branch or leave) and both represent the same exit.static @Nullable BranchmatchBranch(@Nullable Instruction insn, Block targetBlock) Attempts to match a branch instruction to a given block.static @Nullable LeavematchLeave(@Nullable Instruction insn, BlockContainer container) Attempts to match a leave instruction which leaves the specified BlockContainer.static @Nullable ReturnmatchReturn(@Nullable Instruction insn, MethodDecl method) static @Nullable ThrowmatchThrow(@Nullable Instruction insn, LocalVariable variable) Attempts to match aThrowinstruction, which loads the specified variable.
-
Constructor Details
-
BranchLeaveMatching
public BranchLeaveMatching()
-
-
Method Details
-
matchReturn
@Nullable public static @Nullable Return matchReturn(@Nullable @Nullable Instruction insn, MethodDecl method) -
matchLeave
@Nullable public static @Nullable Leave matchLeave(@Nullable @Nullable Instruction insn, BlockContainer container) Attempts to match a leave instruction which leaves the specified BlockContainer.- Parameters:
insn- The instruction.container- The BlockContainer.- Returns:
- The Leave instruction, otherwise empty.
-
matchBranch
@Nullable public static @Nullable Branch matchBranch(@Nullable @Nullable Instruction insn, Block targetBlock) Attempts to match a branch instruction to a given block.- Parameters:
insn- The instruction.targetBlock- The target block.- Returns:
- The Branch instruction, otherwise empty.
-
compatibleExitInstruction
public static boolean compatibleExitInstruction(@Nullable @Nullable Instruction exit1, @Nullable @Nullable Instruction exit2) Returns true if exit1 and exit2 are both exit instructions (branch or leave) and both represent the same exit.- Parameters:
exit1- The first exit point.exit2- The second exit point.- Returns:
- If they represent the same exit.
-
matchThrow
@Nullable public static @Nullable Throw matchThrow(@Nullable @Nullable Instruction insn, LocalVariable variable) Attempts to match aThrowinstruction, which loads the specified variable.- Parameters:
insn- The Instruction.variable- The variable.- Returns:
- The
Throwornull.
-