# HG changeset patch # User Thomas Wuerthinger # Date 1381180560 -7200 # Node ID 60bf1372d1a00b9da0420cfabfc6d74420b57adb # Parent 66909d05531457a6a6b3dc0a9997b84e24f6871f# Parent b7ce25d81ef3c3ecb8acaea11e27e065ba6d103a Merge. diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PhiCreationTests.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PhiCreationTests.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PhiCreationTests.java Mon Oct 07 23:16:00 2013 +0200 @@ -41,7 +41,7 @@ @Test public void test1() { StructuredGraph graph = parse("test1Snippet"); - Assert.assertFalse(graph.getNodes(PhiNode.class).iterator().hasNext()); + Assert.assertFalse(graph.getNodes().filter(PhiNode.class).iterator().hasNext()); } public static int test1Snippet(int a) { @@ -54,7 +54,7 @@ @Test public void test2() { StructuredGraph graph = parse("test2Snippet"); - Assert.assertFalse(graph.getNodes(PhiNode.class).iterator().hasNext()); + Assert.assertFalse(graph.getNodes().filter(PhiNode.class).iterator().hasNext()); } public static int test2Snippet(int a) { @@ -68,7 +68,7 @@ public void test3() { StructuredGraph graph = parse("test3Snippet"); Debug.dump(graph, "Graph"); - Assert.assertFalse(graph.getNodes(PhiNode.class).iterator().hasNext()); + Assert.assertFalse(graph.getNodes().filter(PhiNode.class).iterator().hasNext()); } public static int test3Snippet(int a) { @@ -84,7 +84,7 @@ public void test4() { StructuredGraph graph = parse("test4Snippet"); Debug.dump(graph, "Graph"); - Assert.assertFalse(graph.getNodes(PhiNode.class).iterator().hasNext()); + Assert.assertFalse(graph.getNodes().filter(PhiNode.class).iterator().hasNext()); } public static int test4Snippet(int a) { diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Mon Oct 07 23:16:00 2013 +0200 @@ -76,7 +76,7 @@ @Test public void testSimple() { ValueNode result = getReturn("testSimpleSnippet").result(); - assertTrue(graph.getNodes(LoadFieldNode.class).isEmpty()); + assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); assertEquals(graph.getLocal(0), result); } diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Mon Oct 07 23:16:00 2013 +0200 @@ -83,7 +83,7 @@ @Test public void testSimple() { ValueNode result = getReturn("testSimpleSnippet").result(); - assertTrue(graph.getNodes(LoadFieldNode.class).isEmpty()); + assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); assertTrue(result.isConstant()); assertEquals(2, result.asConstant().asInt()); } @@ -112,7 +112,7 @@ @Test public void testParam() { ValueNode result = getReturn("testParamSnippet").result(); - assertTrue(graph.getNodes(LoadFieldNode.class).isEmpty()); + assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); assertEquals(graph.getLocal(1), result); } @@ -126,7 +126,7 @@ @Test public void testMaterialized() { ValueNode result = getReturn("testMaterializedSnippet").result(); - assertTrue(graph.getNodes(LoadFieldNode.class).isEmpty()); + assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); assertEquals(graph.getLocal(0), result); } @@ -142,7 +142,7 @@ @Test public void testSimpleLoop() { ValueNode result = getReturn("testSimpleLoopSnippet").result(); - assertTrue(graph.getNodes(LoadFieldNode.class).isEmpty()); + assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); assertEquals(graph.getLocal(1), result); } @@ -160,7 +160,7 @@ @Test public void testBadLoop() { ValueNode result = getReturn("testBadLoopSnippet").result(); - assertEquals(0, graph.getNodes(LoadFieldNode.class).count()); + assertEquals(0, graph.getNodes().filter(LoadFieldNode.class).count()); assertTrue(result instanceof ProxyNode); assertTrue(((ProxyNode) result).value() instanceof PhiNode); } @@ -178,7 +178,7 @@ @Test public void testBadLoop2() { ValueNode result = getReturn("testBadLoop2Snippet").result(); - assertEquals(1, graph.getNodes(LoadFieldNode.class).count()); + assertEquals(1, graph.getNodes().filter(LoadFieldNode.class).count()); assertTrue(result instanceof LoadFieldNode); } @@ -195,7 +195,7 @@ @Test public void testPhi() { ValueNode result = getReturn("testPhiSnippet").result(); - assertTrue(graph.getNodes(LoadFieldNode.class).isEmpty()); + assertTrue(graph.getNodes().filter(LoadFieldNode.class).isEmpty()); assertTrue(result instanceof PhiNode); PhiNode phi = (PhiNode) result; assertTrue(phi.valueAt(0).isConstant()); diff -r 66909d055314 -r 60bf1372d1a0 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 Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Mon Oct 07 23:16:00 2013 +0200 @@ -258,9 +258,10 @@ int barriers = 0; if (useG1GC()) { - barriers = graph.getNodes(G1ReferentFieldReadBarrier.class).count() + graph.getNodes(G1PreWriteBarrier.class).count() + graph.getNodes(G1PostWriteBarrier.class).count(); + barriers = graph.getNodes().filter(G1ReferentFieldReadBarrier.class).count() + graph.getNodes().filter(G1PreWriteBarrier.class).count() + + graph.getNodes().filter(G1PostWriteBarrier.class).count(); } else { - barriers = graph.getNodes(SerialWriteBarrier.class).count(); + barriers = graph.getNodes().filter(SerialWriteBarrier.class).count(); } Assert.assertEquals(expectedBarriers, barriers); for (WriteNode write : graph.getNodes().filter(WriteNode.class)) { diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Mon Oct 07 23:16:00 2013 +0200 @@ -647,11 +647,11 @@ int barriers = 0; // First, the total number of expected barriers is checked. if (((HotSpotRuntime) runtime()).config.useG1GC) { - barriers = graph.getNodes(G1PreWriteBarrier.class).count() + graph.getNodes(G1PostWriteBarrier.class).count() + graph.getNodes(G1ArrayRangePreWriteBarrier.class).count() + - graph.getNodes(G1ArrayRangePostWriteBarrier.class).count(); + barriers = graph.getNodes().filter(G1PreWriteBarrier.class).count() + graph.getNodes().filter(G1PostWriteBarrier.class).count() + + graph.getNodes().filter(G1ArrayRangePreWriteBarrier.class).count() + graph.getNodes().filter(G1ArrayRangePostWriteBarrier.class).count(); Assert.assertTrue(expectedBarriers * 2 == barriers); } else { - barriers = graph.getNodes(SerialWriteBarrier.class).count() + graph.getNodes(SerialArrayRangeWriteBarrier.class).count(); + barriers = graph.getNodes().filter(SerialWriteBarrier.class).count() + graph.getNodes().filter(SerialArrayRangeWriteBarrier.class).count(); Assert.assertTrue(expectedBarriers == barriers); } // Iterate over all write nodes and remove barriers according to input indices. diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Mon Oct 07 23:16:00 2013 +0200 @@ -22,13 +22,12 @@ */ package com.oracle.graal.hotspot.nodes; -import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; -public abstract class WriteBarrier extends FixedWithNextNode implements Lowerable, IterableNodeType { +public abstract class WriteBarrier extends FixedWithNextNode implements Lowerable { @Input private ValueNode object; @Input private ValueNode value; diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNegationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNegationNode.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNegationNode.java Mon Oct 07 23:16:00 2013 +0200 @@ -28,7 +28,7 @@ /** * Logic node that negates its argument. */ -public class LogicNegationNode extends LogicNode implements Canonicalizable, IterableNodeType { +public class LogicNegationNode extends LogicNode implements Canonicalizable { @Input private LogicNode input; diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Mon Oct 07 23:16:00 2013 +0200 @@ -34,7 +34,7 @@ * variable. */ @NodeInfo(nameTemplate = "{p#type/s}Phi({i#values})") -public class PhiNode extends FloatingNode implements Canonicalizable, IterableNodeType, GuardingNode { +public class PhiNode extends FloatingNode implements Canonicalizable, GuardingNode { public static enum PhiType { Value(null), // normal value phis diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Mon Oct 07 23:16:00 2013 +0200 @@ -31,7 +31,7 @@ /** * The ValueAnchor instruction keeps non-CFG (floating) nodes above a certain point in the graph. */ -public final class ValueAnchorNode extends FixedWithNextNode implements Canonicalizable, LIRLowerable, IterableNodeType, Virtualizable, GuardingNode { +public final class ValueAnchorNode extends FixedWithNextNode implements Canonicalizable, LIRLowerable, Virtualizable, GuardingNode { @Input private ValueNode anchored; diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Mon Oct 07 23:16:00 2013 +0200 @@ -37,7 +37,7 @@ * The {@code LoadFieldNode} represents a read of a static or instance field. */ @NodeInfo(nameTemplate = "LoadField#{p#field/s}") -public final class LoadFieldNode extends AccessFieldNode implements Canonicalizable, IterableNodeType, VirtualizableRoot { +public final class LoadFieldNode extends AccessFieldNode implements Canonicalizable, VirtualizableRoot { /** * Creates a new LoadFieldNode instance. diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Mon Oct 07 23:16:00 2013 +0200 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.java; import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -31,7 +30,7 @@ /** * The {@code LoadIndexedNode} represents a read from an element of an array. */ -public final class LoadIndexedNode extends AccessIndexedNode implements IterableNodeType, Virtualizable { +public final class LoadIndexedNode extends AccessIndexedNode implements Virtualizable { /** * Creates a new LoadIndexedNode. diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java Mon Oct 07 23:16:00 2013 +0200 @@ -22,10 +22,9 @@ */ package com.oracle.graal.nodes.virtual; -import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; -public abstract class EscapeObjectState extends VirtualState implements IterableNodeType { +public abstract class EscapeObjectState extends VirtualState { @Input private VirtualObjectNode object; diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/PhiStampPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/PhiStampPhase.java Mon Oct 07 23:10:17 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2011, 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.phases.common; - -import com.oracle.graal.nodes.*; -import com.oracle.graal.phases.*; - -public class PhiStampPhase extends Phase { - - @Override - protected void run(StructuredGraph graph) { - // Infer phis stopping at loop phis. - for (PhiNode phi : graph.getNodes(PhiNode.class)) { - inferPhi(phi); - } - - // Start iterative inference for loop phis. - if (graph.hasLoops()) { - for (PhiNode phi : graph.getNodes(PhiNode.class)) { - if (phi.isLoopPhi()) { - iterativeInferPhi(phi); - } - } - } - } - - private void iterativeInferPhi(PhiNode phi) { - if (phi.inferPhiStamp()) { - for (PhiNode phiUsage : phi.usages().filter(PhiNode.class)) { - iterativeInferPhi(phiUsage); - } - } - } - - private void inferPhi(PhiNode phi) { - for (PhiNode phiInput : phi.values().filter(PhiNode.class)) { - if (!phiInput.isLoopPhi()) { - inferPhi(phiInput); - } - } - phi.inferPhiStamp(); - } -} diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/phases/ReplaceLoadFinalPhase.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/phases/ReplaceLoadFinalPhase.java Mon Oct 07 23:10:17 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * 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.truffle.phases; - -import java.lang.reflect.*; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.java.*; -import com.oracle.graal.phases.*; -import com.oracle.graal.truffle.nodes.*; -import com.oracle.truffle.api.*; -import com.oracle.truffle.api.nodes.Node.Children; - -public class ReplaceLoadFinalPhase extends Phase { - - @Override - protected void run(StructuredGraph graph) { - for (LoadIndexedNode loadIndexedNode : graph.getNodes(LoadIndexedNode.class)) { - if (loadIndexedNode.array() instanceof LoadFieldNode) { - LoadFieldNode loadFieldNode = (LoadFieldNode) loadIndexedNode.array(); - if (!loadFieldNode.isStatic() && isCompilationFinal(loadFieldNode.field())) { - graph.replaceFixedWithFixed(loadIndexedNode, graph.add(new LoadIndexedFinalNode(loadIndexedNode.array(), loadIndexedNode.index(), loadIndexedNode.elementKind()))); - } - } else if (loadIndexedNode.array() instanceof ConstantNode) { - graph.replaceFixedWithFixed(loadIndexedNode, graph.add(new LoadIndexedFinalNode(loadIndexedNode.array(), loadIndexedNode.index(), loadIndexedNode.elementKind()))); - } - } - } - - private static boolean isCompilationFinal(ResolvedJavaField field) { - assert (field.getAnnotation(Children.class) == null && field.getAnnotation(CompilerDirectives.CompilationFinal.class) == null) || Modifier.isFinal(field.getModifiers()) : "field needs to be declared as final"; - return Modifier.isFinal(field.getModifiers()) && (field.getAnnotation(Children.class) != null || field.getAnnotation(CompilerDirectives.CompilationFinal.class) != null); - } -} diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Mon Oct 07 23:16:00 2013 +0200 @@ -29,7 +29,7 @@ /** * This class encapsulated the materialized state of an escape analyzed object. */ -public final class MaterializedObjectState extends EscapeObjectState implements IterableNodeType, Node.ValueNumberable { +public final class MaterializedObjectState extends EscapeObjectState implements Node.ValueNumberable { @Input private ValueNode materializedValue; diff -r 66909d055314 -r 60bf1372d1a0 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Mon Oct 07 23:10:17 2013 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Mon Oct 07 23:16:00 2013 +0200 @@ -31,7 +31,7 @@ /** * This class encapsulated the virtual state of an escape analyzed object. */ -public final class VirtualObjectState extends EscapeObjectState implements IterableNodeType, Node.ValueNumberable { +public final class VirtualObjectState extends EscapeObjectState implements Node.ValueNumberable { @Input private final NodeInputList fieldValues;