Skip to content

Commit 1905753

Browse files
committed
clear cache in EnumSwitchPlugin after Analysis
1 parent b188cdd commit 1905753

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/phases/EnumSwitchPlugin.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ public boolean handleInvoke(GraphBuilderContext b, ResolvedJavaMethod m, ValueNo
9595
* that end up in the same class or in the JDK.
9696
*/
9797
EnumSwitchFeature feature = ImageSingletons.lookup(EnumSwitchFeature.class);
98-
method.ensureGraphParsed(feature.bb);
99-
Boolean methodSafeForExecution = feature.methodsSafeForExecution.get(method);
98+
method.ensureGraphParsed(feature.getBigBang());
99+
Boolean methodSafeForExecution = feature.isMethodsSafeForExecution(method);
100100
assert methodSafeForExecution != null : "after-parsing hook not executed for method " + method.format("%H.%n(%p)");
101101
if (!methodSafeForExecution.booleanValue()) {
102102
return false;
@@ -121,9 +121,9 @@ public boolean handleInvoke(GraphBuilderContext b, ResolvedJavaMethod m, ValueNo
121121
@AutomaticallyRegisteredFeature
122122
final class EnumSwitchFeature implements InternalFeature {
123123

124-
BigBang bb;
124+
private BigBang bb;
125125

126-
final ConcurrentMap<AnalysisMethod, Boolean> methodsSafeForExecution = new ConcurrentHashMap<>();
126+
private ConcurrentMap<AnalysisMethod, Boolean> methodsSafeForExecution = new ConcurrentHashMap<>();
127127

128128
@Override
129129
public void duringSetup(DuringSetupAccess a) {
@@ -142,10 +142,19 @@ private void onMethodParsed(AnalysisMethod method, StructuredGraph graph) {
142142
@Override
143143
public void afterAnalysis(AfterAnalysisAccess access) {
144144
bb = null;
145+
methodsSafeForExecution = null;
145146
}
146147

147148
@Override
148149
public void registerGraphBuilderPlugins(Providers providers, Plugins plugins, ParsingReason reason) {
149150
plugins.appendNodePlugin(new EnumSwitchPlugin(reason));
150151
}
152+
153+
Boolean isMethodsSafeForExecution(AnalysisMethod method) {
154+
return methodsSafeForExecution.get(method);
155+
}
156+
157+
public BigBang getBigBang() {
158+
return bb;
159+
}
151160
}

0 commit comments

Comments
 (0)