Skip to content

Commit

Permalink
Re-compile module if IdMap is present (#11032)
Browse files Browse the repository at this point in the history
Loading IR caches and IdMap for a module don't play very well. Rather
than complicating logic and introducing yet another re-compilation
request let's not even attempt to deserialize a module if IdMap is
present. The cost of compiling a single module (right now containing the
project itself) is negligble, compared to a possibility of bugs that
we've encountered so far.

(cherry picked from commit 62e1569)
  • Loading branch information
hubertp authored and jdunkerley committed Sep 10, 2024
1 parent 937edaf commit d381696
Showing 1 changed file with 6 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ import org.enso.compiler.core.EnsoParser
import org.enso.compiler.data.CompilerConfig
import org.enso.compiler.pass.PassManager
import org.enso.compiler.pass.analyse._
import org.enso.compiler.phase.{
IdMapProcessor,
ImportResolver,
ImportResolverAlgorithm
}
import org.enso.compiler.phase.{ImportResolver, ImportResolverAlgorithm}
import org.enso.editions.LibraryName
import org.enso.pkg.QualifiedName
import org.enso.common.CompilationStage
Expand Down Expand Up @@ -562,25 +558,11 @@ class Compiler(
)
context.updateModule(module, _.resetScope())

if (useCaches) {
if (context.deserializeModule(this, module)) {
val updatedIr =
IdMapProcessor.updateIr(
context.getIr(module),
context.getIdMap(module)
)
if (updatedIr != null) {
context.updateModule(
module,
u => {
u.resetScope()
u.ir(updatedIr)
u.compilationStage(CompilationStage.AFTER_PARSING)
}
)
}
return
}
if (
useCaches && context.getIdMap(module) == null && context
.deserializeModule(this, module)
) {
return
}

uncachedParseModule(module, isGenDocs)
Expand Down

0 comments on commit d381696

Please sign in to comment.