src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EarlyReadEliminationPhase.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 52910 583fd71c47d6
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    27 import static org.graalvm.compiler.core.common.GraalOptions.EscapeAnalyzeOnly;
    27 import static org.graalvm.compiler.core.common.GraalOptions.EscapeAnalyzeOnly;
    28 
    28 
    29 import org.graalvm.compiler.nodes.StructuredGraph;
    29 import org.graalvm.compiler.nodes.StructuredGraph;
    30 import org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult;
    30 import org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult;
    31 import org.graalvm.compiler.nodes.cfg.ControlFlowGraph;
    31 import org.graalvm.compiler.nodes.cfg.ControlFlowGraph;
       
    32 import org.graalvm.compiler.nodes.spi.CoreProviders;
    32 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
    33 import org.graalvm.compiler.phases.common.CanonicalizerPhase;
    33 import org.graalvm.compiler.phases.tiers.PhaseContext;
       
    34 
    34 
    35 public class EarlyReadEliminationPhase extends EffectsPhase<PhaseContext> {
    35 public class EarlyReadEliminationPhase extends EffectsPhase<CoreProviders> {
    36 
    36 
    37     private final boolean considerGuards;
    37     private final boolean considerGuards;
    38 
    38 
    39     public EarlyReadEliminationPhase(CanonicalizerPhase canonicalizer) {
    39     public EarlyReadEliminationPhase(CanonicalizerPhase canonicalizer) {
    40         super(1, canonicalizer, true);
    40         super(1, canonicalizer, true);
    45         super(1, canonicalizer, true);
    45         super(1, canonicalizer, true);
    46         this.considerGuards = considerGuards;
    46         this.considerGuards = considerGuards;
    47     }
    47     }
    48 
    48 
    49     @Override
    49     @Override
    50     protected void run(StructuredGraph graph, PhaseContext context) {
    50     protected void run(StructuredGraph graph, CoreProviders context) {
    51         if (VirtualUtil.matches(graph, EscapeAnalyzeOnly.getValue(graph.getOptions()))) {
    51         if (VirtualUtil.matches(graph, EscapeAnalyzeOnly.getValue(graph.getOptions()))) {
    52             runAnalysis(graph, context);
    52             runAnalysis(graph, context);
    53         }
    53         }
    54     }
    54     }
    55 
    55 
    56     @Override
    56     @Override
    57     protected Closure<?> createEffectsClosure(PhaseContext context, ScheduleResult schedule, ControlFlowGraph cfg) {
    57     protected Closure<?> createEffectsClosure(CoreProviders context, ScheduleResult schedule, ControlFlowGraph cfg) {
    58         assert schedule == null;
    58         assert schedule == null;
    59         return new ReadEliminationClosure(cfg, considerGuards);
    59         return new ReadEliminationClosure(cfg, considerGuards);
    60     }
    60     }
    61 
    61 
    62     @Override
    62     @Override