Skip to content

Optimize large methods #9896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/ast/Positioned.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dotc
package ast

import util.Spans._
import util.{SourceFile, NoSource, SourcePosition, SrcPos}
import util.{SourceFile, NoSource, SourcePosition, SrcPos, Stats}
import core.Contexts._
import core.Decorators._
import core.NameOps._
Expand All @@ -23,6 +23,8 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Src
private var myUniqueId: Int = _
private var mySpan: Span = _

Stats.record(s"Positioned/$getClass")

/** A unique identifier. Among other things, used for determining the source file
* component of the position.
*/
Expand Down
333 changes: 167 additions & 166 deletions compiler/src/dotty/tools/dotc/ast/Trees.scala

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/config/Feature.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ object Feature:
def toPrefix(sym: Symbol): String =
if !sym.exists || sym == defn.LanguageModule.moduleClass then ""
else toPrefix(sym.owner) + sym.name.stripModuleClassSuffix + "."
val prefix = if owner ne NoSymbol then toPrefix(owner) else ""
ctx.base.settings.language.value.contains(prefix + feature)
val fullName = if owner ne NoSymbol then toPrefix(owner) + feature else feature.toString
ctx.base.settings.language.value.contains(fullName)

/** Is `feature` enabled by by an import? This is the case if the feature
* is imported by a named import
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class ScalaSettings extends Settings.SettingGroup {
val YnoDecodeStacktraces: Setting[Boolean] = BooleanSetting("-Yno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.")

val Yinstrument: Setting[Boolean] = BooleanSetting("-Yinstrument", "Add instrumentation code that counts allocations and closure creations.")
val YinstrumentDefs: Setting[Boolean] = BooleanSetting("-Yinstrument-defs", "Add instrumentation code that counts method calls; needs -Yinstrument to be set, too.")

/** Dottydoc specific settings */
val siteRoot: Setting[String] = StringSetting(
Expand Down
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/core/TypeApplications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ class TypeApplications(val self: Type) extends AnyVal {
*/
def hkResult(using Context): Type = self.dealias match {
case self: TypeRef =>
if (self.symbol == defn.AnyKindClass) self else self.info.hkResult
if self.symbol.isClass then
if self.symbol == defn.AnyKindClass then self else NoType
else self.info.hkResult
case self: AppliedType =>
if (self.tycon.typeSymbol.isClass) NoType else self.superType.hkResult
case self: HKTypeLambda => self.resultType
Expand Down
Loading