Package com.tonic.analysis.ssa.type
Enum PrimitiveType
- java.lang.Object
-
- java.lang.Enum<PrimitiveType>
-
- com.tonic.analysis.ssa.type.PrimitiveType
-
- All Implemented Interfaces:
IRType,Serializable,Comparable<PrimitiveType>
public enum PrimitiveType extends Enum<PrimitiveType> implements IRType
Represents JVM primitive types.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BOOLEANTruth value, descriptorZ, treated as integral since the JVM carries it as an int.BYTE8-bit signed integer, descriptorB, integral and one slot wide.CHAR16-bit unsigned integer, descriptorC, counted as integral here.DOUBLE64-bit floating point, descriptorD, occupying two local or stack slots.FLOAT32-bit floating point, descriptorF, occupying one slot.INT32-bit signed integer, descriptorI, and the width the narrower integral types compute in.LONG64-bit signed integer, descriptorJ, occupying two local or stack slots.SHORT16-bit signed integer, descriptorS, integral and one slot wide.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDescriptor()intgetSize()booleanisArray()booleanisFloatingPoint()Checks if this is a floating-point type.booleanisIntegral()Checks if this is an integral type.booleanisPrimitive()booleanisReference()booleanisTwoSlot()booleanisVoid()static PrimitiveTypevalueOf(String name)Returns the enum constant of this type with the specified name.static PrimitiveType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BOOLEAN
public static final PrimitiveType BOOLEAN
Truth value, descriptorZ, treated as integral since the JVM carries it as an int.
-
BYTE
public static final PrimitiveType BYTE
8-bit signed integer, descriptorB, integral and one slot wide.
-
CHAR
public static final PrimitiveType CHAR
16-bit unsigned integer, descriptorC, counted as integral here.
-
SHORT
public static final PrimitiveType SHORT
16-bit signed integer, descriptorS, integral and one slot wide.
-
INT
public static final PrimitiveType INT
32-bit signed integer, descriptorI, and the width the narrower integral types compute in.
-
LONG
public static final PrimitiveType LONG
64-bit signed integer, descriptorJ, occupying two local or stack slots.
-
FLOAT
public static final PrimitiveType FLOAT
32-bit floating point, descriptorF, occupying one slot.
-
DOUBLE
public static final PrimitiveType DOUBLE
64-bit floating point, descriptorD, occupying two local or stack slots.
-
-
Method Detail
-
values
public static PrimitiveType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PrimitiveType c : PrimitiveType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PrimitiveType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
getDescriptor
public String getDescriptor()
- Specified by:
getDescriptorin interfaceIRType- Returns:
- the JVM type descriptor for this type
-
getSize
public int getSize()
-
isReference
public boolean isReference()
- Specified by:
isReferencein interfaceIRType- Returns:
- true for object and array types
-
isPrimitive
public boolean isPrimitive()
- Specified by:
isPrimitivein interfaceIRType- Returns:
- true for the eight primitive types
-
isVoid
public boolean isVoid()
-
isArray
public boolean isArray()
-
isTwoSlot
public boolean isTwoSlot()
-
isIntegral
public boolean isIntegral()
Checks if this is an integral type.- Returns:
- true if boolean, byte, char, short, or int
-
isFloatingPoint
public boolean isFloatingPoint()
Checks if this is a floating-point type.- Returns:
- true if float or double
-
-