Skip to content

Commit 6755f52

Browse files
Remove reduceParallel
1 parent eef623a commit 6755f52

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,9 +3764,6 @@ object Types {
37643764

37653765
override def tryNormalize(implicit ctx: Context): Type = reduced.normalized
37663766

3767-
/** Switch to choose parallel or sequential reduction */
3768-
private final val reduceInParallel = false
3769-
37703767
final def cantPossiblyMatch(cas: Type)(implicit ctx: Context): Boolean =
37713768
true // should be refined if we allow overlapping cases
37723769

@@ -3783,24 +3780,6 @@ object Types {
37833780
else NoType
37843781
}
37853782

3786-
def reduceParallel(implicit ctx: Context) = {
3787-
val applicableBranches = cases
3788-
.map(typeComparer.matchCase(scrutinee, _, instantiate = true)(trackingCtx))
3789-
.filter(_.exists)
3790-
applicableBranches match {
3791-
case Nil => NoType
3792-
case applicableBranch :: Nil => applicableBranch
3793-
case _ =>
3794-
record(i"MatchType.multi-branch")
3795-
ctx.typeComparer.glb(applicableBranches)
3796-
}
3797-
}
3798-
3799-
def isBounded(tp: Type) = tp match {
3800-
case tp: TypeParamRef =>
3801-
case tp: TypeRef => ctx.gadt.contains(tp.symbol)
3802-
}
3803-
38043783
def contextInfo(tp: Type): Type = tp match {
38053784
case tp: TypeParamRef =>
38063785
val constraint = ctx.typerState.constraint
@@ -3813,27 +3792,26 @@ object Types {
38133792
tp.underlying
38143793
}
38153794

3816-
def updateReductionContext() = {
3795+
def updateReductionContext(): Unit = {
38173796
reductionContext = new mutable.HashMap
38183797
for (tp <- typeComparer.footprint)
38193798
reductionContext(tp) = contextInfo(tp)
38203799
typr.println(i"footprint for $this $hashCode: ${typeComparer.footprint.toList.map(x => (x, contextInfo(x)))}%, %")
38213800
}
38223801

3823-
def upToDate =
3802+
def isUpToDate: Boolean =
38243803
reductionContext.keysIterator.forall { tp =>
38253804
reductionContext(tp) `eq` contextInfo(tp)
38263805
}
38273806

38283807
record("MatchType.reduce called")
3829-
if (!Config.cacheMatchReduced || myReduced == null || !upToDate) {
3808+
if (!Config.cacheMatchReduced || myReduced == null || !isUpToDate) {
38303809
record("MatchType.reduce computed")
38313810
if (myReduced != null) record("MatchType.reduce cache miss")
38323811
myReduced =
38333812
trace(i"reduce match type $this $hashCode", typr, show = true) {
38343813
try
38353814
if (defn.isBottomType(scrutinee)) defn.NothingType
3836-
else if (reduceInParallel) reduceParallel(trackingCtx)
38373815
else reduceSequential(cases)(trackingCtx)
38383816
catch {
38393817
case ex: Throwable =>

0 commit comments

Comments
 (0)