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.
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.
Optimizations within a single method.
Optimizations within a single method.
unreachable code
removeUnreachableCode
empty exception handlers
simplify jumps
empty local variable descriptors
empty line numbers
stale labels
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.