Enum Class JitTypeBehavior

java.lang.Object
java.lang.Enum<JitTypeBehavior>
ghidra.pcode.emu.jit.analysis.JitTypeBehavior
All Implemented Interfaces:
Serializable, Comparable<JitTypeBehavior>, Constable

public enum JitTypeBehavior extends Enum<JitTypeBehavior>
The behavior/requirement for an operand's type.
See Also:
  • Enum Constant Details

    • ANY

      public static final JitTypeBehavior ANY
      No type requirement or interpretation.
    • INTEGER

      public static final JitTypeBehavior INTEGER
      The bits are interpreted as an integer.
    • FLOAT

      public static final JitTypeBehavior FLOAT
      The bits are interpreted as a floating-point value.
    • COPY

      public static final JitTypeBehavior COPY
      For JitCopyOp and JitPhiOp: No type requirement or interpretation, but there is an implication that the output has the same interpretation as the inputs.
  • Method Details

    • values

      public static JitTypeBehavior[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static JitTypeBehavior valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • compare

      public static int compare(JitTypeBehavior b1, JitTypeBehavior b2)
      Compare two behaviors by preference. The behavior with the smaller ordinal is preferred.
      Parameters:
      b1 - the first behavior
      b2 - the second behavior
      Returns:
      as in Comparator.compare(Object, Object)
    • type

      public abstract JitType type(int size)
      Apply this behavior to a value of the given size to determine its type
      Parameters:
      size - the size of the value in bytes
      Returns:
      the resulting type
      Throws:
      AssertionError - if the type is not applicable, and such an invocation was not expected
    • resolve

      public abstract JitType resolve(JitType varType)
      Re-apply this behavior to an existing type

      For ANY and COPY the result is the given type.

      Parameters:
      varType - the type
      Returns:
      the resulting type
    • forJavaType

      public static JitTypeBehavior forJavaType(Class<?> cls)
      Derive the type behavior from a Java language type.

      This is used on userops declared with Java primitives for parameters. To work with the JitTypeModel, we need to specify the type behavior of each operand. We aim to select behaviors such that the model allocates JVM locals whose JVM types match the userop method's parameters. This optimizes type conversions during Direct invocation.

      Parameters:
      cls - the primitive class (not boxed)
      Returns:
      the p-code type behavior
      See Also: