scala/scala — pull request #3971 by lrytz (2014-09-09 22:10:51+00:00)
Title: GenBCode: eliminate unreachable code

Re-submission of #3957

[`-Ybackend:GenBCode` test](https://scala-webapps.epfl.ch/jenkins/job/scala-checkin-manual/1337/) running.

Here's some of the changes, but just refer to individual commit messages.

The actual DCE is implemented by the ASM framework. As noted in the commit message, it is slow. I think OK enough if we run it once (which is currently the case. Note that it's enabled even in non-optimized mode). But it will probably be too slow if we apply it multiple times (to clean up after other optimizations). I think we should merge it as-is for now, we can later implement a faster DCE.

I added a new compiler flag `-Yopt` for enabling / disabling optimizations in GenBCode. I think it makes sense for now, we can always decide later how to interpret old flags when the new backend is enabled.

You can now write JUnit tests like:
```
assertSameCode(
singleMethodInstructions(compiler)("def f: Int = { return 1; 2 }").dropNonOp,
List(Op(ICONST_1), Op(IRETURN))
```