Skip to content

Remove dead code in OptimizerCore. #5103

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

Merged
merged 2 commits into from
Jan 5, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ private[optimizer] abstract class OptimizerCore(
* `Return`s we produce in order to decide whether we can remove
* the `Labeled`.
*/
info.returnedTreeTypes.value ::= RefinedType.NoRefinedType
info.returnedTreeTypes.value ::= RefinedType(VoidType)
Return(newExpr, newLabel)
}
} else if (!info.acceptRecords) {
Expand Down Expand Up @@ -5725,8 +5725,6 @@ private[optimizer] object OptimizerCore {
private final class TooManyRollbacksException
extends scala.util.control.ControlThrowable

private val AnonFunctionClassPrefix = "sjsr_AnonFunction"

private type CancelFun = () => Nothing
private type PreTransCont = PreTransform => TailRec[Tree]

Expand All @@ -5736,12 +5734,6 @@ private[optimizer] object OptimizerCore {
def isNullable: Boolean = base.isNullable

def isNothingType: Boolean = base == NothingType

def toNonNullable: RefinedType = {
if (!isNullable) this
else if (base == NullType) RefinedType.Nothing
else RefinedType(base.toNonNullable, isExact, allocationSite)
}
}

private object RefinedType {
Expand All @@ -5766,9 +5758,6 @@ private[optimizer] object OptimizerCore {
}
RefinedType(tpe, isExact)
}

val NoRefinedType = RefinedType(VoidType)
val Nothing = RefinedType(NothingType)
}

/**
Expand Down Expand Up @@ -6018,12 +6007,6 @@ private[optimizer] object OptimizerCore {
copy(implsBeingInlined = implsBeingInlined + impl)
}

def inlining(impls: Set[Scope.InliningID]): Scope = {
val intersection = implsBeingInlined.intersect(impls)
assert(intersection.isEmpty, s"Circular inlining of $intersection")
copy(implsBeingInlined = implsBeingInlined ++ impls)
}

def withImportReplacement(importReplacement: ImportReplacement): Scope = {
assert(this.importReplacement.isEmpty, "Alreadying replacing " +
s"$this.importReplacement while trying to replace $importReplacement")
Expand Down Expand Up @@ -6418,10 +6401,6 @@ private[optimizer] object OptimizerCore {
if (y >= 0) x-y <= x
else x-y > x

/** Tests whether `-x` is valid without falling out of range. */
private def canNegateLong(x: Long): Boolean =
x != Long.MinValue

private final class Intrinsics(intrinsicsMap: Map[(ClassName, MethodName), Int]) {
def apply(flags: ApplyFlags, target: AbstractMethodID): Int = {
if (flags.isPrivate || flags.isConstructor) {
Expand Down
Loading