Skip to content

Commit

Permalink
Tweak help text and usages per review
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed Feb 14, 2022
1 parent 45fe16f commit 05218d2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Expand Up @@ -682,7 +682,7 @@ lazy val bench = project.in(file("test") / "benchmarks")
if (benchmarkScalaVersion == "") Nil
else "org.scala-lang" % "scala-compiler" % benchmarkScalaVersion :: Nil
},
//scalacOptions ++= Seq("-feature", "-opt:all", "-opt:inline:scala/**", "-Wopt"),
//scalacOptions ++= Seq("-feature", "-opt:inline:scala/**", "-Wopt"),
scalacOptions ++= Seq("-feature", "-opt:l:inline", "-opt-inline-from:scala/**", "-opt-warnings"),
// Skips JMH source generators during IDE import to avoid needing to compile scala-library during the import
// should not be needed once sbt-jmh 0.4.3 is out (https://github.com/sbt/sbt-jmh/pull/207)
Expand Down
2 changes: 1 addition & 1 deletion project/ScriptCommands.scala
Expand Up @@ -161,7 +161,7 @@ object ScriptCommands {
}

private[this] val enableOptimizer = Seq(
//ThisBuild / Compile / scalacOptions ++= Seq("-opt:all", "-opt:inline:scala/**")
//ThisBuild / Compile / scalacOptions ++= Seq("-opt:inline:scala/**")
ThisBuild / Compile / scalacOptions ++= Seq("-opt:l:inline", "-opt-inline-from:scala/**")
)

Expand Down
20 changes: 11 additions & 9 deletions src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
Expand Up @@ -321,7 +321,7 @@ trait ScalaSettings extends StandardScalaSettings with Warnings { _: MutableSett
val localOptimizations = List(simplifyJumps, compactLocals, copyPropagation, redundantCasts, boxUnbox, nullnessTracking, closureInvocations, allowSkipCoreModuleInit, assumeModulesNonNull, allowSkipClassLoading)
val lMethod = Choice(
"local",
localOptimizations.mkString("Enable intra-method optimizations: ", ",", "."),
(defaultOptimizations ::: localOptimizations).mkString("Enable intra-method optimizations: ", ",", "."),
expandsTo = defaultOptimizations ::: localOptimizations)

val inlineFrom = Choice(
Expand All @@ -341,7 +341,7 @@ trait ScalaSettings extends StandardScalaSettings with Warnings { _: MutableSett
val opt = MultiChoiceSetting(
name = "-opt",
helpArg = "optimization",
descr = "Enable optimizations, `help` for details.",
descr = "Enable optimizations: `-opt:local`, `-opt:inline:<pattern>`; `-opt:help` for details.",
domain = optChoices,
).withPostSetHook { ss =>
// kludge alert: will be invoked twice, with selections available 2nd time
Expand Down Expand Up @@ -385,7 +385,9 @@ trait ScalaSettings extends StandardScalaSettings with Warnings { _: MutableSett
def optInlineFrom: List[String] = optChoices.inlineFrom.selections

def inlineHelp =
"""Patterns for classfile names from which the inliner is allowed to pull in code.
"""
|Inlining requires a list of patterns defining where code can be inlined from: `-opt:inline:p1,p2`.
|
| * Matches classes in the empty package
| ** All classes
| a.C Class a.C
Expand All @@ -398,13 +400,13 @@ trait ScalaSettings extends StandardScalaSettings with Warnings { _: MutableSett
| <sources> Classes defined in source files compiled in the current compilation, either
| passed explicitly to the compiler or picked up from the `-sourcepath`
|
|The setting requires a list of patterns: `-opt:inline:p1,p2`. The setting can be passed
|multiple times, the list of patterns gets extended. A leading `!` marks a pattern as excluding.
|The last matching pattern defines whether a classfile is included or excluded (default: excluded).
|For example, `a.**,!a.b.**` includes classes in a and sub-packages, but not in a.b and sub-packages.
|`-opt:inline:p` may be specified multiple times to extend the list of patterns.
|A leading `!` means exclude anything that matches the pattern. The last matching pattern wins.
|For example, `a.**,!a.b.**` includes classes in `a` and sub-packages, but not in `a.b` and sub-packages.
|
|Note: on the command line you might need to quote patterns containing `*` to prevent the shell
|from expanding it to a list of files in the current directory.""".stripMargin
|When patterns are supplied on a command line, it is usually necessary to quote special shell characters
|such as `*`, `<`, `>`, and `$`: `'-opt:inline:p.*,!p.C$D' '-opt:inline:<sources>'`.
|Quoting may not be needed in a build file.""".stripMargin

@deprecated("Deprecated alias", since="2.13.8")
val xoptInlineFrom = MultiStringSetting(
Expand Down

0 comments on commit 05218d2

Please sign in to comment.