summaryrefslogtreecommitdiff
path: root/test/files/jvm/t2214.check
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2014-08-22 09:50:44 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2014-09-09 23:56:52 +0200
commit90781e874adb1af44a43d3e64d403230970b423d (patch)
treedf7e054a165e0026e6b69bee03c13ea670d96990 /test/files/jvm/t2214.check
parenta3dfb43263a9d29d47f34ad8d183f7a01f3a1ea7 (diff)
downloadscala-90781e874adb1af44a43d3e64d403230970b423d.tar.gz
scala-90781e874adb1af44a43d3e64d403230970b423d.tar.bz2
scala-90781e874adb1af44a43d3e64d403230970b423d.zip
Eliminate unreachable code in GenBCode
We rely on dead code elimination provided by the ASM framework, as described in the ASM User Guide (http://asm.ow2.org/index.html), Section 8.2.1. It runs a data flow analysis, which only computes information for reachable instructions. Instructions for which no data is available after the analyis are unreachable. There's one issue with the ASM framework (or the way we use it): Data flow analysis requires the maxlocals and maxstack of each method to be computed. The ASM framework calculates these maxes only when writing the classfiles, not during code generation. In order to run DCE, we therefore run a MethodWriter beforehand on every method. This assings the MethodNode's maxStack/maxLocals, but it does more work (writes the instructions to a byte array). This is also what Miguel uses on his branch. The change is basically the same as https://github.com/lrytz/scala/commit/bfadf92c20. We could probably make this faster (and allocate less memory) by hacking the ASM framework: create a subclass of MethodWriter with a /dev/null byteVector. Another option would be to create a separate visitor for computing those values, duplicating the functionality from the MethodWriter. For now, I added some timers to be able to measure the time DCE takes. Here's compiling the library with -Ystatistics:jvm time in backend : 1 spans, 6597ms bcode initialization : 1 spans, 8ms (0.1%) code generation : 1 spans, 4580ms (69.4%) dead code elimination : 3771 spans, 742ms (11.2%) classfile writing : 1 spans, 879ms (13.3%)
Diffstat (limited to 'test/files/jvm/t2214.check')
0 files changed, 0 insertions, 0 deletions