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

Enabling structural equality for MetadataStorage again #11012

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Sep 9, 2024

Pull Request Description

Fixes #10985 and #11004 by enabling structural equality for MetadataStorage again.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • All code follows the
    Scala,
    Java,
  • Unit tests have been written where possible.

@@ -214,7 +214,7 @@ public boolean equals(Object obj) {
return true;
}
if (obj instanceof MetadataStorage other) {
return this.metadata == other.metadata;
return Objects.equals(this.metadata, other.metadata);
Copy link
Member Author

@JaroslavTulach JaroslavTulach Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change alone is causing StackOverflowError in IR.duplicate(), @hubertp, please try to make just this change and check if you get the StackOverflowError as well. If so, do you have any idea how to prevent it?

"main"
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:529)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:473)
	at org.enso.compiler.pass.resolve.TypeSignatures$Signature.duplicate(TypeSignatures.scala:351)
	at org.enso.compiler.core.ir.MetadataStorage.duplicate(MetadataStorage.java:95)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:529)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:473)
	at org.enso.compiler.pass.resolve.TypeSignatures$Signature.duplicate(TypeSignatures.scala:351)
	at org.enso.compiler.core.ir.MetadataStorage.duplicate(MetadataStorage.java:95)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:529)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:473)
	at org.enso.compiler.pass.resolve.TypeSignatures$Signature.duplicate(TypeSignatures.scala:351)
	at org.enso.compiler.core.ir.MetadataStorage.duplicate(MetadataStorage.java:95)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:529)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:473)
	at org.enso.compiler.pass.resolve.TypeSignatures$Signature.duplicate(TypeSignatures.scala:351)
	at org.enso.compiler.core.ir.MetadataStorage.duplicate(MetadataStorage.java:95)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:529)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:473)
	at org.enso.compiler.pass.resolve.TypeSignatures$Signature.duplicate(TypeSignatures.scala:351)
	at org.enso.compiler.core.ir.MetadataStorage.duplicate(MetadataStorage.java:95)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:529)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:473)
	at org.enso.compiler.pass.resolve.TypeSignatures$Signature.duplicate(TypeSignatures.scala:351)
	at org.enso.compiler.core.ir.MetadataStorage.duplicate(MetadataStorage.java:95)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:529)
	at org.enso.compiler.core.ir.Name$Literal.duplicate(Name.scala:473)
	at org.enso.compiler.core.ir.DefinitionArgument$Specified.duplicate(DefinitionArgument.scala:159)
	at org.enso.compiler.core.ir.DefinitionArgument$Specified.duplicate(DefinitionArgument.scala:56)
	at org.enso.compiler.core.ir.module.scope.Definition$Data.$anonfun$duplicate$2(Definition.scala:246)
	at org.enso.compiler.core.ir.module.scope.Definition$Data$$Lambda/0x00007b79305fee10.apply
	at scala.collection.immutable.List.map(List.scala:246)
	at org.enso.compiler.core.ir.module.scope.Definition$Data.duplicate(Definition.scala:242)
	at org.enso.compiler.core.ir.module.scope.Definition$Type.$anonfun$duplicate$1(Definition.scala:111)
	at org.enso.compiler.core.ir.module.scope.Definition$Type$$Lambda/0x00007b79305fea50.apply
	at scala.collection.immutable.List.map(List.scala:246)
	at org.enso.compiler.core.ir.module.scope.Definition$Type.duplicate(Definition.scala:107)
	at org.enso.compiler.core.ir.module.scope.Definition$Type.duplicate(Definition.scala:56)
	at org.enso.compiler.core.ir.Module.$anonfun$duplicate$2(Module.scala:123)
	at org.enso.compiler.core.ir.Module$$Lambda/0x00007b79305fe690.apply
	at scala.collection.immutable.List.map(List.scala:250)
	at org.enso.compiler.core.ir.Module.duplicate(Module.scala:119)
	at org.enso.interpreter.runtime.TruffleCompilerContext.serializeModule(TruffleCompilerContext.java:359)
	at org.enso.compiler.Compiler.$anonfun$runCompilerPipeline$14(Compiler.scala:433)
	at org.enso.compiler.Compiler$$Lambda/0x00007b79305d1bd8.apply
	at scala.collection.immutable.List.foreach(List.scala:333)

Copy link
Member Author

@JaroslavTulach JaroslavTulach Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@JaroslavTulach JaroslavTulach Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With 6f93f4e the StackOverflowError shall disappear. Unless it doesn't:

Copy link
Member Author

@JaroslavTulach JaroslavTulach Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid

has introduced cycles in the IR graph - TypeSignatures metadata may probably point to Name.Literal that points back to the TypeSignatures metadata. CCing @radeusgd

Otherwise I cannot explain to myself why there is StackOverflowError processing a finite tree-like structure.

@JaroslavTulach JaroslavTulach added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Sep 9, 2024
@JaroslavTulach
Copy link
Member Author

We have cycles in the IR now. I am afraid structure equality isn't going to fly at current state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
1 participant