# HG changeset patch # User Christos Kotselidis # Date 1374426940 -7200 # Node ID b05e1ff3aac0760429b0b2faf410f4791a4bed03 # Parent d5a8a7054005060975ec345e89c968f661384865 Rename WriteBarrierType to BarrierType diff -r d5a8a7054005 -r b05e1ff3aac0 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Sun Jul 21 19:15:40 2013 +0200 @@ -35,7 +35,7 @@ import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.phases.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; +import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.phases.*; @@ -240,13 +240,13 @@ Assert.assertTrue(barriers == expectedBarriers); for (WriteNode write : graph.getNodes(WriteNode.class)) { if (useG1GC()) { - if (write.getWriteBarrierType() != WriteBarrierType.NONE) { + if (write.getBarrierType() != BarrierType.NONE) { Assert.assertTrue(write.successors().count() == 1); Assert.assertTrue(write.next() instanceof G1PostWriteBarrier); Assert.assertTrue(write.predecessor() instanceof G1PreWriteBarrier); } } else { - if (write.getWriteBarrierType() != WriteBarrierType.NONE) { + if (write.getBarrierType() != BarrierType.NONE) { Assert.assertTrue(write.successors().count() == 1); Assert.assertTrue(write.next() instanceof SerialWriteBarrier); } @@ -254,14 +254,14 @@ } for (ReadNode read : graph.getNodes(ReadNode.class)) { - if (read.getWriteBarrierType() != WriteBarrierType.NONE) { + if (read.getBarrierType() != BarrierType.NONE) { if (read.location() instanceof ConstantLocationNode) { Assert.assertTrue(((ConstantLocationNode) (read.location())).getDisplacement() == referentOffset()); } else { Assert.assertTrue(((IndexedLocationNode) (read.location())).getDisplacement() == referentOffset()); } Assert.assertTrue(useG1GC()); - Assert.assertTrue(read.getWriteBarrierType() == WriteBarrierType.PRECISE); + Assert.assertTrue(read.getBarrierType() == BarrierType.PRECISE); Assert.assertTrue(read.next() instanceof G1PreWriteBarrier); } } diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sun Jul 21 19:15:40 2013 +0200 @@ -78,7 +78,7 @@ 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.HeapAccess.BarrierType; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; @@ -487,7 +487,7 @@ 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(), - WriteBarrierType.NONE, false)); + BarrierType.NONE, false)); tool.createNullCheckGuard(arrayLengthRead, array); graph.replaceFixedWithFixed(arrayLengthNode, arrayLengthRead); } else if (n instanceof Invoke) { @@ -522,7 +522,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()), WriteBarrierType.NONE, false)); + StampFactory.forKind(wordKind()), BarrierType.NONE, false)); loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall)); @@ -545,7 +545,7 @@ HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) loadField.field(); ValueNode object = loadField.isStatic() ? ConstantNode.forObject(field.getDeclaringClass().mirror(), this, graph) : loadField.object(); assert loadField.kind() != Kind.Illegal; - WriteBarrierType barrierType = getFieldLoadBarrierType(field); + BarrierType barrierType = getFieldLoadBarrierType(field); ReadNode memoryRead = graph.add(new ReadNode(object, createFieldLocation(graph, field), loadField.stamp(), barrierType, (loadField.kind() == Kind.Object))); tool.createNullCheckGuard(memoryRead, object); @@ -561,7 +561,7 @@ StoreFieldNode storeField = (StoreFieldNode) n; HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) storeField.field(); ValueNode object = storeField.isStatic() ? ConstantNode.forObject(field.getDeclaringClass().mirror(), this, graph) : storeField.object(); - WriteBarrierType barrierType = getFieldStoreBarrierType(storeField); + BarrierType barrierType = getFieldStoreBarrierType(storeField); WriteNode memoryWrite = graph.add(new WriteNode(object, storeField.value(), createFieldLocation(graph, field), barrierType, storeField.field().getKind() == Kind.Object)); tool.createNullCheckGuard(memoryWrite, object); memoryWrite.setStateAfter(storeField.stateAfter()); @@ -580,7 +580,7 @@ CompareAndSwapNode cas = (CompareAndSwapNode) n; LocationNode location = IndexedLocationNode.create(ANY_LOCATION, cas.expected().kind(), cas.displacement(), cas.offset(), graph, 1); cas.setLocation(location); - cas.setWriteBarrierType(getCompareAndSwapBarrier(cas)); + cas.setBarrierType(getCompareAndSwapBarrier(cas)); if (cas.expected().kind() == Kind.Object) { cas.setCompressible(); } @@ -589,7 +589,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(), WriteBarrierType.NONE, elementKind == Kind.Object)); + ReadNode memoryRead = graph.add(new ReadNode(loadIndexed.array(), arrayLocation, loadIndexed.stamp(), BarrierType.NONE, elementKind == Kind.Object)); memoryRead.setGuard(boundsCheck); graph.replaceFixedWithFixed(loadIndexed, memoryRead); } else if (n instanceof StoreIndexedNode) { @@ -619,7 +619,7 @@ value = checkcast; } } - WriteBarrierType barrierType = getArrayStoreBarrierType(storeIndexed); + BarrierType barrierType = getArrayStoreBarrierType(storeIndexed); WriteNode memoryWrite = graph.add(new WriteNode(array, value, arrayLocation, barrierType, elementKind == Kind.Object)); memoryWrite.setGuard(boundsCheck); memoryWrite.setStateAfter(storeIndexed.stateAfter()); @@ -633,7 +633,7 @@ unsafeLoadSnippets.lower(load, tool); } else { 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(), WriteBarrierType.NONE, compressible)); + ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp(), BarrierType.NONE, compressible)); // An unsafe read must not float outside its block otherwise // it may float above an explicit null check on its object. memoryRead.setGuard(AbstractBeginNode.prevBegin(load)); @@ -643,7 +643,7 @@ UnsafeStoreNode store = (UnsafeStoreNode) n; IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, store.accessKind(), store.displacement(), store.offset(), graph, 1); ValueNode object = store.object(); - WriteBarrierType barrierType = getUnsafeStoreBarrierType(store); + BarrierType barrierType = getUnsafeStoreBarrierType(store); WriteNode write = graph.add(new WriteNode(object, store.value(), location, barrierType, store.value().kind() == Kind.Object)); write.setStateAfter(store.stateAfter()); graph.replaceFixedWithFixed(store, write); @@ -704,7 +704,7 @@ value = allocations[commit.getVirtualObjects().indexOf(value)]; } if (!(value.isConstant() && value.asConstant().isDefaultForKind())) { - WriteNode write = new WriteNode(newObject, value, createFieldLocation(graph, (HotSpotResolvedJavaField) virtualInstance.field(i)), WriteBarrierType.NONE, + WriteNode write = new WriteNode(newObject, value, createFieldLocation(graph, (HotSpotResolvedJavaField) virtualInstance.field(i)), BarrierType.NONE, virtualInstance.field(i).getKind() == Kind.Object); graph.addBeforeFixed(commit, graph.add(write)); @@ -722,7 +722,7 @@ value = allocations[indexOf]; } if (!(value.isConstant() && value.asConstant().isDefaultForKind())) { - WriteNode write = new WriteNode(newObject, value, createArrayLocation(graph, element.getKind(), ConstantNode.forInt(i, graph)), WriteBarrierType.NONE, + WriteNode write = new WriteNode(newObject, value, createArrayLocation(graph, element.getKind(), ConstantNode.forInt(i, graph)), BarrierType.NONE, value.kind() == Kind.Object); graph.addBeforeFixed(commit, graph.add(write)); } @@ -769,7 +769,7 @@ int size = FrameStateBuilder.stackSlots(osrLocal.kind()); int offset = localsOffset - (osrLocal.index() + size - 1) * 8; IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, osrLocal.kind(), offset, ConstantNode.forLong(0, graph), graph, 1); - ReadNode load = graph.add(new ReadNode(buffer, location, osrLocal.stamp(), WriteBarrierType.NONE, false)); + ReadNode load = graph.add(new ReadNode(buffer, location, osrLocal.stamp(), BarrierType.NONE, false)); osrLocal.replaceAndDelete(load); graph.addBeforeFixed(migrationEnd, load); } @@ -849,7 +849,7 @@ 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()), WriteBarrierType.NONE, + ReadNode metaspaceMethod = graph.add(new ReadNode(hub, ConstantLocationNode.create(ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind()), BarrierType.NONE, false)); return metaspaceMethod; } @@ -857,60 +857,60 @@ private ReadNode createReadHub(StructuredGraph graph, Kind wordKind, ValueNode object) { LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, config.hubOffset, graph); assert !object.isConstant() || object.asConstant().isNull(); - return graph.add(new ReadNode(object, location, StampFactory.forKind(wordKind()), WriteBarrierType.NONE, config.useCompressedKlassPointers)); + return graph.add(new ReadNode(object, location, StampFactory.forKind(wordKind()), BarrierType.NONE, config.useCompressedKlassPointers)); } private WriteNode createWriteHub(StructuredGraph graph, Kind wordKind, ValueNode object, ValueNode value) { LocationNode location = ConstantLocationNode.create(ANY_LOCATION, wordKind, config.hubOffset, graph); assert !object.isConstant() || object.asConstant().isNull(); - return graph.add(new WriteNode(object, value, location, WriteBarrierType.NONE, config.useCompressedKlassPointers)); + return graph.add(new WriteNode(object, value, location, BarrierType.NONE, config.useCompressedKlassPointers)); } - private static WriteBarrierType getFieldLoadBarrierType(HotSpotResolvedJavaField loadField) { - WriteBarrierType barrierType = WriteBarrierType.NONE; + private static BarrierType getFieldLoadBarrierType(HotSpotResolvedJavaField loadField) { + BarrierType barrierType = BarrierType.NONE; if (config().useG1GC && loadField.getKind() == Kind.Object && loadField.getDeclaringClass().mirror() == java.lang.ref.Reference.class && loadField.getName().equals("referent")) { - barrierType = WriteBarrierType.PRECISE; + barrierType = BarrierType.PRECISE; } return barrierType; } - private static WriteBarrierType getFieldStoreBarrierType(StoreFieldNode storeField) { - WriteBarrierType barrierType = WriteBarrierType.NONE; + private static BarrierType getFieldStoreBarrierType(StoreFieldNode storeField) { + BarrierType barrierType = BarrierType.NONE; if (storeField.field().getKind() == Kind.Object && !storeField.value().objectStamp().alwaysNull()) { - barrierType = WriteBarrierType.IMPRECISE; + barrierType = BarrierType.IMPRECISE; } return barrierType; } - private static WriteBarrierType getArrayStoreBarrierType(StoreIndexedNode store) { - WriteBarrierType barrierType = WriteBarrierType.NONE; + private static BarrierType getArrayStoreBarrierType(StoreIndexedNode store) { + BarrierType barrierType = BarrierType.NONE; if (store.elementKind() == Kind.Object && !store.value().objectStamp().alwaysNull()) { - barrierType = WriteBarrierType.PRECISE; + barrierType = BarrierType.PRECISE; } return barrierType; } - private static WriteBarrierType getUnsafeStoreBarrierType(UnsafeStoreNode store) { - WriteBarrierType barrierType = WriteBarrierType.NONE; + private static BarrierType getUnsafeStoreBarrierType(UnsafeStoreNode store) { + BarrierType barrierType = BarrierType.NONE; if (store.value().kind() == Kind.Object && !store.value().objectStamp().alwaysNull()) { ResolvedJavaType type = store.object().objectStamp().type(); if (type != null && type.isArray()) { - barrierType = WriteBarrierType.PRECISE; + barrierType = BarrierType.PRECISE; } else { - barrierType = WriteBarrierType.IMPRECISE; + barrierType = BarrierType.IMPRECISE; } } return barrierType; } - private static WriteBarrierType getCompareAndSwapBarrier(CompareAndSwapNode cas) { - WriteBarrierType barrierType = WriteBarrierType.NONE; + private static BarrierType getCompareAndSwapBarrier(CompareAndSwapNode cas) { + BarrierType barrierType = BarrierType.NONE; if (cas.expected().kind() == Kind.Object && !cas.newValue().objectStamp().alwaysNull()) { ResolvedJavaType type = cas.object().objectStamp().type(); if (type != null && type.isArray()) { - barrierType = WriteBarrierType.PRECISE; + barrierType = BarrierType.PRECISE; } else { - barrierType = WriteBarrierType.IMPRECISE; + barrierType = BarrierType.IMPRECISE; } } return barrierType; diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Sun Jul 21 19:15:40 2013 +0200 @@ -25,7 +25,7 @@ import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; +import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; @@ -54,20 +54,20 @@ } private static void addReadNodeBarriers(ReadNode node, StructuredGraph graph) { - if (node.getWriteBarrierType() == WriteBarrierType.PRECISE) { + if (node.getBarrierType() == BarrierType.PRECISE) { assert useG1GC(); G1PreWriteBarrier barrier = graph.add(new G1PreWriteBarrier(node.object(), node, node.location(), false, node.getNullCheck())); barrier.setDeoptimizationState(node.getDeoptimizationState()); node.setNullCheck(false); graph.addAfterFixed(node, barrier); } else { - assert node.getWriteBarrierType() == WriteBarrierType.NONE : "Non precise write barrier has been attached to read node."; + assert node.getBarrierType() == BarrierType.NONE : "Non precise write barrier has been attached to read node."; } } private static void addWriteNodeBarriers(WriteNode node, StructuredGraph graph) { - WriteBarrierType barrierType = node.getWriteBarrierType(); - if (barrierType == WriteBarrierType.PRECISE) { + BarrierType barrierType = node.getBarrierType(); + if (barrierType == BarrierType.PRECISE) { if (useG1GC()) { if (node.isInitialized()) { G1PreWriteBarrier preBarrier = graph.add(new G1PreWriteBarrier(node.object(), null, node.location(), true, node.getNullCheck())); @@ -79,7 +79,7 @@ } else { graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.location(), true))); } - } else if (barrierType == WriteBarrierType.IMPRECISE) { + } else if (barrierType == BarrierType.IMPRECISE) { if (useG1GC()) { G1PreWriteBarrier preBarrier = graph.add(new G1PreWriteBarrier(node.object(), null, node.location(), true, node.getNullCheck())); preBarrier.setDeoptimizationState(node.getDeoptimizationState()); @@ -90,21 +90,21 @@ graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.location(), false))); } } else { - assert barrierType == WriteBarrierType.NONE; + assert barrierType == BarrierType.NONE; } } private static void addCASBarriers(CompareAndSwapNode node, StructuredGraph graph) { - WriteBarrierType barrierType = node.getWriteBarrierType(); - if (barrierType == WriteBarrierType.PRECISE) { + BarrierType barrierType = node.getBarrierType(); + if (barrierType == BarrierType.PRECISE) { if (useG1GC()) { graph.addBeforeFixed(node, graph.add(new G1PreWriteBarrier(node.object(), node.expected(), node.getLocation(), false, false))); graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.newValue(), node.getLocation(), true))); } else { graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.getLocation(), true))); } - } else if (barrierType == WriteBarrierType.IMPRECISE) { + } else if (barrierType == BarrierType.IMPRECISE) { if (useG1GC()) { graph.addBeforeFixed(node, graph.add(new G1PreWriteBarrier(node.object(), node.expected(), node.getLocation(), false, false))); graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.newValue(), node.getLocation(), false))); @@ -112,7 +112,7 @@ graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.getLocation(), false))); } } else { - assert barrierType == WriteBarrierType.NONE; + assert barrierType == BarrierType.NONE; } } diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Sun Jul 21 19:15:40 2013 +0200 @@ -30,7 +30,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.replacements.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; +import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; @@ -112,8 +112,8 @@ } private static boolean isObjectWrite(Node node) { - if ((node instanceof WriteNode && (((WriteNode) node).getWriteBarrierType() != WriteBarrierType.NONE)) || - (node instanceof CompareAndSwapNode && (((CompareAndSwapNode) node).getWriteBarrierType() != WriteBarrierType.NONE))) { + if ((node instanceof WriteNode && (((WriteNode) node).getBarrierType() != BarrierType.NONE)) || + (node instanceof CompareAndSwapNode && (((CompareAndSwapNode) node).getBarrierType() != BarrierType.NONE))) { return true; } return false; diff -r d5a8a7054005 -r b05e1ff3aac0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java Sun Jul 21 19:15:40 2013 +0200 @@ -26,7 +26,7 @@ import static com.oracle.graal.replacements.SnippetTemplate.*; import com.oracle.graal.api.code.*; -import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; +import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.replacements.*; @@ -41,9 +41,9 @@ public static Object lowerUnsafeLoad(Object object, long offset, int disp) { long displacement = disp + offset; if (object instanceof java.lang.ref.Reference && referentOffset() == displacement) { - return Word.fromObject(object).readObject((int) displacement, WriteBarrierType.PRECISE, true); + return Word.fromObject(object).readObject((int) displacement, BarrierType.PRECISE, true); } else { - return Word.fromObject(object).readObject((int) displacement, WriteBarrierType.NONE, true); + return Word.fromObject(object).readObject((int) displacement, BarrierType.NONE, true); } } diff -r d5a8a7054005 -r b05e1ff3aac0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Sun Jul 21 19:15:40 2013 +0200 @@ -33,7 +33,7 @@ import com.oracle.graal.graph.Node.NodeIntrinsic; import com.oracle.graal.hotspot.nodes.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; +import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; @@ -119,7 +119,7 @@ // If the previous value has to be loaded (before the write), the load is issued. // The load is always issued except the cases of CAS and referent field. if (probability(LIKELY_PROBABILITY, doLoad)) { - previousOop = (Word) Word.fromObject(field.readObject(0, WriteBarrierType.NONE, true)); + previousOop = (Word) Word.fromObject(field.readObject(0, BarrierType.NONE, true)); if (trace) { log(trace, "[%d] G1-Pre Thread %p Previous Object %p\n ", gcCycle, thread.rawValue(), previousOop.rawValue()); verifyOop(previousOop.toObject()); @@ -226,7 +226,7 @@ for (int i = startIndex; i < length; i++) { Word address = (Word) Word.fromObject(dest).add(header).add(Word.unsigned(i * (long) scale)); - oop = (Word) Word.fromObject(address.readObject(0, WriteBarrierType.NONE, true)); + oop = (Word) Word.fromObject(address.readObject(0, BarrierType.NONE, true)); if (oop.notEqual(0)) { if (indexValue.notEqual(0)) { Word nextIndex = indexValue.subtract(wordSize()); diff -r d5a8a7054005 -r b05e1ff3aac0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/HeapAccess.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/HeapAccess.java Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/HeapAccess.java Sun Jul 21 19:15:40 2013 +0200 @@ -28,19 +28,19 @@ public interface HeapAccess { /** - * The types of write barriers attached to stores. + * The types of (write/read) barriers attached to stores. */ - public enum WriteBarrierType { + public enum BarrierType { /** - * Primitive stores which do not necessitate write barriers. + * Primitive stores which do not necessitate barriers. */ NONE, /** - * Array object stores which necessitate precise write barriers. + * Array object stores which necessitate precise barriers. */ PRECISE, /** - * Field object stores which necessitate imprecise write barriers. + * Field object stores which necessitate imprecise barriers. */ IMPRECISE } @@ -48,7 +48,7 @@ /** * Gets the write barrier type for that particular access. */ - WriteBarrierType getWriteBarrierType(); + BarrierType getBarrierType(); /** * Returns whether or not the heap access is a compressed pointer candidate. diff -r d5a8a7054005 -r b05e1ff3aac0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Sun Jul 21 19:15:40 2013 +0200 @@ -30,7 +30,7 @@ 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.HeapAccess.BarrierType; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; @@ -200,9 +200,9 @@ ConstantNode arrayConstant = ConstantNode.forObject(COUNTERS, runtime, graph); ConstantLocationNode location = ConstantLocationNode.create(NamedLocationIdentity.getArrayLocation(Kind.Long), Kind.Long, Unsafe.ARRAY_LONG_BASE_OFFSET + Unsafe.ARRAY_LONG_INDEX_SCALE * index, graph); - ReadNode read = graph.add(new ReadNode(arrayConstant, location, StampFactory.forKind(Kind.Long), WriteBarrierType.NONE, false)); + ReadNode read = graph.add(new ReadNode(arrayConstant, location, StampFactory.forKind(Kind.Long), BarrierType.NONE, false)); IntegerAddNode add = graph.add(new IntegerAddNode(Kind.Long, read, ConstantNode.forLong(increment, graph))); - WriteNode write = graph.add(new WriteNode(arrayConstant, add, location, WriteBarrierType.NONE, false)); + WriteNode write = graph.add(new WriteNode(arrayConstant, add, location, BarrierType.NONE, false)); graph.addBeforeFixed(position, read); graph.addBeforeFixed(position, write); diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java Sun Jul 21 19:15:40 2013 +0200 @@ -37,7 +37,7 @@ @Input private ValueNode object; @Input private ValueNode location; private boolean nullCheck; - private WriteBarrierType barrierType; + private BarrierType barrierType; private boolean compressible; public ValueNode object() { @@ -61,14 +61,14 @@ } public AccessNode(ValueNode object, ValueNode location, Stamp stamp) { - this(object, location, stamp, null, WriteBarrierType.NONE, false); + this(object, location, stamp, null, BarrierType.NONE, false); } - public AccessNode(ValueNode object, ValueNode location, Stamp stamp, WriteBarrierType barrierType, boolean compressible) { + public AccessNode(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType, boolean compressible) { this(object, location, stamp, null, barrierType, compressible); } - public AccessNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, WriteBarrierType barrierType, boolean compressible) { + public AccessNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean compressible) { super(stamp); this.object = object; this.location = location; @@ -104,7 +104,7 @@ } @Override - public WriteBarrierType getWriteBarrierType() { + public BarrierType getBarrierType() { return barrierType; } diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatableAccessNode.java Sun Jul 21 19:15:40 2013 +0200 @@ -35,11 +35,11 @@ super(object, location, stamp); } - public FloatableAccessNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, WriteBarrierType barrierType, boolean compressible) { + public FloatableAccessNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean compressible) { super(object, location, stamp, guard, barrierType, compressible); } - public FloatableAccessNode(ValueNode object, ValueNode location, Stamp stamp, WriteBarrierType barrierType, boolean compressible) { + public FloatableAccessNode(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType, boolean compressible) { super(object, location, stamp, barrierType, compressible); } @@ -51,6 +51,6 @@ * an attached write barrier with pre-semantics can not also float. */ public boolean canFloat() { - return location().getLocationIdentity() != LocationIdentity.ANY_LOCATION && getWriteBarrierType() == WriteBarrierType.NONE; + return location().getLocationIdentity() != LocationIdentity.ANY_LOCATION && getBarrierType() == BarrierType.NONE; } } diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Sun Jul 21 19:15:40 2013 +0200 @@ -32,7 +32,7 @@ @Input private LocationNode location; @Input private FrameState deoptState; private boolean nullCheck; - private WriteBarrierType barrierType; + private BarrierType barrierType; private boolean compressible; public ValueNode object() { @@ -61,7 +61,7 @@ this.location = location; } - public FloatingAccessNode(ValueNode object, LocationNode location, Stamp stamp, GuardingNode guard, WriteBarrierType barrierType, boolean compressible) { + public FloatingAccessNode(ValueNode object, LocationNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean compressible) { super(stamp, guard); this.object = object; this.location = location; @@ -96,7 +96,7 @@ } @Override - public WriteBarrierType getWriteBarrierType() { + public BarrierType getBarrierType() { return barrierType; } diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Sun Jul 21 19:15:40 2013 +0200 @@ -37,10 +37,10 @@ @Input private Node lastLocationAccess; public FloatingReadNode(ValueNode object, LocationNode location, Node lastLocationAccess, Stamp stamp) { - this(object, location, lastLocationAccess, stamp, null, WriteBarrierType.NONE, false); + this(object, location, lastLocationAccess, stamp, null, BarrierType.NONE, false); } - public FloatingReadNode(ValueNode object, LocationNode location, Node lastLocationAccess, Stamp stamp, GuardingNode guard, WriteBarrierType barrierType, boolean compressible) { + public FloatingReadNode(ValueNode object, LocationNode location, Node lastLocationAccess, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean compressible) { super(object, location, stamp, guard, barrierType, compressible); this.lastLocationAccess = lastLocationAccess; } @@ -62,6 +62,6 @@ @Override public Access asFixedNode() { - return graph().add(new ReadNode(object(), nullCheckLocation(), stamp(), getGuard(), getWriteBarrierType(), compressible())); + return graph().add(new ReadNode(object(), nullCheckLocation(), stamp(), getGuard(), getBarrierType(), compressible())); } } diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Sun Jul 21 19:15:40 2013 +0200 @@ -34,11 +34,11 @@ */ public final class ReadNode extends FloatableAccessNode implements Node.IterableNodeType, LIRLowerable, Canonicalizable, PiPushable, Virtualizable { - public ReadNode(ValueNode object, ValueNode location, Stamp stamp, WriteBarrierType barrierType, boolean compressible) { + public ReadNode(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType, boolean compressible) { super(object, location, stamp, barrierType, compressible); } - public ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, WriteBarrierType barrierType, boolean compressible) { + public ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean compressible) { super(object, location, stamp, guard, barrierType, compressible); } @@ -51,7 +51,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(), (GuardingNode) guard, WriteBarrierType.NONE, false); + super(object, location, StampFactory.forNodeIntrinsic(), (GuardingNode) guard, BarrierType.NONE, false); } @Override @@ -67,7 +67,7 @@ @Override public FloatingAccessNode asFloatingNode(ValueNode lastLocationAccess) { - return graph().unique(new FloatingReadNode(object(), location(), lastLocationAccess, stamp(), getGuard(), getWriteBarrierType(), compressible())); + return graph().unique(new FloatingReadNode(object(), location(), lastLocationAccess, stamp(), getGuard(), getBarrierType(), compressible())); } public static ValueNode canonicalizeRead(ValueNode read, LocationNode location, ValueNode object, CanonicalizerTool tool, boolean compressedPointer) { diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Sun Jul 21 19:15:40 2013 +0200 @@ -65,11 +65,11 @@ return initialized; } - public WriteNode(ValueNode object, ValueNode value, ValueNode location, WriteBarrierType barrierType, boolean compressible) { + public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean compressible) { this(object, value, location, barrierType, compressible, true); } - public WriteNode(ValueNode object, ValueNode value, ValueNode location, WriteBarrierType barrierType, boolean compressible, boolean initialized) { + public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean compressible, boolean initialized) { super(object, location, StampFactory.forVoid(), barrierType, compressible); this.value = value; this.initialized = initialized; @@ -82,7 +82,7 @@ } @NodeIntrinsic - public static native void writeMemory(Object object, Object value, Location location, @ConstantNodeParameter WriteBarrierType barrierType, @ConstantNodeParameter boolean compressible); + public static native void writeMemory(Object object, Object value, Location location, @ConstantNodeParameter BarrierType barrierType, @ConstantNodeParameter boolean compressible); @Override public LocationIdentity getLocationIdentity() { diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Sun Jul 21 19:15:40 2013 +0200 @@ -43,7 +43,7 @@ @Input private ValueNode newValue; @Input private LocationNode location; private final int displacement; - private WriteBarrierType barrierType; + private BarrierType barrierType; private boolean compressible; public ValueNode object() { @@ -76,11 +76,11 @@ } @Override - public WriteBarrierType getWriteBarrierType() { + public BarrierType getBarrierType() { return barrierType; } - public void setWriteBarrierType(WriteBarrierType type) { + public void setBarrierType(BarrierType type) { this.barrierType = type; } @@ -101,7 +101,7 @@ this.expected = expected; this.newValue = newValue; this.displacement = displacement; - this.barrierType = WriteBarrierType.NONE; + this.barrierType = BarrierType.NONE; this.compressible = false; } diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Sun Jul 21 19:15:40 2013 +0200 @@ -26,7 +26,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; +import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -66,7 +66,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, value.kind() == Kind.Object)); + WriteNode write = graph().add(new WriteNode(object, value, location, BarrierType.NONE, value.kind() == Kind.Object)); graph().replaceFixedWithFixed(this, write); } } diff -r d5a8a7054005 -r b05e1ff3aac0 graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java Sun Jul 21 19:15:40 2013 +0200 @@ -23,7 +23,7 @@ package com.oracle.graal.word; import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.HeapAccess.WriteBarrierType; +import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; public interface Pointer extends Unsigned { @@ -623,7 +623,7 @@ * @param compressible whether or not the object is a decompression candidate * @return the result of the memory access */ - Object readObject(WordBase offset, WriteBarrierType barrierType, boolean compressible); + Object readObject(WordBase offset, BarrierType barrierType, boolean compressible); /** * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in @@ -715,7 +715,7 @@ * @param compressible whether or not the object is a decompression candidate * @return the result of the memory access */ - Object readObject(int offset, WriteBarrierType barrierType, boolean compressible); + Object readObject(int offset, BarrierType barrierType, boolean compressible); /** * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in diff -r d5a8a7054005 -r b05e1ff3aac0 graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java Sun Jul 21 19:15:40 2013 +0200 @@ -30,7 +30,7 @@ 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.HeapAccess.BarrierType; import com.oracle.graal.nodes.calc.*; public abstract class Word implements Signed, Unsigned, Pointer { @@ -882,7 +882,7 @@ public native Object readObject(WordBase offset); @Operation(opcode = Opcode.READ_HEAP) - public native Object readObject(WordBase offset, WriteBarrierType barrierType, boolean compressible); + public native Object readObject(WordBase offset, BarrierType barrierType, boolean compressible); @Override @Operation(opcode = Opcode.READ) @@ -939,7 +939,7 @@ } @Operation(opcode = Opcode.READ_HEAP) - public Object readObject(int offset, WriteBarrierType barrierType, boolean compressible) { + public Object readObject(int offset, BarrierType barrierType, boolean compressible) { return readObject(signed(offset), barrierType, compressible); } diff -r d5a8a7054005 -r b05e1ff3aac0 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 Fri Jul 19 22:21:31 2013 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Sun Jul 21 19:15:40 2013 +0200 @@ -29,7 +29,7 @@ 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.HeapAccess.BarrierType; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; @@ -183,14 +183,14 @@ } else { location = makeLocation(graph, arguments.get(1), readKind, arguments.get(2)); } - replace(invoke, readOp(graph, arguments.get(0), invoke, location, WriteBarrierType.NONE, false)); + replace(invoke, readOp(graph, arguments.get(0), invoke, location, BarrierType.NONE, false)); break; } case READ_HEAP: { assert arguments.size() == 4; Kind readKind = asKind(callTargetNode.returnType()); LocationNode location = makeLocation(graph, arguments.get(1), readKind, ANY_LOCATION); - WriteBarrierType barrierType = (WriteBarrierType) arguments.get(2).asConstant().asObject(); + BarrierType barrierType = (BarrierType) arguments.get(2).asConstant().asObject(); replace(invoke, readOp(graph, arguments.get(0), invoke, location, barrierType, arguments.get(3).asConstant().asInt() == 0 ? false : true)); break; } @@ -332,7 +332,7 @@ return IndexedLocationNode.create(locationIdentity, readKind, 0, offset, graph, 1); } - private static ValueNode readOp(StructuredGraph graph, ValueNode base, Invoke invoke, LocationNode location, WriteBarrierType barrierType, boolean compressible) { + private static ValueNode readOp(StructuredGraph graph, ValueNode base, Invoke invoke, LocationNode location, BarrierType barrierType, boolean compressible) { ReadNode read = graph.add(new ReadNode(base, location, invoke.asNode().stamp(), barrierType, compressible)); graph.addBeforeFixed(invoke.asNode(), read); // The read must not float outside its block otherwise it may float above an explicit zero @@ -343,7 +343,7 @@ private static ValueNode writeOp(StructuredGraph graph, ValueNode base, ValueNode value, Invoke invoke, LocationNode location, Opcode op) { assert op == Opcode.WRITE || op == Opcode.INITIALIZE; - WriteNode write = graph.add(new WriteNode(base, value, location, WriteBarrierType.NONE, false, op == Opcode.WRITE)); + WriteNode write = graph.add(new WriteNode(base, value, location, BarrierType.NONE, false, op == Opcode.WRITE)); write.setStateAfter(invoke.stateAfter()); graph.addBeforeFixed(invoke.asNode(), write); return write;