Skip to content

Commit

Permalink
drop option, choose indy or not based on target
Browse files Browse the repository at this point in the history
  • Loading branch information
harpocrates committed Mar 30, 2021
1 parent 00369f8 commit ec7b7d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
Expand Up @@ -33,7 +33,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
import bTypes._
import coreBTypes._
import definitions._
import genBCode.postProcessor.backendUtils.addIndyLambdaImplMethod
import genBCode.postProcessor.backendUtils.{addIndyLambdaImplMethod, classfileVersion}
import genBCode.postProcessor.callGraph.{inlineAnnotatedCallsites, noInlineAnnotatedCallsites}

/*
Expand Down Expand Up @@ -991,7 +991,11 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
}
}

/* Generate string concatenation code based on the strategy specified at `-YstringConcat` */
/* Generate string concatenation
*
* On JDK 8: create and append using `StringBuilder`
* On JDK 9+: use `invokedynamic` with `StringConcatFactory`
*/
def genStringConcat(tree: Tree): BType = {
lineNumber(tree)
liftStringConcat(tree) match {
Expand All @@ -1016,8 +1020,8 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
}
.toList

if (currentSettings.YstringConcat.value == "inline" ||
currentSettings.YstringConcat.value == "detect" && currentSettings.target.value == "8") {
// `StringConcatFactory` only got added in JDK 9, so use `StringBuilder` for lower
if (classfileVersion.get < asm.Opcodes.V9) {

// Estimate capacity needed for the string builder
val approxBuilderSize = concatArguments.view.map {
Expand Down
1 change: 0 additions & 1 deletion src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
Expand Up @@ -278,7 +278,6 @@ trait ScalaSettings extends StandardScalaSettings with Warnings { _: MutableSett

val exposeEmptyPackage = BooleanSetting ("-Yexpose-empty-package", "Internal only: expose the empty package.").internalOnly()
val Ydelambdafy = ChoiceSetting ("-Ydelambdafy", "strategy", "Strategy used for translating lambdas into JVM code.", List("inline", "method"), "method")
val YstringConcat = ChoiceSetting ("-YstringConcat", "strategy", "Strategy used for translating string concatenation into JVM code.", List("inline", "indy", "detect"), "detect")

// Allows a specialised jar to be written. For instance one that provides stable hashing of content, or customisation of the file storage
val YjarFactory = StringSetting ("-YjarFactory", "classname", "factory for jar files", classOf[DefaultJarFactory].getName)
Expand Down

0 comments on commit ec7b7d0

Please sign in to comment.