Record Class VarGen.BlockTransition

java.lang.Object
java.lang.Record
ghidra.pcode.emu.jit.gen.var.VarGen.BlockTransition
Record Components:
gen - the code generator
toRetire - the varnodes to retire on the transition
toBirth - the varnodes to birth on the transition
Enclosing interface:
VarGen<V extends JitVar>

public static record VarGen.BlockTransition(JitCodeGenerator gen, Set<Varnode> toRetire, Set<Varnode> toBirth) extends Record
A means to emit bytecode on transitions between blocks
  • Constructor Details

    • BlockTransition

      public BlockTransition(JitCodeGenerator gen)
      Construct a "nop" or blank transition.

      The transition is mutable, so it's common to create one in this fashion and then populate it.

      Parameters:
      gen - the code generator
    • BlockTransition

      public BlockTransition(JitCodeGenerator gen, Set<Varnode> toRetire, Set<Varnode> toBirth)
      Creates an instance of a BlockTransition record class.
      Parameters:
      gen - the value for the gen record component
      toRetire - the value for the toRetire record component
      toBirth - the value for the toBirth record component
  • Method Details

    • needed

      public boolean needed()
      Check if a transition is actually needed.

      When a transition is not needed, some smaller control-flow constructs (e.g., in CBranchOpGen) can be averted.

      Returns:
      true if bytecode must be emitted
    • generate

      public void generate(org.objectweb.asm.MethodVisitor rv)
      Emit bytecode for the transition
      Parameters:
      rv - the visitor for the run method
    • generateInv

      public void generateInv(org.objectweb.asm.MethodVisitor rv)
      Emit bytecode for the reverse transition

      Sometimes "transitions" are used around hazards, notably CallOtherOpGen. This method is used after the hazard to restore the live variables in scope. (generate(MethodVisitor) is used before the hazard.) Variables that were retired and re-birthed here. There should not have been any variables birthed going into the hazard.

      Parameters:
      rv - the visitor for the run method
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • gen

      public JitCodeGenerator gen()
      Returns the value of the gen record component.
      Returns:
      the value of the gen record component
    • toRetire

      public Set<Varnode> toRetire()
      Returns the value of the toRetire record component.
      Returns:
      the value of the toRetire record component
    • toBirth

      public Set<Varnode> toBirth()
      Returns the value of the toBirth record component.
      Returns:
      the value of the toBirth record component