src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GuardProxyNode.java
changeset 58877 aec7bf35d6f5
parent 57537 ecc6e394475f
equal deleted inserted replaced
58876:1a8d65e71a66 58877:aec7bf35d6f5
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
     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.
     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.
    23 
    23 
    24 
    24 
    25 package org.graalvm.compiler.nodes;
    25 package org.graalvm.compiler.nodes;
    26 
    26 
    27 import org.graalvm.compiler.core.common.type.StampFactory;
    27 import org.graalvm.compiler.core.common.type.StampFactory;
    28 import org.graalvm.compiler.graph.Node;
       
    29 import org.graalvm.compiler.graph.NodeClass;
    28 import org.graalvm.compiler.graph.NodeClass;
    30 import org.graalvm.compiler.graph.spi.Canonicalizable;
       
    31 import org.graalvm.compiler.graph.spi.CanonicalizerTool;
       
    32 import org.graalvm.compiler.nodeinfo.InputType;
    29 import org.graalvm.compiler.nodeinfo.InputType;
    33 import org.graalvm.compiler.nodeinfo.NodeInfo;
    30 import org.graalvm.compiler.nodeinfo.NodeInfo;
    34 import org.graalvm.compiler.nodes.extended.GuardingNode;
    31 import org.graalvm.compiler.nodes.extended.GuardingNode;
    35 import org.graalvm.compiler.nodes.spi.LIRLowerable;
       
    36 import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
       
    37 import org.graalvm.compiler.nodes.spi.Proxy;
       
    38 
    32 
    39 @NodeInfo(allowedUsageTypes = {InputType.Guard}, nameTemplate = "Proxy({i#value})")
    33 @NodeInfo(allowedUsageTypes = {InputType.Guard}, nameTemplate = "GuardProxy({i#value})")
    40 public final class GuardProxyNode extends ProxyNode implements GuardingNode, Proxy, LIRLowerable, Canonicalizable {
    34 public final class GuardProxyNode extends ProxyNode implements GuardingNode {
    41 
    35 
    42     public static final NodeClass<GuardProxyNode> TYPE = NodeClass.create(GuardProxyNode.class);
    36     public static final NodeClass<GuardProxyNode> TYPE = NodeClass.create(GuardProxyNode.class);
    43     @OptionalInput(InputType.Guard) GuardingNode value;
    37     @OptionalInput(InputType.Guard) GuardingNode value;
    44 
    38 
    45     public GuardProxyNode(GuardingNode value, LoopExitNode proxyPoint) {
    39     public GuardProxyNode(GuardingNode value, LoopExitNode proxyPoint) {
    46         super(TYPE, StampFactory.forVoid(), proxyPoint);
    40         super(TYPE, StampFactory.forVoid(), proxyPoint);
    47         this.value = value;
    41         this.value = value;
    48     }
       
    49 
       
    50     @Override
       
    51     public void generate(NodeLIRBuilderTool generator) {
       
    52     }
    42     }
    53 
    43 
    54     public void setValue(GuardingNode newValue) {
    44     public void setValue(GuardingNode newValue) {
    55         this.updateUsages(value.asNode(), newValue.asNode());
    45         this.updateUsages(value.asNode(), newValue.asNode());
    56         this.value = newValue;
    46         this.value = newValue;
    63 
    53 
    64     @Override
    54     @Override
    65     public PhiNode createPhi(AbstractMergeNode merge) {
    55     public PhiNode createPhi(AbstractMergeNode merge) {
    66         return graph().addWithoutUnique(new GuardPhiNode(merge));
    56         return graph().addWithoutUnique(new GuardPhiNode(merge));
    67     }
    57     }
    68 
       
    69     @Override
       
    70     public Node getOriginalNode() {
       
    71         return (value == null ? null : value.asNode());
       
    72     }
       
    73 
       
    74     @Override
       
    75     public Node canonical(CanonicalizerTool tool) {
       
    76         if (value == null) {
       
    77             return null;
       
    78         }
       
    79         return this;
       
    80     }
       
    81 }
    58 }