Skip to content

Commit

Permalink
Use graph.checkCancellation instead of task.isCancelled.
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-spas committed Mar 17, 2022
1 parent a985b76 commit 0836e30
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,7 @@ private void compileAST(TruffleCompilationWrapper wrapper, DebugContext debug) {
StructuredGraph graph = null;
try (CompilationAlarm alarm = CompilationAlarm.trackCompilationPeriod(debug.getOptions())) {
graph = truffleTier(wrapper, debug);
if (wrapper.task.isCancelled()) {
return;
}
graph.checkCancellation();
// The Truffle compiler owns the last 2 characters of the compilation name, and uses
// them to encode the compilation tier, so escaping the target name is not necessary.
String compilationName = wrapper.compilable.toString() + (wrapper.task.isFirstTier() ? TruffleCompiler.FIRST_TIER_COMPILATION_SUFFIX : TruffleCompiler.SECOND_TIER_COMPILATION_SUFFIX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
public final class InliningAcrossTruffleBoundaryPhase extends BasePhase<TruffleTierContext> {
@Override
protected void run(StructuredGraph graph, TruffleTierContext context) {
if (context.task.isCancelled()) {
return;
}
graph.checkCancellation();
TruffleCompilerRuntime rt = TruffleCompilerRuntime.getRuntime();
for (MethodCallTargetNode mct : graph.getNodes(MethodCallTargetNode.TYPE)) {
TruffleCompilerRuntime.InlineKind inlineKind = rt.getInlineKind(mct.targetMethod(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
public final class MaterializeFramesPhase extends BasePhase<TruffleTierContext> {
@Override
protected void run(StructuredGraph graph, TruffleTierContext context) {
if (context.task.isCancelled()) {
return;
}
graph.checkCancellation();
for (AllowMaterializeNode materializeNode : graph.getNodes(AllowMaterializeNode.TYPE).snapshot()) {
materializeNode.replaceAtUsages(materializeNode.getFrame());
graph.removeFixed(materializeNode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
public final class NeverPartOfCompilationPhase extends BasePhase<TruffleTierContext> {
@Override
protected void run(StructuredGraph graph, TruffleTierContext context) {
if (context.task.isCancelled()) {
return;
}
graph.checkCancellation();
for (NeverPartOfCompilationNode neverPartOfCompilationNode : graph.getNodes(NeverPartOfCompilationNode.TYPE)) {
final NeverPartOfCompilationException neverPartOfCompilationException = new NeverPartOfCompilationException(neverPartOfCompilationNode.getMessage());
neverPartOfCompilationException.setStackTrace(GraphUtil.approxSourceStackTraceElement(neverPartOfCompilationNode));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
public final class SetIdentityForValueTypesPhase extends BasePhase<TruffleTierContext> {
@Override
protected void run(StructuredGraph graph, TruffleTierContext context) {
if (context.task.isCancelled()) {
return;
}
graph.checkCancellation();
TruffleCompilerRuntime rt = TruffleCompilerRuntime.getRuntime();
for (VirtualObjectNode virtualObjectNode : graph.getNodes(VirtualObjectNode.TYPE)) {
if (virtualObjectNode instanceof VirtualInstanceNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
public class VerifyFrameDoesNotEscapePhase extends BasePhase<TruffleTierContext> {
@Override
protected void run(StructuredGraph graph, TruffleTierContext context) {
if (context.task.isCancelled()) {
return;
}
graph.checkCancellation();
for (NewFrameNode virtualFrame : graph.getNodes(NewFrameNode.TYPE)) {
for (MethodCallTargetNode callTarget : virtualFrame.usages().filter(MethodCallTargetNode.class)) {
if (callTarget.invoke() != null) {
Expand Down

0 comments on commit 0836e30

Please sign in to comment.