Skip to content

Commit

Permalink
requireAnalysisIteration
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Wimmer committed Feb 10, 2022
1 parent 1729654 commit 386b168
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,15 @@ protected void processMethodMetadata(DuringAnalysisAccessImpl access) {
if (!SubstitutionReflectivityFilter.shouldExclude(reflectMethod, access.getMetaAccess(), access.getUniverse())) {
AnalysisMethod analysisMethod = access.getMetaAccess().lookupJavaMethod(reflectMethod);
registerTypesForQueriedMethod(access, analysisMethod, reflectMethod);
registerHidingSubTypeMethods(analysisMethod, analysisMethod.getDeclaringClass());
registerHidingSubTypeMethods(access, analysisMethod, analysisMethod.getDeclaringClass());
newQueriedMethods.add(reflectMethod);
}
}
queriedMethods = newQueriedMethods;
for (Executable method : reflectionMethods) {
if (!SubstitutionReflectivityFilter.shouldExclude(method, access.getMetaAccess(), access.getUniverse())) {
AnalysisMethod analysisMethod = access.getMetaAccess().lookupJavaMethod(method);
registerHidingSubTypeMethods(analysisMethod, analysisMethod.getDeclaringClass());
registerHidingSubTypeMethods(access, analysisMethod, analysisMethod.getDeclaringClass());
}
}
}
Expand All @@ -312,7 +312,7 @@ protected void processMethodMetadata(DuringAnalysisAccessImpl access) {

private final Map<AnalysisMethod, Set<AnalysisType>> seenHidingMethods = new HashMap<>();

private void registerHidingSubTypeMethods(AnalysisMethod method, AnalysisType type) {
private void registerHidingSubTypeMethods(DuringAnalysisAccessImpl access, AnalysisMethod method, AnalysisType type) {
if (!type.equals(method.getDeclaringClass()) && type.isReachable()) {
if (!seenHidingMethods.containsKey(method) || !seenHidingMethods.get(method).contains(type)) {
seenHidingMethods.computeIfAbsent(method, m -> new HashSet<>()).add(type);
Expand All @@ -335,6 +335,12 @@ private void registerHidingSubTypeMethods(AnalysisMethod method, AnalysisType ty
if (subClassMethod != null) {
hidingMethods.add(subClassMethod);
}
/*
* findMethod can lead to the creation of new AnalysisMethod, so we need to run
* another analysis iteration.
*/
access.requireAnalysisIteration();

} catch (UnsupportedFeatureException | LinkageError e) {
/*
* A method that is not supposed to end up in the image is considered as being
Expand All @@ -345,7 +351,7 @@ private void registerHidingSubTypeMethods(AnalysisMethod method, AnalysisType ty
}
for (AnalysisType subType : type.getSubTypes()) {
if (!subType.equals(type)) {
registerHidingSubTypeMethods(method, subType);
registerHidingSubTypeMethods(access, method, subType);
}
}
}
Expand Down

0 comments on commit 386b168

Please sign in to comment.