Interface SimpleVarHandler<T extends Types.BPrim<?>,JT extends JitType.SimpleJitType<T,JT>>

Type Parameters:
T - the JVM type of the variable
JT - the p-code type of the variable
All Superinterfaces:
VarHandler
All Known Implementing Classes:
DoubleVarAlloc, FloatVarAlloc, IntVarAlloc, LongVarAlloc

public interface SimpleVarHandler<T extends Types.BPrim<?>,JT extends JitType.SimpleJitType<T,JT>> extends VarHandler
A handler for p-code variables composed of a single JVM local variable.
  • Method Details

    • local

      JvmLocal<T,JT> local()
      Get the local variable into which this p-code variable is allocated
      Returns:
      the local
    • vn

      default Varnode vn()
      Description copied from interface: VarHandler
      Get the complete varnode accessible to this handler
      Specified by:
      vn in interface VarHandler
      Returns:
      the varnode
    • type

      JT type()
      Description copied from interface: VarHandler
      Get the p-code type of the local variable this handler uses.
      Specified by:
      type in interface VarHandler
      Returns:
      the type
    • genLoadToStack

      default <TT extends Types.BPrim<?>, TJT extends JitType.SimpleJitType<TT, TJT>, N extends Emitter.Next> Emitter<Emitter.Ent<N,TT>> genLoadToStack(Emitter<N> em, JitCodeGenerator<?> gen, TJT type, Opnd.Ext ext)
      Description copied from interface: VarHandler
      Emit bytecode to load the varnode's value onto the JVM stack.
      Specified by:
      genLoadToStack in interface VarHandler
      Type Parameters:
      TT - the JVM type of the value to load onto the stack
      TJT - the p-code type of the value to load onto the stack
      N - the incoming stack
      Parameters:
      em - the emitter typed with the incoming stack
      gen - the code generator
      type - the p-code type of the value expected on the JVM stack by the proceeding bytecode
      ext - the kind of extension to apply when adjusting from JVM size to varnode size
      Returns:
      the emitter typed with the resulting stack
    • genLoadToOpnd

      default <N extends Emitter.Next> Opnd.OpndEm<JitType.MpIntJitType,N> genLoadToOpnd(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope)
      Description copied from interface: VarHandler
      Emit bytecode to load the varnode's value into several locals.
      Specified by:
      genLoadToOpnd in interface VarHandler
      Type Parameters:
      N - the incoming stack
      Parameters:
      em - the emitter typed with the incoming stack
      gen - the code generator
      type - the p-code type of the value expected on the JVM stack by the proceeding bytecode
      ext - the kind of extension to apply
      scope - a scope for generating temporary local storage
      Returns:
      the operand containing the locals, and the emitter typed with the incoming stack
    • genLoadLegToStackC1

      default <N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genLoadLegToStackC1(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, int leg, Opnd.Ext ext)
      This provides the implementation of VarHandler.genLoadLegToStack(Emitter, JitCodeGenerator, MpIntJitType, int, Ext) for category-1 primitives, i.e., int and float.

      Only leg 0 is meaningful for a category-1 primitive. Any other leg is just the extension of the one leg.

      Type Parameters:
      N - the incoming stack
      Parameters:
      em - the emitter typed with the incoming stack
      gen - the code generator
      type - the p-code type of the complete multi-precision value
      leg - the index of the leg to load, 0 being least significant
      ext - the kind of extension to apply
      Returns:
      the emitter typed with the resulting stack, i.e., having the int leg pushed onto it
    • genLoadLegToStackC2

      default <N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genLoadLegToStackC2(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, int leg, Opnd.Ext ext)
      This provides the implementation of VarHandler.genLoadLegToStack(Emitter, JitCodeGenerator, MpIntJitType, int, Ext) for category-2 primitives, i.e., long and double.

      Only legs 0 and 1 are meaningful for a category-2 primitive. Any other leg is just the extension of the upper leg.

      Type Parameters:
      N - the incoming stack
      Parameters:
      em - the emitter typed with the incoming stack
      gen - the code generator
      type - the p-code type of the complete multi-precision value
      leg - the index of the leg to load, 0 being least significant
      ext - the kind of extension to apply
      Returns:
      the emitter typed with the resulting stack, i.e., having the int leg pushed onto it
    • genLoadToArray

      default <N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TRef<int[]>>> genLoadToArray(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope, int slack)
      Description copied from interface: VarHandler
      Emit bytecode to load the varnode's value into an integer array in little-endian order, pushing its ref onto the JVM stack.
      Specified by:
      genLoadToArray in interface VarHandler
      Type Parameters:
      N - the incoming stack
      Parameters:
      em - the emitter typed with the incoming stack
      gen - the code generator
      type - the p-code type of the complete multi-precision value
      ext - the kind of extension to apply
      scope - a scope for generating temporary local storage
      slack - the number of additional, more significant, elements to allocate in the array
      Returns:
      the emitter typed with the resulting stack, i.e., having the ref pushed onto it
    • genStoreFromStack

      default <FT extends Types.BPrim<?>, FJT extends JitType.SimpleJitType<FT, FJT>, N1 extends Emitter.Next, N0 extends Emitter.Ent<N1, FT>> Emitter<N1> genStoreFromStack(Emitter<N0> em, JitCodeGenerator<?> gen, FJT type, Opnd.Ext ext, Scope scope)
      Description copied from interface: VarHandler
      Emit bytecode to store a value into a variable from the JVM stack.
      Specified by:
      genStoreFromStack in interface VarHandler
      Type Parameters:
      FT - the JVM type of the value on the stack
      FJT - the p-code type of the value on the stack
      N1 - the tail of the incoming stack
      N0 - the incoming stack having the value to store on top
      Parameters:
      em - the emitter typed with the incoming stack
      gen - the code generator
      type - the p-code type of the value on the stack
      ext - the kind of extension to apply
      scope - a scope for generating temporary local storage
      Returns:
      the emitter typed with the resulting stack, i.e., having popped the value
    • getConvToStack

      Get the converter of multi-precision integers to the stack type of this handler's local.

      Note that the converter need only extract the least 1 or 2 legs of the source multi-precision int, depending on the category of the destination's type. The converter knows how to handle both the operand (series of locals) and array forms.

      Returns:
      the converter
    • genStoreFromOpnd

      default <N extends Emitter.Next> Emitter<N> genStoreFromOpnd(Emitter<N> em, JitCodeGenerator<?> gen, Opnd<JitType.MpIntJitType> opnd, Opnd.Ext ext, Scope scope)
      Description copied from interface: VarHandler
      Emit bytecode to store a varnode's value from several locals.
      Specified by:
      genStoreFromOpnd in interface VarHandler
      Type Parameters:
      N - the incoming stack
      Parameters:
      em - the emitter typed with the incoming stack
      gen - the code generator
      opnd - the operand whose locals contain the value to be stored
      ext - the kind of extension to apply
      scope - a scope for generating temporary local storage
      Returns:
      the emitter typed with the incoming stack
    • genStoreFromArray

      default <N1 extends Emitter.Next, N0 extends Emitter.Ent<N1, Types.TRef<int[]>>> Emitter<N1> genStoreFromArray(Emitter<N0> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope)
      Description copied from interface: VarHandler
      Emit bytecode to store a varnode's value from an array of integer legs, in little endian order
      Specified by:
      genStoreFromArray in interface VarHandler
      Type Parameters:
      N1 - the tail of the incoming stack
      N0 - the incoming stack having the array ref on top
      Parameters:
      em - the emitter typed with the incoming stack
      gen - the code generator
      type - the p-code type of the value on the stack
      ext - the kind of extension to apply
      scope - a scope for generating temporary local storage
      Returns:
      the emitter typed with the resulting stack, i.e., having popped the array