G1PreWriteBarrier.java revision 12657:6ef01bd40ce2
1119418Sobrien/* 2120477Sscottl * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. 3120477Sscottl * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4120477Sscottl * 589580Smsmith * This code is free software; you can redistribute it and/or modify it 689580Smsmith * under the terms of the GNU General Public License version 2 only, as 789580Smsmith * published by the Free Software Foundation. 889580Smsmith * 989580Smsmith * This code is distributed in the hope that it will be useful, but WITHOUT 1089580Smsmith * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1189580Smsmith * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1289580Smsmith * version 2 for more details (a copy is included in the LICENSE file that 1389580Smsmith * accompanied this code). 1489580Smsmith * 1589580Smsmith * You should have received a copy of the GNU General Public License version 1689580Smsmith * 2 along with this work; if not, write to the Free Software Foundation, 1789580Smsmith * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1889580Smsmith * 1989580Smsmith * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2089580Smsmith * or visit www.oracle.com if you need additional information or have any 2189580Smsmith * questions. 2289580Smsmith */ 2389580Smsmithpackage org.graalvm.compiler.hotspot.nodes; 2489580Smsmith 2589580Smsmithimport static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_50; 2689580Smsmithimport static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_50; 2789580Smsmith 2889580Smsmithimport org.graalvm.compiler.graph.NodeClass; 2989580Smsmithimport org.graalvm.compiler.nodeinfo.InputType; 3089580Smsmithimport org.graalvm.compiler.nodeinfo.NodeInfo; 3189580Smsmithimport org.graalvm.compiler.nodes.DeoptimizingNode; 32119418Sobrienimport org.graalvm.compiler.nodes.FrameState; 33119418Sobrienimport org.graalvm.compiler.nodes.ValueNode; 34119418Sobrienimport org.graalvm.compiler.nodes.memory.address.AddressNode; 3589580Smsmith 3689580Smsmith@NodeInfo(cycles = CYCLES_50, size = SIZE_50) 3789580Smsmithpublic final class G1PreWriteBarrier extends ObjectWriteBarrier implements DeoptimizingNode.DeoptBefore { 3889580Smsmith 39120477Sscottl public static final NodeClass<G1PreWriteBarrier> TYPE = NodeClass.create(G1PreWriteBarrier.class); 4089580Smsmith 4189580Smsmith @OptionalInput(InputType.State) FrameState stateBefore; 4289580Smsmith protected final boolean nullCheck; 4389580Smsmith protected final boolean doLoad; 4489580Smsmith 4589580Smsmith public G1PreWriteBarrier(AddressNode address, ValueNode expectedObject, boolean doLoad, boolean nullCheck) { 4689580Smsmith super(TYPE, address, expectedObject, true); 4789580Smsmith this.doLoad = doLoad; 4889580Smsmith this.nullCheck = nullCheck; 4995533Smike } 5089580Smsmith 51117126Sscottl public ValueNode getExpectedObject() { 52117126Sscottl return getValue(); 5389580Smsmith } 5489580Smsmith 5589580Smsmith public boolean doLoad() { 5689580Smsmith return doLoad; 5789580Smsmith } 5889580Smsmith 5989580Smsmith public boolean getNullCheck() { 60119280Simp return nullCheck; 61119280Simp } 6289580Smsmith 6389580Smsmith @Override 6489580Smsmith public boolean canDeoptimize() { 6589580Smsmith return nullCheck; 6689580Smsmith } 6789580Smsmith 68119690Sjhb @Override 6989580Smsmith public FrameState stateBefore() { 7089580Smsmith return stateBefore; 7189580Smsmith } 7289580Smsmith 7389580Smsmith @Override 7489580Smsmith public void setStateBefore(FrameState state) { 7589580Smsmith updateUsages(stateBefore, state); 7689580Smsmith stateBefore = state; 7789580Smsmith } 7889580Smsmith} 7989580Smsmith