Skip to content

Conversation

@graalvmbot
Copy link
Collaborator

This PR refactors the analysis code to reduce ambiguity and introduce more invariants. In particular, the following changes are made:

  • AnalysisMethod.isEntryPoint() was renamed to AnalysisMethod.isNativeEntryPoint() to minimize the chances that it would be incorrectly used to collect call graph root methods, which are in some context also called entrypoints, but not all root methods are (native) entry points. The call graph obtained by starting from native entrypoints would not include all reachable methods.
  • The vice versa will be enforced: (native) entry points are now a subset of root methods. In particular, a method cannot be registered as a native entry point until it has been registered as a direct root.

This PR also fixes three issues of the CSV call graph. In this context, the word entrypoint means root (hence the confusion).

  • It makes sure that all entrypoints are marked properly.
  • It stops filtering out invokes with no callees, which was confusing.
  • It creates MethodNodes for methods serving purely as call targets lazily, removing the need for extra iteration over the call graph.

The following invariant now holds for all CSV call graphs that Native Image generates:

  • All methods in call_tree_methods_*.csv are reachable. In particular, each method is either an entrypoint, reachable from an entrypoint, or a call target of an invoke.

There were three issues:
1) Not all entrypoints were marked properly
2) Invokes with no callees were filtered out, which could be confusing.
3) Simplify the code, get rid of unnecessary traversal
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Feb 11, 2025
@graalvmbot graalvmbot closed this Feb 11, 2025
@graalvmbot graalvmbot deleted the d-kozak/GR-60855/analysis-debugging-tests branch February 11, 2025 16:00
@graalvmbot graalvmbot merged commit 009a6f9 into master Feb 11, 2025
12 of 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