1 /* |
1 /* |
2 * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 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. |
26 |
26 |
27 import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC; |
27 import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC; |
28 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2; |
28 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2; |
29 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1; |
29 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1; |
30 |
30 |
|
31 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.ObjectStamp; |
32 import org.graalvm.compiler.core.common.type.Stamp; |
33 import org.graalvm.compiler.core.common.type.Stamp; |
33 import org.graalvm.compiler.core.common.type.TypeReference; |
34 import org.graalvm.compiler.core.common.type.TypeReference; |
34 import org.graalvm.compiler.graph.NodeClass; |
35 import org.graalvm.compiler.graph.NodeClass; |
35 import org.graalvm.compiler.graph.spi.Canonicalizable; |
36 import org.graalvm.compiler.graph.spi.Canonicalizable; |
60 |
61 |
61 public ValueNode getValue() { |
62 public ValueNode getValue() { |
62 return value; |
63 return value; |
63 } |
64 } |
64 |
65 |
65 private static Stamp hubStamp(StampProvider stampProvider, ValueNode value) { |
66 private static AbstractPointerStamp hubStamp(StampProvider stampProvider, ValueNode value) { |
66 assert value.stamp(NodeView.DEFAULT) instanceof ObjectStamp; |
67 assert value.stamp(NodeView.DEFAULT) instanceof ObjectStamp; |
67 return stampProvider.createHubStamp(((ObjectStamp) value.stamp(NodeView.DEFAULT))); |
68 return stampProvider.createHubStamp(((ObjectStamp) value.stamp(NodeView.DEFAULT))); |
68 } |
69 } |
69 |
70 |
70 public static ValueNode create(ValueNode value, StampProvider stampProvider, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { |
71 public static ValueNode create(ValueNode value, StampProvider stampProvider, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { |
71 Stamp stamp = hubStamp(stampProvider, value); |
72 final AbstractPointerStamp stamp = hubStamp(stampProvider, value); |
|
73 return create(value, stamp, metaAccess, constantReflection); |
|
74 } |
|
75 |
|
76 public static ValueNode create(ValueNode value, AbstractPointerStamp stamp, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) { |
72 ValueNode synonym = findSynonym(value, stamp, metaAccess, constantReflection); |
77 ValueNode synonym = findSynonym(value, stamp, metaAccess, constantReflection); |
73 if (synonym != null) { |
78 if (synonym != null) { |
74 return synonym; |
79 return synonym; |
75 } |
80 } |
76 return new LoadHubNode(stamp, value); |
81 return new LoadHubNode(stamp, value); |