Mercurial > hg > truffle
annotate graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeStoreMacroNode.java @ 19526:8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 20 Feb 2015 22:22:55 +0100 |
parents | 9c4168877444 |
children | 3d0116ec99c5 |
rev | line source |
---|---|
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
16256
6f02ff62c3ef
new constructor (with stateAfter) for UnsafeStoreNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15018
diff
changeset
|
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.truffle.nodes.typesystem; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 import com.oracle.graal.api.meta.*; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 import com.oracle.graal.graph.*; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.graal.graph.spi.*; |
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:
16822
diff
changeset
|
28 import com.oracle.graal.nodeinfo.*; |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.nodes.*; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.nodes.extended.*; |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
31 import com.oracle.graal.replacements.nodes.*; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12445
diff
changeset
|
32 import com.oracle.graal.truffle.nodes.*; |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 /** |
18907
7536b78cd31d
Truffle: remove references to unsafe in comments
Andreas Woess <andreas.woess@jku.at>
parents:
18845
diff
changeset
|
35 * Macro node for method CompilerDirectives#unsafePut*. |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 */ |
16822
5d468add216f
added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16582
diff
changeset
|
37 @NodeInfo |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
38 public final class CustomizedUnsafeStoreMacroNode extends MacroStateSplitNode implements Canonicalizable, StateSplit { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19521
diff
changeset
|
39 public static final NodeClass<CustomizedUnsafeStoreMacroNode> TYPE = NodeClass.create(CustomizedUnsafeStoreMacroNode.class); |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 private static final int ARGUMENT_COUNT = 4; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 private static final int OBJECT_ARGUMENT_INDEX = 0; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 private static final int OFFSET_ARGUMENT_INDEX = 1; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 private static final int VALUE_ARGUMENT_INDEX = 2; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 private static final int LOCATION_ARGUMENT_INDEX = 3; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18487
diff
changeset
|
46 public CustomizedUnsafeStoreMacroNode(Invoke invoke) { |
19521
9c4168877444
Create CompilerAsserts tests. Add graph builder context on bailout. Consolidate CompilerAsserts Truffle API class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
47 super(TYPE, invoke); |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 assert arguments.size() == ARGUMENT_COUNT; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 } |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 @Override |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 public Node canonical(CanonicalizerTool tool) { |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 ValueNode locationArgument = arguments.get(LOCATION_ARGUMENT_INDEX); |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 if (locationArgument.isConstant()) { |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 ValueNode objectArgument = arguments.get(OBJECT_ARGUMENT_INDEX); |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 ValueNode offsetArgument = arguments.get(OFFSET_ARGUMENT_INDEX); |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 ValueNode valueArgument = arguments.get(VALUE_ARGUMENT_INDEX); |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 LocationIdentity locationIdentity; |
18487
0f4813e0b4a9
Use asConstant() instead of asJavaConstant() where possible.
Roland Schatz <roland.schatz@oracle.com>
parents:
18331
diff
changeset
|
59 if (locationArgument.isNullConstant()) { |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 locationIdentity = LocationIdentity.ANY_LOCATION; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 } else { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
17450
diff
changeset
|
62 locationIdentity = ObjectLocationIdentity.create(locationArgument.asJavaConstant()); |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 } |
11927
776e348d6c2e
Propagate state after when creating unsafe store node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11926
diff
changeset
|
64 |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
18487
diff
changeset
|
65 return new UnsafeStoreNode(objectArgument, offsetArgument, valueArgument, this.getTargetMethod().getSignature().getParameterKind(VALUE_ARGUMENT_INDEX), locationIdentity, stateAfter()); |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 } |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 return this; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 } |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 } |