[LL FIR] LLFirLockProvider: drop checkContractViolations hack
This check was required due to missed proper implementation for jumping locks. Now it is safe to call `lazyResolveToPhase` under the jumping lock – it won't lead to any deadlocks or stack overflows.
This commit is contained in:
committed by
Space Team
parent
04e1e19dfc
commit
f036954ac0
-15
@@ -39,21 +39,6 @@ internal class LLFirLockProvider(private val checker: LLFirLazyResolveContractCh
|
||||
return globalLock.lockWithPCECheck(lockingIntervalMs, action)
|
||||
}
|
||||
|
||||
/**
|
||||
* A contract violation check to be sure that we won't request a violated phase later.
|
||||
* This is useful to catch a contract violation for jumping phases because they may encounter infinite recursion.
|
||||
*
|
||||
* Example: we have cycle between phases 'implicit type (1) -> body (2) -> implicit type (3)` and
|
||||
* we can get [StackOverflowError] because regular phases checks can't catch such case
|
||||
* because will check only implicit type -> implicit type resolution due to
|
||||
* sequent resolution requests
|
||||
*
|
||||
* @see org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirModuleLazyDeclarationResolver
|
||||
*/
|
||||
fun checkContractViolations(toPhase: FirResolvePhase) {
|
||||
checker.checkIfCanLazyResolveToPhase(toPhase, isJumpingPhase = true)
|
||||
}
|
||||
|
||||
/**
|
||||
* Locks an a [FirElementWithResolveState] to resolve from `phase - 1` to [phase] and
|
||||
* then updates the [FirElementWithResolveState.resolveState] to a [phase].
|
||||
|
||||
-3
@@ -122,9 +122,6 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
||||
var currentPhase = getMinResolvePhase(target).coerceAtLeast(FirResolvePhase.IMPORTS)
|
||||
if (currentPhase >= toPhase) return
|
||||
|
||||
// to catch a contract violation for jumping phases
|
||||
moduleComponents.globalResolveComponents.lockProvider.checkContractViolations(toPhase)
|
||||
|
||||
while (currentPhase < toPhase) {
|
||||
currentPhase = currentPhase.next
|
||||
checkCanceled()
|
||||
|
||||
Reference in New Issue
Block a user