Interface JitType
- All Known Subinterfaces:
JitType.SimpleJitType
- All Known Implementing Classes:
JitType.DoubleJitType,JitType.FloatJitType,JitType.IntJitType,JitType.LongJitType,JitType.MpFloatJitType,JitType.MpIntJitType
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 ClassesModifier and TypeInterfaceDescriptionstatic enumThe p-code type for floating-point of size 8, i.e., that fits in a JVM double.static enumThe p-code type for floating-point of size 4, i.e., that fits in a JVM float.static final recordThe p-code types for integers of size 1 through 4, i.e., that fit in a JVM int.static final recordThe p-code types for integers of size 5 through 8, i.e., that fit in a JVM long.static final recordWIP: The p-code types for floats of size other than 4 and 8static final recordThe p-code types for integers of size 9 and greater.static interfaceA p-code type that can be represented in a single JVM variable. -
Method Summary
Modifier and TypeMethodDescriptionstatic intCompare two types by preference.ext()Extend this p-code type to the p-code type that fills its entire host JVM type.static JitTypeforJavaType(Class<?> cls) Identify the p-code type that is exactly represented by the given JVM type.List<? extends JitType.SimpleJitType> legTypes()Get the p-code type that describes the part of the variable in each legnm()Part of the name of a JVM local variable allocated for this typeintpref()The preference for this type.intsize()The size of this type
-
Method Details
-
compare
Compare two types by preference. The type with the more preferred behavior then smaller size is preferred.- Parameters:
t1- the first typet2- the second type- Returns:
- as in
Comparator.compare(Object, Object)
-
forJavaType
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
int3values usingimulthat the result might be anint4and so may need additional conversion.- Returns:
- the extended type
-
legTypes
List<? extends JitType.SimpleJitType> legTypes()Get the p-code type that describes the part of the variable in each legEach 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.
-