@@ -137,8 +137,7 @@ protected void verify(StructuredGraph graph, CoreProviders context) {
137
137
MethodSource .of ("com.oracle.graal.pointsto.phases.InlineBeforeAnalysis" , "decodeGraph" ),
138
138
MethodSource .of ("com.oracle.svm.hosted.classinitialization.SimulateClassInitializerSupport" , "decodeGraph" ),
139
139
MethodSource .of ("com.oracle.svm.hosted.classinitialization.SimulateClassInitializerAbortException" , "doAbort" ),
140
- MethodSource .of (CallTree .class , "dumpBasic" ),
141
- MethodSource .of (CallTree .class , "GraphManager" , "peRoot" ));
140
+ MethodSource .of (CallTree .class , "dumpBasic" ));
142
141
143
142
/**
144
143
* The set of methods allowed to call a {@code Debug.dump(...)} method with the {@code level}
@@ -156,7 +155,17 @@ protected void verify(StructuredGraph graph, CoreProviders context) {
156
155
MethodSource .of (SnippetTemplate .class , "instantiate" ),
157
156
MethodSource .of (SnippetTemplate .class , "<init>" ),
158
157
MethodSource .of (SymbolicSnippetEncoder .class , "verifySnippetEncodeDecode" ),
159
- MethodSource .of (CallTree .class , "dumpInfo" ),
158
+ MethodSource .of (CallTree .class , "dumpInfo" ));
159
+
160
+ /**
161
+ * The set of methods allowed to call a {@code Debug.dump(...)} method with a variable
162
+ * {@code level} parameter and the {@code object} parameter bound to a {@link StructuredGraph}
163
+ * value.
164
+ *
165
+ * If you add a *justified* graph dump with variable level parameter, then update the allow
166
+ * list.
167
+ */
168
+ private static final Set <MethodSource > ParameterizedLevelStructuredGraphDumpAllowList = CollectionsUtil .setOf (
160
169
MethodSource .of (CallTree .class , "GraphManager" , "pe" ));
161
170
162
171
@ Override
@@ -175,7 +184,10 @@ protected void verifyParameters(MetaAccessProvider metaAccess1, MethodCallTarget
175
184
allowedClasses .add (ReportHotCodePhase .class .getName ());
176
185
String callerClassName = debugCallTarget .graph ().method ().format ("%H" );
177
186
if (!allowedClasses .contains (callerClassName )) {
178
- int dumpLevel = verifyDumpLevelParameter (debugCallTarget , verifiedCallee , args .get (1 ));
187
+ ResolvedJavaMethod callerMethod = debugCallTarget .graph ().method ();
188
+ Integer dumpLevel = ParameterizedLevelStructuredGraphDumpAllowList .stream ().noneMatch (ms -> ms .matches (callerMethod ))
189
+ ? verifyDumpLevelParameter (debugCallTarget , verifiedCallee , args .get (1 ))
190
+ : null ;
179
191
verifyDumpObjectParameter (debugCallTarget , args .get (2 ), verifiedCallee , dumpLevel );
180
192
}
181
193
}
@@ -220,7 +232,13 @@ protected void verifyDumpObjectParameter(MethodCallTargetNode debugCallTarget, V
220
232
protected void verifyStructuredGraphDumping (MethodCallTargetNode debugCallTarget , ResolvedJavaMethod verifiedCallee , Integer dumpLevel )
221
233
throws VerifyPhase .VerificationError {
222
234
ResolvedJavaMethod method = debugCallTarget .graph ().method ();
223
- if (dumpLevel == DebugContext .BASIC_LEVEL ) {
235
+ if (dumpLevel == null ) {
236
+ if (ParameterizedLevelStructuredGraphDumpAllowList .stream ().noneMatch (ms -> ms .matches (method ))) {
237
+ throw new VerificationError (
238
+ debugCallTarget , "call to %s with parameterized level not in %s.ParameterizedLevelStructuredGraphDumpAllowList.%n" , verifiedCallee .format ("%H.%n(%p)" ),
239
+ getClass ().getName ());
240
+ }
241
+ } else if (dumpLevel == DebugContext .BASIC_LEVEL ) {
224
242
if (BasicLevelStructuredGraphDumpAllowList .stream ().noneMatch (ms -> ms .matches (method ))) {
225
243
throw new VerificationError (
226
244
debugCallTarget , "call to %s with level == DebugContext.BASIC_LEVEL not in %s.BasicLevelStructuredGraphDumpAllowList.%n" , verifiedCallee .format ("%H.%n(%p)" ),
0 commit comments