Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java @ 10089:97e8cabe9064
fix canonicalization of UnsafeStoreNode: preserve stateAfter
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Wed, 19 Jun 2013 15:29:37 +0200 |
parents | b4f12c603be5 |
children | ae6f0c381087 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
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 |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
25 import static com.oracle.graal.api.meta.LocationIdentity.*; |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
26 import static com.oracle.graal.graph.UnsafeAccess.*; |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
27 |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5504
diff
changeset
|
28 import com.oracle.graal.api.meta.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
29 import com.oracle.graal.nodes.*; |
7091
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
30 import com.oracle.graal.nodes.java.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
31 import com.oracle.graal.nodes.spi.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 import com.oracle.graal.nodes.type.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
35 * Store of a value at 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
|
36 * performed before the store. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 */ |
7900
30d754a0e87c
let UnsafeStoreNode implement MemoryCheckpoint
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
38 public class UnsafeStoreNode extends UnsafeAccessNode implements StateSplit, Lowerable, Virtualizable, Canonicalizable, MemoryCheckpoint { |
7090
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
39 |
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
40 @Input private ValueNode value; |
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
41 @Input(notDataflow = true) private FrameState stateAfter; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 |
7090
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
43 public UnsafeStoreNode(ValueNode object, int displacement, ValueNode offset, ValueNode value, Kind accessKind) { |
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
44 this(StampFactory.forVoid(), object, displacement, offset, value, accessKind); |
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
45 } |
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
46 |
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
47 public UnsafeStoreNode(Stamp stamp, ValueNode object, int displacement, ValueNode offset, ValueNode value, Kind accessKind) { |
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
48 super(stamp, object, displacement, offset, accessKind); |
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
49 assert accessKind != Kind.Void && accessKind != Kind.Illegal; |
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
50 this.value = value; |
05ce1defa4f9
Common out some parts of UnsafeLoad/Store in UnsafeAccess
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7049
diff
changeset
|
51 } |
5375
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
52 |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
53 public FrameState stateAfter() { |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
54 return stateAfter; |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
55 } |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
56 |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
57 public void setStateAfter(FrameState x) { |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
58 assert x == null || x.isAlive() : "frame state must be in a graph"; |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
59 updateUsages(stateAfter, x); |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
60 stateAfter = x; |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
61 } |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
62 |
6534
feb579677b58
SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6521
diff
changeset
|
63 public boolean hasSideEffect() { |
5375
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
64 return true; |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
65 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 public ValueNode value() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 return value; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
5705
f96e7b39e9fe
Be more strict on isInt check in CAS lowering when index is constant
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5540
diff
changeset
|
71 @Override |
9251
435bb9425124
added enum to Lowerable interface (before/after guard lowering)
Lukas Stadler <lukas.stadler@jku.at>
parents:
8481
diff
changeset
|
72 public void lower(LoweringTool tool, LoweringType loweringType) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 tool.getRuntime().lower(this, tool); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
76 @Override |
9526
ae5cd887e67c
Use a LocationIdentity interface instead of just Object for the location identity of a LocationNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9251
diff
changeset
|
77 public LocationIdentity[] getLocationIdentities() { |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
78 return new LocationIdentity[]{ANY_LOCATION}; |
7900
30d754a0e87c
let UnsafeStoreNode implement MemoryCheckpoint
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
79 } |
30d754a0e87c
let UnsafeStoreNode implement MemoryCheckpoint
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
80 |
30d754a0e87c
let UnsafeStoreNode implement MemoryCheckpoint
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
81 @Override |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
82 public void virtualize(VirtualizerTool tool) { |
7394
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
7091
diff
changeset
|
83 State state = tool.getObjectState(object()); |
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
7091
diff
changeset
|
84 if (state != null && state.getState() == EscapeState.Virtual) { |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
85 ValueNode indexValue = tool.getReplacedValue(offset()); |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
86 if (indexValue.isConstant()) { |
7394
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
7091
diff
changeset
|
87 long offset = indexValue.asConstant().asLong() + displacement(); |
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
7091
diff
changeset
|
88 int entryIndex = state.getVirtualObject().entryIndexForOffset(offset); |
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
7091
diff
changeset
|
89 if (entryIndex != -1 && state.getVirtualObject().entryKind(entryIndex) == accessKind()) { |
94f032472c28
changed PEA interface:
Lukas Stadler <lukas.stadler@jku.at>
parents:
7091
diff
changeset
|
90 tool.setVirtualEntry(state, entryIndex, value()); |
7049
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
91 tool.delete(); |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
92 } |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
93 } |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
94 } |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
95 } |
ccade022ec83
virtualization of unsafeload and unsafestore
Lukas Stadler <lukas.stadler@jku.at>
parents:
6716
diff
changeset
|
96 |
7091
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
97 @Override |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
98 public ValueNode canonical(CanonicalizerTool tool) { |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
99 if (offset().isConstant()) { |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
100 long constantOffset = offset().asConstant().asLong(); |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
101 if (constantOffset != 0) { |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
102 int intDisplacement = (int) (constantOffset + displacement()); |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
103 if (constantOffset == intDisplacement) { |
10089
97e8cabe9064
fix canonicalization of UnsafeStoreNode: preserve stateAfter
Andreas Woess <andreas.woess@jku.at>
parents:
9793
diff
changeset
|
104 UnsafeStoreNode unsafeStoreNode = graph().add(new UnsafeStoreNode(stamp(), object(), intDisplacement, ConstantNode.forInt(0, graph()), value(), accessKind())); |
97e8cabe9064
fix canonicalization of UnsafeStoreNode: preserve stateAfter
Andreas Woess <andreas.woess@jku.at>
parents:
9793
diff
changeset
|
105 unsafeStoreNode.setStateAfter(stateAfter()); |
97e8cabe9064
fix canonicalization of UnsafeStoreNode: preserve stateAfter
Andreas Woess <andreas.woess@jku.at>
parents:
9793
diff
changeset
|
106 return unsafeStoreNode; |
7091
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
107 } |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
108 } else if (object().stamp() instanceof ObjectStamp) { // TODO (gd) remove that once |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
109 // UnsafeAccess only have an |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
110 // object base |
7091
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
111 ObjectStamp receiverStamp = object().objectStamp(); |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
112 if (receiverStamp.nonNull()) { |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
113 ResolvedJavaType receiverType = receiverStamp.type(); |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
114 ResolvedJavaField field = receiverType.findInstanceFieldWithOffset(displacement()); |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
115 if (field != null) { |
10089
97e8cabe9064
fix canonicalization of UnsafeStoreNode: preserve stateAfter
Andreas Woess <andreas.woess@jku.at>
parents:
9793
diff
changeset
|
116 StoreFieldNode storeFieldNode = graph().add(new StoreFieldNode(object(), field, value())); |
97e8cabe9064
fix canonicalization of UnsafeStoreNode: preserve stateAfter
Andreas Woess <andreas.woess@jku.at>
parents:
9793
diff
changeset
|
117 storeFieldNode.setStateAfter(stateAfter()); |
97e8cabe9064
fix canonicalization of UnsafeStoreNode: preserve stateAfter
Andreas Woess <andreas.woess@jku.at>
parents:
9793
diff
changeset
|
118 return storeFieldNode; |
7091
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
119 } |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
120 } |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
121 } |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
122 } |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
123 return this; |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
124 } |
08fe3a509cf1
Canoncialize UnsafeLoad/Store
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7090
diff
changeset
|
125 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 // specialized on value type until boxing/unboxing is sorted out in intrinsification |
8436
10293cbfc2b6
wrote implementations for node intrinsics so that they can be interpreted when a method substitution is deoptimized and added unit tests to ensure existing method substitutions can run interpreted
Doug Simon <doug.simon@oracle.com>
parents:
8394
diff
changeset
|
127 |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
128 @SuppressWarnings("unused") |
8436
10293cbfc2b6
wrote implementations for node intrinsics so that they can be interpreted when a method substitution is deoptimized and added unit tests to ensure existing method substitutions can run interpreted
Doug Simon <doug.simon@oracle.com>
parents:
8394
diff
changeset
|
129 @NodeIntrinsic |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
130 public static void store(Object object, @ConstantNodeParameter int displacement, long offset, Object value, @ConstantNodeParameter Kind kind) { |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
131 unsafe.putObject(object, offset + displacement, value); |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
132 } |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
133 |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
134 @SuppressWarnings("unused") |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
135 @NodeIntrinsic |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
136 public static void store(Object object, @ConstantNodeParameter int displacement, long offset, boolean value, @ConstantNodeParameter Kind kind) { |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
137 unsafe.putBoolean(object, offset + displacement, value); |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
138 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
139 |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
140 @SuppressWarnings("unused") |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
141 @NodeIntrinsic |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
142 public static void store(Object object, @ConstantNodeParameter int displacement, long offset, byte value, @ConstantNodeParameter Kind kind) { |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
143 unsafe.putByte(object, offset + displacement, value); |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
144 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
146 @SuppressWarnings("unused") |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 @NodeIntrinsic |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
148 public static void store(Object object, @ConstantNodeParameter int displacement, long offset, char value, @ConstantNodeParameter Kind kind) { |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
149 unsafe.putChar(object, offset + displacement, value); |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
150 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
152 @SuppressWarnings("unused") |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
153 @NodeIntrinsic |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
154 public static void store(Object object, @ConstantNodeParameter int displacement, long offset, double value, @ConstantNodeParameter Kind kind) { |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
155 unsafe.putDouble(object, offset + displacement, value); |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
156 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
158 @SuppressWarnings("unused") |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 @NodeIntrinsic |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
160 public static void store(Object object, @ConstantNodeParameter int displacement, long offset, float value, @ConstantNodeParameter Kind kind) { |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
161 unsafe.putFloat(object, offset + displacement, value); |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
162 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
164 @SuppressWarnings("unused") |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 @NodeIntrinsic |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
166 public static void store(Object object, @ConstantNodeParameter int displacement, long offset, int value, @ConstantNodeParameter Kind kind) { |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
167 unsafe.putInt(object, offset + displacement, value); |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
168 } |
5187
9b8c0d1bc2dd
unsafe load/store snippets now require a displacement argument which allows x86 complex addressing modes to be used for tighter encoding of array store/load operations
Doug Simon <doug.simon@oracle.com>
parents:
5061
diff
changeset
|
169 |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
170 @SuppressWarnings("unused") |
8436
10293cbfc2b6
wrote implementations for node intrinsics so that they can be interpreted when a method substitution is deoptimized and added unit tests to ensure existing method substitutions can run interpreted
Doug Simon <doug.simon@oracle.com>
parents:
8394
diff
changeset
|
171 @NodeIntrinsic |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
172 public static void store(Object object, @ConstantNodeParameter int displacement, long offset, long value, @ConstantNodeParameter Kind kind) { |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
173 unsafe.putLong(object, offset + displacement, value); |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
174 } |
8451
2ffd472c5d25
Backed out changeset: 10293cbfc2b6
Doug Simon <doug.simon@oracle.com>
parents:
8436
diff
changeset
|
175 |
8481
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
176 @SuppressWarnings("unused") |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
177 @NodeIntrinsic |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
178 public static void store(Object object, @ConstantNodeParameter int displacement, long offset, short value, @ConstantNodeParameter Kind kind) { |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
179 unsafe.putShort(object, offset + displacement, value); |
92571f3eeeeb
made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
180 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
181 } |