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
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.

Linear Supertypes
MethodsBinding, MethodsReader, Constant_PoolAbstractions, AnyRef, Any
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. All

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
    Definition Classes
    Constant_PoolAbstractions
  8. type Method_Info = Method
    Definition Classes
    MethodsBinding → MethodsReader
  9. type Methods = RefArray[(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
    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
    Definition Classes
    BytecodeOptimizerMethodsBinding → MethodsReader
  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[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  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(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from MethodsBinding

Inherited from MethodsReader

Inherited from Constant_PoolAbstractions

Inherited from AnyRef

Inherited from Any

Ungrouped