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.
- Alphabetic
- By Inheritance
- BytecodeOptimizer
- MethodsBinding
- MethodsReader
- Constant_PoolAbstractions
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
abstract
type
Attributes
- Definition Classes
- MethodsReader
-
abstract
type
CONSTANT_Utf8_info <: (BytecodeOptimizer.this)#Constant_Pool_Entry
- Definition Classes
- Constant_PoolAbstractions
-
abstract
type
ClassFile
- Definition Classes
- Constant_PoolAbstractions
-
final
type
Constant_Pool = Array[(BytecodeOptimizer.this)#Constant_Pool_Entry]
- Definition Classes
- Constant_PoolAbstractions
-
abstract
type
Constant_Pool_Entry <: ConstantPoolEntry
- Definition Classes
- Constant_PoolAbstractions
-
final
type
Constant_Pool_Index = Int
- Definition Classes
- Constant_PoolAbstractions
-
type
DeferredActionsStore = Buffer[((BytecodeOptimizer.this)#ClassFile) ⇒ (BytecodeOptimizer.this)#ClassFile] with (BytecodeOptimizer.this)#Constant_Pool_Entry
- Definition Classes
- Constant_PoolAbstractions
-
type
Method_Info = Method
- Definition Classes
- MethodsBinding → MethodsReader
-
type
Methods = RefArray[(BytecodeOptimizer.this)#Method_Info]
- Definition Classes
- MethodsReader
Abstract Value Members
-
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
-
abstract
def
applyDeferredActions(cp: (BytecodeOptimizer.this)#Constant_Pool, classFile: (BytecodeOptimizer.this)#ClassFile): (BytecodeOptimizer.this)#ClassFile
- Definition Classes
- Constant_PoolAbstractions
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final val LogControlFlowSimplifications: Boolean
-
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
- BytecodeOptimizer → MethodsBinding → MethodsReader
-
def
Methods(cp: (BytecodeOptimizer.this)#Constant_Pool, in: DataInputStream): (BytecodeOptimizer.this)#Methods
- Definition Classes
- MethodsReader
- final val PerformControlFlowSimplifications: Boolean
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def optimizeInstructions(exceptionsHandlers: ExceptionHandlers, instructions: Array[Instruction]): Boolean
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )