mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 21:41:34 +03:00
Fix serialization of alias analysis graph (#8550)
close #8431 Fixes the scenario: - user sends `executionContext/executeExpression` - program execution is scheduled - during the compilation the already compiled `IR` is loaded from the cache (reading invalid alias analysis graph) - during the codegen the local scope with that aliasing graph is propagated to the runtime - `EvalNode` compiles the expression to execute with the local scope containing an invalid aliasing graph - compilation fails in the `AliasAnalysis` pass because of the clashing IDs in the graph
This commit is contained in:
parent
4b65e44ef3
commit
56cc9561b1
@ -146,7 +146,7 @@ public final class PassPersistance {
|
||||
@org.openide.util.lookup.ServiceProvider(service = Persistance.class)
|
||||
public static final class PersistAliasAnalysisGraph extends Persistance<Graph> {
|
||||
public PersistAliasAnalysisGraph() {
|
||||
super(Graph.class, false, 1119);
|
||||
super(Graph.class, false, 1131);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -160,6 +160,10 @@ public final class PassPersistance {
|
||||
var links =
|
||||
(scala.collection.immutable.Set) in.readInline(scala.collection.immutable.Set.class);
|
||||
g.links_$eq(links);
|
||||
|
||||
var nextIdCounter = in.readInt();
|
||||
g.nextIdCounter_$eq(nextIdCounter);
|
||||
|
||||
return g;
|
||||
}
|
||||
|
||||
@ -168,6 +172,7 @@ public final class PassPersistance {
|
||||
protected void writeObject(Graph obj, Output out) throws IOException {
|
||||
out.writeObject(obj.rootScope());
|
||||
out.writeInline(scala.collection.immutable.Set.class, obj.links());
|
||||
out.writeInt(obj.nextIdCounter());
|
||||
}
|
||||
|
||||
private static void assignParents(AliasAnalysis$Graph$Scope scope) {
|
||||
|
@ -69,7 +69,7 @@ import scala.reflect.ClassTag
|
||||
*
|
||||
* - A [[org.enso.compiler.pass.PassConfiguration]] containing an instance of
|
||||
* [[AliasAnalysis.Configuration]].
|
||||
* - A [[LocalScope]], where relevant.
|
||||
* - A [[org.enso.compiler.context.LocalScope]], where relevant.
|
||||
*/
|
||||
case object AliasAnalysis extends IRPass {
|
||||
|
||||
@ -940,11 +940,10 @@ case object AliasAnalysis extends IRPass {
|
||||
sealed class Graph extends Serializable {
|
||||
var rootScope: Graph.Scope = new Graph.Scope()
|
||||
var links: Set[Graph.Link] = Set()
|
||||
var nextIdCounter = 0
|
||||
|
||||
private var globalSymbols: Map[Graph.Symbol, Occurrence.Global] = Map()
|
||||
|
||||
private var nextIdCounter = 0
|
||||
|
||||
/** @return a deep structural copy of `this` */
|
||||
def deepCopy(
|
||||
scope_mapping: mutable.Map[Scope, Scope] = mutable.Map()
|
||||
|
Loading…
Reference in New Issue
Block a user