Interface JitType

All Known Subinterfaces:
JitType.SimpleJitType
All Known Implementing Classes:
JitType.DoubleJitType, JitType.FloatJitType, JitType.IntJitType, JitType.LongJitType, JitType.MpFloatJitType, JitType.MpIntJitType

public interface JitType
The p-code type of an operand.

A type is an integer of floating-point value of a specific size in bytes. All values and variables in p-code are just bit vectors. The operators interpret those vectors according to a JitTypeBehavior. While types only technically belong to the operands, we also talk about values, variables, and varnodes being assigned types, so that we can allocate suitable JVM locals.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The p-code type for floating-point of size 8, i.e., that fits in a JVM double.
    static enum 
    The p-code type for floating-point of size 4, i.e., that fits in a JVM float.
    static final record 
    The p-code types for integers of size 1 through 4, i.e., that fit in a JVM int.
    static final record 
    The p-code types for integers of size 5 through 8, i.e., that fit in a JVM long.
    static final record 
    WIP: The p-code types for floats of size other than 4 and 8
    static final record 
    WIP: The p-code types for integers of size 9 and greater.
    static interface 
    A p-code type that can be represented in a single JVM variable.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Compare two types by preference.
    ext()
    Extend this p-code type to the p-code type that fills its entire host JVM type.
    static JitType
    Identify the p-code type that is exactly represented by the given JVM type.
    nm()
    Part of the name of a JVM local variable allocated for this type
    int
    The preference for this type.
    int
    The size of this type
  • Method Details

    • compare

      static int compare(JitType t1, JitType t2)
      Compare two types by preference. The type with the more preferred behavior then smaller size is preferred.
      Parameters:
      t1 - the first type
      t2 - the second type
      Returns:
      as in Comparator.compare(Object, Object)
    • forJavaType

      static JitType forJavaType(Class<?> cls)
      Identify the p-code type that is exactly represented by the given JVM type.

      This is used during Direct userop invocation to convert the arguments and return value.

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

      int pref()
      The preference for this type. Smaller is more preferred.
      Returns:
      the preference
    • nm

      String nm()
      Part of the name of a JVM local variable allocated for this type
      Returns:
      the "type" part of a JVM local's name
    • size

      int size()
      The size of this type
      Returns:
      the size in bytes
    • ext

      JitType ext()
      Extend this p-code type to the p-code type that fills its entire host JVM type.

      This is useful, e.g., when multiplying two int3 values using imul that the result might be an int4 and so may need additional conversion.

      Returns:
      the extended type