Skip to content

[GR-63033] [GR-63361] Add specialized filter primitive flow for constant y operand #10897

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

Merged
merged 3 commits into from
Mar 23, 2025

Conversation

graalvmbot
Copy link
Collaborator

This PR introduces a specialized flow for primitive comparisons whose y(right) operand is a constant. I discovered that typeflow graphs for methods containing lost of if statements like

if(someBooleanMethod()){...}

tend to be hard to comprehend when debugging, because there are lots of use edges from a primitive constant 0 to primitive filters. Also, propagating the constant primitive typestate via use edges is essentially a waste of resources, because it is always the same value. I made a quick measurement and noticed that this pattern seems to be quite common. For example, on Spring Petclinic, almost 72% of primitive comparisons that we model in the analysis have constant y operands.

To sum up, this change should make the following improvements:

  1. It makes typeflow graphs more compact and easier to understand.
  2. It reduces the amount of use edges that always propagate the same constant value, which could improve analysis time and memory footprint, though I do not expect significant gains here.

As side tasks, this PR also:

  • adds predicate-specific error messages to StrengthenGraphs to differentiate between optimizations caused by flows marked as disabled vs flows with empty typestate/list of callees
  • introduces a verification for the fixed-point state of the analysis, useful to fail fast with a concrete counter-example if a flow ends up in an invalid state or an information between flows is not propagated correctly

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 21, 2025
@graalvmbot graalvmbot closed this Mar 23, 2025
@graalvmbot graalvmbot deleted the d-kozak/GR-63033/specialized-primitive-filter branch March 23, 2025 00:23
@graalvmbot graalvmbot merged commit d2cd8ba into master Mar 23, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants