src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/ValueProxyNode.java
equal
deleted
inserted
replaced
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. |
33 import org.graalvm.compiler.nodes.spi.ValueProxy; |
33 import org.graalvm.compiler.nodes.spi.ValueProxy; |
34 import org.graalvm.compiler.nodes.spi.Virtualizable; |
34 import org.graalvm.compiler.nodes.spi.Virtualizable; |
35 import org.graalvm.compiler.nodes.spi.VirtualizerTool; |
35 import org.graalvm.compiler.nodes.spi.VirtualizerTool; |
36 import org.graalvm.compiler.nodes.virtual.VirtualObjectNode; |
36 import org.graalvm.compiler.nodes.virtual.VirtualObjectNode; |
37 |
37 |
38 @NodeInfo(nameTemplate = "Proxy({i#value})") |
38 @NodeInfo(nameTemplate = "ValueProxy({i#value})") |
39 public final class ValueProxyNode extends ProxyNode implements Canonicalizable, Virtualizable, ValueProxy { |
39 public final class ValueProxyNode extends ProxyNode implements Canonicalizable, Virtualizable, ValueProxy { |
40 |
40 |
41 public static final NodeClass<ValueProxyNode> TYPE = NodeClass.create(ValueProxyNode.class); |
41 public static final NodeClass<ValueProxyNode> TYPE = NodeClass.create(ValueProxyNode.class); |
42 @Input ValueNode value; |
42 @Input ValueNode value; |
43 private final boolean loopPhiProxy; |
43 private final boolean loopPhiProxy; |
63 return updateStamp(value.stamp(NodeView.DEFAULT)); |
63 return updateStamp(value.stamp(NodeView.DEFAULT)); |
64 } |
64 } |
65 |
65 |
66 @Override |
66 @Override |
67 public Node canonical(CanonicalizerTool tool) { |
67 public Node canonical(CanonicalizerTool tool) { |
|
68 Node result = super.canonical(tool); |
|
69 if (result != this) { |
|
70 return result; |
|
71 } |
|
72 |
68 ValueNode curValue = value; |
73 ValueNode curValue = value; |
69 if (curValue.isConstant()) { |
74 if (curValue.getNodeClass().isLeafNode()) { |
70 return curValue; |
75 return curValue; |
71 } |
76 } |
72 if (loopPhiProxy && !loopExit.loopBegin().isPhiAtMerge(curValue)) { |
77 if (loopPhiProxy && !loopExit.loopBegin().isPhiAtMerge(curValue)) { |
73 return curValue; |
78 return curValue; |
74 } |
79 } |