Skip to content

Commit b4046be

Browse files
committed
[GR-53468] Add support for beforeCompile policy hooks in the compile queue
PullRequest: graal/21511
2 parents dcd8e17 + c9e05c7 commit b4046be

File tree

1 file changed

+10
-0
lines changed
  • substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ public Policy(HostedUniverse universe) {
292292
public void beforeEncode(HostedMethod method, StructuredGraph graph, HighTierContext context) {
293293
}
294294

295+
public void beforeCompile() {
296+
}
297+
295298
@SuppressWarnings("unused")
296299
public void afterMethodCompile(HostedMethod method, StructuredGraph graph) {
297300
}
@@ -458,6 +461,7 @@ public void finish(DebugContext debug) {
458461
assert suitesNotCreated();
459462
createSuites();
460463
try (ProgressReporter.ReporterClosable _ = reporter.printCompiling()) {
464+
notifyBeforeCompile();
461465
compileAll();
462466
notifyAfterCompile();
463467
}
@@ -950,6 +954,12 @@ protected CompileTask createCompileTask(HostedMethod method, CompileReason reaso
950954
return new CompileTask(method, reason);
951955
}
952956

957+
private void notifyBeforeCompile() {
958+
for (Policy policy : this.policies) {
959+
policy.beforeCompile();
960+
}
961+
}
962+
953963
protected void compileAll() throws InterruptedException {
954964
/*
955965
* We parse ahead of time compiled methods before deoptimization targets so that we remove

0 commit comments

Comments
 (0)