Package serp.bytecode
Class TypedInstruction
- java.lang.Object
-
- serp.bytecode.CodeEntry
-
- serp.bytecode.Instruction
-
- serp.bytecode.TypedInstruction
-
- All Implemented Interfaces:
BCEntity
,VisitAcceptor
- Direct Known Subclasses:
ArrayInstruction
,ClassInstruction
,CmpInstruction
,ConstantInstruction
,ConvertInstruction
,LocalVariableInstruction
,MathInstruction
,NewArrayInstruction
,ReturnInstruction
,StackInstruction
public abstract class TypedInstruction extends Instruction
Any typed instruction.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Set
_opcodeTypes
-
Constructor Summary
Constructors Constructor Description TypedInstruction(Code owner)
TypedInstruction(Code owner, int opcode)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Class
getType()
Return the type for this instruction.BCClass
getTypeBC()
Return the type for this instruction.abstract java.lang.String
getTypeName()
Return the type name for this instruction.(package private) java.lang.String
mapType(java.lang.String type, java.lang.Class[][] mappings, boolean demote)
Return the type for the given name.TypedInstruction
setType(java.lang.Class type)
Set the type of this instruction.abstract TypedInstruction
setType(java.lang.String type)
Set the type of this instruction.TypedInstruction
setType(BCClass type)
Set the type of this instruction.-
Methods inherited from class serp.bytecode.Instruction
acceptVisit, equalsInstruction, getByteIndex, getClassLoader, getCode, getLength, getLineNumber, getLogicalStackChange, getName, getOpcode, getPool, getProject, getStackChange, invalidate, invalidateByteIndexes, isValid, read, read, setOpcode, write
-
-
-
-
Method Detail
-
mapType
java.lang.String mapType(java.lang.String type, java.lang.Class[][] mappings, boolean demote)
Return the type for the given name. Takes into account the given mappings and the demote flag.- Parameters:
mappings
- mappings of one type to another; for example, array instruction treat booleans as ints, so to reflect that there should be an index x of the array such that mappings[x][0] = boolean.class and mappings[x][1] = int.class; may be null if no special mappings are neededdemote
- if true, all object types will be demoted to Object.class
-
getTypeName
public abstract java.lang.String getTypeName()
Return the type name for this instruction. If the type has not been set, this method will return null.
-
getType
public java.lang.Class getType()
Return the type for this instruction. If the type has not been set, this method will return null.
-
getTypeBC
public BCClass getTypeBC()
Return the type for this instruction. If the type has not been set, this method will return null.
-
setType
public abstract TypedInstruction setType(java.lang.String type)
Set the type of this instruction. Types that have no direct support will be converted accordingly.- Returns:
- this instruction, for method chaining
-
setType
public TypedInstruction setType(java.lang.Class type)
Set the type of this instruction. Types that have no direct support will be converted accordingly.- Returns:
- this instruction, for method chaining
-
setType
public TypedInstruction setType(BCClass type)
Set the type of this instruction. Types that have no direct support will be converted accordingly.- Returns:
- this instruction, for method chaining
-
-