< prev index next >

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

Print this page
rev 56282 : [mq]: graal
   1 /*
   2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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 
  24 
  25 package org.graalvm.compiler.nodes;
  26 
  27 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_0;
  28 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_0;
  29 
  30 import org.graalvm.compiler.core.common.type.AbstractPointerStamp;
  31 import org.graalvm.compiler.core.common.type.ObjectStamp;
  32 import org.graalvm.compiler.core.common.type.Stamp;
  33 import org.graalvm.compiler.core.common.type.StampFactory;
  34 import org.graalvm.compiler.core.common.type.TypeReference;
  35 import org.graalvm.compiler.debug.DebugContext;
  36 import org.graalvm.compiler.graph.IterableNodeType;
  37 import org.graalvm.compiler.graph.Node;
  38 import org.graalvm.compiler.graph.NodeClass;
  39 import org.graalvm.compiler.graph.spi.Canonicalizable;
  40 import org.graalvm.compiler.graph.spi.CanonicalizerTool;
  41 import org.graalvm.compiler.nodeinfo.NodeInfo;
  42 import org.graalvm.compiler.nodes.extended.GuardingNode;
  43 import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
  44 import org.graalvm.compiler.nodes.memory.ReadNode;
  45 import org.graalvm.compiler.nodes.spi.LIRLowerable;
  46 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
  47 import org.graalvm.compiler.nodes.spi.ValueProxy;
  48 import org.graalvm.compiler.nodes.spi.Virtualizable;
  49 import org.graalvm.compiler.nodes.spi.VirtualizerTool;
  50 import org.graalvm.compiler.nodes.type.StampTool;
  51 import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
  52 
  53 import jdk.vm.ci.meta.JavaKind;
  54 import jdk.vm.ci.meta.ResolvedJavaMethod;
  55 import jdk.vm.ci.meta.ResolvedJavaType;
  56 
  57 //JaCoCo Exclude
  58 
  59 /**
  60  * A node that changes the type of its input, usually narrowing it. For example, a {@link PiNode}
  61  * refines the type of a receiver during type-guarded inlining to be the type tested by the guard.
  62  *
  63  * In contrast to a {@link GuardedValueNode}, a {@link PiNode} is useless as soon as the type of its
  64  * input is as narrow or narrower than the {@link PiNode}'s type. The {@link PiNode}, and therefore
  65  * also the scheduling restriction enforced by the guard, will go away.
  66  */
  67 @NodeInfo(cycles = CYCLES_0, size = SIZE_0)
  68 public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, IterableNodeType, Canonicalizable, ValueProxy {
  69 
  70     public static final NodeClass<PiNode> TYPE = NodeClass.create(PiNode.class);
  71     @Input ValueNode object;
  72     protected Stamp piStamp;
  73 
  74     public ValueNode object() {
  75         return object;
  76     }
  77 
  78     protected PiNode(NodeClass<? extends PiNode> c, ValueNode object, Stamp stamp, GuardingNode guard) {
  79         super(c, stamp, guard);
  80         this.object = object;
  81         this.piStamp = stamp;
  82         assert piStamp.isCompatible(object.stamp(NodeView.DEFAULT)) : "Object stamp not compatible to piStamp";
  83         inferStamp();
  84     }
  85 
  86     public PiNode(ValueNode object, Stamp stamp) {
  87         this(object, stamp, null);
  88     }


   1 /*
   2  * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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 
  24 
  25 package org.graalvm.compiler.nodes;
  26 
  27 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_0;
  28 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_0;
  29 
  30 import org.graalvm.compiler.core.common.type.AbstractPointerStamp;
  31 import org.graalvm.compiler.core.common.type.ObjectStamp;
  32 import org.graalvm.compiler.core.common.type.Stamp;
  33 import org.graalvm.compiler.core.common.type.StampFactory;
  34 import org.graalvm.compiler.core.common.type.TypeReference;
  35 import org.graalvm.compiler.debug.DebugContext;

  36 import org.graalvm.compiler.graph.Node;
  37 import org.graalvm.compiler.graph.NodeClass;
  38 import org.graalvm.compiler.graph.spi.Canonicalizable;
  39 import org.graalvm.compiler.graph.spi.CanonicalizerTool;
  40 import org.graalvm.compiler.nodeinfo.NodeInfo;
  41 import org.graalvm.compiler.nodes.extended.GuardingNode;
  42 import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderContext;
  43 import org.graalvm.compiler.nodes.memory.ReadNode;
  44 import org.graalvm.compiler.nodes.spi.LIRLowerable;
  45 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
  46 import org.graalvm.compiler.nodes.spi.ValueProxy;
  47 import org.graalvm.compiler.nodes.spi.Virtualizable;
  48 import org.graalvm.compiler.nodes.spi.VirtualizerTool;
  49 import org.graalvm.compiler.nodes.type.StampTool;
  50 import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
  51 
  52 import jdk.vm.ci.meta.JavaKind;
  53 import jdk.vm.ci.meta.ResolvedJavaMethod;
  54 import jdk.vm.ci.meta.ResolvedJavaType;
  55 
  56 //JaCoCo Exclude
  57 
  58 /**
  59  * A node that changes the type of its input, usually narrowing it. For example, a {@link PiNode}
  60  * refines the type of a receiver during type-guarded inlining to be the type tested by the guard.
  61  *
  62  * In contrast to a {@link GuardedValueNode}, a {@link PiNode} is useless as soon as the type of its
  63  * input is as narrow or narrower than the {@link PiNode}'s type. The {@link PiNode}, and therefore
  64  * also the scheduling restriction enforced by the guard, will go away.
  65  */
  66 @NodeInfo(cycles = CYCLES_0, size = SIZE_0)
  67 public class PiNode extends FloatingGuardedNode implements LIRLowerable, Virtualizable, Canonicalizable, ValueProxy {
  68 
  69     public static final NodeClass<PiNode> TYPE = NodeClass.create(PiNode.class);
  70     @Input ValueNode object;
  71     protected Stamp piStamp;
  72 
  73     public ValueNode object() {
  74         return object;
  75     }
  76 
  77     protected PiNode(NodeClass<? extends PiNode> c, ValueNode object, Stamp stamp, GuardingNode guard) {
  78         super(c, stamp, guard);
  79         this.object = object;
  80         this.piStamp = stamp;
  81         assert piStamp.isCompatible(object.stamp(NodeView.DEFAULT)) : "Object stamp not compatible to piStamp";
  82         inferStamp();
  83     }
  84 
  85     public PiNode(ValueNode object, Stamp stamp) {
  86         this(object, stamp, null);
  87     }


< prev index next >