< prev index next >

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

Print this page
rev 52509 : [mq]: graal


   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.extended;
  26 
  27 import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
  28 
  29 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
  30 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
  31 
  32 import org.graalvm.compiler.core.common.type.ObjectStamp;
  33 import org.graalvm.compiler.core.common.type.Stamp;
  34 import org.graalvm.compiler.core.common.type.TypeReference;
  35 import org.graalvm.compiler.graph.NodeClass;
  36 import org.graalvm.compiler.graph.spi.Canonicalizable;
  37 import org.graalvm.compiler.graph.spi.CanonicalizerTool;
  38 import org.graalvm.compiler.nodeinfo.NodeInfo;
  39 import org.graalvm.compiler.nodes.ConstantNode;
  40 import org.graalvm.compiler.nodes.NodeView;
  41 import org.graalvm.compiler.nodes.ValueNode;
  42 import org.graalvm.compiler.nodes.calc.FloatingNode;
  43 import org.graalvm.compiler.nodes.spi.Lowerable;
  44 import org.graalvm.compiler.nodes.spi.LoweringTool;
  45 import org.graalvm.compiler.nodes.spi.StampProvider;
  46 import org.graalvm.compiler.nodes.spi.Virtualizable;
  47 import org.graalvm.compiler.nodes.spi.VirtualizerTool;
  48 import org.graalvm.compiler.nodes.type.StampTool;


 104         }
 105         return this;
 106     }
 107 
 108     public static ValueNode findSynonym(ValueNode curValue, Stamp stamp, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) {
 109         if (!GeneratePIC.getValue(curValue.getOptions())) {
 110             TypeReference type = StampTool.typeReferenceOrNull(curValue);
 111             if (type != null && type.isExact()) {
 112                 return ConstantNode.forConstant(stamp, constantReflection.asObjectHub(type.getType()), metaAccess);
 113             }
 114         }
 115         return null;
 116     }
 117 
 118     @Override
 119     public void virtualize(VirtualizerTool tool) {
 120         if (!GeneratePIC.getValue(tool.getOptions())) {
 121             ValueNode alias = tool.getAlias(getValue());
 122             TypeReference type = StampTool.typeReferenceOrNull(alias);
 123             if (type != null && type.isExact()) {
 124                 tool.replaceWithValue(ConstantNode.forConstant(stamp(NodeView.DEFAULT), tool.getConstantReflectionProvider().asObjectHub(type.getType()), tool.getMetaAccessProvider(), graph()));
 125             }
 126         }
 127     }
 128 }


   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.extended;
  26 
  27 import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;

  28 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
  29 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
  30 
  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.TypeReference;
  34 import org.graalvm.compiler.graph.NodeClass;
  35 import org.graalvm.compiler.graph.spi.Canonicalizable;
  36 import org.graalvm.compiler.graph.spi.CanonicalizerTool;
  37 import org.graalvm.compiler.nodeinfo.NodeInfo;
  38 import org.graalvm.compiler.nodes.ConstantNode;
  39 import org.graalvm.compiler.nodes.NodeView;
  40 import org.graalvm.compiler.nodes.ValueNode;
  41 import org.graalvm.compiler.nodes.calc.FloatingNode;
  42 import org.graalvm.compiler.nodes.spi.Lowerable;
  43 import org.graalvm.compiler.nodes.spi.LoweringTool;
  44 import org.graalvm.compiler.nodes.spi.StampProvider;
  45 import org.graalvm.compiler.nodes.spi.Virtualizable;
  46 import org.graalvm.compiler.nodes.spi.VirtualizerTool;
  47 import org.graalvm.compiler.nodes.type.StampTool;


 103         }
 104         return this;
 105     }
 106 
 107     public static ValueNode findSynonym(ValueNode curValue, Stamp stamp, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) {
 108         if (!GeneratePIC.getValue(curValue.getOptions())) {
 109             TypeReference type = StampTool.typeReferenceOrNull(curValue);
 110             if (type != null && type.isExact()) {
 111                 return ConstantNode.forConstant(stamp, constantReflection.asObjectHub(type.getType()), metaAccess);
 112             }
 113         }
 114         return null;
 115     }
 116 
 117     @Override
 118     public void virtualize(VirtualizerTool tool) {
 119         if (!GeneratePIC.getValue(tool.getOptions())) {
 120             ValueNode alias = tool.getAlias(getValue());
 121             TypeReference type = StampTool.typeReferenceOrNull(alias);
 122             if (type != null && type.isExact()) {
 123                 tool.replaceWithValue(ConstantNode.forConstant(stamp(NodeView.DEFAULT), tool.getConstantReflection().asObjectHub(type.getType()), tool.getMetaAccess(), graph()));
 124             }
 125         }
 126     }
 127 }
< prev index next >