From 1265e19de8073da2691fac4d52bc763091ad7b9c Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Fri, 11 Dec 2015 10:47:00 +0100 Subject: Eliminate non-escaping boxes, tuples and refs Eliminate boxes, tuples and refs that are created and used within a single method without escaping. For details on the implementation see the doc comment in class BoxUnbox. This commit also cleans up the logic of inter-dependent method-level optimizations that run until reaching a fixpoint. --- src/compiler/scala/tools/nsc/settings/ScalaSettings.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/compiler/scala/tools/nsc/settings') diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 794c0ba324..42ed9ef935 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 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.") val inlineProject = Choice("inline-project", "Inline only methods defined in the files being compiled. Enables unreachable-code.") @@ -239,7 +240,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, nullnessTracking, closureInvocations) + private val methodChoices = List(unreachableCode, simplifyJumps, compactLocals, copyPropagation, boxUnbox, nullnessTracking, closureInvocations) val lMethod = Choice("l:method", "Enable intra-method optimizations: "+ methodChoices.mkString(","), expandsTo = methodChoices) private val projectChoices = List(lMethod, inlineProject) @@ -260,6 +261,7 @@ trait ScalaSettings extends AbsScalaSettings def YoptSimplifyJumps = Yopt.contains(YoptChoices.simplifyJumps) def YoptCompactLocals = Yopt.contains(YoptChoices.compactLocals) def YoptCopyPropagation = Yopt.contains(YoptChoices.copyPropagation) + def YoptBoxUnbox = Yopt.contains(YoptChoices.boxUnbox) def YoptNullnessTracking = Yopt.contains(YoptChoices.nullnessTracking) def YoptClosureInvocations = Yopt.contains(YoptChoices.closureInvocations) -- cgit v1.2.3