scala/scala — pull request #2665 by magarciaEPFL (2013-06-20 12:13:49+00:00)
Title: taming outer refs: anon-closures that retain fewer heap objects (3rd attempt)

This PR supersedes #2634

Original discussion at https://groups.google.com/forum/#!topic/scala-internals/jQiRINTvhZQ

Looking into the future, after fixing https://issues.scala-lang.org/browse/SI-4440
the constructors phase should be kept in synch with that fix. Thus this "note to the future".
In particular, with that fix in place, while the `$outer` field and its accessor won't be elided as often as now,
they will still be elided for anon-closure-classes (provided the `$outer` in question sees no use).
For similar reasons, the optimization in this PR will still be useful (not for inner classes fulfilling some conditions
but for anon-closure classes fulfilling some conditions). Two comments in the previous PR go into more detail: https://github.com/scala/scala/pull/2634#issuecomment-19173210 and
https://github.com/scala/scala/pull/2634#issuecomment-19259239

review by @JamesIry