# HG changeset patch # User Christos Kotselidis # Date 1370336113 -7200 # Node ID 6e0c6526334bc675143e2744436c1b382841de1b # Parent 5aedcaed6ccf47d23a870ac7aa27b4b4f7148363 Add HeapInfo interface for write barriers and compressed oops support diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/WriteBarrierAdditionTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/WriteBarrierAdditionTest.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/WriteBarrierAdditionTest.java Tue Jun 04 10:55:13 2013 +0200 @@ -27,10 +27,10 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.debug.*; import com.oracle.graal.hotspot.phases.*; +import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType; -import com.oracle.graal.nodes.spi.Lowerable.*; +import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Jun 04 10:55:13 2013 +0200 @@ -76,9 +76,9 @@ import com.oracle.graal.hotspot.stubs.*; import com.oracle.graal.java.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; import com.oracle.graal.nodes.spi.*; @@ -476,7 +476,8 @@ if (n instanceof ArrayLengthNode) { ArrayLengthNode arrayLengthNode = (ArrayLengthNode) n; ValueNode array = arrayLengthNode.array(); - ReadNode arrayLengthRead = graph.add(new ReadNode(array, ConstantLocationNode.create(FINAL_LOCATION, Kind.Int, config.arrayLengthOffset, graph), StampFactory.positiveInt())); + ReadNode arrayLengthRead = graph.add(new ReadNode(array, ConstantLocationNode.create(FINAL_LOCATION, Kind.Int, config.arrayLengthOffset, graph), StampFactory.positiveInt(), + WriteBarrierType.NONE, false)); tool.createNullCheckGuard(arrayLengthRead, array); graph.replaceFixedWithFixed(arrayLengthNode, arrayLengthRead); } else if (n instanceof Invoke) { @@ -504,7 +505,7 @@ // compiled code entry as HotSpot does not guarantee they are final // values. ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, ConstantLocationNode.create(ANY_LOCATION, wordKind, config.methodCompiledEntryOffset, graph), - StampFactory.forKind(wordKind()))); + StampFactory.forKind(wordKind()), WriteBarrierType.NONE, false)); loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall)); @@ -527,7 +528,7 @@ HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) loadField.field(); ValueNode object = loadField.isStatic() ? ConstantNode.forObject(field.getDeclaringClass().mirror(), this, graph) : loadField.object(); assert loadField.kind() != Kind.Illegal; - ReadNode memoryRead = graph.add(new ReadNode(object, createFieldLocation(graph, field), loadField.stamp())); + ReadNode memoryRead = graph.add(new ReadNode(object, createFieldLocation(graph, field), loadField.stamp(), WriteBarrierType.NONE, false)); tool.createNullCheckGuard(memoryRead, object); graph.replaceFixedWithFixed(loadField, memoryRead); @@ -543,7 +544,7 @@ HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) storeField.field(); ValueNode object = storeField.isStatic() ? ConstantNode.forObject(field.getDeclaringClass().mirror(), this, graph) : storeField.object(); WriteBarrierType barrierType = getFieldStoreBarrierType(storeField); - WriteNode memoryWrite = graph.add(new WriteNode(object, storeField.value(), createFieldLocation(graph, field), barrierType)); + WriteNode memoryWrite = graph.add(new WriteNode(object, storeField.value(), createFieldLocation(graph, field), barrierType, false)); tool.createNullCheckGuard(memoryWrite, object); memoryWrite.setStateAfter(storeField.stateAfter()); graph.replaceFixedWithFixed(storeField, memoryWrite); @@ -567,7 +568,7 @@ GuardingNode boundsCheck = createBoundsCheck(loadIndexed, tool); Kind elementKind = loadIndexed.elementKind(); LocationNode arrayLocation = createArrayLocation(graph, elementKind, loadIndexed.index()); - ReadNode memoryRead = graph.add(new ReadNode(loadIndexed.array(), arrayLocation, loadIndexed.stamp())); + ReadNode memoryRead = graph.add(new ReadNode(loadIndexed.array(), arrayLocation, loadIndexed.stamp(), WriteBarrierType.NONE, false)); memoryRead.setGuard(boundsCheck); graph.replaceFixedWithFixed(loadIndexed, memoryRead); } else if (n instanceof StoreIndexedNode) { @@ -598,7 +599,7 @@ } } WriteBarrierType barrierType = getArrayStoreBarrierType(storeIndexed); - WriteNode memoryWrite = graph.add(new WriteNode(array, value, arrayLocation, barrierType)); + WriteNode memoryWrite = graph.add(new WriteNode(array, value, arrayLocation, barrierType, false)); memoryWrite.setGuard(boundsCheck); memoryWrite.setStateAfter(storeIndexed.stateAfter()); graph.replaceFixedWithFixed(storeIndexed, memoryWrite); @@ -607,7 +608,7 @@ UnsafeLoadNode load = (UnsafeLoadNode) n; assert load.kind() != Kind.Illegal; IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, 1); - ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp())); + ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp(), WriteBarrierType.NONE, false)); // An unsafe read must not floating outside its block as may float above an explicit // null check on its object. memoryRead.setGuard(AbstractBeginNode.prevBegin(load)); @@ -617,7 +618,7 @@ IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, store.accessKind(), store.displacement(), store.offset(), graph, 1); ValueNode object = store.object(); WriteBarrierType barrierType = getUnsafeStoreBarrierType(store); - WriteNode write = graph.add(new WriteNode(object, store.value(), location, barrierType)); + WriteNode write = graph.add(new WriteNode(object, store.value(), location, barrierType, false)); write.setStateAfter(store.stateAfter()); graph.replaceFixedWithFixed(store, write); } else if (n instanceof LoadHubNode) { @@ -667,7 +668,8 @@ value = allocations[commit.getVirtualObjects().indexOf(value)]; } if (!(value.isConstant() && value.asConstant().isDefaultForKind())) { - graph.addBeforeFixed(commit, graph.add(new WriteNode(newObject, value, createFieldLocation(graph, (HotSpotResolvedJavaField) instance.field(i)), WriteBarrierType.NONE))); + graph.addBeforeFixed(commit, + graph.add(new WriteNode(newObject, value, createFieldLocation(graph, (HotSpotResolvedJavaField) instance.field(i)), WriteBarrierType.NONE, false))); } } } else { @@ -682,7 +684,7 @@ } if (!(value.isConstant() && value.asConstant().isDefaultForKind())) { graph.addBeforeFixed(commit, - graph.add(new WriteNode(newObject, value, createArrayLocation(graph, element.getKind(), ConstantNode.forInt(i, graph)), WriteBarrierType.NONE))); + graph.add(new WriteNode(newObject, value, createArrayLocation(graph, element.getKind(), ConstantNode.forInt(i, graph)), WriteBarrierType.NONE, false))); } } } @@ -776,14 +778,15 @@ assert vtableEntryOffset > 0; // We use LocationNode.ANY_LOCATION for the reads that access the vtable // entry as HotSpot does not guarantee that this is a final value. - ReadNode metaspaceMethod = graph.add(new ReadNode(hub, ConstantLocationNode.create(ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind()))); + ReadNode metaspaceMethod = graph.add(new ReadNode(hub, ConstantLocationNode.create(ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind()), WriteBarrierType.NONE, + false)); return metaspaceMethod; } private ReadNode createReadHub(LoweringTool tool, StructuredGraph graph, Kind wordKind, ValueNode object) { LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.hubOffset, graph); assert !object.isConstant() || object.asConstant().isNull(); - ReadNode hub = graph.add(new ReadNode(object, location, StampFactory.forKind(wordKind()))); + ReadNode hub = graph.add(new ReadNode(object, location, StampFactory.forKind(wordKind()), WriteBarrierType.NONE, false)); tool.createNullCheckGuard(hub, object); return hub; } diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Tue Jun 04 10:55:13 2013 +0200 @@ -23,8 +23,8 @@ package com.oracle.graal.hotspot.phases; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Tue Jun 04 10:55:13 2013 +0200 @@ -27,8 +27,8 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/HeapAccess.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/HeapAccess.java Tue Jun 04 10:55:13 2013 +0200 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.nodes; + +/** + * A HeapAccess is a node that access the heap and therefore may be subjected to certain rules of + * the underlying runtime. + */ +public interface HeapAccess { + + /* + * The types of write barriers attached to stores. + */ + public enum WriteBarrierType { + /* + * Primitive stores which do not necessitate write barriers. + */ + NONE, + /* + * Array object stores which necessitate precise write barriers. + */ + PRECISE, + /* + * Field object stores which necessitate imprecise write barriers. + */ + IMPRECISE + } + + /** + * Gets the write barrier type for that particular access. + */ + WriteBarrierType getWriteBarrierType(); + + /** + * Returns whether or not the heap access is a compressed pointer candidate. + */ + boolean compress(); +} \ No newline at end of file diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/Access.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/Access.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/Access.java Tue Jun 04 10:55:13 2013 +0200 @@ -24,7 +24,7 @@ import com.oracle.graal.nodes.*; -public interface Access extends DeoptimizingNode, GuardedNode { +public interface Access extends DeoptimizingNode, GuardedNode, HeapAccess { ValueNode object(); diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java Tue Jun 04 10:55:13 2013 +0200 @@ -37,6 +37,8 @@ @Input private ValueNode object; @Input private ValueNode location; private boolean nullCheck; + private WriteBarrierType barrierType; + private boolean compress; public ValueNode object() { return object; @@ -59,14 +61,20 @@ } public AccessNode(ValueNode object, ValueNode location, Stamp stamp) { - this(object, location, stamp, null); + this(object, location, stamp, null, WriteBarrierType.NONE, false); } - public AccessNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard) { + public AccessNode(ValueNode object, ValueNode location, Stamp stamp, WriteBarrierType barrierType, boolean compress) { + this(object, location, stamp, null, barrierType, compress); + } + + public AccessNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, WriteBarrierType barrierType, boolean compress) { super(stamp); this.object = object; this.location = location; this.guard = guard; + this.barrierType = barrierType; + this.compress = compress; } @Override @@ -94,4 +102,14 @@ updateUsages(this.guard == null ? null : this.guard.asNode(), guard == null ? null : guard.asNode()); this.guard = guard; } + + @Override + public WriteBarrierType getWriteBarrierType() { + return barrierType; + } + + @Override + public boolean compress() { + return compress; + } } diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatableAccessNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatableAccessNode.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatableAccessNode.java Tue Jun 04 10:55:13 2013 +0200 @@ -34,8 +34,12 @@ super(object, location, stamp); } - public FloatableAccessNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard) { - super(object, location, stamp, guard); + public FloatableAccessNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, WriteBarrierType barrierType, boolean compress) { + super(object, location, stamp, guard, barrierType, compress); + } + + public FloatableAccessNode(ValueNode object, ValueNode location, Stamp stamp, WriteBarrierType barrierType, boolean compress) { + super(object, location, stamp, barrierType, compress); } public abstract FloatingAccessNode asFloatingNode(ValueNode lastLocationAccess); diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Tue Jun 04 10:55:13 2013 +0200 @@ -32,6 +32,8 @@ @Input private LocationNode location; @Input private FrameState deoptState; private boolean nullCheck; + private WriteBarrierType barrierType; + private boolean compress; public ValueNode object() { return object; @@ -59,10 +61,12 @@ this.location = location; } - public FloatingAccessNode(ValueNode object, LocationNode location, Stamp stamp, GuardingNode guard) { + public FloatingAccessNode(ValueNode object, LocationNode location, Stamp stamp, GuardingNode guard, WriteBarrierType barrierType, boolean compress) { super(stamp, guard); this.object = object; this.location = location; + this.barrierType = barrierType; + this.compress = compress; } @Override @@ -91,5 +95,15 @@ deoptState = f; } + @Override + public WriteBarrierType getWriteBarrierType() { + return barrierType; + } + + @Override + public boolean compress() { + return compress; + } + public abstract Access asFixedNode(); } diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Tue Jun 04 10:55:13 2013 +0200 @@ -37,11 +37,11 @@ @Input private Node lastLocationAccess; public FloatingReadNode(ValueNode object, LocationNode location, Node lastLocationAccess, Stamp stamp) { - this(object, location, lastLocationAccess, stamp, null); + this(object, location, lastLocationAccess, stamp, null, WriteBarrierType.NONE, false); } - public FloatingReadNode(ValueNode object, LocationNode location, Node lastLocationAccess, Stamp stamp, GuardingNode guard) { - super(object, location, stamp, guard); + public FloatingReadNode(ValueNode object, LocationNode location, Node lastLocationAccess, Stamp stamp, GuardingNode guard, WriteBarrierType barrierType, boolean compress) { + super(object, location, stamp, guard, barrierType, compress); this.lastLocationAccess = lastLocationAccess; } @@ -62,6 +62,6 @@ @Override public Access asFixedNode() { - return graph().add(new ReadNode(object(), nullCheckLocation(), stamp(), getGuard())); + return graph().add(new ReadNode(object(), nullCheckLocation(), stamp(), getGuard(), getWriteBarrierType(), compress())); } } diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Tue Jun 04 10:55:13 2013 +0200 @@ -33,12 +33,12 @@ */ public final class ReadNode extends FloatableAccessNode implements Node.IterableNodeType, LIRLowerable, Canonicalizable, PiPushable { - public ReadNode(ValueNode object, ValueNode location, Stamp stamp) { - super(object, location, stamp); + public ReadNode(ValueNode object, ValueNode location, Stamp stamp, WriteBarrierType barrierType, boolean compress) { + super(object, location, stamp, barrierType, compress); } - public ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard) { - super(object, location, stamp, guard); + public ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, WriteBarrierType barrierType, boolean compress) { + super(object, location, stamp, guard, barrierType, compress); } private ReadNode(ValueNode object, int displacement, LocationIdentity locationIdentity, Kind kind) { @@ -50,7 +50,7 @@ * Used by node intrinsics. Since the initial value for location is a parameter, i.e., a * LocalNode, the constructor cannot use the declared type LocationNode. */ - super(object, location, StampFactory.forNodeIntrinsic(), guard); + super(object, location, StampFactory.forNodeIntrinsic(), guard, WriteBarrierType.NONE, false); } @Override @@ -66,7 +66,7 @@ @Override public FloatingAccessNode asFloatingNode(ValueNode lastLocationAccess) { - return graph().unique(new FloatingReadNode(object(), location(), lastLocationAccess, stamp(), getGuard())); + return graph().unique(new FloatingReadNode(object(), location(), lastLocationAccess, stamp(), getGuard(), getWriteBarrierType(), compress())); } public static ValueNode canonicalizeRead(ValueNode read, LocationNode location, ValueNode object, CanonicalizerTool tool) { diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Tue Jun 04 10:55:13 2013 +0200 @@ -38,24 +38,6 @@ @Input(notDataflow = true) private FrameState stateAfter; private final WriteBarrierType barrierType; - /* - * The types of write barriers attached to stores. - */ - public enum WriteBarrierType { - /* - * Primitive stores which do not necessitate write barriers. - */ - NONE, - /* - * Array object stores which necessitate precise write barriers. - */ - PRECISE, - /* - * Field object stores which necessitate imprecise write barriers. - */ - IMPRECISE - } - public FrameState stateAfter() { return stateAfter; } @@ -74,12 +56,8 @@ return value; } - public WriteBarrierType getWriteBarrierType() { - return barrierType; - } - - public WriteNode(ValueNode object, ValueNode value, ValueNode location, WriteBarrierType barrierType) { - super(object, location, StampFactory.forVoid()); + public WriteNode(ValueNode object, ValueNode value, ValueNode location, WriteBarrierType barrierType, boolean compress) { + super(object, location, StampFactory.forVoid(), barrierType, compress); this.value = value; this.barrierType = barrierType; } @@ -91,7 +69,7 @@ } @NodeIntrinsic - public static native void writeMemory(Object object, Object value, Location location, @ConstantNodeParameter WriteBarrierType barrierType); + public static native void writeMemory(Object object, Object value, Location location, @ConstantNodeParameter WriteBarrierType barrierType, @ConstantNodeParameter boolean compress); @Override public LocationIdentity[] getLocationIdentities() { diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Tue Jun 04 10:55:13 2013 +0200 @@ -29,7 +29,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -37,7 +36,7 @@ * Represents an atomic compare-and-swap operation The result is a boolean that contains whether the * value matched the expected value. */ -public class CompareAndSwapNode extends AbstractStateSplit implements StateSplit, LIRLowerable, Lowerable, MemoryCheckpoint, Node.IterableNodeType { +public class CompareAndSwapNode extends AbstractStateSplit implements StateSplit, LIRLowerable, Lowerable, MemoryCheckpoint, Node.IterableNodeType, HeapAccess { @Input private ValueNode object; @Input private ValueNode offset; @@ -46,6 +45,7 @@ @Input private LocationNode location; private final int displacement; private WriteBarrierType barrierType; + private boolean compress; public ValueNode object() { return object; @@ -76,6 +76,7 @@ this.location = location; } + @Override public WriteBarrierType getWriteBarrierType() { return barrierType; } @@ -84,6 +85,15 @@ this.barrierType = type; } + @Override + public boolean compress() { + return compress; + } + + public void setCompress() { + this.compress = true; + } + public CompareAndSwapNode(ValueNode object, int displacement, ValueNode offset, ValueNode expected, ValueNode newValue) { super(StampFactory.forKind(Kind.Boolean.getStackKind())); assert expected.kind() == newValue.kind(); @@ -93,6 +103,7 @@ this.newValue = newValue; this.displacement = displacement; this.barrierType = WriteBarrierType.NONE; + this.compress = false; } @Override diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Tue Jun 04 10:55:13 2013 +0200 @@ -25,8 +25,8 @@ import static com.oracle.graal.api.meta.LocationIdentity.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.word.*; @@ -65,7 +65,7 @@ @Override public void lower(LoweringTool tool, LoweringType loweringType) { IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, value.kind(), displacement, offset, graph(), 1); - WriteNode write = graph().add(new WriteNode(object, value, location, WriteBarrierType.NONE)); + WriteNode write = graph().add(new WriteNode(object, value, location, WriteBarrierType.NONE, false)); graph().replaceFixedWithFixed(this, write); } } diff -r 5aedcaed6ccf -r 6e0c6526334b graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Sun May 26 18:16:28 2013 -0400 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Tue Jun 04 10:55:13 2013 +0200 @@ -29,9 +29,9 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.extended.WriteNode.WriteBarrierType; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; @@ -310,7 +310,7 @@ } private static ValueNode readOp(StructuredGraph graph, ValueNode base, Invoke invoke, LocationNode location) { - ReadNode read = graph.add(new ReadNode(base, location, invoke.asNode().stamp())); + ReadNode read = graph.add(new ReadNode(base, location, invoke.asNode().stamp(), WriteBarrierType.NONE, false)); graph.addBeforeFixed(invoke.asNode(), read); // The read must not float outside its block otherwise it may float above an explicit zero // check on its base address @@ -319,7 +319,7 @@ } private static ValueNode writeOp(StructuredGraph graph, ValueNode base, ValueNode value, Invoke invoke, LocationNode location) { - WriteNode write = graph.add(new WriteNode(base, value, location, WriteBarrierType.NONE)); + WriteNode write = graph.add(new WriteNode(base, value, location, WriteBarrierType.NONE, false)); write.setStateAfter(invoke.stateAfter()); graph.addBeforeFixed(invoke.asNode(), write); return write;