scala-dev icon indicating copy to clipboard operation
scala-dev copied to clipboard

Eliminate unused (inlined) private methods (including $anonfun)

Open lrytz opened this issue 10 years ago • 1 comments
trafficstars

Example:

class C {
  def t = {
    val f = (b: Int, i: Object) => 0
    f(1, null)
  }
}

The classfile has an unused method C$$$anonfun$1$adapted. After closure rewriting and inlining C$$$anonfun$1$adapted, method t directly invokes C$$$anonfun$1. In case that method also gets inlined, it could be eliminated as well.

lrytz avatar Nov 13 '15 10:11 lrytz

Maybe requires collecting additional information from method symbols into the backend metadata: whether the method is private (in Scala's view).

lrytz avatar Nov 13 '15 10:11 lrytz