-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Refactor iterative analysis code to common method #3773
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
Conversation
Thank you for your contribution, this PR is tracked internally by GR-33705 |
|
||
if (stopIterationCriteria.getAsBoolean()) { | ||
if (numTypes != universe.getTypes().size() || numMethods != universe.getMethods().size() || numFields != universe.getFields().size()) { | ||
reportError.accept( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this error reporting code should remain in NativeImageGenerator
. That avoids passing in a reportError
handler. And duringAnalyssiAction
and stopIterationCriteria
can be combined to a single Predicate
(i.e., boolean function). That way only one lambda needs to be passed into this method, making it maintainable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as suggested.
3add7df
to
864222d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comments.
int numMethods = aUniverse.getMethods().size(); | ||
int numFields = aUniverse.getFields().size(); | ||
|
||
String msg = ((NativeImagePointsToAnalysis) bb).iterativelyAnalyze(debug, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would call the method runAnalysis
and add it to the BigBang
interface. This would avoid the cast here and allow instantiation of other analysis types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as suggested.
} | ||
return !config.getAndResetRequireAnalysisIteration(); | ||
}); | ||
if (msg.length() > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this approach of returning a String on error. Instead you could just throw an com.oracle.graal.pointsto.util.AnalysisError
from PoinstToAnalysis.runAnalysis()
then catch it here and wrap it in a user error, something like: throw UserError.abort(original, "Analysis step failed. Reason: %s.", original.getMessage());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed as suggested
@@ -779,6 +744,8 @@ private boolean runPointsToAnalysis(String imageName, OptionValues options, Debu | |||
return false; | |||
} | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These extra lines should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
a8ad963
to
5d03edc
Compare
Extract the iteratively analyzing code from NativeImageGenerator to PointsToAnalysis so it can be used by both native image generation and standalone pointsto analysis.
5d03edc
to
01f82d3
Compare
Extract the iteratively analyzing code from
NativeImageGenerator
toPointsToAnalysis
so it can be used by both native image generation and standalone pointsto analysis.This PR is related with Feature request: #3418