Interface MemoryVarGen<V extends JitVarnodeVar>

Type Parameters:
V - the class of p-code variable node in the use-def graph
All Superinterfaces:
ValGen<V>, VarGen<V>
All Known Subinterfaces:
DirectMemoryVarGen, MemoryOutVarGen, SubMemoryVarGen<V>
All Known Implementing Classes:
SubDirectMemoryVarGen, SubMemoryOutVarGen, WholeDirectMemoryVarGen, WholeMemoryOutVarGen

public interface MemoryVarGen<V extends JitVarnodeVar> extends VarGen<V>
The generator for memory variables.

These variables affect the state immediately, i.e., they are not birthed or retired as local JVM variables. The generator delegates to the appropriate AccessGen for this variable's varnode and assigned type.

  • Method Details

    • getVarnode

      default Varnode getVarnode(JitCodeGenerator<?> gen, V v)
      Get the varnode actually accessed for the given p-code variable

      This is made to be overridden for the implementation of subpiece access.

      Parameters:
      gen - the code generator
      v - the value
      Returns:
      the varnode
    • genValInit

      default <THIS extends JitCompiledPassage, N extends Emitter.Next> Emitter<N> genValInit(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v)
      Description copied from interface: ValGen
      Emit code to 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.

      This should be used to emit code into the constructor.

      Specified by:
      genValInit in interface ValGen<V extends JitVarnodeVar>
      Type Parameters:
      THIS - the type of the generated class
      N - the tail of the stack (...)
      Parameters:
      em - the emitter
      localThis - a handle to this
      gen - the code generator
      v - the value
      Returns:
      the emitter with ...
    • genReadToStack

      default <THIS extends JitCompiledPassage, T extends Types.BPrim<?>, JT extends JitType.SimpleJitType<T, JT>, N extends Emitter.Next> Emitter<Emitter.Ent<N,T>> genReadToStack(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JT type, Opnd.Ext ext)
      Description copied from interface: ValGen
      Emit code to read the value onto the stack
      Specified by:
      genReadToStack in interface ValGen<V extends JitVarnodeVar>
      Type Parameters:
      THIS - the type of the generated class
      T - the desired JVM type
      JT - the desired p-code type
      N - the tail of the stack (...)
      Parameters:
      em - the emitter
      localThis - a handle to this
      gen - the code generator
      v - the value
      type - the desired p-code type
      ext - the kind of extension to apply
      Returns:
      the emitter with ..., result
    • genReadToOpnd

      default <THIS extends JitCompiledPassage, N extends Emitter.Next> Opnd.OpndEm<JitType.MpIntJitType,N> genReadToOpnd(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope)
      Description copied from interface: ValGen
      Emit code to read the value into local variables

      NOTE: In some cases, this may not emit any code at all. It may simple compose the operand from locals already allocated for a variable being "read."

      Specified by:
      genReadToOpnd in interface ValGen<V extends JitVarnodeVar>
      Type Parameters:
      THIS - the type of the generated class
      N - the tail of the stack (...)
      Parameters:
      em - the emitter
      localThis - a handle to this
      gen - the code generator
      v - the value
      type - the desired p-code type
      ext - the kind of extension to apply
      scope - a scope for generated temporary variables
      Returns:
      the operand and emitter with ...
    • genReadLegToStack

      default <THIS extends JitCompiledPassage, N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genReadLegToStack(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JitType.MpIntJitType type, int leg, Opnd.Ext ext)
      Description copied from interface: ValGen
      Emit code to read a leg of the value onto the stack
      Specified by:
      genReadLegToStack in interface ValGen<V extends JitVarnodeVar>
      Type Parameters:
      THIS - the type of the generated class
      N - the tail of the stack (...)
      Parameters:
      em - the emitter
      localThis - a handle to this
      gen - the code generator
      v - the value
      type - the desired p-code type
      leg - the leg index, 0 being the least significant
      ext - the kind of extension to apply
      Returns:
      the emitter with ..., result
    • genReadToArray

      default <THIS extends JitCompiledPassage, N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TRef<int[]>>> genReadToArray(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope, int slack)
      Description copied from interface: ValGen
      Emit code to read the value into an array
      Specified by:
      genReadToArray in interface ValGen<V extends JitVarnodeVar>
      Type Parameters:
      THIS - the type of the generated class
      N - the tail of the stack (...)
      Parameters:
      em - the emitter
      localThis - a handle to this
      gen - the code generator
      v - the value
      type - the desired p-code type
      ext - the kind of extension to apply
      scope - a scope for generated temporary variables
      slack - the number of extra (more significant) elements to allocate in the array
      Returns:
      the operand and emitter with ..., arrayref
    • genReadToBool

      default <THIS extends JitCompiledPassage, N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genReadToBool(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, V v)
      Description copied from interface: ValGen
      Emit code to read the value onto the stack as a boolean
      Specified by:
      genReadToBool in interface ValGen<V extends JitVarnodeVar>
      Type Parameters:
      THIS - the type of the generated class
      N - the tail of the stack (...)
      Parameters:
      em - the emitter
      localThis - a handle to this
      gen - the code generator
      v - the value
      Returns:
      the emitter with ..., result