InlineInfoAttribute

dotty.tools.backend.jvm.opt.InlineInfoAttribute
See theInlineInfoAttribute companion object
case class InlineInfoAttribute(inlineInfo: InlineInfo) extends 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 (method names, method signatures) would exist in there anyway. So the ScalaInlineAttribute remains relatively compact.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Attribute
class Object
trait Matchable
class Any
Show all
Known subtypes

Members list

Value members

Concrete methods

override def isUnknown: Boolean

Not sure what this method is good for, it is not invoked anywhere in the ASM framework. However, the example in the ASM manual also overrides it to false for custom attributes, so it might be a good idea.

Not sure what this method is good for, it is not invoked anywhere in the ASM framework. However, the example in the ASM manual also overrides it to false for custom attributes, so it might be a good idea.

Attributes

Definition Classes
override def read(cr: ClassReader, off: Int, len: Int, buf: Array[Char], codeOff: Int, labels: Array[Label]): InlineInfoAttribute

Deserialize the attribute into an InlineInfo. The attribute starts at cr.b(off), but we don't need to access that array directly, we can use the read methods provided by the ClassReader.

Deserialize the attribute into an InlineInfo. The attribute starts at cr.b(off), but we don't need to access that array directly, we can use the read methods provided by the ClassReader.

buf is a pre-allocated character array that is guaranteed to be long enough to hold any string of the constant pool. So we can use it to invoke cr.readUTF8.

Attributes

Definition Classes
override def write(cw: ClassWriter, code: Array[Byte], len: Int, maxStack: Int, maxLocals: Int): ByteVector

Serialize the inlineInfo into a byte array. Strings are added to the constant pool and serialized as references.

Serialize the inlineInfo into a byte array. Strings are added to the constant pool and serialized as references.

Attributes

Definition Classes

Inherited methods

Attributes

Inherited from:
Attribute

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product

Inherited fields

final val `type`: String

Attributes

Inherited from:
Attribute