Package ghidra.pcode.emu.jit.analysis
Enum Class JitTypeBehavior
- All Implemented Interfaces:
Serializable,Comparable<JitTypeBehavior>,Constable
The behavior/requirement for an operand's type.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionNo type requirement or interpretation.The bits are interpreted as a floating-point value.The bits are interpreted as an integer. -
Method Summary
Modifier and TypeMethodDescriptionstatic intcompare(JitTypeBehavior b1, JitTypeBehavior b2) Compare two behaviors by preference.static JitTypeBehaviorforJavaType(Class<?> cls) Derive the type behavior from a Java language type.abstract JitTypeRe-apply this behavior to an existing typeabstract JitTypetype(int size) Apply this behavior to a value of the given size to determine its typestatic JitTypeBehaviorReturns the enum constant of this class with the specified name.static JitTypeBehavior[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ANY
No type requirement or interpretation. -
INTEGER
The bits are interpreted as an integer. -
FLOAT
The bits are interpreted as a floating-point value. -
COPY
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
compare
Compare two behaviors by preference. The behavior with the smaller ordinal is preferred.- Parameters:
b1- the first behaviorb2- the second behavior- Returns:
- as in
Comparator.compare(Object, Object)
-
type
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
- Parameters:
varType- the type- Returns:
- the resulting type
-
forJavaType
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:
-