New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new inliner does not inline methods that allocate an indylambda closure #9378

scabug opened this Issue Jul 3, 2015 · 2 comments


None yet
2 participants
Copy link

scabug commented Jul 3, 2015

The GenBCode inliner doesn't inline methods that have an invokedynamic instruction, see here and here.

class A {
  @inline final def assert(c: Boolean, m: => String): Unit = {
    if (!c) println(m)

  @inline final def assert(c: Boolean): Unit = assert(c, "")

  def test(b: Boolean): Unit = {
➜  sandbox git:(yoptInScala) ✗ qsc -Yopt:l:classpath -Yopt-warnings:_ Test.scala 
Test.scala:9: warning: A::assert(Z)V is annotated @inline but could not be inlined:
The callee A::assert(Z)V contains the instruction INVOKEDYNAMIC apply()Lscala/runtime/java8/JFunction0; [
      // handle kind 0x6 : INVOKESTATIC
      // arguments:
      // handle kind 0x6 : INVOKESTATIC
that would cause an IllegalAccessError when inlined into class A.
one warning found

When enabling the new optimizer in scala/scala (scala/scala#4602), we needed to add a filter to some partest tests to make them ignore the new inliner warning:

  • presentation/t7678
  • run/t8029.scala

This comment has been minimized.

Copy link

scabug commented Jul 3, 2015


This comment has been minimized.

Copy link

scabug commented Jul 6, 2015

@scabug scabug closed this Jul 23, 2015

@scabug scabug added the blocker label Apr 7, 2017

@scabug scabug added this to the 2.12.0-M2 milestone Apr 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment