43972
|
1 |
/*
|
58299
|
2 |
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
43972
|
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 |
*/
|
50858
|
23 |
|
|
24 |
|
43972
|
25 |
package org.graalvm.compiler.nodes.memory;
|
|
26 |
|
46393
|
27 |
import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2;
|
43972
|
28 |
import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_1;
|
|
29 |
|
54328
|
30 |
import org.graalvm.compiler.core.common.type.Stamp;
|
43972
|
31 |
import org.graalvm.compiler.core.common.type.StampFactory;
|
|
32 |
import org.graalvm.compiler.graph.Node;
|
|
33 |
import org.graalvm.compiler.graph.NodeClass;
|
|
34 |
import org.graalvm.compiler.nodeinfo.InputType;
|
|
35 |
import org.graalvm.compiler.nodeinfo.NodeInfo;
|
|
36 |
import org.graalvm.compiler.nodes.FrameState;
|
|
37 |
import org.graalvm.compiler.nodes.StateSplit;
|
|
38 |
import org.graalvm.compiler.nodes.ValueNode;
|
|
39 |
import org.graalvm.compiler.nodes.ValueNodeUtil;
|
|
40 |
import org.graalvm.compiler.nodes.extended.GuardingNode;
|
|
41 |
import org.graalvm.compiler.nodes.memory.address.AddressNode;
|
49873
|
42 |
import jdk.internal.vm.compiler.word.LocationIdentity;
|
43972
|
43 |
|
46393
|
44 |
@NodeInfo(allowedUsageTypes = {InputType.Memory, InputType.Guard}, cycles = CYCLES_2, size = SIZE_1)
|
43972
|
45 |
public abstract class AbstractWriteNode extends FixedAccessNode implements StateSplit, MemoryCheckpoint.Single, MemoryAccess, GuardingNode {
|
|
46 |
|
|
47 |
public static final NodeClass<AbstractWriteNode> TYPE = NodeClass.create(AbstractWriteNode.class);
|
|
48 |
@Input ValueNode value;
|
|
49 |
@OptionalInput(InputType.State) FrameState stateAfter;
|
|
50 |
@OptionalInput(InputType.Memory) Node lastLocationAccess;
|
|
51 |
|
|
52 |
@Override
|
|
53 |
public FrameState stateAfter() {
|
|
54 |
return stateAfter;
|
|
55 |
}
|
|
56 |
|
|
57 |
@Override
|
|
58 |
public void setStateAfter(FrameState x) {
|
|
59 |
assert x == null || x.isAlive() : "frame state must be in a graph";
|
|
60 |
updateUsages(stateAfter, x);
|
|
61 |
stateAfter = x;
|
|
62 |
}
|
|
63 |
|
|
64 |
@Override
|
|
65 |
public boolean hasSideEffect() {
|
|
66 |
return true;
|
|
67 |
}
|
|
68 |
|
|
69 |
public ValueNode value() {
|
|
70 |
return value;
|
|
71 |
}
|
|
72 |
|
|
73 |
protected AbstractWriteNode(NodeClass<? extends AbstractWriteNode> c, AddressNode address, LocationIdentity location, ValueNode value, BarrierType barrierType) {
|
|
74 |
super(c, address, location, StampFactory.forVoid(), barrierType);
|
|
75 |
this.value = value;
|
|
76 |
}
|
|
77 |
|
|
78 |
@Override
|
|
79 |
public boolean isAllowedUsageType(InputType type) {
|
|
80 |
return (type == InputType.Guard && getNullCheck()) ? true : super.isAllowedUsageType(type);
|
|
81 |
}
|
|
82 |
|
|
83 |
@Override
|
|
84 |
public MemoryNode getLastLocationAccess() {
|
|
85 |
return (MemoryNode) lastLocationAccess;
|
|
86 |
}
|
|
87 |
|
|
88 |
@Override
|
|
89 |
public void setLastLocationAccess(MemoryNode lla) {
|
|
90 |
Node newLla = ValueNodeUtil.asNode(lla);
|
|
91 |
updateUsages(lastLocationAccess, newLla);
|
|
92 |
lastLocationAccess = newLla;
|
|
93 |
}
|
54328
|
94 |
|
|
95 |
public abstract Stamp getAccessStamp();
|
43972
|
96 |
}
|