Skip to content
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

Merged
merged 102 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
61d2d01
Framework for persisting objects into ByteBuffer
JaroslavTulach Nov 1, 2023
a59e9b7
Turning Location into record
JaroslavTulach Nov 1, 2023
999bea6
Testing simple serde of Location
JaroslavTulach Nov 1, 2023
f8ff83a
Enable debugging in runtime-parser tests
JaroslavTulach Nov 2, 2023
c845572
Test persistance of composed classes
JaroslavTulach Nov 2, 2023
95298f4
Allow access to Truffle API from runtime-parser/test
JaroslavTulach Nov 2, 2023
89df854
Encapsulating Persistance lookup
JaroslavTulach Nov 2, 2023
236cc08
Deserialize nested objects
JaroslavTulach Nov 2, 2023
04b97ef
Don't serialize UUIDs
JaroslavTulach Nov 2, 2023
3fe9e33
Adjusting imports to new location of Location
JaroslavTulach Nov 2, 2023
7a7f9d9
Turning IdentifiedLocation into record
JaroslavTulach Nov 2, 2023
98f720b
Save some memory by using UUID directly without Some(UUID) overhead
JaroslavTulach Nov 2, 2023
c549943
Making the tests compiler again
JaroslavTulach Nov 2, 2023
400b151
Using own Persistance Input and Output types
JaroslavTulach Nov 2, 2023
b583697
Measure the expected size of the serialized data
JaroslavTulach Nov 2, 2023
e26c83f
Storing objects inline lowers the size of the stream
JaroslavTulach Nov 2, 2023
d2afbab
References don't need identification of the object type
JaroslavTulach Nov 2, 2023
aa131e5
Support for serializing Scala List
JaroslavTulach Nov 2, 2023
de85e83
Keep the API stream based
JaroslavTulach Nov 2, 2023
2df600b
Using Persistance to store IR
JaroslavTulach Nov 2, 2023
9260903
Support null values in writeObject
JaroslavTulach Nov 2, 2023
f52c7e1
Can persist some ir.Module
JaroslavTulach Nov 2, 2023
a25bfb6
Use class loader of the language when searching for provides
JaroslavTulach Nov 2, 2023
ff2c9ac
Log also runtime exceptions
JaroslavTulach Nov 3, 2023
704ac72
Don't swallow exceptions - log them
JaroslavTulach Nov 3, 2023
7e6e9b5
Can read IR for (some) import statements
JaroslavTulach Nov 3, 2023
1f1d797
Can read (some) export statements
JaroslavTulach Nov 3, 2023
c8c8366
Support for lazy Seq
JaroslavTulach Nov 3, 2023
cd12f51
Using lazy Seq to delay loading of method body
JaroslavTulach Nov 3, 2023
719993a
Persistance for Name.MethodReference
JaroslavTulach Nov 3, 2023
0740709
Persistance for imports.Polyglot
JaroslavTulach Nov 3, 2023
9721fbb
Persistance for Function.Lambda
JaroslavTulach Nov 3, 2023
db4f8f2
Annotation processor for @Persistable to automate Persistance of simp…
JaroslavTulach Nov 3, 2023
14c2282
Able to persist signatures
JaroslavTulach Nov 8, 2023
f888c4f
Able to persist IR for Standard.Visualization
JaroslavTulach Nov 8, 2023
3391d6e
Persistance has writeObject and readObject static methods
JaroslavTulach Nov 8, 2023
bab61a1
Using Persistance to store MapToBindings
JaroslavTulach Nov 8, 2023
6d15515
Library BindingsMaps get serialized without issues
JaroslavTulach Nov 9, 2023
b05ec17
Persistance of MetadataStorage
JaroslavTulach Nov 9, 2023
4a5809a
More of persistance for metadata
JaroslavTulach Nov 9, 2023
5413e2f
Persist all caches
JaroslavTulach Nov 9, 2023
a76a9bb
PersistanceMap is singleton
JaroslavTulach Nov 9, 2023
2d1b62a
Formatting
JaroslavTulach Nov 9, 2023
2d60832
Lazy BindingsMap
JaroslavTulach Nov 10, 2023
5aacca7
Caching read objects
JaroslavTulach Nov 10, 2023
73d56e0
Avoid empty objects by appending trailing zero
JaroslavTulach Nov 10, 2023
e56d043
Warn when a cache cannot be loaded
JaroslavTulach Nov 10, 2023
d4a1460
Manual persistance of AliasAnalysis.Graph and co.
JaroslavTulach Nov 10, 2023
44d1af1
Java formatting
JaroslavTulach Nov 10, 2023
0a1f325
Merge remote-tracking branch 'origin/develop' into wip/jtulach/Persis…
JaroslavTulach Nov 10, 2023
3ed31ac
Making Function.Lambda body list lazy
JaroslavTulach Nov 12, 2023
da5ecdc
IDE complained about missing Double conversion
JaroslavTulach Nov 13, 2023
f2886a2
More case classes elligible for serialization
JaroslavTulach Nov 13, 2023
0f77ac0
Add missing import to address #8289
JaroslavTulach Nov 13, 2023
20f5ae8
Merging with CompilerContext based serialization
JaroslavTulach Nov 13, 2023
4a314ef
Support for services associated with Persistance.Input
JaroslavTulach Nov 13, 2023
0363603
Making runtime tests compile again and SerdeTest pass
JaroslavTulach Nov 13, 2023
5e52147
Perform restoreFromSerialization on demand, not in a batch
JaroslavTulach Nov 13, 2023
56663af
No need for cross module links: either the module deserializes OK or …
JaroslavTulach Nov 13, 2023
78bab90
Modules loaded from cache shall have no errors
JaroslavTulach Nov 13, 2023
b66bfa1
Store Method.Explicit.isStatic information in caches to avoid materia…
JaroslavTulach Nov 13, 2023
177c44e
Delay construction of RuntimeFunction until really needed
JaroslavTulach Nov 14, 2023
ef84e1d
Serializing errors.ImportExport now fails
JaroslavTulach Nov 14, 2023
95ff6a0
Compare IR before and after serialization test
JaroslavTulach Nov 15, 2023
5cb4b68
Make sure the richest constructor (that includes all variables) is us…
JaroslavTulach Nov 15, 2023
98b95c4
Adding persistance for two more IR types
JaroslavTulach Nov 15, 2023
68ed2a7
Use @Persistable annotation for more classes
JaroslavTulach Nov 15, 2023
7c562b4
Turn linkage errors into AssertionError
JaroslavTulach Nov 16, 2023
0f21b80
prepareForSerialization just before writing MetadataStorage down
JaroslavTulach Nov 16, 2023
bb1bc94
Using ir.duplicate(keepLocations=false...) to eliminate locations
JaroslavTulach Nov 16, 2023
b172c85
Avoid prepareForSerialization calls that modify the IR. Do the conver…
JaroslavTulach Nov 16, 2023
120ac13
Make sure Scala's Seq is stored inline
JaroslavTulach Nov 16, 2023
cacf9f0
Merge remote-tracking branch 'origin/develop' into wip/jtulach/Persis…
JaroslavTulach Nov 16, 2023
2122da8
Introducing writeReplace and readResolve functions
JaroslavTulach Nov 16, 2023
497e300
Either convert AbstractModule or stop deserialization
JaroslavTulach Nov 16, 2023
0fec07d
Fix exhaustiveness check
hubertp Nov 16, 2023
aad192b
Treat List as Seq for purposes of the test
JaroslavTulach Nov 16, 2023
385b3b8
Merge branch 'wip/jtulach/Persistance_6100' of enso:enso-org/enso int…
JaroslavTulach Nov 16, 2023
c40c7c4
scalafmt
JaroslavTulach Nov 16, 2023
79482a1
Moving Persistance classes and annotation processor into their own pr…
JaroslavTulach Nov 16, 2023
b7f2e09
Lookup library shall only be used at compile time
JaroslavTulach Nov 17, 2023
76859b9
Splitting implementation away from the API classes
JaroslavTulach Nov 17, 2023
f5238b0
legal
hubertp Nov 17, 2023
5e8d880
bring back more precise patterns
hubertp Nov 17, 2023
05be437
Adding tests to persistance project
JaroslavTulach Nov 17, 2023
2231152
Basic documentation of the org.enso.persistance package
JaroslavTulach Nov 17, 2023
3586c33
More code examples
JaroslavTulach Nov 17, 2023
3370745
more legal
hubertp Nov 17, 2023
a4048a6
Documenting the @Persistable annotation
JaroslavTulach Nov 17, 2023
5300790
one more legal change
hubertp Nov 17, 2023
73b63f3
Shorter package names
JaroslavTulach Nov 17, 2023
2c1a2c1
Merge branch 'wip/jtulach/Persistance_6100' of enso:enso-org/enso int…
JaroslavTulach Nov 17, 2023
dbf62e2
Complete javadoc for all API elements
JaroslavTulach Nov 17, 2023
7c9c23c
Merging with GraalVM for JDK21 effort
JaroslavTulach Nov 18, 2023
54a0471
Updating the IR caches documentation
JaroslavTulach Nov 18, 2023
b22f5eb
Documenting PersistableProcessor
JaroslavTulach Nov 18, 2023
7d23bd2
ServiceLoader doesn't want to load classes from Module.isNamed() - le…
JaroslavTulach Nov 18, 2023
4ff07ca
Formatting build.sbt
JaroslavTulach Nov 18, 2023
0fbcdc3
Avoid legal changes due to lookup library
JaroslavTulach Nov 18, 2023
b1ecbdf
Giving the lazy sequence a real IrLazySeq name
JaroslavTulach Nov 18, 2023
36f1d7e
Adding LF at EOF
JaroslavTulach Nov 18, 2023
13ae27e
It's a Seq
JaroslavTulach Nov 18, 2023
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
13 changes: 10 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -1428,10 +1428,17 @@ 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.enso.compiler.core.ir.{
Function,
IdentifiedLocation,
Literal,
Location,
Name,
Type
}
Expand All @@ -28,7 +29,6 @@ import org.enso.compiler.pass.resolve.{
import org.enso.pkg.QualifiedName
import org.enso.polyglot.Suggestion
import org.enso.polyglot.data.{Tree, TypeGraph}
import org.enso.syntax.text.Location
import org.enso.text.editing.IndexedSource

import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.enso.compiler.core.ir.{
Empty,
Expression,
Function,
IdentifiedLocation,
Literal,
Module,
Name,
Expand Down Expand Up @@ -185,9 +186,10 @@ case object DemandAnalysis extends IRPass {
} else {
name match {
case lit: Name.Literal if isDefined(lit) =>
val forceLocation = name.location
val newNameLocation = name.location.map(l => l.copy(id = None))
val newName = lit.copy(location = newNameLocation)
val forceLocation = name.location
val newNameLocation =
name.location.map(l => new IdentifiedLocation(l.location()))
val newName = lit.copy(location = newNameLocation)
Application.Force(newName, forceLocation)
case _ => name
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.enso.compiler.core.ir.{
DefinitionArgument,
Expression,
Function,
IdentifiedLocation,
Module,
Name,
Type
Expand Down Expand Up @@ -267,8 +268,9 @@ case object LambdaShorthandToLambda extends IRPass {
name
case it => desugarExpression(it, freshNameSupply)
}
val newVec = vector.copy(newItems)
val locWithoutId = newVec.location.map(_.copy(id = None))
val newVec = vector.copy(newItems)
val locWithoutId =
newVec.location.map(l => new IdentifiedLocation(l.location()))
bindings.foldLeft(newVec: Expression) { (body, bindingName) =>
val defArg = DefinitionArgument.Specified(
bindingName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.enso.compiler.core.ir.{
Expression,
Function,
IdentifiedLocation,
Location,
Module,
Name
}
Expand All @@ -23,7 +24,6 @@ import org.enso.compiler.pass.analyse.{
}
import org.enso.compiler.pass.desugar._
import org.enso.compiler.pass.resolve.IgnoredBindings
import org.enso.syntax.text.Location

import java.util.UUID

Expand Down Expand Up @@ -171,8 +171,8 @@ case object LambdaConsolidate extends IRPass {
val newLocation = chainedLambdas.head.location match {
case Some(location) =>
Some(
IdentifiedLocation(
Location(
new IdentifiedLocation(
new Location(
location.start,
chainedLambdas.last.location.getOrElse(location).location.end
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.enso.compiler.core.Implicits.AsDiagnostics
import org.enso.compiler.core.ir.{
Expression,
IdentifiedLocation,
Location,
Module,
Pattern
}
Expand All @@ -19,7 +20,6 @@ import org.enso.compiler.pass.analyse.{
}
import org.enso.compiler.pass.desugar._
import org.enso.compiler.pass.resolve.{DocumentationComments, IgnoredBindings}
import org.enso.syntax.text.Location

import scala.annotation.unused

Expand Down Expand Up @@ -146,8 +146,8 @@ case object UnreachableMatchBranches extends IRPass {
branch.location match {
case Some(branchLoc) =>
Some(
IdentifiedLocation(
Location(loc.start, branchLoc.end),
new IdentifiedLocation(
new Location(loc.start, branchLoc.end),
loc.id
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import org.enso.compiler.core.{
}
import org.enso.compiler.core.Implicits.AsMetadata
import org.enso.compiler.core.ir.Literal
import org.enso.compiler.core.ir.Location
import org.enso.compiler.core.ir.Name
import org.enso.compiler.core.ir.module.scope.definition
import org.enso.compiler.pass.analyse.DataflowAnalysis
import org.enso.interpreter.instrument.execution.model.PendingEdit
import org.enso.syntax.text.Location
import org.enso.text.editing.model.TextEdit
import org.enso.text.editing.{IndexedSource, TextEditor}

Expand Down Expand Up @@ -288,7 +288,7 @@ object ChangesetBuilder {
* @return the node with a new location
*/
def shift(offset: Int): Node = {
val newLocation = location.copy(
val newLocation = new Location(
start = location.start + offset,
end = location.end + offset
)
Expand Down Expand Up @@ -359,7 +359,7 @@ object ChangesetBuilder {
val nodeBetweenPreviousPositionAndNextNode =
Node(
NodeId(currentIr),
Location(previousPosition, nextNode.location.start),
new Location(previousPosition, nextNode.location.start),
false
)
acc += nodeBetweenPreviousPositionAndNextNode
Expand All @@ -378,7 +378,7 @@ object ChangesetBuilder {
if (hasRemainingTextAfterLastChild) {
val nodeAfterLastChild = Node(
NodeId(currentIr),
Location(lastCoveredPosition, endOfNonLeafIr),
new Location(lastCoveredPosition, endOfNonLeafIr),
false
)
acc += nodeAfterLastChild
Expand Down Expand Up @@ -491,7 +491,7 @@ object ChangesetBuilder {
edit: TextEdit,
source: A
): Location = {
Location(
new Location(
IndexedSource[A].toIndex(edit.range.start, source),
IndexedSource[A].toIndex(edit.range.end, source)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package org.enso.interpreter.instrument.execution

import com.oracle.truffle.api.source.SourceSection
import org.enso.compiler.core.{ExternalID, IR, Identifier}
import org.enso.compiler.core.ir.Location
import org.enso.compiler.core.ir.IdentifiedLocation
import org.enso.interpreter.runtime.Module
import org.enso.syntax.text.Location
import org.enso.text.editing.{model, IndexedSource}

import java.util.UUID
Expand Down Expand Up @@ -121,7 +121,7 @@ object LocationResolver {
source: A
): Location = {
val range = sectionToRange(section)
Location(
new Location(
IndexedSource[A].toIndex(range.start, source),
IndexedSource[A].toIndex(range.end, source)
)
Expand Down
Loading
Loading