Package serp.bytecode

Class 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 Details

    • _opcodeTypes

      private static final Set _opcodeTypes
  • Constructor Details

    • TypedInstruction

      TypedInstruction(Code owner)
    • TypedInstruction

      TypedInstruction(Code owner, int opcode)
  • Method Details

    • mapType

      String mapType(String type, 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 needed
      demote - if true, all object types will be demoted to Object.class
    • getTypeName

      public abstract String getTypeName()
      Return the type name for this instruction. If the type has not been set, this method will return null.
    • getType

      public 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(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(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