summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/settings
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2015-12-15 15:03:08 +0100
committerLukas Rytz <lukas.rytz@gmail.com>2015-12-15 15:12:47 +0100
commite4319789ea6d1a4e958d383619cf7e51338bfde2 (patch)
treeafc73a35b4564da3ff55afecc7e10669c07a075c /src/compiler/scala/tools/nsc/settings
parent1265e19de8073da2691fac4d52bc763091ad7b9c (diff)
downloadscala-e4319789ea6d1a4e958d383619cf7e51338bfde2.tar.gz
scala-e4319789ea6d1a4e958d383619cf7e51338bfde2.tar.bz2
scala-e4319789ea6d1a4e958d383619cf7e51338bfde2.zip
Eliminate unnecessary casts
Eliminate casts that are statically known to succeed. This enables boxes to be eliminated and simplifies the implementation of closure allocation elimination.
Diffstat (limited to 'src/compiler/scala/tools/nsc/settings')
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 42ed9ef935..87a9c262f4 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -229,6 +229,7 @@ trait ScalaSettings extends AbsScalaSettings
val simplifyJumps = Choice("simplify-jumps", "Simplify branching instructions, eliminate unnecessary ones.")
val compactLocals = Choice("compact-locals", "Eliminate empty slots in the sequence of local variables.")
val copyPropagation = Choice("copy-propagation", "Eliminate redundant local variables and unused values (including closures). Enables unreachable-code.")
+ val redundantCasts = Choice("redundant-casts", "Eliminate redundant casts using a type propagation analysis.")
val boxUnbox = Choice("box-unbox", "Eliminate box-unbox pairs within the same method (also tuples, xRefs, value class instances). Enables unreachable-code.")
val nullnessTracking = Choice("nullness-tracking", "Track nullness / non-nullness of local variables and apply optimizations.")
val closureInvocations = Choice("closure-invocations" , "Rewrite closure invocations to the implementation method.")
@@ -240,7 +241,7 @@ trait ScalaSettings extends AbsScalaSettings
private val defaultChoices = List(unreachableCode)
val lDefault = Choice("l:default", "Enable default optimizations: "+ defaultChoices.mkString(","), expandsTo = defaultChoices)
- private val methodChoices = List(unreachableCode, simplifyJumps, compactLocals, copyPropagation, boxUnbox, nullnessTracking, closureInvocations)
+ private val methodChoices = List(unreachableCode, simplifyJumps, compactLocals, copyPropagation, redundantCasts, boxUnbox, nullnessTracking, closureInvocations)
val lMethod = Choice("l:method", "Enable intra-method optimizations: "+ methodChoices.mkString(","), expandsTo = methodChoices)
private val projectChoices = List(lMethod, inlineProject)
@@ -261,6 +262,7 @@ trait ScalaSettings extends AbsScalaSettings
def YoptSimplifyJumps = Yopt.contains(YoptChoices.simplifyJumps)
def YoptCompactLocals = Yopt.contains(YoptChoices.compactLocals)
def YoptCopyPropagation = Yopt.contains(YoptChoices.copyPropagation)
+ def YoptRedundantCasts = Yopt.contains(YoptChoices.redundantCasts)
def YoptBoxUnbox = Yopt.contains(YoptChoices.boxUnbox)
def YoptNullnessTracking = Yopt.contains(YoptChoices.nullnessTracking)
def YoptClosureInvocations = Yopt.contains(YoptChoices.closureInvocations)