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

Use IR.STRUCTURE_COMPARATOR to compare two IR objects #11178

Merged
merged 8 commits into from
Sep 30, 2024

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Sep 26, 2024

Pull Request Description

Fixes #10985 by providing a special IR.STRUCTURE_COMPARATOR that removes metadata and diagnostics before comparing two IR objects. Inefficient, not fully correct, but enough for the debugging purposes this prev != null check was introduced.

Checklist

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

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

@JaroslavTulach JaroslavTulach added the CI: No changelog needed Do not require a changelog entry for this PR. label Sep 26, 2024
@JaroslavTulach JaroslavTulach self-assigned this Sep 26, 2024
@JaroslavTulach JaroslavTulach changed the title Use IR.STRUCTURE_COMPARATOR to compare two IR objects Use IR.STRUCTURE_COMPARATOR to compare two IR objects Sep 26, 2024
@JaroslavTulach JaroslavTulach added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Sep 26, 2024
@JaroslavTulach JaroslavTulach added the CI: Keep up to date Automatically update this PR to the latest develop. label Sep 27, 2024
@JaroslavTulach JaroslavTulach removed the CI: Keep up to date Automatically update this PR to the latest develop. label Sep 27, 2024
@JaroslavTulach
Copy link
Member Author

Got the failure in parallel PR CI run. Need review!

Copy link
Collaborator

@hubertp hubertp left a comment

Choose a reason for hiding this comment

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

Approving although I'm a bit wary of the performance impact. Please make sure it doesn't get worse.

return 0;
}
var aCopy = aIr.duplicate(true, false, false, true);
var bCopy = bIr.duplicate(true, false, false, true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

That looks expensive if we do it for every IR that we read?

Copy link
Member Author

Choose a reason for hiding this comment

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

We are not doing this for every IR we read. The code is only performed before exception:

   sb.append("Adding at ").append(at).append(" object:\n  ");
      dumpObject(sb, res);
      sb.append("\nbut there already is:\n  ");
      dumpObject(sb, prev);
      sb.append("\nare they equal: ").append(bothObjectsAreTheSame);

is logged or thrown. How frequently that happens? It happens on CI from time to time. I haven't seen it on my computer yet.

@JaroslavTulach JaroslavTulach merged commit da33c6d into develop Sep 30, 2024
42 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/SpecialIrCompare10985 branch September 30, 2024 08:28
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
Development

Successfully merging this pull request may close these issues.

Two IR objects aren't the same after de-serialization
2 participants