Mercurial > hg > graal-jvmci-8
changeset 11222:8f33568d693d
Merge
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Tue, 06 Aug 2013 14:39:47 +0200 |
parents | 8d4bd13c6983 (diff) 3718acd022db (current diff) |
children | 7244c8366d44 |
files | src/os_cpu/linux_sparc/vm/assembler_linux_sparc.cpp src/os_cpu/solaris_sparc/vm/assembler_solaris_sparc.cpp src/share/vm/memory/klassInfoClosure.hpp src/share/vm/runtime/aprofiler.cpp src/share/vm/runtime/aprofiler.hpp |
diffstat | 6 files changed, 43 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Mon Aug 05 20:20:32 2013 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Tue Aug 06 14:39:47 2013 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.graal.hotspot.test; +import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; + import java.lang.ref.*; import java.lang.reflect.*; @@ -41,7 +43,6 @@ import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; -import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; /** * The following unit tests assert the presence of write barriers for both Serial and G1 GCs. @@ -146,9 +147,9 @@ static Container con = new Container(); /** - * Expected 4 barriers for the Serial GC and 9 for G1 (5 pre + 4 post). In this test, we load - * the correct offset of the WeakReference object so naturally we assert the presence of the pre - * barrier. + * Expected 4 barriers for the Serial GC and 9 for G1 (1 ref + 4 pre + 4 post). In this test, we + * load the correct offset of the WeakReference object so naturally we assert the presence of + * the pre barrier. */ @Test public void test5() throws Exception { @@ -156,7 +157,7 @@ } public static Object test5Snippet() throws Exception { - return UnsafeLoadNode.load(wr, 0, 16, Kind.Object); + return UnsafeLoadNode.load(wr, 0, useCompressedOops() ? 12 : 16, Kind.Object); } /** @@ -246,9 +247,12 @@ public void run() { StructuredGraph graph = parse(snippet); - HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); - new InliningPhase(new InliningPhase.InlineEverythingPolicy()).apply(graph, context); - new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, context); + HighTierContext highContext = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + MidTierContext midContext = new MidTierContext(runtime(), new Assumptions(false), replacements, runtime().getTarget(), OptimisticOptimizations.ALL); + new InliningPhase(new InliningPhase.InlineEverythingPolicy()).apply(graph, highContext); + new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, highContext); + new GuardLoweringPhase().apply(graph, midContext); + new LoweringPhase(LoweringType.AFTER_GUARDS).apply(graph, midContext); new WriteBarrierAdditionPhase().apply(graph); Debug.dump(graph, "After Write Barrier Addition"); @@ -278,8 +282,6 @@ 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.getBarrierType() == BarrierType.PRECISE);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon Aug 05 20:20:32 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Aug 06 14:39:47 2013 +0200 @@ -311,7 +311,7 @@ linkForeignCall(r, OSR_MIGRATION_END, c.osrMigrationEndAddress, DONT_PREPEND_THREAD, LEAF, NOT_REEXECUTABLE, NO_LOCATIONS); linkForeignCall(r, G1WBPRECALL, c.writeBarrierPreAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); linkForeignCall(r, G1WBPOSTCALL, c.writeBarrierPostAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); - linkForeignCall(r, VALIDATEOBJECT, c.validateObject, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); + linkForeignCall(r, VALIDATE_OBJECT, c.validateObject, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); if (IntrinsifyObjectMethods.getValue()) { r.registerSubstitutions(ObjectSubstitutions.class); @@ -636,11 +636,11 @@ graph.replaceFixedWithFixed(storeIndexed, memoryWrite); } else if (n instanceof UnsafeLoadNode) { - if (tool.getLoweringType() != LoweringType.BEFORE_GUARDS) { + if (tool.getLoweringType().ordinal() > LoweringType.BEFORE_GUARDS.ordinal()) { UnsafeLoadNode load = (UnsafeLoadNode) n; assert load.kind() != Kind.Illegal; boolean compressible = (!load.object().isNullConstant() && load.accessKind() == Kind.Object); - if (addReadBarrier(load, tool)) { + if (addReadBarrier(load)) { unsafeLoadSnippets.lower(load, tool); } else { IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, 1); @@ -849,9 +849,9 @@ } } - private static boolean addReadBarrier(UnsafeLoadNode load, LoweringTool tool) { + private static boolean addReadBarrier(UnsafeLoadNode load) { return useG1GC() && load.object().kind() == Kind.Object && load.accessKind() == Kind.Object && !load.object().objectStamp().alwaysNull() && load.object().objectStamp().type() != null && - !(load.object().objectStamp().type().isArray()) && tool.getLoweringType() == LoweringType.BEFORE_GUARDS; + !(load.object().objectStamp().type().isArray()); } private static ReadNode createReadVirtualMethod(StructuredGraph graph, Kind wordKind, ValueNode hub, ResolvedJavaMethod method) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Mon Aug 05 20:20:32 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Tue Aug 06 14:39:47 2013 +0200 @@ -71,6 +71,7 @@ G1PreWriteBarrier preBarrier = graph.add(new G1PreWriteBarrier(node.object(), null, node.location(), true, node.getNullCheck())); preBarrier.setDeoptimizationState(node.getDeoptimizationState()); node.setNullCheck(false); + node.setDeoptimizationState(null); graph.addBeforeFixed(node, preBarrier); } graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.value(), node.location(), true))); @@ -82,6 +83,7 @@ G1PreWriteBarrier preBarrier = graph.add(new G1PreWriteBarrier(node.object(), null, node.location(), true, node.getNullCheck())); preBarrier.setDeoptimizationState(node.getDeoptimizationState()); node.setNullCheck(false); + node.setDeoptimizationState(null); graph.addBeforeFixed(node, preBarrier); graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.value(), node.location(), false))); } else {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Mon Aug 05 20:20:32 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java Tue Aug 06 14:39:47 2013 +0200 @@ -72,12 +72,12 @@ Node currentNode = iterator.next(); assert !isSafepoint(currentNode) : "Write barrier must be present"; if (useG1GC()) { - if (!(currentNode instanceof G1PostWriteBarrier) || ((currentNode instanceof G1PostWriteBarrier) && !validateBarrier(write, (WriteBarrier) currentNode))) { + if (!(currentNode instanceof G1PostWriteBarrier) || ((currentNode instanceof G1PostWriteBarrier) && !validateBarrier((AccessNode) write, (WriteBarrier) currentNode))) { expandFrontier(frontier, currentNode); } } else { - if (!(currentNode instanceof SerialWriteBarrier) || ((currentNode instanceof SerialWriteBarrier) && !validateBarrier(write, (WriteBarrier) currentNode)) || - ((currentNode instanceof SerialWriteBarrier) && !validateBarrier(write, (WriteBarrier) currentNode))) { + if (!(currentNode instanceof SerialWriteBarrier) || ((currentNode instanceof SerialWriteBarrier) && !validateBarrier((AccessNode) write, (WriteBarrier) currentNode)) || + ((currentNode instanceof SerialWriteBarrier) && !validateBarrier((AccessNode) write, (WriteBarrier) currentNode))) { expandFrontier(frontier, currentNode); } } @@ -87,36 +87,22 @@ private static boolean hasAttachedBarrier(FixedWithNextNode node) { final Node next = node.next(); final Node previous = node.predecessor(); - if (HotSpotReplacementsUtil.useG1GC()) { - if (isObjectWrite(node)) { - return next instanceof G1PostWriteBarrier && previous instanceof G1PreWriteBarrier && validateBarrier(node, (G1PostWriteBarrier) next) && - validateBarrier(node, (G1PreWriteBarrier) previous); - } else if (isObjectArrayRangeWrite(node)) { - assert (next instanceof G1ArrayRangePostWriteBarrier) && (previous instanceof G1ArrayRangePreWriteBarrier) && - ((ArrayRangeWriteNode) node).getArray() == ((G1ArrayRangePostWriteBarrier) next).getObject() && - ((ArrayRangeWriteNode) node).getArray() == ((G1ArrayRangePreWriteBarrier) previous).getObject() : "ArrayRangeWriteNode misses pre and/or post barriers"; - return true; - } else { - return false; - } + final boolean validatePreBarrier = HotSpotReplacementsUtil.useG1GC() && (isObjectWrite(node) || !((ArrayRangeWriteNode) node).isInitialization()); + if (isObjectWrite(node)) { + return next instanceof WriteBarrier && validateBarrier((AccessNode) node, (WriteBarrier) next) && + (!validatePreBarrier || (previous instanceof WriteBarrier && validateBarrier((AccessNode) node, (WriteBarrier) previous))); + + } else if (isObjectArrayRangeWrite(node)) { + return ((next instanceof ArrayRangeWriteBarrier) && ((ArrayRangeWriteNode) node).getArray() == ((ArrayRangeWriteBarrier) next).getObject()) && + (!validatePreBarrier || ((previous instanceof ArrayRangeWriteBarrier) && ((ArrayRangeWriteNode) node).getArray() == ((ArrayRangeWriteBarrier) previous).getObject())); } else { - if (isObjectWrite(node)) { - return next instanceof SerialWriteBarrier && validateBarrier(node, (SerialWriteBarrier) next); - } else if (isObjectArrayRangeWrite(node)) { - assert (next instanceof SerialArrayRangeWriteBarrier && ((ArrayRangeWriteNode) node).getArray() == ((SerialArrayRangeWriteBarrier) next).getObject()) : "ArrayRangeWriteNode misses post barriers"; - return true; - } else { - return false; - } + return true; } } private static boolean isObjectWrite(Node node) { - if ((node instanceof WriteNode && (((WriteNode) node).getBarrierType() != BarrierType.NONE)) || - (node instanceof LoweredCompareAndSwapNode && (((LoweredCompareAndSwapNode) node).getBarrierType() != BarrierType.NONE))) { - return true; - } - return false; + // Read nodes with barrier attached (G1 Ref field) are not validated yet. + return node instanceof AccessNode && ((HeapAccess) node).getBarrierType() != BarrierType.NONE && !(node instanceof ReadNode); } private static boolean isObjectArrayRangeWrite(Node node) { @@ -140,20 +126,9 @@ return ((node instanceof DeoptimizingNode) && ((DeoptimizingNode) node).canDeoptimize()) || (node instanceof LoopBeginNode); } - private static boolean validateBarrier(Node write, WriteBarrier barrier) { - ValueNode writtenObject = null; - LocationNode writtenLocation = null; - if (write instanceof WriteNode) { - writtenObject = ((WriteNode) write).object(); - writtenLocation = ((WriteNode) write).location(); - } else if (write instanceof LoweredCompareAndSwapNode) { - writtenObject = ((LoweredCompareAndSwapNode) write).object(); - writtenLocation = ((LoweredCompareAndSwapNode) write).getLocation(); - } else { - assert false : "Node must be of type requiring a write barrier"; - } - - if ((barrier.getObject() == writtenObject) && (!barrier.usePrecise() || (barrier.usePrecise() && barrier.getLocation() == writtenLocation))) { + private static boolean validateBarrier(AccessNode write, WriteBarrier barrier) { + assert write instanceof WriteNode || write instanceof LoweredCompareAndSwapNode : "Node must be of type requiring a write barrier"; + if ((barrier.getObject() == write.object()) && (!barrier.usePrecise() || (barrier.usePrecise() && barrier.getLocation() == write.location()))) { return true; } return false;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Mon Aug 05 20:20:32 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Tue Aug 06 14:39:47 2013 +0200 @@ -434,6 +434,11 @@ } @Fold + public static boolean useCompressedOops() { + return config().useCompressedOops; + } + + @Fold static int uninitializedIdentityHashCodeValue() { return config().uninitializedIdentityHashCodeValue; }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Mon Aug 05 20:20:32 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Tue Aug 06 14:39:47 2013 +0200 @@ -437,13 +437,13 @@ * prematurely crash the VM and debug the stack trace of the faulty method. */ private static void validateObject(Object parent, Object child) { - if (verifyOops() && child != null && !validateOop(VALIDATEOBJECT, parent, child)) { + if (verifyOops() && child != null && !validateOop(VALIDATE_OBJECT, parent, child)) { log(true, "Verification ERROR, Parent: %p Child: %p\n", Word.fromObject(parent).rawValue(), Word.fromObject(child).rawValue()); DirectObjectStoreNode.storeWord(null, 0, 0, Word.zero()); } } - public static final ForeignCallDescriptor VALIDATEOBJECT = new ForeignCallDescriptor("validate_object", boolean.class, Word.class, Word.class); + public static final ForeignCallDescriptor VALIDATE_OBJECT = new ForeignCallDescriptor("validate_object", boolean.class, Word.class, Word.class); @NodeIntrinsic(ForeignCallNode.class) private static native boolean validateOop(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object parent, Object object);