scala.tools.nsc.backend.jvm

# opt

#### package opt

Content Hierarchy Learn more about scaladoc diagrams
Visibility

1. Public
2. All

### Type Members

1. #### class ByteCodeRepository extends AnyRef

   The ByteCodeRepository provides utilities to read the bytecode of classfiles from the compilation classpath.

   The ByteCodeRepository provides utilities to read the bytecode of classfiles from the compilation classpath. Parsed classes are cached in the `classes` map.

2. #### class CallGraph[BT <: BTypes] extends AnyRef

3. #### case class InlineInfoAttribute(inlineInfo: InlineInfo) extends Attribute with Product with Serializable

   This attribute stores the InlineInfo for a ClassBType as an independent classfile attribute.

   This attribute stores the InlineInfo for a ClassBType as an independent classfile attribute. The compiler does so for every class being compiled.

   The reason is that a precise InlineInfo can only be obtained if the symbol for a class is available. For example, we need to know if a method is final in Scala's terms, or if it has the @inline annotation. Looking up a class symbol for a given class filename is brittle (name-mangling).

   The attribute is also helpful for inlining mixin methods. The mixin phase only adds mixin method symbols to classes that are being compiled. For all other class symbols, there are no mixin members. However, the inliner requires an InlineInfo for inlining mixin members. That problem is solved by reading the InlineInfo from this attribute.

   In principle we could encode the InlineInfo into a Java annotation (instead of a classfile attribute). However, an attribute allows us to save many bits. In particular, note that the strings in an InlineInfo are serialized as references to constants in the constant pool, and those strings (traitImplClassSelfType, method names, method signatures) would exist in there anyway. So the ScalaInlineAttribute remains relatively compact.

4. #### class Inliner[BT <: BTypes] extends AnyRef

5. #### class LocalOpt[BT <: BTypes] extends AnyRef

   Optimizations within a single method.

   Optimizations within a single method.

   unreachable code

   - removes instructions of basic blocks to which no branch instruction points + enables eliminating some exception handlers and local variable descriptors > eliminating them is required for correctness, as explained in `removeUnreachableCode`

   empty exception handlers

   - removes exception handlers whose try block is empty + eliminating a handler where the try block is empty and reachable will turn the catch block unreachable. in this case "unreachable code" is invoked recursively until reaching a fixpoint. > for try blocks that are unreachable, "unreachable code" removes also the instructions of the catch block, and the recursive invocation is not necessary.

   simplify jumps

   - various simplifications, see doc domments of individual optimizations + changing or eliminating jumps may render some code unreachable, therefore "simplify jumps" is executed in a loop with "unreachable code"

   empty local variable descriptors

   - removes entries from the local variable table where the variable is not actually used + enables eliminating labels that the entry points to (if they are not otherwise referenced)

   empty line numbers

   - eliminates line number nodes that describe no executable instructions + enables eliminating the label of the line number node (if it's not otherwise referenced)

   stale labels

   - eliminate labels that are not referenced, merge sequences of label definitions.

### Value Members

1. #### object ByteCodeRepository

2. #### object BytecodeUtils

3. #### object InlineInfoAttribute extends Serializable

4. #### object InlineInfoAttributePrototype extends InlineInfoAttribute

   In order to instruct the ASM framework to de-serialize the ScalaInlineInfo attribute, we need to pass a prototype instance when running the class reader.

5. #### object InstructionResultSize

6. #### object LocalOptImpls

### Ungrouped