Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java @ 22604:b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 08 Sep 2015 19:57:39 +0200 |
parents | b611fa9fef24 |
children | 05183a084a08 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
19403
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18950
diff
changeset
|
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.nodes.extended; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
22054 | 25 import jdk.internal.jvmci.meta.*; |
26 | |
15261
882f4cb7cfcf
Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15039
diff
changeset
|
27 import com.oracle.graal.compiler.common.type.*; |
19403
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18950
diff
changeset
|
28 import com.oracle.graal.graph.*; |
16841
cbd42807a31f
moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents:
16811
diff
changeset
|
29 import com.oracle.graal.nodeinfo.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
30 import com.oracle.graal.nodes.*; |
7091
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
31 import com.oracle.graal.nodes.java.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 import com.oracle.graal.nodes.spi.*; |
22349
681c04ce9db2
PEA refactoring: simplify VirtualizerTool, arrays instead of HashMaps, route all modifications through BlockState, copy-on-write in BlockState
Lukas Stadler <lukas.stadler@oracle.com>
parents:
22054
diff
changeset
|
33 import com.oracle.graal.nodes.virtual.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
36 * Load of a value from a location specified as an offset relative to an object. No null check is |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
37 * performed before the load. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 */ |
16811
5d468add216f
added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16792
diff
changeset
|
39 @NodeInfo |
19403
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18950
diff
changeset
|
40 public final class UnsafeLoadNode extends UnsafeAccessNode implements Lowerable, Virtualizable { |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19410
diff
changeset
|
41 public static final NodeClass<UnsafeLoadNode> TYPE = NodeClass.create(UnsafeLoadNode.class); |
16897
f90dcdbbb75e
switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents:
16895
diff
changeset
|
42 @OptionalInput(InputType.Condition) LogicNode guardingCondition; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22400
diff
changeset
|
44 public UnsafeLoadNode(ValueNode object, ValueNode offset, JavaKind accessKind, LocationIdentity locationIdentity) { |
12548
e1f40574c309
Unsafe{Load,Store}Node: users must provide an LocationIdentity explicitly. Provide more specific LocationIdentity in UnsafeArraySnippets (instead of ANY_LOCATION)
Bernhard Urban <bernhard.urban@jku.at>
parents:
12445
diff
changeset
|
45 this(object, offset, accessKind, locationIdentity, null); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22400
diff
changeset
|
48 public UnsafeLoadNode(ValueNode object, ValueNode offset, JavaKind accessKind, LocationIdentity locationIdentity, LogicNode condition) { |
19403
7e2c87dae93e
Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18950
diff
changeset
|
49 super(TYPE, StampFactory.forKind(accessKind.getStackKind()), object, offset, accessKind, locationIdentity); |
11943
0fa39f034839
Allow floating unsafe loads.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11923
diff
changeset
|
50 this.guardingCondition = condition; |
0fa39f034839
Allow floating unsafe loads.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11923
diff
changeset
|
51 } |
0fa39f034839
Allow floating unsafe loads.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11923
diff
changeset
|
52 |
0fa39f034839
Allow floating unsafe loads.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11923
diff
changeset
|
53 public LogicNode getGuardingCondition() { |
0fa39f034839
Allow floating unsafe loads.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11923
diff
changeset
|
54 return guardingCondition; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 @Override |
11579
ae619d70bf4b
Rename LoweringType to GuardsPhase and make it an attribute of StructuredGraphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
10647
diff
changeset
|
58 public void lower(LoweringTool tool) { |
12045
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
59 tool.getLowerer().lower(this, tool); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
62 @Override |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
63 public void virtualize(VirtualizerTool tool) { |
22349
681c04ce9db2
PEA refactoring: simplify VirtualizerTool, arrays instead of HashMaps, route all modifications through BlockState, copy-on-write in BlockState
Lukas Stadler <lukas.stadler@oracle.com>
parents:
22054
diff
changeset
|
64 ValueNode alias = tool.getAlias(object()); |
681c04ce9db2
PEA refactoring: simplify VirtualizerTool, arrays instead of HashMaps, route all modifications through BlockState, copy-on-write in BlockState
Lukas Stadler <lukas.stadler@oracle.com>
parents:
22054
diff
changeset
|
65 if (alias instanceof VirtualObjectNode) { |
681c04ce9db2
PEA refactoring: simplify VirtualizerTool, arrays instead of HashMaps, route all modifications through BlockState, copy-on-write in BlockState
Lukas Stadler <lukas.stadler@oracle.com>
parents:
22054
diff
changeset
|
66 VirtualObjectNode virtual = (VirtualObjectNode) alias; |
681c04ce9db2
PEA refactoring: simplify VirtualizerTool, arrays instead of HashMaps, route all modifications through BlockState, copy-on-write in BlockState
Lukas Stadler <lukas.stadler@oracle.com>
parents:
22054
diff
changeset
|
67 ValueNode offsetValue = tool.getAlias(offset()); |
11923
88fb9cba8751
Simplify handling of unsafe store and unsafe load.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11579
diff
changeset
|
68 if (offsetValue.isConstant()) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
69 long off = offsetValue.asJavaConstant().asLong(); |
22349
681c04ce9db2
PEA refactoring: simplify VirtualizerTool, arrays instead of HashMaps, route all modifications through BlockState, copy-on-write in BlockState
Lukas Stadler <lukas.stadler@oracle.com>
parents:
22054
diff
changeset
|
70 int entryIndex = virtual.entryIndexForOffset(off, accessKind()); |
18848
49e5c062e77a
[SPARC] Do not virtualize objects, when the types do not match on big endian machines
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18187
diff
changeset
|
71 |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12045
diff
changeset
|
72 if (entryIndex != -1) { |
22349
681c04ce9db2
PEA refactoring: simplify VirtualizerTool, arrays instead of HashMaps, route all modifications through BlockState, copy-on-write in BlockState
Lukas Stadler <lukas.stadler@oracle.com>
parents:
22054
diff
changeset
|
73 ValueNode entry = tool.getEntry(virtual, entryIndex); |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22400
diff
changeset
|
74 JavaKind entryKind = virtual.entryKind(entryIndex); |
22400
b611fa9fef24
ValueNode.getKind is really getStackKind
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22349
diff
changeset
|
75 if (entry.getStackKind() == getStackKind() || entryKind == accessKind()) { |
12405
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12045
diff
changeset
|
76 tool.replaceWith(entry); |
139b84d713bc
Truffle API adjustments: Simplify frame handling. Introduce cast for MaterializedFrame objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
12045
diff
changeset
|
77 } |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
78 } |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
79 } |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
80 } |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
81 } |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
82 |
7091
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
83 @Override |
10647
2ea604c4c6ec
Factor and improve unsafe load/store canonicalization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10646
diff
changeset
|
84 protected ValueNode cloneAsFieldAccess(ResolvedJavaField field) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
85 return new LoadFieldNode(object(), field); |
10647
2ea604c4c6ec
Factor and improve unsafe load/store canonicalization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10646
diff
changeset
|
86 } |
2ea604c4c6ec
Factor and improve unsafe load/store canonicalization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10646
diff
changeset
|
87 |
15039
631ca3972292
Allow Unsafe operations on Java to use precise LocationIdentity and improve address formation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15001
diff
changeset
|
88 @Override |
631ca3972292
Allow Unsafe operations on Java to use precise LocationIdentity and improve address formation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15001
diff
changeset
|
89 protected ValueNode cloneAsArrayAccess(ValueNode location, LocationIdentity identity) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
90 return new UnsafeLoadNode(object(), location, accessKind(), identity, guardingCondition); |
15039
631ca3972292
Allow Unsafe operations on Java to use precise LocationIdentity and improve address formation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15001
diff
changeset
|
91 } |
631ca3972292
Allow Unsafe operations on Java to use precise LocationIdentity and improve address formation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15001
diff
changeset
|
92 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 @NodeIntrinsic |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22400
diff
changeset
|
94 public static native Object load(Object object, long offset, @ConstantNodeParameter JavaKind kind, @ConstantNodeParameter LocationIdentity locationIdentity); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
95 } |