annotate graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectStoreNode.java @ 19410:61d3cb8e1280

Add generic parameter to NodeClass. Change Graph#getNodes(Class) to Graph#getNodes(NodeClass).
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 16 Feb 2015 17:47:43 +0100
parents 7e2c87dae93e
children 8fc336a04d77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5400
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16076
diff changeset
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
5400
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
8415
2361bf148c06 rename packages: *snippets* -> *replacements*
Doug Simon <doug.simon@oracle.com>
parents: 7861
diff changeset
23 package com.oracle.graal.replacements.nodes;
5400
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
15291
471e28b8f03b Move UnsafeAccess to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15261
diff changeset
25 import static com.oracle.graal.compiler.common.UnsafeAccess.*;
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
26
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5506
diff changeset
27 import com.oracle.graal.api.meta.*;
15261
882f4cb7cfcf Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 14950
diff changeset
28 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: 18845
diff changeset
29 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
30 import com.oracle.graal.nodeinfo.*;
5400
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31 import com.oracle.graal.nodes.*;
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32 import com.oracle.graal.nodes.extended.*;
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33 import com.oracle.graal.nodes.spi.*;
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7298
diff changeset
36 * A special purpose store node that differs from {@link UnsafeStoreNode} in that it is not a
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7298
diff changeset
37 * {@link StateSplit} and takes a computed address instead of an object.
5400
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
38 */
16811
5d468add216f added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents: 16094
diff changeset
39 @NodeInfo
19403
7e2c87dae93e Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18845
diff changeset
40 public final class DirectStoreNode extends FixedWithNextNode implements LIRLowerable {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7298
diff changeset
41
19410
61d3cb8e1280 Add generic parameter to NodeClass. Change Graph#getNodes(Class) to Graph#getNodes(NodeClass).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19403
diff changeset
42 public static final NodeClass<DirectStoreNode> TYPE = NodeClass.get(DirectStoreNode.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
43 @Input protected ValueNode address;
f90dcdbbb75e switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents: 16895
diff changeset
44 @Input protected ValueNode value;
17328
c9bb0da795d4 Backed out of changeset 17322:655f3e6b467b
Doug Simon <doug.simon@oracle.com>
parents: 17327
diff changeset
45 protected final Kind kind;
5400
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46
18845
f57d86eb036f removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents: 17450
diff changeset
47 public DirectStoreNode(ValueNode address, ValueNode value, Kind kind) {
19403
7e2c87dae93e Create static final NodeClass field named TYPE in Node subclasses.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18845
diff changeset
48 super(TYPE, StampFactory.forVoid());
5400
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
49 this.address = address;
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
50 this.value = value;
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
51 this.kind = kind;
5400
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
52 }
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
53
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
54 @Override
14950
d5a1206e1923 NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents: 14888
diff changeset
55 public void generate(NodeLIRBuilderTool gen) {
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5510
diff changeset
56 Value v = gen.operand(value);
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16076
diff changeset
57 LIRKind lirKind = gen.getLIRGeneratorTool().target().getLIRKind(kind);
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 16076
diff changeset
58 gen.getLIRGeneratorTool().emitStore(lirKind, gen.operand(address), v, null);
5400
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
59 }
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
60
16076
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 15291
diff changeset
61 protected ValueNode getAddress() {
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 15291
diff changeset
62 return address;
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 15291
diff changeset
63 }
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 15291
diff changeset
64
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 15291
diff changeset
65 protected ValueNode getValue() {
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 15291
diff changeset
66 return value;
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 15291
diff changeset
67 }
06eedda53e14 HSAIL: add support to allocate new TLAB from GPU
Doug Simon <doug.simon@oracle.com>
parents: 15291
diff changeset
68
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
69 /*
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
70 * The kind of the store is provided explicitly in these intrinsics because it is not always
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
71 * possible to determine the kind from the given value during compilation (because stack kinds
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
72 * are used).
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
73 */
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
74
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
75 @SuppressWarnings("unused")
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
76 @NodeIntrinsic
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
77 public static void store(long address, boolean value, @ConstantNodeParameter Kind kind) {
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
78 int b = value ? 1 : 0;
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
79 unsafe.putByte(address, (byte) b);
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
80 }
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
81
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
82 @SuppressWarnings("unused")
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
83 @NodeIntrinsic
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
84 public static void store(long address, byte value, @ConstantNodeParameter Kind kind) {
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
85 unsafe.putByte(address, value);
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
86 }
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: 8416
diff changeset
87
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
88 @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: 8416
diff changeset
89 @NodeIntrinsic
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
90 public static void store(long address, short value, @ConstantNodeParameter Kind kind) {
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
91 unsafe.putShort(address, value);
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
92 }
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
93
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
94 @SuppressWarnings("unused")
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
95 @NodeIntrinsic
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
96 public static void store(long address, char value, @ConstantNodeParameter Kind kind) {
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
97 unsafe.putChar(address, value);
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
98 }
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
99
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
100 @SuppressWarnings("unused")
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
101 @NodeIntrinsic
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
102 public static void store(long address, int value, @ConstantNodeParameter Kind kind) {
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
103 unsafe.putInt(address, value);
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
104 }
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
105
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
106 @SuppressWarnings("unused")
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
107 @NodeIntrinsic
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
108 public static void store(long address, long value, @ConstantNodeParameter Kind kind) {
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
109 unsafe.putLong(address, value);
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
110 }
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
111
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
112 @SuppressWarnings("unused")
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
113 @NodeIntrinsic
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
114 public static void store(long address, float value, @ConstantNodeParameter Kind kind) {
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
115 unsafe.putFloat(address, value);
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
116 }
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
117
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
118 @SuppressWarnings("unused")
7763
ebba355f5605 explicitly specify type in DirectStoreNode.store
Lukas Stadler <lukas.stadler@jku.at>
parents: 7530
diff changeset
119 @NodeIntrinsic
8481
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
120 public static void store(long address, double value, @ConstantNodeParameter Kind kind) {
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
121 unsafe.putDouble(address, value);
92571f3eeeeb made VM independent method substitutions be interpretable
Doug Simon <doug.simon@oracle.com>
parents: 8451
diff changeset
122 }
5400
028c9ce0fc0f added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
123 }