src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/DeoptimizeNode.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/DeoptimizeNode.java

Print this page




   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
   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 package org.graalvm.compiler.nodes;
  24 
  25 import org.graalvm.compiler.debug.Debug;
  26 import org.graalvm.compiler.graph.NodeClass;
  27 import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
  28 import org.graalvm.compiler.nodeinfo.NodeInfo;
  29 import org.graalvm.compiler.nodes.spi.LIRLowerable;
  30 import org.graalvm.compiler.nodes.spi.Lowerable;
  31 import org.graalvm.compiler.nodes.spi.LoweringTool;
  32 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
  33 
  34 import jdk.vm.ci.meta.DeoptimizationAction;
  35 import jdk.vm.ci.meta.DeoptimizationReason;
  36 import jdk.vm.ci.meta.JavaConstant;
  37 import jdk.vm.ci.meta.JavaKind;
  38 import jdk.vm.ci.meta.MetaAccessProvider;
  39 import jdk.vm.ci.meta.Value;
  40 
  41 @NodeInfo(shortName = "Deopt", nameTemplate = "Deopt {p#reason/s}")
  42 public final class DeoptimizeNode extends AbstractDeoptimizeNode implements Lowerable, LIRLowerable {
  43     public static final int DEFAULT_DEBUG_ID = 0;
  44 
  45     public static final NodeClass<DeoptimizeNode> TYPE = NodeClass.create(DeoptimizeNode.class);


  66         this.debugId = debugId;
  67         this.speculation = speculation;
  68     }
  69 
  70     public DeoptimizationAction action() {
  71         return action;
  72     }
  73 
  74     public DeoptimizationReason reason() {
  75         return reason;
  76     }
  77 
  78     @Override
  79     public void lower(LoweringTool tool) {
  80         tool.getLowerer().lower(this, tool);
  81     }
  82 
  83     @SuppressWarnings("deprecation")
  84     public int getDebugId() {
  85         int deoptDebugId = debugId;
  86         if (deoptDebugId == DEFAULT_DEBUG_ID && (Debug.isDumpEnabledForMethod() || Debug.isLogEnabledForMethod())) {


  87             deoptDebugId = this.getId();
  88         }

  89         return deoptDebugId;
  90     }
  91 
  92     public void setDebugId(int debugId) {
  93         assert debugId != DEFAULT_DEBUG_ID;
  94         this.debugId = debugId;
  95     }
  96 
  97     @Override
  98     public void generate(NodeLIRBuilderTool gen) {
  99         LIRGeneratorTool tool = gen.getLIRGeneratorTool();
 100         Value actionAndReason = tool.emitJavaConstant(tool.getMetaAccess().encodeDeoptActionAndReason(action, reason, getDebugId()));
 101         Value speculationValue = tool.emitJavaConstant(speculation);
 102         gen.getLIRGeneratorTool().emitDeoptimize(actionAndReason, speculationValue, gen.state(this));
 103     }
 104 
 105     @Override
 106     public ValueNode getActionAndReason(MetaAccessProvider metaAccess) {
 107         return ConstantNode.forConstant(metaAccess.encodeDeoptActionAndReason(action, reason, getDebugId()), metaAccess, graph());
 108     }


   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
   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 package org.graalvm.compiler.nodes;
  24 
  25 import org.graalvm.compiler.debug.DebugContext;
  26 import org.graalvm.compiler.graph.NodeClass;
  27 import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
  28 import org.graalvm.compiler.nodeinfo.NodeInfo;
  29 import org.graalvm.compiler.nodes.spi.LIRLowerable;
  30 import org.graalvm.compiler.nodes.spi.Lowerable;
  31 import org.graalvm.compiler.nodes.spi.LoweringTool;
  32 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
  33 
  34 import jdk.vm.ci.meta.DeoptimizationAction;
  35 import jdk.vm.ci.meta.DeoptimizationReason;
  36 import jdk.vm.ci.meta.JavaConstant;
  37 import jdk.vm.ci.meta.JavaKind;
  38 import jdk.vm.ci.meta.MetaAccessProvider;
  39 import jdk.vm.ci.meta.Value;
  40 
  41 @NodeInfo(shortName = "Deopt", nameTemplate = "Deopt {p#reason/s}")
  42 public final class DeoptimizeNode extends AbstractDeoptimizeNode implements Lowerable, LIRLowerable {
  43     public static final int DEFAULT_DEBUG_ID = 0;
  44 
  45     public static final NodeClass<DeoptimizeNode> TYPE = NodeClass.create(DeoptimizeNode.class);


  66         this.debugId = debugId;
  67         this.speculation = speculation;
  68     }
  69 
  70     public DeoptimizationAction action() {
  71         return action;
  72     }
  73 
  74     public DeoptimizationReason reason() {
  75         return reason;
  76     }
  77 
  78     @Override
  79     public void lower(LoweringTool tool) {
  80         tool.getLowerer().lower(this, tool);
  81     }
  82 
  83     @SuppressWarnings("deprecation")
  84     public int getDebugId() {
  85         int deoptDebugId = debugId;
  86         if (deoptDebugId == DEFAULT_DEBUG_ID) {
  87             DebugContext debug = getDebug();
  88             if ((debug.isDumpEnabledForMethod() || debug.isLogEnabledForMethod())) {
  89                 deoptDebugId = this.getId();
  90             }
  91         }
  92         return deoptDebugId;
  93     }
  94 
  95     public void setDebugId(int debugId) {
  96         assert debugId != DEFAULT_DEBUG_ID;
  97         this.debugId = debugId;
  98     }
  99 
 100     @Override
 101     public void generate(NodeLIRBuilderTool gen) {
 102         LIRGeneratorTool tool = gen.getLIRGeneratorTool();
 103         Value actionAndReason = tool.emitJavaConstant(tool.getMetaAccess().encodeDeoptActionAndReason(action, reason, getDebugId()));
 104         Value speculationValue = tool.emitJavaConstant(speculation);
 105         gen.getLIRGeneratorTool().emitDeoptimize(actionAndReason, speculationValue, gen.state(this));
 106     }
 107 
 108     @Override
 109     public ValueNode getActionAndReason(MetaAccessProvider metaAccess) {
 110         return ConstantNode.forConstant(metaAccess.encodeDeoptActionAndReason(action, reason, getDebugId()), metaAccess, graph());
 111     }
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/DeoptimizeNode.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File