43972
|
1 |
/*
|
|
2 |
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
|
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 |
*/
|
|
23 |
package org.graalvm.compiler.nodes.memory;
|
|
24 |
|
|
25 |
import org.graalvm.compiler.core.common.type.Stamp;
|
46344
|
26 |
import org.graalvm.compiler.graph.IterableNodeType;
|
43972
|
27 |
import org.graalvm.compiler.graph.NodeClass;
|
|
28 |
import org.graalvm.compiler.nodeinfo.InputType;
|
|
29 |
import org.graalvm.compiler.nodeinfo.NodeInfo;
|
|
30 |
import org.graalvm.compiler.nodes.DeoptimizingFixedWithNextNode;
|
|
31 |
import org.graalvm.compiler.nodes.FrameState;
|
|
32 |
import org.graalvm.compiler.nodes.extended.GuardingNode;
|
|
33 |
import org.graalvm.compiler.nodes.memory.address.AddressNode;
|
46551
|
34 |
import org.graalvm.word.LocationIdentity;
|
43972
|
35 |
|
|
36 |
/**
|
|
37 |
* Accesses a value at an memory address specified by an {@linkplain #address address}. The access
|
|
38 |
* does not include a null check on the object.
|
|
39 |
*/
|
|
40 |
@NodeInfo
|
46344
|
41 |
public abstract class FixedAccessNode extends DeoptimizingFixedWithNextNode implements Access, IterableNodeType {
|
43972
|
42 |
public static final NodeClass<FixedAccessNode> TYPE = NodeClass.create(FixedAccessNode.class);
|
|
43 |
|
|
44 |
@OptionalInput(InputType.Guard) protected GuardingNode guard;
|
|
45 |
|
|
46 |
@Input(InputType.Association) AddressNode address;
|
|
47 |
protected final LocationIdentity location;
|
|
48 |
|
|
49 |
protected boolean nullCheck;
|
|
50 |
protected BarrierType barrierType;
|
|
51 |
|
|
52 |
@Override
|
|
53 |
public AddressNode getAddress() {
|
|
54 |
return address;
|
|
55 |
}
|
|
56 |
|
|
57 |
public void setAddress(AddressNode address) {
|
|
58 |
updateUsages(this.address, address);
|
|
59 |
this.address = address;
|
|
60 |
}
|
|
61 |
|
|
62 |
@Override
|
|
63 |
public LocationIdentity getLocationIdentity() {
|
|
64 |
return location;
|
|
65 |
}
|
|
66 |
|
|
67 |
public boolean getNullCheck() {
|
|
68 |
return nullCheck;
|
|
69 |
}
|
|
70 |
|
|
71 |
public void setNullCheck(boolean check) {
|
|
72 |
this.nullCheck = check;
|
|
73 |
}
|
|
74 |
|
|
75 |
protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp) {
|
|
76 |
this(c, address, location, stamp, BarrierType.NONE);
|
|
77 |
}
|
|
78 |
|
|
79 |
protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp, BarrierType barrierType) {
|
|
80 |
this(c, address, location, stamp, null, barrierType, false, null);
|
|
81 |
}
|
|
82 |
|
|
83 |
protected FixedAccessNode(NodeClass<? extends FixedAccessNode> c, AddressNode address, LocationIdentity location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck,
|
|
84 |
FrameState stateBefore) {
|
|
85 |
super(c, stamp, stateBefore);
|
|
86 |
this.address = address;
|
|
87 |
this.location = location;
|
|
88 |
this.guard = guard;
|
|
89 |
this.barrierType = barrierType;
|
|
90 |
this.nullCheck = nullCheck;
|
|
91 |
}
|
|
92 |
|
|
93 |
@Override
|
|
94 |
public boolean canDeoptimize() {
|
|
95 |
return nullCheck;
|
|
96 |
}
|
|
97 |
|
|
98 |
@Override
|
|
99 |
public GuardingNode getGuard() {
|
|
100 |
return guard;
|
|
101 |
}
|
|
102 |
|
|
103 |
@Override
|
|
104 |
public void setGuard(GuardingNode guard) {
|
|
105 |
updateUsagesInterface(this.guard, guard);
|
|
106 |
this.guard = guard;
|
|
107 |
}
|
|
108 |
|
|
109 |
@Override
|
|
110 |
public BarrierType getBarrierType() {
|
|
111 |
return barrierType;
|
|
112 |
}
|
|
113 |
}
|