annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java @ 9474:85f83b7b3616

Fix parameter type of NodeIntrinsic
author Christian Wimmer <christian.wimmer@oracle.com>
date Wed, 01 May 2013 09:09:33 -0700
parents 9ee5f3bfa755
children 038fa65cbd8d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
4314
9ce8594bedaf Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4199
diff changeset
2 * Copyright (c) 2011, 2012, 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
9298
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9203
diff changeset
25 import com.oracle.graal.api.meta.*;
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9203
diff changeset
26 import com.oracle.graal.graph.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
27 import com.oracle.graal.nodes.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
28 import com.oracle.graal.nodes.spi.*;
5076
01ffb0fc9aec propagate stamps while lowering
Lukas Stadler <lukas.stadler@jku.at>
parents: 5061
diff changeset
29 import com.oracle.graal.nodes.type.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5443
diff changeset
31 /**
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5443
diff changeset
32 * Writes a given {@linkplain #value() value} a {@linkplain AccessNode memory location}.
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5443
diff changeset
33 */
8935
81ef56feff1b Move write barriers' addition to a separate stage after lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8892
diff changeset
34 public final class WriteNode extends AccessNode implements StateSplit, LIRLowerable, MemoryCheckpoint, Node.IterableNodeType {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6716
diff changeset
35
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36 @Input private ValueNode value;
5375
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
37 @Input(notDataflow = true) private FrameState stateAfter;
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
38 private final WriteBarrierType barrierType;
5375
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
39
8935
81ef56feff1b Move write barriers' addition to a separate stage after lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8892
diff changeset
40 /*
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
41 * The types of write barriers attached to stores.
8935
81ef56feff1b Move write barriers' addition to a separate stage after lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8892
diff changeset
42 */
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
43 public enum WriteBarrierType {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
44 /*
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
45 * Primitive stores which do not necessitate write barriers.
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
46 */
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
47 NONE,
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
48 /*
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
49 * Array object stores which necessitate precise write barriers.
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
50 */
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
51 PRECISE,
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
52 /*
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
53 * Field object stores which necessitate imprecise write barriers.
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
54 */
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
55 IMPRECISE
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
56 }
8935
81ef56feff1b Move write barriers' addition to a separate stage after lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8892
diff changeset
57
5375
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
58 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
59 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
60 }
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 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
63 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
64 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
65 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
66 }
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
67
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
68 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
69 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
70 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72 public ValueNode value() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 return value;
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
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
76 public WriteBarrierType getWriteBarrierType() {
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
77 return barrierType;
8935
81ef56feff1b Move write barriers' addition to a separate stage after lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8892
diff changeset
78 }
81ef56feff1b Move write barriers' addition to a separate stage after lowering
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8892
diff changeset
79
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
80 public WriteNode(ValueNode object, ValueNode value, ValueNode location, WriteBarrierType barrierType) {
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5375
diff changeset
81 super(object, location, StampFactory.forVoid());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82 this.value = value;
9105
2cae919cd3af Introduce enumeration for the different write barrier types
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8935
diff changeset
83 this.barrierType = barrierType;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 public void generate(LIRGeneratorTool gen) {
9298
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9203
diff changeset
88 Value address = location().generateAddress(gen, gen.operand(object()));
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9203
diff changeset
89 gen.emitStore(location().getValueKind(), address, gen.operand(value()), this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 }
6290
01d274503562 canonicalize reads and writes on null objects to deopts
Lukas Stadler <lukas.stadler@jku.at>
parents: 5823
diff changeset
91
6406
33dab7b4b006 Add snippet factory methods
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6290
diff changeset
92 @NodeIntrinsic
9474
85f83b7b3616 Fix parameter type of NodeIntrinsic
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9298
diff changeset
93 public static native void writeMemory(Object object, Object value, Object location, @ConstantNodeParameter WriteBarrierType barrierType);
7864
b66a826acf4b add location identity to MemoryCheckpoint and let WriteNode implement MemoryCheckpoint
Lukas Stadler <lukas.stadler@jku.at>
parents: 7861
diff changeset
94
b66a826acf4b add location identity to MemoryCheckpoint and let WriteNode implement MemoryCheckpoint
Lukas Stadler <lukas.stadler@jku.at>
parents: 7861
diff changeset
95 @Override
8394
7aefc149c471 allow multiple identities in MemoryCheckpoint interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 7864
diff changeset
96 public Object[] getLocationIdentities() {
7aefc149c471 allow multiple identities in MemoryCheckpoint interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 7864
diff changeset
97 return new Object[]{location().locationIdentity()};
7864
b66a826acf4b add location identity to MemoryCheckpoint and let WriteNode implement MemoryCheckpoint
Lukas Stadler <lukas.stadler@jku.at>
parents: 7861
diff changeset
98 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 }