Skip to content

Commit 56d38af

Browse files
committed
[GR-56794] Update the CompilationPolicy class
PullRequest: graal/19785
2 parents 54e7d71 + 7d8b2f7 commit 56d38af

File tree

1 file changed

+15
-1
lines changed
  • substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code

1 file changed

+15
-1
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,13 @@ public Policy(HostedUniverse universe) {
270270
this.universe = universe;
271271
}
272272

273-
public abstract void beforeEncode(HostedMethod method, StructuredGraph graph, HighTierContext context);
273+
@SuppressWarnings("unused")
274+
public void beforeEncode(HostedMethod method, StructuredGraph graph, HighTierContext context) {
275+
}
276+
277+
@SuppressWarnings("unused")
278+
public void afterMethodCompile(HostedMethod method, StructuredGraph graph) {
279+
}
274280

275281
public void afterCompile() {
276282
}
@@ -1361,6 +1367,8 @@ private CompilationResult defaultCompileFunction(DebugContext debug, HostedMetho
13611367
result.setTargetCode(Arrays.copyOf(result.getTargetCode(), result.getTargetCodeSize()), result.getTargetCodeSize());
13621368
}
13631369

1370+
notifyAfterMethodCompile(method, graph);
1371+
13641372
return result;
13651373
}
13661374
} catch (Throwable ex) {
@@ -1370,6 +1378,12 @@ private CompilationResult defaultCompileFunction(DebugContext debug, HostedMetho
13701378
}
13711379
}
13721380

1381+
private void notifyAfterMethodCompile(HostedMethod method, StructuredGraph graph) {
1382+
for (Policy policy : this.policies) {
1383+
policy.afterMethodCompile(method, graph);
1384+
}
1385+
}
1386+
13731387
/**
13741388
* Allows subclasses to customize the {@link StructuredGraph graph} after its creation.
13751389
*

0 commit comments

Comments
 (0)