diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-09-04 08:07:57 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2014-09-10 09:55:33 +0200 |
commit | 59070cc385560b48267cbc77e872027dd8304c05 (patch) | |
tree | f2eaf1bd8f1737cf04bfe600a05307f4d220f47b /src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala | |
parent | 01f5435318551ce12787b120440572f169c71463 (diff) | |
download | scala-59070cc385560b48267cbc77e872027dd8304c05.tar.gz scala-59070cc385560b48267cbc77e872027dd8304c05.tar.bz2 scala-59070cc385560b48267cbc77e872027dd8304c05.zip |
Remove stale local variables and exception handlers after DCE
This is required for correctness of the generated bytecode. Exception
handlers and local variable descriptors specify code offset ranges.
These offsets have to exist, not be eliminated.
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala index 4592031a31..03bc32061b 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala @@ -346,6 +346,13 @@ abstract class BCodeSkelBuilder extends BCodeHelpers { /* * Bookkeeping for method-local vars and method-params. + * + * TODO: use fewer slots. local variable slots are never re-used in separate blocks. + * In the following example, x and y could use the same slot. + * def foo() = { + * { val x = 1 } + * { val y = "a" } + * } */ object locals { |