Packages

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

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.

Source
InlineInfoAttribute.scala
Linear Supertypes
Serializable, java.io.Serializable, Product, Equals, Attribute, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. InlineInfoAttribute
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Attribute
  7. AnyRef
  8. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new InlineInfoAttribute(inlineInfo: InlineInfo)

Value Members

  1. val inlineInfo: InlineInfo
  2. def isCodeAttribute(): Boolean
    Definition Classes
    Attribute
  3. def isUnknown(): Boolean

    Not sure what this method is good for, it is not invoked anywhere in the ASM framework.

    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.

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

    Deserialize the attribute into an InlineInfo.

    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.

    Definition Classes
    InlineInfoAttribute → Attribute
  5. def write(cw: ClassWriter, code: Array[Byte], len: Int, maxStack: Int, maxLocals: Int): ByteVector

    Serialize the inlineInfo into a byte array.

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

    Definition Classes
    InlineInfoAttribute → Attribute