-
Notifications
You must be signed in to change notification settings - Fork 323
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
Store IR caches in suitable format to read them "on demand" #8207
Changes from 80 commits
61d2d01
a59e9b7
999bea6
f8ff83a
c845572
95298f4
89df854
236cc08
04b97ef
3fe9e33
7a7f9d9
98f720b
c549943
400b151
b583697
e26c83f
d2afbab
aa131e5
de85e83
2df600b
9260903
f52c7e1
a25bfb6
ff2c9ac
704ac72
7e6e9b5
1f1d797
c8c8366
cd12f51
719993a
0740709
9721fbb
db4f8f2
14c2282
f888c4f
3391d6e
bab61a1
6d15515
b05ec17
4a5809a
5413e2f
a76a9bb
2d1b62a
2d60832
5aacca7
73d56e0
e56d043
d4a1460
44d1af1
0a1f325
3ed31ac
da5ecdc
f2886a2
0f77ac0
20f5ae8
4a314ef
0363603
5e52147
56663af
78bab90
b66bfa1
177c44e
ef84e1d
95ff6a0
5cb4b68
98b95c4
68ed2a7
7c562b4
0f21b80
bb1bc94
b172c85
120ac13
cacf9f0
2122da8
497e300
0fec07d
aad192b
385b3b8
c40c7c4
79482a1
b7f2e09
76859b9
f5238b0
5e8d880
05be437
2231152
3586c33
3370745
a4048a6
5300790
73b63f3
2c1a2c1
dbf62e2
7c9c23c
54a0471
b22f5eb
7d23bd2
4ff07ca
0fbcdc3
b1ecbdf
36f1d7e
13ae27e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,8 @@ bootstrap := {} | |
lazy val enso = (project in file(".")) | ||
.settings(version := "0.1") | ||
.aggregate( | ||
`persistance-dsl`, | ||
`persistance`, | ||
`interpreter-dsl`, | ||
`interpreter-dsl-test`, | ||
`json-rpc-server-test`, | ||
|
@@ -1015,6 +1017,31 @@ lazy val searcher = project | |
.dependsOn(testkit % Test) | ||
.dependsOn(`polyglot-api`) | ||
|
||
lazy val `persistance` = (project in file("lib/java/persistance")) | ||
.settings( | ||
version := "0.1", | ||
frgaalJavaCompilerSetting, | ||
Compile / javacOptions := ((Compile / javacOptions).value), | ||
libraryDependencies ++= Seq() | ||
) | ||
|
||
lazy val `persistance-dsl` = (project in file("lib/java/persistance-dsl")) | ||
.settings( | ||
version := "0.1", | ||
frgaalJavaCompilerSetting, | ||
Compile / javacOptions := ((Compile / javacOptions).value ++ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can do |
||
// Only run ServiceProvider processor and ignore those defined in META-INF, thus | ||
// fixing incremental compilation setup | ||
Seq( | ||
"-processor", | ||
"org.netbeans.modules.openide.util.ServiceProviderProcessor" | ||
)), | ||
libraryDependencies ++= Seq( | ||
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" | ||
) | ||
) | ||
.dependsOn(`persistance`) | ||
|
||
lazy val `interpreter-dsl` = (project in file("lib/scala/interpreter-dsl")) | ||
.settings( | ||
version := "0.1", | ||
|
@@ -1028,7 +1055,7 @@ lazy val `interpreter-dsl` = (project in file("lib/scala/interpreter-dsl")) | |
)), | ||
libraryDependencies ++= Seq( | ||
"org.apache.commons" % "commons-lang3" % commonsLangVersion, | ||
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, | ||
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided", | ||
JaroslavTulach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"com.google.guava" % "guava" % guavaVersion exclude ("com.google.code.findbugs", "jsr305") | ||
) | ||
) | ||
|
@@ -1338,22 +1365,23 @@ lazy val runtime = (project in file("engine/runtime")) | |
scalacOptions += "-Ymacro-annotations", | ||
scalacOptions ++= Seq("-Ypatmat-exhaust-depth", "off"), | ||
libraryDependencies ++= jmh ++ jaxb ++ circe ++ Seq( | ||
"org.apache.commons" % "commons-lang3" % commonsLangVersion, | ||
"org.apache.tika" % "tika-core" % tikaVersion, | ||
"org.graalvm.sdk" % "graal-sdk" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion % "provided", | ||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test, | ||
"org.scalactic" %% "scalactic" % scalacticVersion % Test, | ||
"org.scalatest" %% "scalatest" % scalatestVersion % Test, | ||
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % Benchmark, | ||
"org.typelevel" %% "cats-core" % catsVersion, | ||
"junit" % "junit" % junitVersion % Test, | ||
"com.github.sbt" % "junit-interface" % junitIfVersion % Test, | ||
"org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test | ||
"org.apache.commons" % "commons-lang3" % commonsLangVersion, | ||
"org.apache.tika" % "tika-core" % tikaVersion, | ||
"org.graalvm.sdk" % "graal-sdk" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion % "provided", | ||
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided", | ||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test, | ||
"org.scalactic" %% "scalactic" % scalacticVersion % Test, | ||
"org.scalatest" %% "scalatest" % scalatestVersion % Test, | ||
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % Benchmark, | ||
"org.typelevel" %% "cats-core" % catsVersion, | ||
"junit" % "junit" % junitVersion % Test, | ||
"com.github.sbt" % "junit-interface" % junitIfVersion % Test, | ||
"org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test | ||
), | ||
Compile / compile / compileInputs := (Compile / compile / compileInputs) | ||
.dependsOn(CopyTruffleJAR.preCompileTask) | ||
|
@@ -1414,6 +1442,7 @@ lazy val runtime = (project in file("engine/runtime")) | |
.dependsOn(`common-polyglot-core-utils`) | ||
.dependsOn(`edition-updater`) | ||
.dependsOn(`interpreter-dsl`) | ||
.dependsOn(`persistance-dsl` % "provided") | ||
.dependsOn(`library-manager`) | ||
.dependsOn(`logging-truffle-connector`) | ||
.dependsOn(`polyglot-api`) | ||
|
@@ -1428,31 +1457,42 @@ lazy val `runtime-parser` = | |
.settings( | ||
frgaalJavaCompilerSetting, | ||
instrumentationSettings, | ||
commands += WithDebugCommand.withDebug, | ||
fork := true, | ||
Test / javaOptions ++= Seq( | ||
JaroslavTulach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"-Dgraalvm.locatorDisabled=true", | ||
s"--upgrade-module-path=${file("engine/runtime/build-cache/truffle-api.jar").absolutePath}" | ||
), | ||
libraryDependencies ++= Seq( | ||
"junit" % "junit" % junitVersion % Test, | ||
"com.github.sbt" % "junit-interface" % junitIfVersion % Test, | ||
"org.scalatest" %% "scalatest" % scalatestVersion % Test | ||
"junit" % "junit" % junitVersion % Test, | ||
"com.github.sbt" % "junit-interface" % junitIfVersion % Test, | ||
"org.scalatest" %% "scalatest" % scalatestVersion % Test, | ||
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" | ||
) | ||
) | ||
.dependsOn(syntax) | ||
.dependsOn(`syntax-rust-definition`) | ||
.dependsOn(`persistance`) | ||
.dependsOn(`persistance-dsl` % "provided") | ||
|
||
lazy val `runtime-compiler` = | ||
(project in file("engine/runtime-compiler")) | ||
.settings( | ||
frgaalJavaCompilerSetting, | ||
instrumentationSettings, | ||
libraryDependencies ++= Seq( | ||
"junit" % "junit" % junitVersion % Test, | ||
"com.github.sbt" % "junit-interface" % junitIfVersion % Test, | ||
"org.scalatest" %% "scalatest" % scalatestVersion % Test, | ||
"com.lihaoyi" %% "fansi" % fansiVersion | ||
"junit" % "junit" % junitVersion % Test, | ||
"com.github.sbt" % "junit-interface" % junitIfVersion % Test, | ||
"org.scalatest" %% "scalatest" % scalatestVersion % Test, | ||
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided", | ||
"com.lihaoyi" %% "fansi" % fansiVersion | ||
) | ||
) | ||
.dependsOn(`runtime-parser`) | ||
.dependsOn(pkg) | ||
.dependsOn(`polyglot-api`) | ||
.dependsOn(editions) | ||
.dependsOn(`persistance-dsl` % "provided") | ||
|
||
lazy val `runtime-instrument-common` = | ||
(project in file("engine/runtime-instrument-common")) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
package org.enso.compiler.pass.analyse; | ||
|
||
import java.io.IOException; | ||
import org.enso.compiler.pass.analyse.AliasAnalysis.Graph; | ||
import org.enso.compiler.pass.resolve.DocumentationComments; | ||
import org.enso.compiler.pass.resolve.FullyQualifiedNames; | ||
import org.enso.compiler.pass.resolve.IgnoredBindings; | ||
import org.enso.compiler.pass.resolve.ModuleAnnotations; | ||
import org.enso.compiler.pass.resolve.TypeSignatures; | ||
import org.enso.persistance.Persistable; | ||
import org.enso.persistance.Persistance; | ||
import org.openide.util.lookup.ServiceProvider; | ||
import scala.Option; | ||
|
||
@Persistable(clazz = CachePreferenceAnalysis.WeightInfo.class, id = 1111) | ||
@Persistable(clazz = DataflowAnalysis.DependencyInfo.class, id = 1112) | ||
@Persistable(clazz = DataflowAnalysis.DependencyMapping.class, id = 1113) | ||
@Persistable(clazz = GatherDiagnostics.DiagnosticsMeta.class, id = 1114) | ||
@Persistable(clazz = DocumentationComments.Doc.class, id = 1115) | ||
@Persistable(clazz = AliasAnalysis$Info$Occurrence.class, id = 1116) | ||
JaroslavTulach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@Persistable(clazz = TypeSignatures.Signature.class, id = 1117) | ||
@Persistable(clazz = ModuleAnnotations.Annotations.class, id = 1118) | ||
@Persistable(clazz = AliasAnalysis$Info$Scope$Root.class, id = 1120) | ||
@Persistable(clazz = DataflowAnalysis$DependencyInfo$Type$Static.class, id = 1121) | ||
@Persistable(clazz = DataflowAnalysis$DependencyInfo$Type$Dynamic.class, id = 1122) | ||
@Persistable(clazz = AliasAnalysis$Info$Scope$Child.class, id = 1123) | ||
@Persistable(clazz = AliasAnalysis$Graph$Occurrence$Use.class, id = 1125) | ||
@Persistable(clazz = AliasAnalysis$Graph$Occurrence$Def.class, id = 1126) | ||
@Persistable(clazz = AliasAnalysis$Graph$Link.class, id = 1127) | ||
@Persistable(clazz = FullyQualifiedNames.FQNResolution.class, id = 1128) | ||
@Persistable(clazz = FullyQualifiedNames.ResolvedLibrary.class, id = 1129) | ||
@Persistable(clazz = FullyQualifiedNames.ResolvedModule.class, id = 1130) | ||
public final class PassPersistance { | ||
JaroslavTulach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private PassPersistance() {} | ||
|
||
@ServiceProvider(service = Persistance.class) | ||
public static final class PersistState extends Persistance<IgnoredBindings.State> { | ||
public PersistState() { | ||
super(IgnoredBindings.State.class, true, 1101); | ||
} | ||
|
||
@Override | ||
protected void writeObject(IgnoredBindings.State obj, Output out) throws IOException { | ||
out.writeBoolean(obj.isIgnored()); | ||
} | ||
|
||
@Override | ||
protected IgnoredBindings.State readObject(Input in) | ||
throws IOException, ClassNotFoundException { | ||
var b = in.readBoolean(); | ||
return b | ||
? org.enso.compiler.pass.resolve.IgnoredBindings$State$Ignored$.MODULE$ | ||
: org.enso.compiler.pass.resolve.IgnoredBindings$State$NotIgnored$.MODULE$; | ||
} | ||
} | ||
|
||
@ServiceProvider(service = Persistance.class) | ||
public static final class PersistTail extends Persistance<TailCall.TailPosition> { | ||
public PersistTail() { | ||
super(TailCall.TailPosition.class, true, 1102); | ||
} | ||
|
||
@Override | ||
protected void writeObject(TailCall.TailPosition obj, Output out) throws IOException { | ||
out.writeBoolean(obj.isTail()); | ||
} | ||
|
||
@Override | ||
protected TailCall.TailPosition readObject(Input in) | ||
throws IOException, ClassNotFoundException { | ||
var b = in.readBoolean(); | ||
return b | ||
? org.enso.compiler.pass.analyse.TailCall$TailPosition$Tail$.MODULE$ | ||
: org.enso.compiler.pass.analyse.TailCall$TailPosition$NotTail$.MODULE$; | ||
} | ||
} | ||
|
||
@org.openide.util.lookup.ServiceProvider(service = Persistance.class) | ||
public static final class PersistAliasAnalysisGraphScope | ||
extends Persistance<org.enso.compiler.pass.analyse.AliasAnalysis$Graph$Scope> { | ||
public PersistAliasAnalysisGraphScope() { | ||
super(org.enso.compiler.pass.analyse.AliasAnalysis$Graph$Scope.class, false, 1124); | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
protected org.enso.compiler.pass.analyse.AliasAnalysis$Graph$Scope readObject(Input in) | ||
throws IOException { | ||
var childScopes = in.readInline(scala.collection.immutable.List.class); | ||
var occurrences = (scala.collection.immutable.Set) in.readObject(); | ||
var allDefinitions = in.readInline(scala.collection.immutable.List.class); | ||
var parent = | ||
new org.enso.compiler.pass.analyse.AliasAnalysis$Graph$Scope( | ||
childScopes, occurrences, allDefinitions); | ||
var optionParent = Option.apply(parent); | ||
childScopes.forall( | ||
(object) -> { | ||
var ch = (org.enso.compiler.pass.analyse.AliasAnalysis$Graph$Scope) object; | ||
ch.parent_$eq(optionParent); | ||
return null; | ||
}); | ||
return parent; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
protected void writeObject( | ||
org.enso.compiler.pass.analyse.AliasAnalysis$Graph$Scope obj, Output out) | ||
throws IOException { | ||
out.writeInline(scala.collection.immutable.List.class, obj.childScopes()); | ||
out.writeObject(obj.occurrences()); | ||
out.writeInline(scala.collection.immutable.List.class, obj.allDefinitions()); | ||
} | ||
} | ||
|
||
@org.openide.util.lookup.ServiceProvider(service = Persistance.class) | ||
public static final class PersistAliasAnalysisGraph extends Persistance<Graph> { | ||
public PersistAliasAnalysisGraph() { | ||
super(Graph.class, false, 1119); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
protected Graph readObject(Input in) throws IOException { | ||
var g = new Graph(); | ||
|
||
var rootScope = (AliasAnalysis$Graph$Scope) in.readObject(); | ||
assignParents(rootScope); | ||
g.rootScope_$eq(rootScope); | ||
|
||
var links = | ||
(scala.collection.immutable.Set) in.readInline(scala.collection.immutable.Set.class); | ||
g.links_$eq(links); | ||
return g; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
protected void writeObject(Graph obj, Output out) throws IOException { | ||
out.writeObject(obj.rootScope()); | ||
out.writeInline(scala.collection.immutable.Set.class, obj.links()); | ||
} | ||
|
||
private static void assignParents(AliasAnalysis$Graph$Scope scope) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could probably be shared with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this comment. |
||
var option = Option.apply(scope); | ||
scope | ||
.childScopes() | ||
.foreach( | ||
(ch) -> { | ||
assignParents(ch); | ||
ch.parent_$eq(option); | ||
JaroslavTulach marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return null; | ||
}); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be unnecessary