comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/WriteNode.java @ 21522:28cbfacd0518

Merge
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Thu, 28 May 2015 17:44:05 +0200
parents graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java@8fc336a04d77 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java@cba35d171cd1
children 47bebae7454f
comparison
equal deleted inserted replaced
21521:107300758a4e 21522:28cbfacd0518
1 /*
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package com.oracle.graal.nodes.memory;
24
25 import com.oracle.graal.api.meta.*;
26 import com.oracle.graal.compiler.common.*;
27 import com.oracle.graal.graph.*;
28 import com.oracle.graal.graph.spi.*;
29 import com.oracle.graal.nodeinfo.*;
30 import com.oracle.graal.nodes.*;
31 import com.oracle.graal.nodes.extended.*;
32 import com.oracle.graal.nodes.extended.LocationNode.Location;
33 import com.oracle.graal.nodes.spi.*;
34
35 /**
36 * Writes a given {@linkplain #value() value} a {@linkplain FixedAccessNode memory location}.
37 */
38 @NodeInfo
39 public final class WriteNode extends AbstractWriteNode implements LIRLowerable, Simplifiable, Virtualizable {
40
41 public static final NodeClass<WriteNode> TYPE = NodeClass.create(WriteNode.class);
42
43 public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType) {
44 super(TYPE, object, value, location, barrierType);
45 }
46
47 public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean initialization) {
48 super(TYPE, object, value, location, barrierType, initialization);
49 }
50
51 public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, GuardingNode guard, boolean initialization) {
52 super(TYPE, object, value, location, barrierType, guard, initialization);
53 }
54
55 @Override
56 public void generate(NodeLIRBuilderTool gen) {
57 Value address = location().generateAddress(gen, gen.getLIRGeneratorTool(), gen.operand(object()));
58 LIRKind writeKind = gen.getLIRGeneratorTool().getLIRKind(value().stamp());
59 gen.getLIRGeneratorTool().emitStore(writeKind, address, gen.operand(value()), gen.state(this));
60 }
61
62 @Override
63 public void simplify(SimplifierTool tool) {
64 if (object() instanceof PiNode && ((PiNode) object()).getGuard() == getGuard()) {
65 setObject(((PiNode) object()).getOriginalNode());
66 }
67 }
68
69 @NodeIntrinsic
70 public static native void writeMemory(Object object, Object value, Location location, @ConstantNodeParameter BarrierType barrierType);
71
72 @Override
73 public void virtualize(VirtualizerTool tool) {
74 throw GraalInternalError.shouldNotReachHere("unexpected WriteNode before PEA");
75 }
76
77 public boolean canNullCheck() {
78 return true;
79 }
80 }