Interface ValGen<V extends JitVal>

Type Parameters:
V - the class op p-code value node in the use-def graph
All Known Subinterfaces:
LocalVarGen<V>, MemoryVarGen<V>, VarGen<V>
All Known Implementing Classes:
ConstValGen, DirectMemoryVarGen, InputVarGen, LocalOutVarGen, MemoryOutVarGen, MissingVarGen

public interface ValGen<V extends JitVal>
The bytecode generator for a specific value (operand) access.

The JitCodeGenerator selects the correct generator for each input operand using lookup(JitVal) and each output operand VarGen.lookup(JitVar). The op generator has already retrieved the JitOp whose operands are of the JitVal class.

Varnode Type Use-Def Type Generator Type Read Bytecodes / Methods Write Bytecodes / Methods
constant JitConstVal ConstValGen ldc
unique,
register
JitInputVar,
JitLocalOutVar,
JitMissingVar
InputVarGen,
LocalOutVarGen
See JitType.SimpleJitType.opcodeLoad():
iload, lload, fload, dload
See JitType.SimpleJitType.opcodeStore():
istore, lstore, fstore, dstore
memory JitDirectMemoryVar,
JitMemoryOutVar
DirectMemoryVarGen,
MemoryOutVarGen
readInt*, readLong*, etc. writeInt*, writeLong*, etc.
*indirect JitIndirectMemoryVar None
See Also:
  • Method Details

    • lookup

      static <V extends JitVal> ValGen<V> lookup(V v)
      Lookup the generator for a given p-code value use-def node
      Type Parameters:
      V - the class of the value
      Parameters:
      v - the JitVal whose generator to look up
      Returns:
      the generator
    • generateValInitCode

      void generateValInitCode(JitCodeGenerator gen, V v, org.objectweb.asm.MethodVisitor iv)
      Prepare any class-level items required to use this variable

      For example, if this represents a direct memory variable, then this can prepare a reference to the portion of the state involved, allowing it to access it readily.

      Parameters:
      gen - the code generator
      v - the value
      iv - the constructor visitor
    • generateValReadCode

      JitType generateValReadCode(JitCodeGenerator gen, V v, JitTypeBehavior typeReq, org.objectweb.asm.MethodVisitor rv)
      Read the value onto the stack
      Parameters:
      gen - the code generator
      v - the value to read
      typeReq - the required type of the value
      rv - the visitor for the run method
      Returns:
      the actual p-code type (which determines the JVM type) of the value on the stack