Interface JitType

All Known Subinterfaces:
JitType.LeggedJitType<T,LT>, JitType.SimpleJitType<T,JT>
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.

  • Method Details

    • unify

      static JitType unify(JitType a, JitType b)
      Get the smallest type to which both of the given types can be converted without loss.

      When the given types are a mix of integral and floating-point, this chooses an integral type whose size is the greater of the two.

      Parameters:
      a - the first type
      b - the second type
      Returns:
      the uniform type
    • unifyLeast

      static JitType unifyLeast(JitType a, JitType b)
      Similar to unify(JitType, JitType), except that it takes the lesser size.

      This is used when culling of unnecessary loads is desired and loss of precision is acceptable.

      Parameters:
      a - the first type
      b - the second type
      Returns:
      the uniform type
    • 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
    • legTypesBE

      List<? extends JitType.SimpleJitType<?,?>> legTypesBE()
      Get the p-code type that describes the part of the variable in each leg

      Each whole leg will have the type JitType.IntJitType.I4, and the partial leg, if applicable, will have its appropriate smaller integer type.

      Returns:
      the list of types, each fitting in a JVM int, in big-endian order.
    • legTypesLE

      List<? extends JitType.SimpleJitType<?,?>> legTypesLE()
      Get the p-code type that describes the part of the variable in each leg

      Each whole leg will have the type JitType.IntJitType.I4, and the partial leg, if applicable, will have its appropriate smaller integer type.

      Returns:
      the list of types, each fitting in a JVM int, in little-endian order.