Package ghidra.pcode.emu.jit.analysis

# Record Class JitAllocationModel.MultiLocalSub

java.lang.Object
java.lang.Record
ghidra.pcode.emu.jit.analysis.JitAllocationModel.MultiLocalSub

Record Components:
  `local` - the local variable allocated to this part
  `shift` - the number of bytes and direction to shift (+ is right)

Enclosing class:
  `JitAllocationModel`

public static record JitAllocationModel.MultiLocalSub(JitAllocationModel.JvmLocal local, int shift) extends Record
A portion of a multi-local variable handler.

This portion is allocated in a JVM local. When loading with a positive shift, the value is shifted to the right to place it into position.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MultiLocalSub(JitAllocationModel.JvmLocal local, int shift)`
  Creates an instance of a `MultiLocalSub` 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`
  `generateLoadCode(JitCodeGenerator gen, JitType type, TypeConversions.Ext ext, org.objectweb.asm.MethodVisitor rv)`
  Emit bytecode to load the value from this local and position it in a value on the JVM stack.
  `void`
  `generateStoreCode(JitCodeGenerator gen, JitType type, TypeConversions.Ext ext, org.objectweb.asm.MethodVisitor rv)`
  Emit bytecode to extract this part from the value on the JVM stack and store it in the local variable.
  `final int`
  `hashCode()`
  Returns a hash code value for this object.
  `JitAllocationModel.JvmLocal`
  `local()`
  Returns the value of the `local` record component.
  `int`
  `shift()`
  Returns the value of the `shift` 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

  - ### MultiLocalSub

    public MultiLocalSub(JitAllocationModel.JvmLocal local, int shift)
    Creates an instance of a `MultiLocalSub` record class.
    Parameters:
      `local` - the value for the `local` record component
      `shift` - the value for the `shift` record component

- ## Method Details

  - ### generateLoadCode

    public void generateLoadCode(JitCodeGenerator gen, JitType type, TypeConversions.Ext ext, org.objectweb.asm.MethodVisitor rv)
    Emit bytecode to load the value from this local and position it in a value on the JVM stack.

    If multiple parts are to be combined, the caller should emit a bitwise or after all loads but the first.

    Parameters:
      `gen` - the code generator
      `type` - the p-code type of the value expected on the stack by the proceeding bytecode, which may be to load additional parts
      `ext` - the kind of extension to apply when adjusting from JVM size to varnode size
      `rv` - the visitor for the `run` method
    Implementation Notes:
      We must keep temporary values in a variable of the larger of the local's or the expected type, otherwise bits may get dropped while positioning the value.

  - ### generateStoreCode

    public void generateStoreCode(JitCodeGenerator gen, JitType type, TypeConversions.Ext ext, org.objectweb.asm.MethodVisitor rv)
    Emit bytecode to extract this part from the value on the JVM stack and store it in the local variable.

    If multiple parts are to be stored, the caller should emit a `dup` or `dup2` before all stores but the last.

    Parameters:
      `gen` - the code generator
      `type` - the p-code type of the value expected on the stack by the proceeding bytecode, which may be to load additional parts
      `ext` - the kind of extension to apply when adjusting from varnode size to JVM size
      `rv` - the visitor for the `run` method
    Implementation Notes:
      We must keep temporary values in a variable of the larger of the local's or the expected type, otherwise bits may get dropped while positioning 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. Reference components are compared with `Objects::equals(Object,Object)`; primitive components are compared with '=='.
    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.

  - ### local

    public JitAllocationModel.JvmLocal local()
    Returns the value of the `local` record component.
    Returns:
      the value of the `local` record component

  - ### shift

    public int shift()
    Returns the value of the `shift` record component.
    Returns:
      the value of the `shift` record component