Interface SubVarHandler<ST extends Types.BPrim<?>,SJT extends JitType.SimpleJitType<ST,SJT>,WT extends Types.BPrim<?>,WJT extends JitType.SimpleJitType<WT,WJT>>

Type Parameters:
ST - the JVM type of the sub variable
SJT - the p-code type of the sub variable
WT - the JVM type of the containing variable
WJT - the p-code type of the containing variable
All Superinterfaces:
VarHandler
All Known Subinterfaces:
SubInLongHandler<ST,SJT>
All Known Implementing Classes:
IntInIntHandler, IntInLongHandler, LongInLongHandler

public interface SubVarHandler<ST extends Types.BPrim<?>,SJT extends JitType.SimpleJitType<ST,SJT>,WT extends Types.BPrim<?>,WJT extends JitType.SimpleJitType<WT,WJT>> extends VarHandler
A handler to p-code variables stored in just a portion of a single JVM local variable.
  • Method Details

    • assertShiftFits

      default void assertShiftFits(int byteShift, SJT type, JvmLocal<WT,WJT> local)
      Verify that the sub variable as shifted actually fits in the containing variable
      Parameters:
      byteShift - the number of unused bytes in the container variable to the right of the sub variable
      type - the type of the sub variable
      local - the containing local variable
    • byteShift

      int byteShift()
      Returns the number of unused bytes in the container variable to the right of the sub variable.
      Returns:
      the number of unused bytes in the container variable to the right of the sub variable
    • bitSize

      default int bitSize()
      Returns the number of bits in the sub variable.
      Returns:
      the number of bits in the sub variable
    • bitShift

      default int bitShift()
      Returns the number of unused bits in the container variable to the right of the sub variable.
      Returns:
      the number of unused bits in the container variable to the right of the sub variable
    • intMask

      default int intMask()
      Returns the mask indicating which parts of the int containing variable are within the sub variable.
      Returns:
      the mask indicating which parts of the int containing variable are within the sub variable
    • longMask

      default long longMask()
      Returns the mask indicating which parts of the long containing variable are within the sub variable.
      Returns:
      the mask indicating which parts of the long containing variable are within the sub variable
    • local

      JvmLocal<WT,WJT> local()
      Returns The containing local variable.
      Returns:
      The containing local variable
    • type

      SJT 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
    • getConvToSub

      Get the converter of multi-precision integers to the type of the sub variable.

      The converter need not worry about positioning or masking wrt. the sub variable. It should extract from the multi-precision integer the minimum number of legs needed to fill the sub variable, i.e., it need only consider the sub variable's size. This handler will then mask and position it within the containing variable for storage.

      Returns:
      the converter
    • 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
    • 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
    • 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