Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeStoreMacroNode.java @ 16895:06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 18 Aug 2014 14:04:21 +0200 |
parents | cbd42807a31f |
children | 0fe4732e5181 |
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:
16811
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.*; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12445
diff
changeset
|
31 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
|
32 import com.oracle.graal.truffle.nodes.asserts.*; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 import com.oracle.truffle.api.*; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 /** |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 * Macro node for method {@link CompilerDirectives#unsafeCast(Object, Class, boolean)}. |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 */ |
16811
5d468add216f
added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16582
diff
changeset
|
38 @NodeInfo |
16290
e6622e77e8c7
split MacroNode into MacroNode and MacroStateSplitNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16256
diff
changeset
|
39 public class CustomizedUnsafeStoreMacroNode extends NeverPartOfCompilationNode implements Canonicalizable, StateSplit { |
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 |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
46 public static CustomizedUnsafeStoreMacroNode create(Invoke invoke) { |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
47 return new CustomizedUnsafeStoreMacroNodeGen(invoke); |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
48 } |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
49 |
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
50 protected CustomizedUnsafeStoreMacroNode(Invoke invoke) { |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 super(invoke, "The location argument could not be resolved to a constant."); |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 assert arguments.size() == ARGUMENT_COUNT; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 } |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 @Override |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 public Node canonical(CanonicalizerTool tool) { |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 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
|
58 if (locationArgument.isConstant()) { |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 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
|
60 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
|
61 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
|
62 LocationIdentity locationIdentity; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12445
diff
changeset
|
63 if (locationArgument.asConstant().isNull()) { |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 locationIdentity = LocationIdentity.ANY_LOCATION; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 } else { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12445
diff
changeset
|
66 locationIdentity = ObjectLocationIdentity.create(locationArgument.asConstant()); |
11926
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 } |
11927
776e348d6c2e
Propagate state after when creating unsafe store node.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11926
diff
changeset
|
68 |
16895
06c15e88d383
added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents:
16841
diff
changeset
|
69 return UnsafeStoreNode.create(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
|
70 } |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 return this; |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 } |
e04a86167368
Add support for unsafe access in early read elimination.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 } |