1 /* |
|
2 * Copyright (c) 2013, 2018, 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 |
|
24 |
|
25 package org.graalvm.compiler.hotspot.nodes; |
|
26 |
|
27 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_64; |
|
28 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_64; |
|
29 |
|
30 import org.graalvm.compiler.graph.NodeClass; |
|
31 import org.graalvm.compiler.nodeinfo.NodeInfo; |
|
32 import org.graalvm.compiler.nodes.ValueNode; |
|
33 import org.graalvm.compiler.nodes.memory.address.AddressNode; |
|
34 |
|
35 /** |
|
36 * The {@code G1ReferentFieldReadBarrier} is added when a read access is performed to the referent |
|
37 * field of a {@link java.lang.ref.Reference} object (through a {@code LoadFieldNode} or an |
|
38 * {@code UnsafeLoadNode}). The return value of the read is passed to the snippet implementing the |
|
39 * read barrier and consequently is added to the SATB queue if the concurrent marker is enabled. |
|
40 */ |
|
41 @NodeInfo(cycles = CYCLES_64, size = SIZE_64) |
|
42 public final class G1ReferentFieldReadBarrier extends ObjectWriteBarrier { |
|
43 public static final NodeClass<G1ReferentFieldReadBarrier> TYPE = NodeClass.create(G1ReferentFieldReadBarrier.class); |
|
44 |
|
45 protected final boolean doLoad; |
|
46 |
|
47 public G1ReferentFieldReadBarrier(AddressNode address, ValueNode expectedObject, boolean doLoad) { |
|
48 super(TYPE, address, expectedObject, true); |
|
49 this.doLoad = doLoad; |
|
50 } |
|
51 |
|
52 public ValueNode getExpectedObject() { |
|
53 return getValue(); |
|
54 } |
|
55 |
|
56 public boolean doLoad() { |
|
57 return doLoad; |
|
58 } |
|
59 } |
|