Packages

trait BytecodeOptimizer extends MethodsBinding

Performs some very basic, in-place control-flow simplifications to make the code more regular. In particular to make it more likely that an if that is actually a loop's if actually jumps back.

The following transformations are performed:

  • trivial gotos which jump to the immediately succeeding instruction are replaced by nops (the CFG may contain less basic blocks afterwards)
  • goto chains are shortened (i.e., a goto jumping to another goto) (this primarily reduces the number of instructions that need to be evaluated at abstract interpretation time; it may - however - also reduce the number of basic blocks)
  • useless ifs where the jump target is the next instruction are replaced by nops (the CFG may contain less basic blocks afterwards)
  • if -> goto instruction sequences are resolved (this primarily reduces the number of instructions that need to be evaluated at abstract interpretation time; it may - however - also reduce the number of basic blocks)
  • useless switches are replaced (the CFG may contain less basic blocks afterwards)

The target array has the same size as the source array to make sure that branch offsets/line- numbers etc. point to the correct instruction. Furthermore, we try to avoid the introduction of dead code.

Self Type
BytecodeOptimizer with ClassFileBinding with ConstantPoolBinding with AttributeBinding
Source
BytecodeOptimizer.scala
Note

All transformation always only reduce the number of basic blocks and never create new basic blocks. The existing stack map table attributes are never effected and remain valid; they may just contain more entries than strictly necessary.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BytecodeOptimizer
  2. MethodsBinding
  3. MethodsReader
  4. Constant_PoolAbstractions
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. abstract type Attributes
    Definition Classes
    MethodsReader
  2. abstract type CONSTANT_Utf8_info <: (BytecodeOptimizer.this)#Constant_Pool_Entry
    Definition Classes
    Constant_PoolAbstractions
  3. abstract type ClassFile
    Definition Classes
    Constant_PoolAbstractions
  4. final type Constant_Pool = Array[(BytecodeOptimizer.this)#Constant_Pool_Entry]
    Definition Classes
    Constant_PoolAbstractions
  5. abstract type Constant_Pool_Entry <: ConstantPoolEntry
    Definition Classes
    Constant_PoolAbstractions
  6. final type Constant_Pool_Index = Int
    Definition Classes
    Constant_PoolAbstractions
  7. type DeferredActionsStore = Buffer[((BytecodeOptimizer.this)#ClassFile) => (BytecodeOptimizer.this)#ClassFile] with (BytecodeOptimizer.this)#Constant_Pool_Entry

    A DeferredActionsStore stores all functions that need to perform post load actions.

    A DeferredActionsStore stores all functions that need to perform post load actions.

    One example is the resolution of references to attributes. (The constant pool is the only structure that is passed around and hence it is the only place where to store information/functions related to a specific class file).

    Definition Classes
    Constant_PoolAbstractions
  8. type Method_Info = Method
    Definition Classes
    MethodsBindingMethodsReader
  9. type Methods = ArraySeq[(BytecodeOptimizer.this)#Method_Info]
    Definition Classes
    MethodsReader

Abstract Value Members

  1. abstract def Attributes(cp: (BytecodeOptimizer.this)#Constant_Pool, ap: AttributeParent, ap_name_index: (BytecodeOptimizer.this)#Constant_Pool_Index, ap_descriptor_index: (BytecodeOptimizer.this)#Constant_Pool_Index, in: DataInputStream): (BytecodeOptimizer.this)#Attributes
    Attributes
    protected
    Definition Classes
    MethodsReader
  2. abstract def applyDeferredActions(cp: (BytecodeOptimizer.this)#Constant_Pool, classFile: (BytecodeOptimizer.this)#ClassFile): (BytecodeOptimizer.this)#ClassFile

    This method is called/needs to be called after the class file was completely loaded to perform class file specific transformations.

    This method is called/needs to be called after the class file was completely loaded to perform class file specific transformations.

    Definition Classes
    Constant_PoolAbstractions
  3. implicit abstract val constantPoolEntryType: ClassTag[(BytecodeOptimizer.this)#Constant_Pool_Entry]
    Definition Classes
    Constant_PoolAbstractions

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final val LogControlFlowSimplifications: Boolean
  5. def Method_Info(cp: (BytecodeOptimizer.this)#Constant_Pool, accessFlags: Int, name_index: Int, descriptor_index: Int, attributes: (BytecodeOptimizer.this)#Attributes): (BytecodeOptimizer.this)#Method_Info
  6. def Methods(cp: (BytecodeOptimizer.this)#Constant_Pool, in: DataInputStream): (BytecodeOptimizer.this)#Methods
    Definition Classes
    MethodsReader
  7. final val PerformControlFlowSimplifications: Boolean
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. implicit val methodInfoType: ClassTag[(BytecodeOptimizer.this)#Method_Info]
    Definition Classes
    MethodsBindingMethodsReader
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  19. def optimizeInstructions(exceptionsHandlers: ExceptionHandlers, instructions: Array[Instruction]): Boolean
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from MethodsBinding

Inherited from MethodsReader

Inherited from AnyRef

Inherited from Any

Ungrouped