< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/phases/OnStackReplacementPhase.java

Print this page




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.hotspot.phases;
  26 
  27 import static jdk.vm.ci.meta.SpeculationLog.SpeculationReason;
  28 import static org.graalvm.compiler.phases.common.DeadCodeEliminationPhase.Optionality.Required;
  29 
  30 import org.graalvm.compiler.core.common.PermanentBailoutException;
  31 import org.graalvm.compiler.core.common.cfg.Loop;
  32 import org.graalvm.compiler.core.common.type.ObjectStamp;
  33 import org.graalvm.compiler.core.common.type.Stamp;
  34 import org.graalvm.compiler.debug.CounterKey;
  35 import org.graalvm.compiler.debug.DebugCloseable;
  36 import org.graalvm.compiler.debug.DebugContext;
  37 import org.graalvm.compiler.debug.GraalError;
  38 import org.graalvm.compiler.graph.Node;
  39 import org.graalvm.compiler.graph.iterators.NodeIterable;
  40 import org.graalvm.compiler.loop.LoopsData;
  41 import org.graalvm.compiler.loop.phases.LoopTransformations;
  42 import org.graalvm.compiler.nodeinfo.InputType;
  43 import org.graalvm.compiler.nodeinfo.Verbosity;
  44 import org.graalvm.compiler.nodes.AbstractBeginNode;
  45 import org.graalvm.compiler.nodes.EntryMarkerNode;
  46 import org.graalvm.compiler.nodes.EntryProxyNode;
  47 import org.graalvm.compiler.nodes.FixedGuardNode;


  60 import org.graalvm.compiler.nodes.extended.OSRLockNode;
  61 import org.graalvm.compiler.nodes.extended.OSRMonitorEnterNode;
  62 import org.graalvm.compiler.nodes.extended.OSRStartNode;
  63 import org.graalvm.compiler.nodes.java.AccessMonitorNode;
  64 import org.graalvm.compiler.nodes.java.InstanceOfNode;
  65 import org.graalvm.compiler.nodes.java.MonitorEnterNode;
  66 import org.graalvm.compiler.nodes.java.MonitorExitNode;
  67 import org.graalvm.compiler.nodes.java.MonitorIdNode;
  68 import org.graalvm.compiler.nodes.util.GraphUtil;
  69 import org.graalvm.compiler.options.Option;
  70 import org.graalvm.compiler.options.OptionKey;
  71 import org.graalvm.compiler.options.OptionType;
  72 import org.graalvm.compiler.options.OptionValues;
  73 import org.graalvm.compiler.phases.Phase;
  74 import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
  75 
  76 import jdk.vm.ci.meta.DeoptimizationAction;
  77 import jdk.vm.ci.meta.DeoptimizationReason;
  78 import jdk.vm.ci.meta.JavaKind;
  79 import jdk.vm.ci.meta.SpeculationLog;

  80 import jdk.vm.ci.runtime.JVMCICompiler;
  81 
  82 public class OnStackReplacementPhase extends Phase {
  83 
  84     public static class Options {
  85         // @formatter:off
  86         @Option(help = "Deoptimize OSR compiled code when the OSR entry loop is finished " +
  87                        "if there is no mature profile available for the rest of the method.", type = OptionType.Debug)
  88         public static final OptionKey<Boolean> DeoptAfterOSR = new OptionKey<>(true);
  89         @Option(help = "Support OSR compilations with locks. If DeoptAfterOSR is true we can per definition not have " +
  90                        "unbalaced enter/extis mappings. If DeoptAfterOSR is false insert artificial monitor enters after " +
  91                        "the OSRStart to have balanced enter/exits in the graph.", type = OptionType.Debug)
  92         public static final OptionKey<Boolean> SupportOSRWithLocks = new OptionKey<>(true);
  93         // @formatter:on
  94     }
  95 
  96     private static final CounterKey OsrWithLocksCount = DebugContext.counter("OSRWithLocks");
  97 
  98     private static boolean supportOSRWithLocks(OptionValues options) {
  99         return Options.SupportOSRWithLocks.getValue(options);




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.hotspot.phases;
  26 

  27 import static org.graalvm.compiler.phases.common.DeadCodeEliminationPhase.Optionality.Required;
  28 
  29 import org.graalvm.compiler.core.common.PermanentBailoutException;
  30 import org.graalvm.compiler.core.common.cfg.Loop;
  31 import org.graalvm.compiler.core.common.type.ObjectStamp;
  32 import org.graalvm.compiler.core.common.type.Stamp;
  33 import org.graalvm.compiler.debug.CounterKey;
  34 import org.graalvm.compiler.debug.DebugCloseable;
  35 import org.graalvm.compiler.debug.DebugContext;
  36 import org.graalvm.compiler.debug.GraalError;
  37 import org.graalvm.compiler.graph.Node;
  38 import org.graalvm.compiler.graph.iterators.NodeIterable;
  39 import org.graalvm.compiler.loop.LoopsData;
  40 import org.graalvm.compiler.loop.phases.LoopTransformations;
  41 import org.graalvm.compiler.nodeinfo.InputType;
  42 import org.graalvm.compiler.nodeinfo.Verbosity;
  43 import org.graalvm.compiler.nodes.AbstractBeginNode;
  44 import org.graalvm.compiler.nodes.EntryMarkerNode;
  45 import org.graalvm.compiler.nodes.EntryProxyNode;
  46 import org.graalvm.compiler.nodes.FixedGuardNode;


  59 import org.graalvm.compiler.nodes.extended.OSRLockNode;
  60 import org.graalvm.compiler.nodes.extended.OSRMonitorEnterNode;
  61 import org.graalvm.compiler.nodes.extended.OSRStartNode;
  62 import org.graalvm.compiler.nodes.java.AccessMonitorNode;
  63 import org.graalvm.compiler.nodes.java.InstanceOfNode;
  64 import org.graalvm.compiler.nodes.java.MonitorEnterNode;
  65 import org.graalvm.compiler.nodes.java.MonitorExitNode;
  66 import org.graalvm.compiler.nodes.java.MonitorIdNode;
  67 import org.graalvm.compiler.nodes.util.GraphUtil;
  68 import org.graalvm.compiler.options.Option;
  69 import org.graalvm.compiler.options.OptionKey;
  70 import org.graalvm.compiler.options.OptionType;
  71 import org.graalvm.compiler.options.OptionValues;
  72 import org.graalvm.compiler.phases.Phase;
  73 import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
  74 
  75 import jdk.vm.ci.meta.DeoptimizationAction;
  76 import jdk.vm.ci.meta.DeoptimizationReason;
  77 import jdk.vm.ci.meta.JavaKind;
  78 import jdk.vm.ci.meta.SpeculationLog;
  79 import jdk.vm.ci.meta.SpeculationLog.SpeculationReason;
  80 import jdk.vm.ci.runtime.JVMCICompiler;
  81 
  82 public class OnStackReplacementPhase extends Phase {
  83 
  84     public static class Options {
  85         // @formatter:off
  86         @Option(help = "Deoptimize OSR compiled code when the OSR entry loop is finished " +
  87                        "if there is no mature profile available for the rest of the method.", type = OptionType.Debug)
  88         public static final OptionKey<Boolean> DeoptAfterOSR = new OptionKey<>(true);
  89         @Option(help = "Support OSR compilations with locks. If DeoptAfterOSR is true we can per definition not have " +
  90                        "unbalaced enter/extis mappings. If DeoptAfterOSR is false insert artificial monitor enters after " +
  91                        "the OSRStart to have balanced enter/exits in the graph.", type = OptionType.Debug)
  92         public static final OptionKey<Boolean> SupportOSRWithLocks = new OptionKey<>(true);
  93         // @formatter:on
  94     }
  95 
  96     private static final CounterKey OsrWithLocksCount = DebugContext.counter("OSRWithLocks");
  97 
  98     private static boolean supportOSRWithLocks(OptionValues options) {
  99         return Options.SupportOSRWithLocks.getValue(options);


< prev index next >