Record Class VarGen.BlockTransition<THIS extends JitCompiledPassage>

java.lang.Object
java.lang.Record
ghidra.pcode.emu.jit.gen.var.VarGen.BlockTransition<THIS>
Type Parameters:
THIS - the type of the generated class
Record Components:
localThis - a handle to this
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<THIS extends JitCompiledPassage>(Local<Types.TRef<THIS extends JitCompiledPassage>> localThis, JitCodeGenerator<THIS extends JitCompiledPassage> gen, Set<Varnode> toRetire, Set<Varnode> toBirth) extends Record
A means to emit bytecode on transitions between blocks
  • Constructor Details

    • BlockTransition

      public BlockTransition(Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> 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:
      localThis - a handle to this
      gen - the code generator
    • BlockTransition

      public BlockTransition(Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, Set<Varnode> toRetire, Set<Varnode> toBirth)
      Creates an instance of a BlockTransition record class.
      Parameters:
      localThis - the value for the localThis record component
      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
    • genFwd

      public <N extends Emitter.Next> Emitter<N> genFwd(Emitter<N> em)
      Emit bytecode for the transition
      Type Parameters:
      N - the tail of the stack (...)
      Parameters:
      em - the emitter
      Returns:
      the emitter with ...
    • genInv

      public <N extends Emitter.Next> Emitter<N> genInv(Emitter<N> em)
      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. (genFwd(Emitter) 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.

      Type Parameters:
      N - the tail of the stack (...)
      Parameters:
      em - the emitter
      Returns:
      the emitter with ...
    • 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.
    • localThis

      public Local<Types.TRef<THIS>> localThis()
      Returns the value of the localThis record component.
      Returns:
      the value of the localThis record component
    • gen

      public JitCodeGenerator<THIS> 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