Record Class FieldForVarnode

java.lang.Object
java.lang.Record
ghidra.pcode.emu.jit.gen.FieldForVarnode
Record Components:
vn - the varnode to pre-construct
All Implemented Interfaces:
FieldReq<Types.TRef<Varnode>>, StaticFieldReq<Types.TRef<Varnode>>

public record FieldForVarnode(Varnode vn) extends Record implements StaticFieldReq<Types.TRef<Varnode>>
A field request for a pre-constructed varnode

These are used to invoke userops using the Standard strategy.

See Also:
  • Constructor Details

    • FieldForVarnode

      public FieldForVarnode(Varnode vn)
      Creates an instance of a FieldForVarnode record class.
      Parameters:
      vn - the value for the vn record component
  • Method Details

    • name

      public String name()
      Description copied from interface: FieldReq
      Derive a suitable name for the field
      Specified by:
      name in interface FieldReq<Types.TRef<Varnode>>
      Returns:
      the name
    • genClInitCode

      public <N extends Emitter.Next> Emitter<N> genClInitCode(Emitter<N> em, JitCodeGenerator<?> gen, org.objectweb.asm.ClassVisitor cv)
      Emit the field declaration and its initialization bytecode

      The declaration is emitted into the class definition, and the initialization code is emitted into the class initializer.

      Consider the varnode (ram:00400000,4). The code is equivalent to:

       private static final Varnode VARNODE_ram_400000_4 = createVarnode(ADDRESS_FACTORY, "ram", 0x400000, 4);
       
      Specified by:
      genClInitCode in interface StaticFieldReq<Types.TRef<Varnode>>
      Type Parameters:
      N - the incoming stack
      Parameters:
      em - the emitter typed with the incoming stack
      gen - the code generator
      cv - the visitor for the class definition
      Returns:
      the emitter typed with the incoming stack
    • genLoad

      public <N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TRef<Varnode>>> genLoad(Emitter<N> em, JitCodeGenerator<?> gen)
      Emit code to load the field onto the JVM stack

      To clarify, this does not load a varnode's current value onto the JVM stack. That is done by VarGen. This loads a ref to the Varnode instance. Also, it's not precisely the same instance as given, but a re-construction of it as a plain Varnode, i.e., just the (space,offset,size) triple.

      Specified by:
      genLoad in interface StaticFieldReq<Types.TRef<Varnode>>
      Type Parameters:
      N - the incoming stack
      Parameters:
      em - the emitter typed with the incoming stack
      gen - the code generator
      Returns:
      the emitter typed with the resulting stack, i.e., having pushed the value
    • 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.
    • vn

      public Varnode vn()
      Returns the value of the vn record component.
      Returns:
      the value of the vn record component