Package ghidra.pcode.emu.jit.gen

# Record Class FieldForExitSlot

java.lang.Object
java.lang.Record
ghidra.pcode.emu.jit.gen.FieldForExitSlot

Record Components:
  `target` - the target address-contextreg pair of the branch exiting via this slot

All Implemented Interfaces:
  `FieldReq`, `InstanceFieldReq`

public record FieldForExitSlot(JitPassage.AddrCtx target) extends Record implements InstanceFieldReq
A field request for an `JitCompiledPassage.ExitSlot`.

One of these is allocated per `JitPassage.ExtBranch.to()`. At run time, the first time a branch is encountered from this passage to the given target, the slot calls `getEntry``(target)` and keeps the reference. Each subsequent encounter uses the kept reference. This reference is what gets returned by `JitCompiledPassage.run(int)`, so now the thread already has in hand the next `JitCompiledPassage.EntryPoint` to execute.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FieldForExitSlot(JitPassage.AddrCtx target)`
  Creates an instance of a `FieldForExitSlot` record class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `equals(Object o)`
  Indicates whether some other object is "equal to" this one.
  `void`
  `generateInitCode(JitCodeGenerator gen, org.objectweb.asm.ClassVisitor cv, org.objectweb.asm.MethodVisitor iv)`
  Emit the field declaration and its initialization bytecode
  `void`
  `generateLoadCode(JitCodeGenerator gen, org.objectweb.asm.MethodVisitor rv)`
  Emit code to load the field onto the JVM stack
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `String`
  `name()`
  Derive a suitable name for the field
  `JitPassage.AddrCtx`
  `target()`
  Returns the value of the `target` record component.
  `final String`
  `toString()`
  Returns a string representation of this record class.

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### FieldForExitSlot

    public FieldForExitSlot(JitPassage.AddrCtx target)
    Creates an instance of a `FieldForExitSlot` record class.
    Parameters:
      `target` - the value for the `target` 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`
    Returns:
      the name

  - ### generateInitCode

    public void generateInitCode(JitCodeGenerator gen, org.objectweb.asm.ClassVisitor cv, org.objectweb.asm.MethodVisitor iv)
    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 constructor.

    Consider the target `(ram:00401234,ctx=80000000)`. The declaration is equivalent to:

         private final JitCompiledPassage.ExitSlot exit_401234_80000000;

    And the initialization is equivalent to:

         exit_401234_80000000 = createExitSlot(0x401234, CTX_80000000);

    Note that this method will ensure the `CTX_...` field is allocated and loads its value as needed.

    Specified by:
      `generateInitCode` in interface `InstanceFieldReq`
    Parameters:
      `gen` - the code generator
      `cv` - the visitor for the class definition
      `iv` - the visitor for the class constructor

  - ### generateLoadCode

    public void generateLoadCode(JitCodeGenerator gen, org.objectweb.asm.MethodVisitor rv)
    Description copied from interface: `FieldReq`
    Emit code to load the field onto the JVM stack
    Specified by:
      `generateLoadCode` in interface `FieldReq`
    Parameters:
      `gen` - the code generator
      `rv` - the visitor often for the `run` method, but could be the static initializer or constructor

  - ### 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.

  - ### target

    public JitPassage.AddrCtx target()
    Returns the value of the `target` record component.
    Returns:
      the value of the `target` record component