# HG changeset patch # User Doug Simon # Date 1408363461 -7200 # Node ID 06c15e88d3837f3af54a9a11b622b63cb7ad18e5 # Parent cc7aaa92c27da6c51ad1b44d0720d504240af7c1 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == .getGenClass()' idiom diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java Mon Aug 18 14:04:21 2014 +0200 @@ -275,63 +275,63 @@ protected AMD64Arithmetic getOp(ValueNode operation, Access access) { Kind memoryKind = getMemoryKind(access); - if (operation.getClass() == IntegerAddNode.class) { + if (operation.getClass() == IntegerAddNode.getGenClass()) { switch (memoryKind) { case Int: return IADD; case Long: return LADD; } - } else if (operation.getClass() == FloatAddNode.class) { + } else if (operation.getClass() == FloatAddNode.getGenClass()) { switch (memoryKind) { case Float: return FADD; case Double: return DADD; } - } else if (operation.getClass() == AndNode.class) { + } else if (operation.getClass() == AndNode.getGenClass()) { switch (memoryKind) { case Int: return IAND; case Long: return LAND; } - } else if (operation.getClass() == OrNode.class) { + } else if (operation.getClass() == OrNode.getGenClass()) { switch (memoryKind) { case Int: return IOR; case Long: return LOR; } - } else if (operation.getClass() == XorNode.class) { + } else if (operation.getClass() == XorNode.getGenClass()) { switch (memoryKind) { case Int: return IXOR; case Long: return LXOR; } - } else if (operation.getClass() == IntegerSubNode.class) { + } else if (operation.getClass() == IntegerSubNode.getGenClass()) { switch (memoryKind) { case Int: return ISUB; case Long: return LSUB; } - } else if (operation.getClass() == FloatSubNode.class) { + } else if (operation.getClass() == FloatSubNode.getGenClass()) { switch (memoryKind) { case Float: return FSUB; case Double: return DSUB; } - } else if (operation.getClass() == IntegerMulNode.class) { + } else if (operation.getClass() == IntegerMulNode.getGenClass()) { switch (memoryKind) { case Int: return IMUL; case Long: return LMUL; } - } else if (operation.getClass() == FloatMulNode.class) { + } else if (operation.getClass() == FloatMulNode.getGenClass()) { switch (memoryKind) { case Float: return FMUL; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FlowSensitiveReductionTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FlowSensitiveReductionTest.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FlowSensitiveReductionTest.java Mon Aug 18 14:04:21 2014 +0200 @@ -175,10 +175,10 @@ new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders(), null)); IfNode ifNode = (IfNode) graph.start().next(); InstanceOfNode instanceOf = (InstanceOfNode) ifNode.condition(); - IsNullNode x = graph.unique(new IsNullNode(graph.getParameter(0))); + IsNullNode x = graph.unique(IsNullNode.create(graph.getParameter(0))); InstanceOfNode y = instanceOf; - ShortCircuitOrNode disjunction = graph.unique(new ShortCircuitOrNode(x, false, y, false, NOT_FREQUENT_PROBABILITY)); - LogicNegationNode negation = graph.unique(new LogicNegationNode(disjunction)); + ShortCircuitOrNode disjunction = graph.unique(ShortCircuitOrNode.create(x, false, y, false, NOT_FREQUENT_PROBABILITY)); + LogicNegationNode negation = graph.unique(LogicNegationNode.create(disjunction)); ifNode.setCondition(negation); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders(), null)); new FlowSensitiveReductionPhase(getMetaAccess()).apply(graph, new PhaseContext(getProviders(), null)); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java Mon Aug 18 14:04:21 2014 +0200 @@ -42,21 +42,21 @@ public void testImplies() { StructuredGraph graph = new StructuredGraph(); - AbstractEndNode trueEnd = graph.add(new EndNode()); - AbstractEndNode falseEnd = graph.add(new EndNode()); + AbstractEndNode trueEnd = graph.add(EndNode.create()); + AbstractEndNode falseEnd = graph.add(EndNode.create()); - BeginNode trueBegin = graph.add(new BeginNode()); + BeginNode trueBegin = graph.add(BeginNode.create()); trueBegin.setNext(trueEnd); - BeginNode falseBegin = graph.add(new BeginNode()); + BeginNode falseBegin = graph.add(BeginNode.create()); falseBegin.setNext(falseEnd); - IfNode ifNode = graph.add(new IfNode(null, trueBegin, falseBegin, 0.5)); + IfNode ifNode = graph.add(IfNode.create(null, trueBegin, falseBegin, 0.5)); graph.start().setNext(ifNode); - MergeNode merge = graph.add(new MergeNode()); + MergeNode merge = graph.add(MergeNode.create()); merge.addForwardEnd(trueEnd); merge.addForwardEnd(falseEnd); - ReturnNode returnNode = graph.add(new ReturnNode(null)); + ReturnNode returnNode = graph.add(ReturnNode.create(null)); merge.setNext(returnNode); dumpGraph(graph); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Mon Aug 18 14:04:21 2014 +0200 @@ -276,9 +276,8 @@ return obj2.x instanceof TestClassObject; } - @SuppressWarnings("unused") public static void testNewNodeSnippet() { - new ValueAnchorNode(null); + ValueAnchorNode.create(null); } /** diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeMapTest.java --- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeMapTest.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeMapTest.java Mon Aug 18 14:04:21 2014 +0200 @@ -27,10 +27,18 @@ import org.junit.*; import com.oracle.graal.graph.*; +import com.oracle.graal.nodeinfo.*; public class NodeMapTest { - private static class TestNode extends Node { + @NodeInfo + static class TestNode extends Node { + TestNode() { + } + + public static TestNode create() { + return new NodeMapTest_TestNodeGen(); + } } private Graph graph; @@ -41,7 +49,7 @@ public void before() { graph = new Graph(); for (int i = 0; i < nodes.length; i++) { - nodes[i] = graph.add(new TestNode()); + nodes[i] = graph.add(TestNode.create()); } map = new NodeMap<>(graph); for (int i = 0; i < nodes.length; i += 2) { @@ -95,7 +103,7 @@ * Failing here is not required, but if this behavior changes, usages of get need to be * checked for compatibility. */ - TestNode newNode = graph.add(new TestNode()); + TestNode newNode = graph.add(TestNode.create()); map.get(newNode); } @@ -105,19 +113,19 @@ * Failing here is not required, but if this behavior changes, usages of set need to be * checked for compatibility. */ - TestNode newNode = graph.add(new TestNode()); + TestNode newNode = graph.add(TestNode.create()); map.set(newNode, 1); } @Test public void testNewGetAndGrow() { - TestNode newNode = graph.add(new TestNode()); + TestNode newNode = graph.add(TestNode.create()); assertEquals(null, map.getAndGrow(newNode)); } @Test public void testNewSetAndGrow() { - TestNode newNode = graph.add(new TestNode()); + TestNode newNode = graph.add(TestNode.create()); map.setAndGrow(newNode, 1); assertEquals((Integer) 1, map.get(newNode)); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeUsagesTests.java --- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeUsagesTests.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/NodeUsagesTests.java Mon Aug 18 14:04:21 2014 +0200 @@ -29,19 +29,28 @@ import org.junit.*; import com.oracle.graal.graph.*; +import com.oracle.graal.nodeinfo.*; public class NodeUsagesTests { - private static class Def extends Node { - + @NodeInfo + static class Def extends Node { + public static Def create() { + return new NodeUsagesTests_DefGen(); + } } - private static class Use extends Node { + @NodeInfo + static class Use extends Node { private @Input Def in0; private @Input Def in1; private @Input Def in2; - public Use(Def in0, Def in1, Def in2) { + public static Use create(Def in0, Def in1, Def in2) { + return new NodeUsagesTests_UseGen(in0, in1, in2); + } + + Use(Def in0, Def in1, Def in2) { this.in0 = in0; this.in1 = in1; this.in2 = in2; @@ -51,11 +60,11 @@ @Test public void testReplaceAtUsages() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); assertEquals(3, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -80,11 +89,11 @@ @Test public void testReplaceAtUsagesWithPredicateAll() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); assertEquals(3, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -109,11 +118,11 @@ @Test public void testReplaceAtUsagesWithPredicateNone() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); assertEquals(3, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -138,11 +147,11 @@ @Test public void testReplaceAtUsagesWithPredicate1() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); assertEquals(3, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -169,11 +178,11 @@ @Test public void testReplaceAtUsagesWithPredicate2() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); assertEquals(3, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -200,11 +209,11 @@ @Test public void testReplaceAtUsagesWithPredicate0() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); assertEquals(3, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -231,11 +240,11 @@ @Test public void testReplaceAtUsagesWithPredicate02() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); assertEquals(3, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -262,12 +271,12 @@ @Test public void testReplaceAtUsagesWithPredicate023() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); - Use use3 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); + Use use3 = graph.add(Use.create(null, null, def0)); assertEquals(4, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -296,12 +305,12 @@ @Test public void testReplaceAtUsagesWithPredicate013() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); - Use use3 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); + Use use3 = graph.add(Use.create(null, null, def0)); assertEquals(4, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -330,12 +339,12 @@ @Test public void testReplaceAtUsagesWithPredicate2_3() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); - Use use3 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); + Use use3 = graph.add(Use.create(null, null, def0)); assertEquals(4, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -364,11 +373,11 @@ @Test public void testReplaceAtUsagesWithPredicate01() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); assertEquals(3, def0.usages().count()); assertThat(def0.usages(), contains(use0)); @@ -395,11 +404,11 @@ @Test public void testReplaceAtUsagesWithPredicate12() { Graph graph = new Graph(); - Def def0 = graph.add(new Def()); - Def def1 = graph.add(new Def()); - Use use0 = graph.add(new Use(def0, null, null)); - Use use1 = graph.add(new Use(null, def0, null)); - Use use2 = graph.add(new Use(null, null, def0)); + Def def0 = graph.add(Def.create()); + Def def1 = graph.add(Def.create()); + Use use0 = graph.add(Use.create(def0, null, null)); + Use use1 = graph.add(Use.create(null, def0, null)); + Use use2 = graph.add(Use.create(null, null, def0)); assertEquals(3, def0.usages().count()); assertThat(def0.usages(), contains(use0)); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/TypedNodeIteratorTest.java --- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/TypedNodeIteratorTest.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/TypedNodeIteratorTest.java Mon Aug 18 14:04:21 2014 +0200 @@ -29,14 +29,20 @@ import org.junit.*; import com.oracle.graal.graph.*; +import com.oracle.graal.nodeinfo.*; public class TypedNodeIteratorTest { - private static class TestNode extends Node implements IterableNodeType, TestNodeInterface { + @NodeInfo + static class TestNode extends Node implements IterableNodeType, TestNodeInterface { private final String name; - public TestNode(String name) { + public static TestNode create(String name) { + return new TypedNodeIteratorTest_TestNodeGen(name); + } + + TestNode(String name) { this.name = name; } @@ -48,14 +54,14 @@ @Test public void singleNodeTest() { Graph graph = new Graph(); - graph.add(new TestNode("a")); + graph.add(TestNode.create("a")); assertTrue(graph.hasNode(TestNode.class)); assertEquals("a", toString(graph.getNodes(TestNode.class))); } @Test public void deletingNodeTest() { - TestNode testNode = new TestNode("a"); + TestNode testNode = TestNode.create("a"); Graph graph = new Graph(); graph.add(testNode); testNode.safeDelete(); @@ -64,29 +70,29 @@ @Test public void deleteAndAddTest() { - TestNode testNode = new TestNode("b"); + TestNode testNode = TestNode.create("b"); Graph graph = new Graph(); - graph.add(new TestNode("a")); + graph.add(TestNode.create("a")); graph.add(testNode); testNode.safeDelete(); assertEquals("a", toString(graph.getNodes(TestNode.class))); - graph.add(new TestNode("c")); + graph.add(TestNode.create("c")); assertEquals("ac", toString(graph.getNodes(TestNode.class))); } @Test public void iteratorBehaviorTest() { Graph graph = new Graph(); - graph.add(new TestNode("a")); + graph.add(TestNode.create("a")); Iterator iterator = graph.getNodes(TestNode.class).iterator(); assertTrue(iterator.hasNext()); assertEquals("a", iterator.next().getName()); assertFalse(iterator.hasNext()); - graph.add(new TestNode("b")); + graph.add(TestNode.create("b")); assertTrue(iterator.hasNext()); assertEquals("b", iterator.next().getName()); assertFalse(iterator.hasNext()); - TestNode c = new TestNode("c"); + TestNode c = TestNode.create("c"); graph.add(c); assertTrue(iterator.hasNext()); c.safeDelete(); @@ -96,26 +102,26 @@ @Test public void complicatedIterationTest() { Graph graph = new Graph(); - graph.add(new TestNode("a")); + graph.add(TestNode.create("a")); for (TestNode tn : graph.getNodes(TestNode.class)) { String name = tn.getName(); for (int i = 0; i < name.length(); ++i) { char c = name.charAt(i); if (c == 'a') { tn.safeDelete(); - graph.add(new TestNode("b")); - graph.add(new TestNode("c")); + graph.add(TestNode.create("b")); + graph.add(TestNode.create("c")); } else if (c == 'b') { tn.safeDelete(); } else if (c == 'c') { - graph.add(new TestNode("d")); - graph.add(new TestNode("e")); - graph.add(new TestNode("d")); - graph.add(new TestNode("e")); - graph.add(new TestNode("e")); - graph.add(new TestNode("d")); - graph.add(new TestNode("e")); - graph.add(new TestNode("d")); + graph.add(TestNode.create("d")); + graph.add(TestNode.create("e")); + graph.add(TestNode.create("d")); + graph.add(TestNode.create("e")); + graph.add(TestNode.create("e")); + graph.add(TestNode.create("d")); + graph.add(TestNode.create("e")); + graph.add(TestNode.create("d")); } else if (c == 'd') { for (TestNode tn2 : graph.getNodes(TestNode.class)) { if (tn2.getName().equals("e")) { @@ -135,12 +141,12 @@ @Test public void addingNodeDuringIterationTest() { Graph graph = new Graph(); - graph.add(new TestNode("a")); + graph.add(TestNode.create("a")); StringBuilder sb = new StringBuilder(); int z = 0; for (TestNode tn : graph.getNodes(TestNode.class)) { if (z == 0) { - graph.add(new TestNode("b")); + graph.add(TestNode.create("b")); } sb.append(tn.getName()); z++; @@ -150,7 +156,7 @@ z = 0; for (TestNode tn : graph.getNodes(TestNode.class)) { if (z == 0) { - graph.add(new TestNode("c")); + graph.add(TestNode.create("c")); } assertNotNull(tn); z++; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/TypedNodeIteratorTest2.java --- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/TypedNodeIteratorTest2.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/test/TypedNodeIteratorTest2.java Mon Aug 18 14:04:21 2014 +0200 @@ -27,14 +27,20 @@ import org.junit.*; import com.oracle.graal.graph.*; +import com.oracle.graal.nodeinfo.*; public class TypedNodeIteratorTest2 { - private static class NodeA extends Node implements TestNodeInterface { + @NodeInfo + static class NodeA extends Node implements TestNodeInterface { private final String name; - public NodeA(String name) { + public static NodeA create(String name) { + return new TypedNodeIteratorTest2_NodeAGen(name); + } + + NodeA(String name) { this.name = name; } @@ -43,23 +49,36 @@ } } - private static class NodeB extends NodeA implements IterableNodeType { + @NodeInfo + static class NodeB extends NodeA implements IterableNodeType { - public NodeB(String name) { + public static NodeB create(String name) { + return new TypedNodeIteratorTest2_NodeBGen(name); + } + + NodeB(String name) { super(name); } } - private static class NodeC extends NodeB { + @NodeInfo + static class NodeC extends NodeB { + public static NodeC create(String name) { + return new TypedNodeIteratorTest2_NodeCGen(name); + } - public NodeC(String name) { + NodeC(String name) { super(name); } } - private static class NodeD extends NodeC { + @NodeInfo + static class NodeD extends NodeC { + public static NodeD create(String name) { + return new TypedNodeIteratorTest2_NodeDGen(name); + } - public NodeD(String name) { + NodeD(String name) { super(name); } } @@ -67,8 +86,8 @@ @Test public void simpleSubclassTest() { Graph graph = new Graph(); - graph.add(new NodeB("b")); - graph.add(new NodeD("d")); + graph.add(NodeB.create("b")); + graph.add(NodeD.create("d")); Assert.assertEquals("bd", TypedNodeIteratorTest.toString(graph.getNodes(NodeB.class))); Assert.assertEquals("d", TypedNodeIteratorTest.toString(graph.getNodes(NodeD.class))); @@ -77,19 +96,19 @@ @Test public void addingNodeDuringIterationTest() { Graph graph = new Graph(); - graph.add(new NodeB("b1")); - NodeD d1 = graph.add(new NodeD("d1")); + graph.add(NodeB.create("b1")); + NodeD d1 = graph.add(NodeD.create("d1")); StringBuilder sb = new StringBuilder(); for (NodeB tn : graph.getNodes(NodeB.class)) { if (tn == d1) { - graph.add(new NodeB("b2")); + graph.add(NodeB.create("b2")); } sb.append(tn.getName()); } assertEquals("b1d1b2", sb.toString()); for (NodeB tn : graph.getNodes(NodeB.class)) { if (tn == d1) { - graph.add(new NodeB("b3")); + graph.add(NodeB.create("b3")); } assertNotNull(tn); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java Mon Aug 18 14:04:21 2014 +0200 @@ -649,10 +649,16 @@ // Fully qualified annotation name is required to satisfy javac @com.oracle.graal.nodeinfo.NodeInfo static class PlaceHolderNode extends Node { + public static PlaceHolderNode create() { + return new Graph_PlaceHolderNodeGen(); + } + PlaceHolderNode() { + // TODO Auto-generated constructor stub + } } - private static final Node PLACE_HOLDER = new PlaceHolderNode(); + private static final Node PLACE_HOLDER = new Graph_PlaceHolderNodeGen(); /** * When the percent of live nodes in {@link #nodes} fall below this number, a call to diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Mon Aug 18 14:04:21 2014 +0200 @@ -114,7 +114,7 @@ * annotated method can be replaced with an instance of the node class denoted by * {@link #value()}. For this reason, the signature of the annotated method must match the * signature (excluding a prefix of {@linkplain InjectedNodeParameter injected} parameters) of a - * constructor in the node class. + * factory method named {@code "create"} in the node class. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @@ -161,6 +161,7 @@ private Node predecessor; public Node() { + assert getClass().getAnnotation(GeneratedNode.class) != null : getClass() + " is not a generated Node class - forgot @" + NodeInfo.class.getSimpleName() + " on class declaration?"; init(); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Aug 18 14:04:21 2014 +0200 @@ -329,7 +329,7 @@ HotSpotVMConfig config = HotSpotGraalRuntime.runtime().getConfig(); RawNativeCallNodeFactory factory = new RawNativeCallNodeFactory() { public FixedWithNextNode createRawCallNode(Kind returnType, Constant functionPointer, ValueNode... args) { - return new AMD64RawNativeCallNode(returnType, functionPointer, args); + return AMD64RawNativeCallNode.create(returnType, functionPointer, args); } }; Backend backend = HotSpotGraalRuntime.runtime().getBackend(AMD64.class); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64RawNativeCallNode.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64RawNativeCallNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64RawNativeCallNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,8 @@ private final Constant functionPointer; @Input private final NodeInputList args; - public AMD64RawNativeCallNode(Kind returnType, Constant functionPointer, ValueNode[] args) { +public static AMD64RawNativeCallNode create(Kind returnType, Constant functionPointer, ValueNode[] args) { return new AMD64RawNativeCallNodeGen(returnType, functionPointer, args); } + protected AMD64RawNativeCallNode(Kind returnType, Constant functionPointer, ValueNode[] args) { super(StampFactory.forKind(returnType)); this.functionPointer = functionPointer; this.args = new NodeInputList<>(this, args); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Mon Aug 18 14:04:21 2014 +0200 @@ -1068,10 +1068,10 @@ return null; } StructuredGraph hostGraph = new StructuredGraph(method, -2); - ParameterNode deoptId = hostGraph.unique(new ParameterNode(0, StampFactory.intValue())); - ParameterNode hsailFrame = hostGraph.unique(new ParameterNode(1, StampFactory.forKind(providers.getCodeCache().getTarget().wordKind))); - ParameterNode reasonAndAction = hostGraph.unique(new ParameterNode(2, StampFactory.intValue())); - ParameterNode speculation = hostGraph.unique(new ParameterNode(3, StampFactory.object())); + ParameterNode deoptId = hostGraph.unique(ParameterNode.create(0, StampFactory.intValue())); + ParameterNode hsailFrame = hostGraph.unique(ParameterNode.create(1, StampFactory.forKind(providers.getCodeCache().getTarget().wordKind))); + ParameterNode reasonAndAction = hostGraph.unique(ParameterNode.create(2, StampFactory.intValue())); + ParameterNode speculation = hostGraph.unique(ParameterNode.create(3, StampFactory.object())); BeginNode[] branches = new BeginNode[deopts.size() + 1]; int[] keys = new int[deopts.size()]; int[] keySuccessors = new int[deopts.size() + 1]; @@ -1094,7 +1094,7 @@ keyProbabilities[deopts.size()] = 0; // default keySuccessors[deopts.size()] = deopts.size(); branches[deopts.size()] = createHostCrashBranch(hostGraph, deoptId); - IntegerSwitchNode switchNode = hostGraph.add(new IntegerSwitchNode(deoptId, branches, keys, keyProbabilities, keySuccessors)); + IntegerSwitchNode switchNode = hostGraph.add(IntegerSwitchNode.create(deoptId, branches, keys, keyProbabilities, keySuccessors)); StartNode start = hostGraph.start(); start.setNext(switchNode); /* @@ -1105,16 +1105,16 @@ } private static BeginNode createHostCrashBranch(StructuredGraph hostGraph, ValueNode deoptId) { - VMErrorNode vmError = hostGraph.add(new VMErrorNode("Error in HSAIL deopt. DeoptId=%d", deoptId)); + VMErrorNode vmError = hostGraph.add(VMErrorNode.create("Error in HSAIL deopt. DeoptId=%d", deoptId)); // ConvertNode.convert(hostGraph, Kind.Long, deoptId))); - vmError.setNext(hostGraph.add(new ReturnNode(ConstantNode.defaultForKind(hostGraph.method().getSignature().getReturnKind(), hostGraph)))); + vmError.setNext(hostGraph.add(ReturnNode.create(ConstantNode.defaultForKind(hostGraph.method().getSignature().getReturnKind(), hostGraph)))); return BeginNode.begin(vmError); } private static BeginNode createHostDeoptBranch(DeoptimizingOp deopt, ParameterNode hsailFrame, ValueNode reasonAndAction, ValueNode speculation, HotSpotProviders providers, HotSpotVMConfig config, int numSRegs, int numDRegs) { - BeginNode branch = hsailFrame.graph().add(new BeginNode()); - DynamicDeoptimizeNode deoptimization = hsailFrame.graph().add(new DynamicDeoptimizeNode(reasonAndAction, speculation)); + BeginNode branch = hsailFrame.graph().add(BeginNode.create()); + DynamicDeoptimizeNode deoptimization = hsailFrame.graph().add(DynamicDeoptimizeNode.create(reasonAndAction, speculation)); deoptimization.setStateBefore(createFrameState(deopt.getFrameState().topFrame, hsailFrame, providers, config, numSRegs, numDRegs)); branch.setNext(deoptimization); return branch; @@ -1147,7 +1147,7 @@ locks[i] = lirValueToHirNode.apply(lockValue); monitorIds[i] = getMonitorIdForHotSpotMonitorValueFromFrame(lockValue, hsailFrame, hostGraph); } - FrameState frameState = hostGraph.add(new FrameState(lowLevelFrame.getMethod(), lowLevelFrame.getBCI(), locals, stack, locks, monitorIds, lowLevelFrame.rethrowException, false)); + FrameState frameState = hostGraph.add(FrameState.create(lowLevelFrame.getMethod(), lowLevelFrame.getBCI(), locals, stack, locks, monitorIds, lowLevelFrame.rethrowException, false)); if (outterFrameState != null) { frameState.setOuterFrameState(outterFrameState); } @@ -1162,7 +1162,7 @@ VirtualObject virtualObject = entry.getKey(); VirtualObjectNode virtualObjectNode = entry.getValue(); List fieldValues = Arrays.stream(virtualObject.getValues()).map(lirValueToHirNode).collect(Collectors.toList()); - virtualStates.add(new VirtualObjectState(virtualObjectNode, fieldValues)); + virtualStates.add(VirtualObjectState.create(virtualObjectNode, fieldValues)); } // New virtual objects may have been discovered while processing the previous set. // Wait until a fixed point is reached @@ -1207,9 +1207,9 @@ private static ValueNode getNodeForVirtualObjectFromFrame(VirtualObject virtualObject, Map virtualObjects, StructuredGraph hostGraph) { return virtualObjects.computeIfAbsent(virtualObject, vo -> { if (vo.getType().isArray()) { - return hostGraph.add(new VirtualArrayNode(vo.getType().getComponentType(), vo.getValues().length)); + return hostGraph.add(VirtualArrayNode.create(vo.getType().getComponentType(), vo.getValues().length)); } else { - return hostGraph.add(new VirtualInstanceNode(vo.getType(), true)); + return hostGraph.add(VirtualInstanceNode.create(vo.getType(), true)); } }); } @@ -1229,7 +1229,7 @@ } else { throw GraalInternalError.shouldNotReachHere("unknown hsail register: " + regNumber); } - valueNode = hostGraph.unique(new FloatingReadNode(hsailFrame, location, null, StampFactory.forKind(valueKind))); + valueNode = hostGraph.unique(FloatingReadNode.create(hsailFrame, location, null, StampFactory.forKind(valueKind))); return valueNode; } @@ -1241,7 +1241,7 @@ int intSize = providers.getCodeCache().getTarget().arch.getSizeInBytes(Kind.Int); long offset = config.hsailFrameHeaderSize + (intSize * numSRegs) + (longSize * numDRegs) + HSAIL.getStackOffsetStart(slot, slotSizeInBits); LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, valueKind, offset, hostGraph); - ValueNode valueNode = hostGraph.unique(new FloatingReadNode(hsailFrame, location, null, StampFactory.forKind(valueKind))); + ValueNode valueNode = hostGraph.unique(FloatingReadNode.create(hsailFrame, location, null, StampFactory.forKind(valueKind))); return valueNode; } else { throw GraalInternalError.shouldNotReachHere("unsupported stack slot kind: " + valueKind); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotLoweringProvider.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotLoweringProvider.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotLoweringProvider.java Mon Aug 18 14:04:21 2014 +0200 @@ -94,7 +94,7 @@ default: reason = DeoptimizationReason.None; } - unwind.replaceAtPredecessor(graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, reason))); + unwind.replaceAtPredecessor(graph.add(DeoptimizeNode.create(DeoptimizationAction.InvalidateReprofile, reason))); unwind.safeDelete(); } else { // unwind whose exception is not an instance of ForeignCallNode diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILDirectLoadAcquireNode.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILDirectLoadAcquireNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILDirectLoadAcquireNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @NodeInfo public class HSAILDirectLoadAcquireNode extends DirectReadNode { - public HSAILDirectLoadAcquireNode(ValueNode address, Kind readKind) { + public static HSAILDirectLoadAcquireNode create(ValueNode address, Kind readKind) { + return new HSAILDirectLoadAcquireNodeGen(address, readKind); + } + + protected HSAILDirectLoadAcquireNode(ValueNode address, Kind readKind) { super(address, readKind); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILDirectStoreReleaseNode.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILDirectStoreReleaseNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILDirectStoreReleaseNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @NodeInfo public class HSAILDirectStoreReleaseNode extends DirectStoreNode { - public HSAILDirectStoreReleaseNode(ValueNode address, ValueNode value, Kind kind) { + public static HSAILDirectStoreReleaseNode create(ValueNode address, ValueNode value, Kind kind) { + return new HSAILDirectStoreReleaseNodeGen(address, value, kind); + } + + protected HSAILDirectStoreReleaseNode(ValueNode address, ValueNode value, Kind kind) { super(address, value, kind); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILWorkItemAbsIdNode.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILWorkItemAbsIdNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/replacements/HSAILWorkItemAbsIdNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @NodeInfo public class HSAILWorkItemAbsIdNode extends FixedWithNextNode implements LIRLowerable { - public HSAILWorkItemAbsIdNode() { + public static HSAILWorkItemAbsIdNode create() { + return new HSAILWorkItemAbsIdNodeGen(); + } + + protected HSAILWorkItemAbsIdNode() { super(StampFactory.forKind(Kind.Int)); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXWrapperBuilder.java --- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXWrapperBuilder.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXWrapperBuilder.java Mon Aug 18 14:04:21 2014 +0200 @@ -192,7 +192,7 @@ InvokeNode kernelStart = createInvoke(getClass(), "getKernelStart", ConstantNode.forConstant(HotSpotObjectConstant.forObject(kernel), providers.getMetaAccess(), getGraph())); - AllocaNode buf = append(new AllocaNode(bufSize / wordSize, new BitSet())); + AllocaNode buf = append(AllocaNode.create(bufSize / wordSize, new BitSet())); ValueNode objectParametersOffsets; ValueNode pinnedObjects; ConstantNode nullWord = ConstantNode.forIntegerKind(wordKind, 0L, getGraph()); @@ -202,22 +202,22 @@ } else { int intsPerWord = wordSize / intSize; int slots = roundUp(objectSlots.size(), intsPerWord); - objectParametersOffsets = append(new AllocaNode(slots, new BitSet())); + objectParametersOffsets = append(AllocaNode.create(slots, new BitSet())); // No refmap for pinned objects list since kernel execution is (currently) GC unsafe - pinnedObjects = append(new AllocaNode(objectSlots.size(), new BitSet())); + pinnedObjects = append(AllocaNode.create(objectSlots.size(), new BitSet())); // Initialize the object parameter offsets array int index = 0; for (int slot : objectSlots) { int offset = slot * wordSize; LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, Kind.Int, index * intSize, getGraph()); - append(new WriteNode(objectParametersOffsets, ConstantNode.forInt(offset, getGraph()), location, BarrierType.NONE, false)); + append(WriteNode.create(objectParametersOffsets, ConstantNode.forInt(offset, getGraph()), location, BarrierType.NONE, false)); index++; } } Map args = new EnumMap<>(LaunchArg.class); - args.put(Thread, append(new ReadRegisterNode(providers.getRegisters().getThreadRegister(), true, false))); + args.put(Thread, append(ReadRegisterNode.create(providers.getRegisters().getThreadRegister(), true, false))); args.put(Kernel, kernelStart); args.put(DimX, forInt(1, getGraph())); args.put(DimY, forInt(1, getGraph())); @@ -234,12 +234,12 @@ ParameterNode javaParameter = javaParameters[javaParametersIndex]; int javaParameterOffset = javaParameterOffsetsInKernelParametersBuffer[javaParametersIndex]; LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, javaParameter.getKind(), javaParameterOffset, getGraph()); - append(new WriteNode(buf, javaParameter, location, BarrierType.NONE, false)); + append(WriteNode.create(buf, javaParameter, location, BarrierType.NONE, false)); updateDimArg(method, sig, sigIndex++, args, javaParameter); } if (returnKind != Kind.Void) { LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, wordKind, bufSize - wordSize, getGraph()); - append(new WriteNode(buf, nullWord, location, BarrierType.NONE, false)); + append(WriteNode.create(buf, nullWord, location, BarrierType.NONE, false)); } HIRFrameStateBuilder fsb = new HIRFrameStateBuilder(method, getGraph(), true); @@ -247,7 +247,7 @@ getGraph().start().setStateAfter(fs); ValueNode[] launchArgsArray = args.values().toArray(new ValueNode[args.size()]); - ForeignCallNode result = append(new ForeignCallNode(providers.getForeignCalls(), CALL_KERNEL, launchArgsArray)); + ForeignCallNode result = append(ForeignCallNode.create(providers.getForeignCalls(), CALL_KERNEL, launchArgsArray)); result.setStateAfter(fs); InvokeNode getObjectResult = null; @@ -261,13 +261,13 @@ case Short: case Char: case Int: - returnValue = unique(new NarrowNode(result, 32)); + returnValue = unique(NarrowNode.create(result, 32)); break; case Long: returnValue = result; break; case Float: { - ValueNode asInt = unique(new NarrowNode(result, 32)); + ValueNode asInt = unique(NarrowNode.create(result, 32)); returnValue = ReinterpretNode.reinterpret(Kind.Float, asInt); break; } @@ -282,7 +282,7 @@ throw new GraalInternalError("%s return kind not supported", returnKind); } - append(new ReturnNode(returnValue)); + append(ReturnNode.create(returnValue)); if (Debug.isDumpEnabled()) { Debug.dump(getGraph(), "Initial kernel launch graph"); @@ -314,7 +314,7 @@ } else { stamp = StampFactory.forKind(kind); } - javaParameters[javaParametersIndex] = unique(new ParameterNode(javaParametersIndex, stamp)); + javaParameters[javaParametersIndex] = unique(ParameterNode.create(javaParametersIndex, stamp)); bufSize += kindByteSize; } @@ -326,7 +326,7 @@ if (sigIndex >= 0) { ParallelOver parallelOver = method.getParameterAnnotation(ParallelOver.class, sigIndex); if (parallelOver != null && sig.getParameterType(sigIndex, method.getDeclaringClass()).equals(providers.getMetaAccess().lookupJavaType(int[].class))) { - ArrayLengthNode dimension = append(new ArrayLengthNode(javaParameter)); + ArrayLengthNode dimension = append(ArrayLengthNode.create(javaParameter)); LaunchArg argKey = LaunchArg.valueOf(LaunchArg.class, "Dim" + parallelOver.dimension()); ValueNode existing = launchArgs.put(argKey, dimension); if (existing != null && existing instanceof ArrayLengthNode) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Mon Aug 18 14:04:21 2014 +0200 @@ -377,18 +377,18 @@ public static void lower(DynamicCounterNode counter, HotSpotRegistersProvider registers, HotSpotVMConfig config, Kind wordKind) { StructuredGraph graph = counter.graph(); - ReadRegisterNode thread = graph.add(new ReadRegisterNode(registers.getThreadRegister(), wordKind, true, false)); + ReadRegisterNode thread = graph.add(ReadRegisterNode.create(registers.getThreadRegister(), wordKind, true, false)); int index = BenchmarkCounters.getIndex(counter); if (index >= config.graalCountersSize) { throw new GraalInternalError("too many counters, reduce number of counters or increase -XX:GraalCounterSize=... (current value: " + config.graalCountersSize + ")"); } ConstantLocationNode arrayLocation = ConstantLocationNode.create(LocationIdentity.ANY_LOCATION, wordKind, config.graalCountersThreadOffset, graph); - ReadNode readArray = graph.add(new ReadNode(thread, arrayLocation, StampFactory.forKind(wordKind), BarrierType.NONE)); + ReadNode readArray = graph.add(ReadNode.create(thread, arrayLocation, StampFactory.forKind(wordKind), BarrierType.NONE)); ConstantLocationNode location = ConstantLocationNode.create(LocationIdentity.ANY_LOCATION, Kind.Long, Unsafe.ARRAY_LONG_INDEX_SCALE * index, graph); - ReadNode read = graph.add(new ReadNode(readArray, location, StampFactory.forKind(Kind.Long), BarrierType.NONE)); - IntegerAddNode add = graph.unique(new IntegerAddNode(read, counter.getIncrement())); - WriteNode write = graph.add(new WriteNode(readArray, add, location, BarrierType.NONE)); + ReadNode read = graph.add(ReadNode.create(readArray, location, StampFactory.forKind(Kind.Long), BarrierType.NONE)); + IntegerAddNode add = graph.unique(IntegerAddNode.create(read, counter.getIncrement())); + WriteNode write = graph.add(WriteNode.create(readArray, add, location, BarrierType.NONE)); graph.addBeforeFixed(counter, thread); graph.addBeforeFixed(counter, readArray); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java Mon Aug 18 14:04:21 2014 +0200 @@ -198,10 +198,10 @@ // We use LocationNode.ANY_LOCATION for the reads that access the // compiled code entry as HotSpot does not guarantee they are final // values. - ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, ConstantLocationNode.create(ANY_LOCATION, wordKind, runtime.getConfig().methodCompiledEntryOffset, graph), + ReadNode compiledEntry = graph.add(ReadNode.create(metaspaceMethod, ConstantLocationNode.create(ANY_LOCATION, wordKind, runtime.getConfig().methodCompiledEntryOffset, graph), StampFactory.forKind(wordKind), BarrierType.NONE)); - loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), + loweredCallTarget = graph.add(HotSpotIndirectCallTargetNode.create(metaspaceMethod, compiledEntry, parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall, callTarget.invokeKind())); graph.addBeforeFixed(invoke.asNode(), metaspaceMethod); @@ -210,7 +210,7 @@ } if (loweredCallTarget == null) { - loweredCallTarget = graph.add(new HotSpotDirectCallTargetNode(parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall, + loweredCallTarget = graph.add(HotSpotDirectCallTargetNode.create(parameters, invoke.asNode().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall, callTarget.invokeKind())); } callTarget.replaceAndDelete(loweredCallTarget); @@ -255,7 +255,7 @@ * Anchor the read of the element klass to the cfg, because it is only valid when arrayClass * is an object class, which might not be the case in other parts of the compiled method. */ - return graph.unique(new FloatingReadNode(arrayHub, location, null, StampFactory.forKind(wordKind), BeginNode.prevBegin(anchor))); + return graph.unique(FloatingReadNode.create(arrayHub, location, null, StampFactory.forKind(wordKind), BeginNode.prevBegin(anchor))); } @Override @@ -293,9 +293,9 @@ private void lowerOSRStartNode(OSRStartNode osrStart) { StructuredGraph graph = osrStart.graph(); if (graph.getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { - StartNode newStart = graph.add(new StartNode()); - ParameterNode buffer = graph.unique(new ParameterNode(0, StampFactory.forKind(runtime.getTarget().wordKind))); - ForeignCallNode migrationEnd = graph.add(new ForeignCallNode(foreignCalls, OSR_MIGRATION_END, buffer)); + StartNode newStart = graph.add(StartNode.create()); + ParameterNode buffer = graph.unique(ParameterNode.create(0, StampFactory.forKind(runtime.getTarget().wordKind))); + ForeignCallNode migrationEnd = graph.add(ForeignCallNode.create(foreignCalls, OSR_MIGRATION_END, buffer)); migrationEnd.setStateAfter(osrStart.stateAfter()); newStart.setNext(migrationEnd); @@ -310,7 +310,7 @@ int size = HIRFrameStateBuilder.stackSlots(osrLocal.getKind()); int offset = localsOffset - (osrLocal.index() + size - 1) * 8; IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, osrLocal.getKind(), offset, ConstantNode.forLong(0, graph), graph, 1); - ReadNode load = graph.add(new ReadNode(buffer, location, osrLocal.stamp(), BarrierType.NONE)); + ReadNode load = graph.add(ReadNode.create(buffer, location, osrLocal.stamp(), BarrierType.NONE)); osrLocal.replaceAndDelete(load); graph.addBeforeFixed(migrationEnd, load); } @@ -368,7 +368,7 @@ throw GraalInternalError.shouldNotReachHere(); } - ForeignCallNode foreignCallNode = graph.add(new ForeignCallNode(foreignCalls, descriptor, node.stamp(), node.getArguments())); + ForeignCallNode foreignCallNode = graph.add(ForeignCallNode.create(foreignCalls, descriptor, node.stamp(), node.getArguments())); graph.replaceFixedWithFixed(node, foreignCallNode); } } @@ -393,7 +393,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), BarrierType.NONE)); + ReadNode metaspaceMethod = graph.add(ReadNode.create(hub, ConstantLocationNode.create(ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind), BarrierType.NONE)); return metaspaceMethod; } @@ -411,7 +411,7 @@ hubStamp = StampFactory.forKind(wordKind); } - FloatingReadNode memoryRead = graph.unique(new FloatingReadNode(object, location, null, hubStamp, guard, BarrierType.NONE)); + FloatingReadNode memoryRead = graph.unique(FloatingReadNode.create(object, location, null, hubStamp, guard, BarrierType.NONE)); if (config.useCompressedClassPointers) { return CompressionNode.uncompress(memoryRead, config.getKlassEncoding()); } else { @@ -429,7 +429,7 @@ writeValue = CompressionNode.compress(value, config.getKlassEncoding()); } - return graph.add(new WriteNode(object, writeValue, location, BarrierType.NONE)); + return graph.add(WriteNode.create(object, writeValue, location, BarrierType.NONE)); } @Override diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/NativeCallStubGraphBuilder.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/NativeCallStubGraphBuilder.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/NativeCallStubGraphBuilder.java Mon Aug 18 14:04:21 2014 +0200 @@ -53,10 +53,10 @@ try { ResolvedJavaMethod method = providers.getMetaAccess().lookupJavaMethod(NativeCallStubGraphBuilder.class.getMethod("libCall", Object.class, Object.class, Object.class)); StructuredGraph g = new StructuredGraph(method); - ParameterNode arg0 = g.unique(new ParameterNode(0, StampFactory.forKind(Kind.Object))); - ParameterNode arg1 = g.unique(new ParameterNode(1, StampFactory.forKind(Kind.Object))); - ParameterNode arg2 = g.unique(new ParameterNode(2, StampFactory.forKind(Kind.Object))); - FrameState frameState = g.add(new FrameState(null, method, 0, Arrays.asList(new ValueNode[]{arg0, arg1, arg2}), 3, 0, false, false, new ArrayList(), + ParameterNode arg0 = g.unique(ParameterNode.create(0, StampFactory.forKind(Kind.Object))); + ParameterNode arg1 = g.unique(ParameterNode.create(1, StampFactory.forKind(Kind.Object))); + ParameterNode arg2 = g.unique(ParameterNode.create(2, StampFactory.forKind(Kind.Object))); + FrameState frameState = g.add(FrameState.create(null, method, 0, Arrays.asList(new ValueNode[]{arg0, arg1, arg2}), 3, 0, false, false, new ArrayList(), new ArrayList())); g.start().setStateAfter(frameState); List parameters = new ArrayList<>(); @@ -84,12 +84,12 @@ throw new IllegalArgumentException("Return type not supported: " + returnType.getName()); } ResolvedJavaType type = providers.getMetaAccess().lookupJavaType(callNode.getKind().toBoxedJavaClass()); - boxedResult = g.unique(new BoxNode(callNode, type, callNode.getKind())); + boxedResult = g.unique(BoxNode.create(callNode, type, callNode.getKind())); } else { - boxedResult = g.unique(new BoxNode(ConstantNode.forLong(0, g), providers.getMetaAccess().lookupJavaType(Long.class), Kind.Long)); + boxedResult = g.unique(BoxNode.create(ConstantNode.forLong(0, g), providers.getMetaAccess().lookupJavaType(Long.class), Kind.Long)); } - ReturnNode returnNode = g.add(new ReturnNode(boxedResult)); + ReturnNode returnNode = g.add(ReturnNode.create(boxedResult)); callNode.setNext(returnNode); (new WordTypeRewriterPhase(providers.getMetaAccess(), providers.getSnippetReflection(), Kind.Long)).apply(g); return g; @@ -103,7 +103,7 @@ FixedWithNextNode last = null; for (int i = 0; i < numArgs; i++) { // load boxed array element: - LoadIndexedNode boxedElement = g.add(new LoadIndexedNode(argumentsArray, ConstantNode.forInt(i, g), Kind.Object)); + LoadIndexedNode boxedElement = g.add(LoadIndexedNode.create(argumentsArray, ConstantNode.forInt(i, g), Kind.Object)); if (i == 0) { g.start().setNext(boxedElement); last = boxedElement; @@ -122,13 +122,13 @@ int indexScaling = getArrayIndexScale(arrayElementKind); IndexedLocationNode locationNode = IndexedLocationNode.create(locationIdentity, arrayElementKind, displacement, index, g, indexScaling); Stamp wordStamp = StampFactory.forKind(providers.getCodeCache().getTarget().wordKind); - ComputeAddressNode arrayAddress = g.unique(new ComputeAddressNode(boxedElement, locationNode, wordStamp)); + ComputeAddressNode arrayAddress = g.unique(ComputeAddressNode.create(boxedElement, locationNode, wordStamp)); args.add(arrayAddress); } else { // boxed primitive value try { ResolvedJavaField field = providers.getMetaAccess().lookupJavaField(kind.toBoxedJavaClass().getDeclaredField("value")); - LoadFieldNode loadFieldNode = g.add(new LoadFieldNode(boxedElement, field)); + LoadFieldNode loadFieldNode = g.add(LoadFieldNode.create(boxedElement, field)); last.setNext(loadFieldNode); last = loadFieldNode; args.add(loadFieldNode); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -51,7 +51,11 @@ */ private final BitSet objects; - public AllocaNode(int slots, BitSet objects) { + public static AllocaNode create(int slots, BitSet objects) { + return new AllocaNodeGen(slots, objects); + } + + protected AllocaNode(int slots, BitSet objects) { super(StampFactory.forKind(HotSpotGraalRuntime.getHostWordKind())); this.slots = slots; this.objects = objects; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -42,6 +42,10 @@ private int lockDepth; + public static BeginLockScopeNode create(int lockDepth) { + return new BeginLockScopeNodeGen(lockDepth); + } + BeginLockScopeNode(int lockDepth) { super(null); this.lockDepth = lockDepth; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -36,6 +36,10 @@ private final String string; + public static CStringNode create(String string) { + return new CStringNodeGen(string); + } + CStringNode(String string) { super(null); this.string = string; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @NodeInfo public class ClassCastNode extends MacroStateSplitNode implements Canonicalizable.Binary { - public ClassCastNode(Invoke invoke) { + public static ClassCastNode create(Invoke invoke) { + return new ClassCastNodeGen(invoke); + } + + protected ClassCastNode(Invoke invoke) { super(invoke); } @@ -64,7 +68,7 @@ Class c = (Class) HotSpotObjectConstant.asObject(forJavaClass.asConstant()); if (c != null && !c.isPrimitive()) { HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) HotSpotResolvedObjectType.fromClass(c); - return new CheckCastNode(type, forObject, null, false); + return CheckCastNode.create(type, forObject, null, false); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetClassLoader0Node.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetClassLoader0Node.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetClassLoader0Node.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,7 +39,11 @@ @NodeInfo public class ClassGetClassLoader0Node extends MacroStateSplitNode implements Canonicalizable { - public ClassGetClassLoader0Node(Invoke invoke) { + public static ClassGetClassLoader0Node create(Invoke invoke) { + return new ClassGetClassLoader0NodeGen(invoke); + } + + protected ClassGetClassLoader0Node(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetComponentTypeNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @NodeInfo public class ClassGetComponentTypeNode extends MacroNode implements Canonicalizable { - public ClassGetComponentTypeNode(Invoke invoke) { + public static ClassGetComponentTypeNode create(Invoke invoke) { + return new ClassGetComponentTypeNodeGen(invoke); + } + + protected ClassGetComponentTypeNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetModifiersNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @NodeInfo public class ClassGetModifiersNode extends MacroNode implements Canonicalizable { - public ClassGetModifiersNode(Invoke invoke) { + public static ClassGetModifiersNode create(Invoke invoke) { + return new ClassGetModifiersNodeGen(invoke); + } + + protected ClassGetModifiersNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassGetSuperclassNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @NodeInfo public class ClassGetSuperclassNode extends MacroNode implements Canonicalizable { - public ClassGetSuperclassNode(Invoke invoke) { + public static ClassGetSuperclassNode create(Invoke invoke) { + return new ClassGetSuperclassNodeGen(invoke); + } + + protected ClassGetSuperclassNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsArrayNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @NodeInfo public class ClassIsArrayNode extends MacroNode implements Canonicalizable { - public ClassIsArrayNode(Invoke invoke) { + public static ClassIsArrayNode create(Invoke invoke) { + return new ClassIsArrayNodeGen(invoke); + } + + protected ClassIsArrayNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInstanceNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInstanceNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInstanceNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -40,7 +40,11 @@ @NodeInfo public class ClassIsInstanceNode extends MacroNode implements Canonicalizable { - public ClassIsInstanceNode(Invoke invoke) { + public static ClassIsInstanceNode create(Invoke invoke) { + return new ClassIsInstanceNodeGen(invoke); + } + + protected ClassIsInstanceNode(Invoke invoke) { super(invoke); } @@ -67,8 +71,8 @@ return ConstantNode.forBoolean(o != null && c.isInstance(o)); } HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) HotSpotResolvedObjectType.fromClass(c); - InstanceOfNode instanceOf = new InstanceOfNode(type, object, null); - return new ConditionalNode(instanceOf, ConstantNode.forBoolean(true), ConstantNode.forBoolean(false)); + InstanceOfNode instanceOf = InstanceOfNode.create(type, object, null); + return ConditionalNode.create(instanceOf, ConstantNode.forBoolean(true), ConstantNode.forBoolean(false)); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsInterfaceNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @NodeInfo public class ClassIsInterfaceNode extends MacroNode implements Canonicalizable { - public ClassIsInterfaceNode(Invoke invoke) { + public static ClassIsInterfaceNode create(Invoke invoke) { + return new ClassIsInterfaceNodeGen(invoke); + } + + protected ClassIsInterfaceNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassIsPrimitiveNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @NodeInfo public class ClassIsPrimitiveNode extends MacroNode implements Canonicalizable { - public ClassIsPrimitiveNode(Invoke invoke) { + public static ClassIsPrimitiveNode create(Invoke invoke) { + return new ClassIsPrimitiveNodeGen(invoke); + } + + protected ClassIsPrimitiveNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -50,6 +50,10 @@ private final CompressionOp op; private final CompressEncoding encoding; + public static CompressionNode create(CompressionOp op, ValueNode input, CompressEncoding encoding) { + return new CompressionNodeGen(op, input, encoding); + } + CompressionNode(CompressionOp op, ValueNode input, CompressEncoding encoding) { super(mkStamp(op, input.stamp(), encoding), input); this.op = op; @@ -62,11 +66,11 @@ } public static CompressionNode compress(ValueNode input, CompressEncoding encoding) { - return input.graph().unique(new CompressionNode(CompressionOp.Compress, input, encoding)); + return input.graph().unique(CompressionNode.create(CompressionOp.Compress, input, encoding)); } public static CompressionNode uncompress(ValueNode input, CompressEncoding encoding) { - return input.graph().unique(new CompressionNode(CompressionOp.Uncompress, input, encoding)); + return input.graph().unique(CompressionNode.create(CompressionOp.Uncompress, input, encoding)); } private static Constant compress(Constant c, CompressEncoding encoding) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -42,6 +42,10 @@ private LIRKind wordKind; + public static CurrentJavaThreadNode create(Kind kind) { + return new CurrentJavaThreadNodeGen(kind); + } + CurrentJavaThreadNode(Kind kind) { super(StampFactory.forKind(kind)); this.wordKind = LIRKind.value(kind); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,6 +38,10 @@ private int lockDepth; + public static CurrentLockNode create(int lockDepth) { + return new CurrentLockNodeGen(lockDepth); + } + CurrentLockNode(int lockDepth) { super(null); this.lockDepth = lockDepth; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizationFetchUnrollInfoCallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizationFetchUnrollInfoCallNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizationFetchUnrollInfoCallNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -44,7 +44,11 @@ @Input private SaveAllRegistersNode registerSaver; private final ForeignCallsProvider foreignCalls; - public DeoptimizationFetchUnrollInfoCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode registerSaver) { + public static DeoptimizationFetchUnrollInfoCallNode create(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode registerSaver) { + return new DeoptimizationFetchUnrollInfoCallNodeGen(foreignCalls, registerSaver); + } + + protected DeoptimizationFetchUnrollInfoCallNode(ForeignCallsProvider foreignCalls, ValueNode registerSaver) { super(StampFactory.forKind(Kind.fromJavaClass(FETCH_UNROLL_INFO.getResultType()))); this.registerSaver = (SaveAllRegistersNode) registerSaver; this.foreignCalls = foreignCalls; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizeCallerNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizeCallerNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizeCallerNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ private final DeoptimizationAction action; private final DeoptimizationReason reason; - public DeoptimizeCallerNode(DeoptimizationAction action, DeoptimizationReason reason) { + public static DeoptimizeCallerNode create(DeoptimizationAction action, DeoptimizationReason reason) { + return new DeoptimizeCallerNodeGen(action, reason); + } + + protected DeoptimizeCallerNode(DeoptimizationAction action, DeoptimizationReason reason) { super(StampFactory.forVoid()); this.action = action; this.reason = reason; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizingStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizingStubCall.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizingStubCall.java Mon Aug 18 14:04:21 2014 +0200 @@ -29,7 +29,11 @@ @NodeInfo public class DeoptimizingStubCall extends DeoptimizingFixedWithNextNode { - public DeoptimizingStubCall(Stamp stamp) { + public static DeoptimizingStubCall create(Stamp stamp) { + return new DeoptimizingStubCallGen(stamp); + } + + protected DeoptimizingStubCall(Stamp stamp) { super(stamp); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,6 +43,10 @@ private final int rank; + public static DimensionsNode create(int rank) { + return new DimensionsNodeGen(rank); + } + DimensionsNode(int rank) { super(null); this.rank = rank; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -47,7 +47,11 @@ private final LocationIdentity locationIdentity; - public DirectCompareAndSwapNode(ValueNode object, ValueNode offset, ValueNode expected, ValueNode newValue, LocationIdentity locationIdentity) { + public static DirectCompareAndSwapNode create(ValueNode object, ValueNode offset, ValueNode expected, ValueNode newValue, LocationIdentity locationIdentity) { + return new DirectCompareAndSwapNodeGen(object, offset, expected, newValue, locationIdentity); + } + + protected DirectCompareAndSwapNode(ValueNode object, ValueNode offset, ValueNode expected, ValueNode newValue, LocationIdentity locationIdentity) { super(expected.stamp()); this.object = object; this.offset = offset; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -36,7 +36,11 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class EndLockScopeNode extends AbstractMemoryCheckpoint implements LIRLowerable, MonitorExit, MemoryCheckpoint.Single { - public EndLockScopeNode() { + public static EndLockScopeNode create() { + return new EndLockScopeNodeGen(); + } + + protected EndLockScopeNode() { super(StampFactory.forVoid()); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EnterUnpackFramesStackFrameNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EnterUnpackFramesStackFrameNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EnterUnpackFramesStackFrameNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,11 @@ @Input private ValueNode senderFp; @Input private SaveAllRegistersNode registerSaver; - public EnterUnpackFramesStackFrameNode(ValueNode framePc, ValueNode senderSp, ValueNode senderFp, ValueNode registerSaver) { + public static EnterUnpackFramesStackFrameNode create(ValueNode framePc, ValueNode senderSp, ValueNode senderFp, ValueNode registerSaver) { + return new EnterUnpackFramesStackFrameNodeGen(framePc, senderSp, senderFp, registerSaver); + } + + protected EnterUnpackFramesStackFrameNode(ValueNode framePc, ValueNode senderSp, ValueNode senderFp, ValueNode registerSaver) { super(StampFactory.forVoid()); this.framePc = framePc; this.senderSp = senderSp; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ArrayRangePostWriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ArrayRangePostWriteBarrier.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ArrayRangePostWriteBarrier.java Mon Aug 18 14:04:21 2014 +0200 @@ -28,7 +28,11 @@ @NodeInfo public class G1ArrayRangePostWriteBarrier extends ArrayRangeWriteBarrier { - public G1ArrayRangePostWriteBarrier(ValueNode object, ValueNode startIndex, ValueNode length) { + public static G1ArrayRangePostWriteBarrier create(ValueNode object, ValueNode startIndex, ValueNode length) { + return new G1ArrayRangePostWriteBarrierGen(object, startIndex, length); + } + + protected G1ArrayRangePostWriteBarrier(ValueNode object, ValueNode startIndex, ValueNode length) { super(object, startIndex, length); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ArrayRangePreWriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ArrayRangePreWriteBarrier.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ArrayRangePreWriteBarrier.java Mon Aug 18 14:04:21 2014 +0200 @@ -28,7 +28,11 @@ @NodeInfo public class G1ArrayRangePreWriteBarrier extends ArrayRangeWriteBarrier { - public G1ArrayRangePreWriteBarrier(ValueNode object, ValueNode startIndex, ValueNode length) { + public static G1ArrayRangePreWriteBarrier create(ValueNode object, ValueNode startIndex, ValueNode length) { + return new G1ArrayRangePreWriteBarrierGen(object, startIndex, length); + } + + protected G1ArrayRangePreWriteBarrier(ValueNode object, ValueNode startIndex, ValueNode length) { super(object, startIndex, length); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PostWriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PostWriteBarrier.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PostWriteBarrier.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,7 +31,11 @@ private final boolean alwaysNull; - public G1PostWriteBarrier(ValueNode object, ValueNode value, LocationNode location, boolean precise, boolean alwaysNull) { + public static G1PostWriteBarrier create(ValueNode object, ValueNode value, LocationNode location, boolean precise, boolean alwaysNull) { + return new G1PostWriteBarrierGen(object, value, location, precise, alwaysNull); + } + + protected G1PostWriteBarrier(ValueNode object, ValueNode value, LocationNode location, boolean precise, boolean alwaysNull) { super(object, value, location, precise); this.alwaysNull = alwaysNull; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PreWriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PreWriteBarrier.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1PreWriteBarrier.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ private final boolean nullCheck; private final boolean doLoad; - public G1PreWriteBarrier(ValueNode object, ValueNode expectedObject, LocationNode location, boolean doLoad, boolean nullCheck) { + public static G1PreWriteBarrier create(ValueNode object, ValueNode expectedObject, LocationNode location, boolean doLoad, boolean nullCheck) { + return new G1PreWriteBarrierGen(object, expectedObject, location, doLoad, nullCheck); + } + + protected G1PreWriteBarrier(ValueNode object, ValueNode expectedObject, LocationNode location, boolean doLoad, boolean nullCheck) { super(object, expectedObject, location, true); this.doLoad = doLoad; this.nullCheck = nullCheck; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ReferentFieldReadBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ReferentFieldReadBarrier.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/G1ReferentFieldReadBarrier.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,11 @@ private final boolean doLoad; - public G1ReferentFieldReadBarrier(ValueNode object, ValueNode expectedObject, LocationNode location, boolean doLoad) { + public static G1ReferentFieldReadBarrier create(ValueNode object, ValueNode expectedObject, LocationNode location, boolean doLoad) { + return new G1ReferentFieldReadBarrierGen(object, expectedObject, location, doLoad); + } + + protected G1ReferentFieldReadBarrier(ValueNode object, ValueNode expectedObject, LocationNode location, boolean doLoad) { super(object, expectedObject, location, true); this.doLoad = doLoad; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @Input private ValueNode object; - public GetObjectAddressNode(ValueNode obj) { + public static GetObjectAddressNode create(ValueNode obj) { + return new GetObjectAddressNodeGen(obj); + } + + protected GetObjectAddressNode(ValueNode obj) { super(StampFactory.forKind(Kind.Long)); this.object = obj; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotDirectCallTargetNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotDirectCallTargetNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotDirectCallTargetNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @NodeInfo public class HotSpotDirectCallTargetNode extends DirectCallTargetNode { - public HotSpotDirectCallTargetNode(List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, Type callType, InvokeKind invokeKind) { + public static HotSpotDirectCallTargetNode create(List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, Type callType, InvokeKind invokeKind) { + return new HotSpotDirectCallTargetNodeGen(arguments, returnStamp, signature, target, callType, invokeKind); + } + + protected HotSpotDirectCallTargetNode(List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, Type callType, InvokeKind invokeKind) { super(arguments, returnStamp, signature, target, callType, invokeKind); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,12 @@ @Input private ValueNode metaspaceMethod; - public HotSpotIndirectCallTargetNode(ValueNode metaspaceMethod, ValueNode computedAddress, List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, + public static HotSpotIndirectCallTargetNode create(ValueNode metaspaceMethod, ValueNode computedAddress, List arguments, Stamp returnStamp, JavaType[] signature, + ResolvedJavaMethod target, Type callType, InvokeKind invokeKind) { + return new HotSpotIndirectCallTargetNodeGen(metaspaceMethod, computedAddress, arguments, returnStamp, signature, target, callType, invokeKind); + } + + protected HotSpotIndirectCallTargetNode(ValueNode metaspaceMethod, ValueNode computedAddress, List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, Type callType, InvokeKind invokeKind) { super(computedAddress, arguments, returnStamp, signature, target, callType, invokeKind); this.metaspaceMethod = metaspaceMethod; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/JumpToExceptionHandlerInCallerNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/JumpToExceptionHandlerInCallerNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/JumpToExceptionHandlerInCallerNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -40,7 +40,11 @@ @Input private ValueNode exception; @Input private ValueNode exceptionPc; - public JumpToExceptionHandlerInCallerNode(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) { + public static JumpToExceptionHandlerInCallerNode create(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) { + return new JumpToExceptionHandlerInCallerNodeGen(handlerInCallerPc, exception, exceptionPc); + } + + protected JumpToExceptionHandlerInCallerNode(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) { super(StampFactory.forVoid()); this.handlerInCallerPc = handlerInCallerPc; this.exception = exception; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveCurrentStackFrameNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveCurrentStackFrameNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveCurrentStackFrameNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @Input private SaveAllRegistersNode registerSaver; - public LeaveCurrentStackFrameNode(ValueNode registerSaver) { + public static LeaveCurrentStackFrameNode create(ValueNode registerSaver) { + return new LeaveCurrentStackFrameNodeGen(registerSaver); + } + + protected LeaveCurrentStackFrameNode(ValueNode registerSaver) { super(StampFactory.forVoid()); this.registerSaver = (SaveAllRegistersNode) registerSaver; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveDeoptimizedStackFrameNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveDeoptimizedStackFrameNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveDeoptimizedStackFrameNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,7 +41,11 @@ @Input private ValueNode frameSize; @Input private ValueNode initialInfo; - public LeaveDeoptimizedStackFrameNode(ValueNode frameSize, ValueNode initialInfo) { + public static LeaveDeoptimizedStackFrameNode create(ValueNode frameSize, ValueNode initialInfo) { + return new LeaveDeoptimizedStackFrameNodeGen(frameSize, initialInfo); + } + + protected LeaveDeoptimizedStackFrameNode(ValueNode frameSize, ValueNode initialInfo) { super(StampFactory.forVoid()); this.frameSize = frameSize; this.initialInfo = initialInfo; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveUnpackFramesStackFrameNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveUnpackFramesStackFrameNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveUnpackFramesStackFrameNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @Input private SaveAllRegistersNode registerSaver; - public LeaveUnpackFramesStackFrameNode(ValueNode registerSaver) { + public static LeaveUnpackFramesStackFrameNode create(ValueNode registerSaver) { + return new LeaveUnpackFramesStackFrameNodeGen(registerSaver); + } + + protected LeaveUnpackFramesStackFrameNode(ValueNode registerSaver) { super(StampFactory.forVoid()); this.registerSaver = (SaveAllRegistersNode) registerSaver; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,6 +37,10 @@ @NodeInfo public class MonitorCounterNode extends FloatingNode implements LIRLowerable { + public static MonitorCounterNode create() { + return new MonitorCounterNodeGen(); + } + MonitorCounterNode() { super(null); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewArrayStubCall.java Mon Aug 18 14:04:21 2014 +0200 @@ -45,7 +45,11 @@ @Input private ValueNode hub; @Input private ValueNode length; - public NewArrayStubCall(ValueNode hub, ValueNode length) { + public static NewArrayStubCall create(ValueNode hub, ValueNode length) { + return new NewArrayStubCallGen(hub, length); + } + + protected NewArrayStubCall(ValueNode hub, ValueNode length) { super(defaultStamp); this.hub = hub; this.length = length; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewInstanceStubCall.java Mon Aug 18 14:04:21 2014 +0200 @@ -44,7 +44,11 @@ @Input private ValueNode hub; - public NewInstanceStubCall(ValueNode hub) { + public static NewInstanceStubCall create(ValueNode hub) { + return new NewInstanceStubCallGen(hub); + } + + protected NewInstanceStubCall(ValueNode hub) { super(defaultStamp); this.hub = hub; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/NewMultiArrayStubCall.java Mon Aug 18 14:04:21 2014 +0200 @@ -46,7 +46,11 @@ @Input private ValueNode dims; private final int rank; - public NewMultiArrayStubCall(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode hub, int rank, ValueNode dims) { + public static NewMultiArrayStubCall create(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode hub, int rank, ValueNode dims) { + return new NewMultiArrayStubCallGen(foreignCalls, hub, rank, dims); + } + + protected NewMultiArrayStubCall(ForeignCallsProvider foreignCalls, ValueNode hub, int rank, ValueNode dims) { super(foreignCalls, NEW_MULTI_ARRAY, defaultStamp); this.hub = hub; this.rank = rank; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PatchReturnAddressNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PatchReturnAddressNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PatchReturnAddressNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,11 @@ @Input private ValueNode address; - public PatchReturnAddressNode(ValueNode address) { + public static PatchReturnAddressNode create(ValueNode address) { + return new PatchReturnAddressNodeGen(address); + } + + protected PatchReturnAddressNode(ValueNode address) { super(StampFactory.forVoid()); this.address = address; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PrefetchAllocateNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PrefetchAllocateNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PrefetchAllocateNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -36,7 +36,11 @@ @Input private ValueNode distance; @Input private ValueNode address; - public PrefetchAllocateNode(ValueNode address, ValueNode distance) { + public static PrefetchAllocateNode create(ValueNode address, ValueNode distance) { + return new PrefetchAllocateNodeGen(address, distance); + } + + protected PrefetchAllocateNode(ValueNode address, ValueNode distance) { super(StampFactory.forVoid()); this.address = address; this.distance = distance; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PushInterpreterFrameNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PushInterpreterFrameNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PushInterpreterFrameNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,7 +41,11 @@ @Input private ValueNode senderSp; @Input private ValueNode initialInfo; - public PushInterpreterFrameNode(ValueNode frameSize, ValueNode framePc, ValueNode senderSp, ValueNode initialInfo) { + public static PushInterpreterFrameNode create(ValueNode frameSize, ValueNode framePc, ValueNode senderSp, ValueNode initialInfo) { + return new PushInterpreterFrameNodeGen(frameSize, framePc, senderSp, initialInfo); + } + + protected PushInterpreterFrameNode(ValueNode frameSize, ValueNode framePc, ValueNode senderSp, ValueNode initialInfo) { super(StampFactory.forVoid()); this.frameSize = frameSize; this.framePc = framePc; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SaveAllRegistersNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SaveAllRegistersNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SaveAllRegistersNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,7 +39,11 @@ private SaveRegistersOp saveRegistersOp; - public SaveAllRegistersNode() { + public static SaveAllRegistersNode create() { + return new SaveAllRegistersNodeGen(); + } + + protected SaveAllRegistersNode() { super(StampFactory.forKind(Kind.Long)); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialArrayRangeWriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialArrayRangeWriteBarrier.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialArrayRangeWriteBarrier.java Mon Aug 18 14:04:21 2014 +0200 @@ -28,7 +28,11 @@ @NodeInfo public class SerialArrayRangeWriteBarrier extends ArrayRangeWriteBarrier { - public SerialArrayRangeWriteBarrier(ValueNode object, ValueNode startIndex, ValueNode length) { + public static SerialArrayRangeWriteBarrier create(ValueNode object, ValueNode startIndex, ValueNode length) { + return new SerialArrayRangeWriteBarrierGen(object, startIndex, length); + } + + protected SerialArrayRangeWriteBarrier(ValueNode object, ValueNode startIndex, ValueNode length) { super(object, startIndex, length); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialWriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialWriteBarrier.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SerialWriteBarrier.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,7 +31,11 @@ private final boolean alwaysNull; - public SerialWriteBarrier(ValueNode object, LocationNode location, boolean precise, boolean alwaysNull) { + public static SerialWriteBarrier create(ValueNode object, LocationNode location, boolean precise, boolean alwaysNull) { + return new SerialWriteBarrierGen(object, location, precise, alwaysNull); + } + + protected SerialWriteBarrier(ValueNode object, LocationNode location, boolean precise, boolean alwaysNull) { super(object, null, location, precise); this.alwaysNull = alwaysNull; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetAnchorNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetAnchorNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetAnchorNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,7 +31,11 @@ @NodeInfo(allowedUsageTypes = {InputType.Value, InputType.Anchor, InputType.Guard}) public class SnippetAnchorNode extends FixedWithNextNode implements Simplifiable, GuardingNode { - public SnippetAnchorNode() { + public static SnippetAnchorNode create() { + return new SnippetAnchorNodeGen(); + } + + protected SnippetAnchorNode() { super(StampFactory.object()); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetLocationProxyNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetLocationProxyNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SnippetLocationProxyNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,11 @@ @Input(InputType.Unchecked) private ValueNode location; - public SnippetLocationProxyNode(ValueNode location) { + public static SnippetLocationProxyNode create(ValueNode location) { + return new SnippetLocationProxyNodeGen(location); + } + + protected SnippetLocationProxyNode(ValueNode location) { super(StampFactory.object()); this.location = location; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -45,7 +45,11 @@ private final ForeignCallDescriptor descriptor; - public StubForeignCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, ValueNode... arguments) { + public static StubForeignCallNode create(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, ValueNode... arguments) { + return new StubForeignCallNodeGen(foreignCalls, descriptor, arguments); + } + + protected StubForeignCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, ValueNode... arguments) { super(StampFactory.forKind(Kind.fromJavaClass(descriptor.getResultType()))); this.arguments = new NodeInputList<>(this, arguments); this.descriptor = descriptor; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubStartNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubStartNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubStartNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,7 +34,11 @@ private final Stub stub; - public StubStartNode(Stub stub) { + public static StubStartNode create(Stub stub) { + return new StubStartNodeGen(stub); + } + + protected StubStartNode(Stub stub) { this.stub = stub; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -52,7 +52,11 @@ * @param target points to the start of an nmethod * @param frameState the parameters will be taken from this FrameState */ - public TailcallNode(ValueNode target, FrameState frameState) { + public static TailcallNode create(ValueNode target, FrameState frameState) { + return new TailcallNodeGen(target, frameState); + } + + protected TailcallNode(ValueNode target, FrameState frameState) { super(StampFactory.forVoid()); this.target = target; this.frameState = frameState; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/UncommonTrapCallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/UncommonTrapCallNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/UncommonTrapCallNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -45,7 +45,11 @@ @Input private SaveAllRegistersNode registerSaver; private final ForeignCallsProvider foreignCalls; - public UncommonTrapCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode registerSaver, ValueNode trapRequest) { + public static UncommonTrapCallNode create(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode registerSaver, ValueNode trapRequest) { + return new UncommonTrapCallNodeGen(foreignCalls, registerSaver, trapRequest); + } + + protected UncommonTrapCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ValueNode registerSaver, ValueNode trapRequest) { super(StampFactory.forKind(Kind.fromJavaClass(UNCOMMON_TRAP.getResultType()))); this.trapRequest = trapRequest; this.registerSaver = (SaveAllRegistersNode) registerSaver; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,11 @@ private final String format; @Input private ValueNode value; - public VMErrorNode(String format, ValueNode value) { + public static VMErrorNode create(String format, ValueNode value) { + return new VMErrorNodeGen(format, value); + } + + protected VMErrorNode(String format, ValueNode value) { super(StampFactory.forVoid()); this.format = format; this.value = value; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -91,7 +91,7 @@ ConstantNode klassNode = ConstantNode.forConstant(klass, metaAccess, graph); Stamp stamp = StampFactory.exactNonNull(metaAccess.lookupJavaType(Class.class)); - FloatingReadNode freadNode = graph.unique(new FloatingReadNode(klassNode, location, null, stamp)); + FloatingReadNode freadNode = graph.unique(FloatingReadNode.create(klassNode, location, null, stamp)); if (HotSpotObjectConstant.isCompressed(constant)) { return CompressionNode.compress(freadNode, oopEncoding); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -84,7 +84,7 @@ FrameState osrState = osr.stateAfter(); osr.setStateAfter(null); - OSRStartNode osrStart = graph.add(new OSRStartNode()); + OSRStartNode osrStart = graph.add(OSRStartNode.create()); StartNode start = graph.start(); FixedNode next = osr.next(); osr.setNext(null); @@ -100,7 +100,7 @@ * we need to drop the stamp since the types we see during OSR may be too precise * (if a branch was not parsed for example). */ - proxy.replaceAndDelete(graph.unique(new OSRLocalNode(i, proxy.stamp().unrestricted()))); + proxy.replaceAndDelete(graph.unique(OSRLocalNode.create(i, proxy.stamp().unrestricted()))); } else { assert value == null || value instanceof OSRLocalNode; } diff -r cc7aaa92c27d -r 06c15e88d383 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 Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -63,7 +63,7 @@ private static void addReadNodeBarriers(ReadNode node, StructuredGraph graph) { if (node.getBarrierType() == BarrierType.PRECISE) { assert useG1GC(); - G1ReferentFieldReadBarrier barrier = graph.add(new G1ReferentFieldReadBarrier(node.object(), node, node.location(), false)); + G1ReferentFieldReadBarrier barrier = graph.add(G1ReferentFieldReadBarrier.create(node.object(), node, node.location(), false)); graph.addAfterFixed(node, barrier); } else { assert node.getBarrierType() == BarrierType.NONE : "Non precise read barrier has been attached to read node."; @@ -71,7 +71,7 @@ } protected static void addG1PreWriteBarrier(FixedAccessNode node, ValueNode object, ValueNode value, LocationNode location, boolean doLoad, boolean nullCheck, StructuredGraph graph) { - G1PreWriteBarrier preBarrier = graph.add(new G1PreWriteBarrier(object, value, location, doLoad, nullCheck)); + G1PreWriteBarrier preBarrier = graph.add(G1PreWriteBarrier.create(object, value, location, doLoad, nullCheck)); preBarrier.setStateBefore(node.stateBefore()); node.setNullCheck(false); node.setStateBefore(null); @@ -80,13 +80,13 @@ protected void addG1PostWriteBarrier(FixedAccessNode node, ValueNode object, ValueNode value, LocationNode location, boolean precise, StructuredGraph graph) { final boolean alwaysNull = StampTool.isObjectAlwaysNull(value); - graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(object, value, location, precise, alwaysNull))); + graph.addAfterFixed(node, graph.add(G1PostWriteBarrier.create(object, value, location, precise, alwaysNull))); } protected void addSerialPostWriteBarrier(FixedAccessNode node, ValueNode object, ValueNode value, LocationNode location, boolean precise, StructuredGraph graph) { final boolean alwaysNull = StampTool.isObjectAlwaysNull(value); final LocationNode loc = (precise ? location : null); - graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(object, loc, precise, alwaysNull))); + graph.addAfterFixed(node, graph.add(SerialWriteBarrier.create(object, loc, precise, alwaysNull))); } private void addWriteNodeBarriers(WriteNode node, StructuredGraph graph) { @@ -157,13 +157,13 @@ private static void addArrayRangeBarriers(ArrayRangeWriteNode node, StructuredGraph graph) { if (useG1GC()) { if (!node.isInitialization()) { - G1ArrayRangePreWriteBarrier g1ArrayRangePreWriteBarrier = graph.add(new G1ArrayRangePreWriteBarrier(node.getArray(), node.getIndex(), node.getLength())); + G1ArrayRangePreWriteBarrier g1ArrayRangePreWriteBarrier = graph.add(G1ArrayRangePreWriteBarrier.create(node.getArray(), node.getIndex(), node.getLength())); graph.addBeforeFixed(node, g1ArrayRangePreWriteBarrier); } - G1ArrayRangePostWriteBarrier g1ArrayRangePostWriteBarrier = graph.add(new G1ArrayRangePostWriteBarrier(node.getArray(), node.getIndex(), node.getLength())); + G1ArrayRangePostWriteBarrier g1ArrayRangePostWriteBarrier = graph.add(G1ArrayRangePostWriteBarrier.create(node.getArray(), node.getIndex(), node.getLength())); graph.addAfterFixed(node, g1ArrayRangePostWriteBarrier); } else { - SerialArrayRangeWriteBarrier serialArrayRangeWriteBarrier = graph.add(new SerialArrayRangeWriteBarrier(node.getArray(), node.getIndex(), node.getLength())); + SerialArrayRangeWriteBarrier serialArrayRangeWriteBarrier = graph.add(SerialArrayRangeWriteBarrier.create(node.getArray(), node.getIndex(), node.getLength())); graph.addAfterFixed(node, serialArrayRangeWriteBarrier); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyCallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyCallNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyCallNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -58,6 +58,11 @@ private boolean disjoint; private boolean uninitialized; + public static ArrayCopyCallNode create(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, Kind elementKind, boolean aligned, boolean disjoint, + boolean uninitialized) { + return new ArrayCopyCallNodeGen(src, srcPos, dest, destPos, length, elementKind, aligned, disjoint, uninitialized); + } + ArrayCopyCallNode(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, Kind elementKind, boolean aligned, boolean disjoint, boolean uninitialized) { super(StampFactory.forVoid()); assert elementKind != null; @@ -72,6 +77,10 @@ this.uninitialized = uninitialized; } + public static ArrayCopyCallNode create(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, Kind elementKind, boolean disjoint) { + return new ArrayCopyCallNodeGen(src, srcPos, dest, destPos, length, elementKind, disjoint); + } + ArrayCopyCallNode(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, Kind elementKind, boolean disjoint) { this(src, srcPos, dest, destPos, length, elementKind, false, disjoint, false); } @@ -113,10 +122,10 @@ } private ValueNode computeBase(ValueNode base, ValueNode pos) { - FixedWithNextNode basePtr = graph().add(new GetObjectAddressNode(base)); + FixedWithNextNode basePtr = graph().add(GetObjectAddressNode.create(base)); graph().addBeforeFixed(this, basePtr); ValueNode loc = IndexedLocationNode.create(getLocationIdentity(), elementKind, arrayBaseOffset(elementKind), pos, graph(), arrayIndexScale(elementKind)); - return graph().unique(new ComputeAddressNode(basePtr, loc, StampFactory.forKind(Kind.Long))); + return graph().unique(ComputeAddressNode.create(basePtr, loc, StampFactory.forKind(Kind.Long))); } @Override @@ -131,7 +140,7 @@ if (len.stamp().getStackKind() != Kind.Long) { len = IntegerConvertNode.convert(len, StampFactory.forKind(Kind.Long), graph()); } - ForeignCallNode call = graph.add(new ForeignCallNode(Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getForeignCalls(), desc, srcAddr, destAddr, len)); + ForeignCallNode call = graph.add(ForeignCallNode.create(Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getForeignCalls(), desc, srcAddr, destAddr, len)); call.setStateAfter(stateAfter()); graph.replaceFixedWithFixed(this, call); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -42,7 +42,11 @@ @NodeInfo public class ArrayCopyNode extends MacroStateSplitNode implements Virtualizable, Lowerable { - public ArrayCopyNode(Invoke invoke) { + public static ArrayCopyNode create(Invoke invoke) { + return new ArrayCopyNodeGen(invoke); + } + + protected ArrayCopyNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,11 @@ @NodeInfo public class CallSiteTargetNode extends MacroStateSplitNode implements Canonicalizable, Lowerable { - public CallSiteTargetNode(Invoke invoke) { + public static CallSiteTargetNode create(Invoke invoke) { + return new CallSiteTargetNodeGen(invoke); + } + + protected CallSiteTargetNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompositeValueClassSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompositeValueClassSubstitutions.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompositeValueClassSubstitutions.java Mon Aug 18 14:04:21 2014 +0200 @@ -47,7 +47,11 @@ @NodeInfo public static class CompositeValueClassGetNode extends PureFunctionMacroNode { - public CompositeValueClassGetNode(Invoke invoke) { + public static CompositeValueClassGetNode create(Invoke invoke) { + return new CompositeValueClassSubstitutions_CompositeValueClassGetNodeGen(invoke); + } + + protected CompositeValueClassGetNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotNodeClassSubstitutions.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotNodeClassSubstitutions.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotNodeClassSubstitutions.java Mon Aug 18 14:04:21 2014 +0200 @@ -47,7 +47,11 @@ @NodeInfo public static class NodeClassGetNode extends PureFunctionMacroNode { - public NodeClassGetNode(Invoke invoke) { + public static NodeClassGetNode create(Invoke invoke) { + return new HotSpotNodeClassSubstitutions_NodeClassGetNodeGen(invoke); + } + + protected NodeClassGetNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java Mon Aug 18 14:04:21 2014 +0200 @@ -78,9 +78,9 @@ public void lower(LoadExceptionObjectNode loadExceptionObject, HotSpotRegistersProvider registers, LoweringTool tool) { if (USE_C_RUNTIME) { StructuredGraph graph = loadExceptionObject.graph(); - ReadRegisterNode thread = graph.add(new ReadRegisterNode(registers.getThreadRegister(), true, false)); + ReadRegisterNode thread = graph.add(ReadRegisterNode.create(registers.getThreadRegister(), true, false)); graph.addBeforeFixed(loadExceptionObject, thread); - ForeignCallNode loadExceptionC = graph.add(new ForeignCallNode(providers.getForeignCalls(), LOAD_AND_CLEAR_EXCEPTION, thread)); + ForeignCallNode loadExceptionC = graph.add(ForeignCallNode.create(providers.getForeignCalls(), LOAD_AND_CLEAR_EXCEPTION, thread)); loadExceptionC.setStateAfter(loadExceptionObject.stateAfter()); graph.replaceFixedWithFixed(loadExceptionObject, loadExceptionC); } else { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MethodHandleNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MethodHandleNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MethodHandleNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -56,7 +56,11 @@ private JavaType replacementReturnType; @Input private final NodeInputList replacementArguments; - public MethodHandleNode(Invoke invoke) { + public static MethodHandleNode create(Invoke invoke) { + return new MethodHandleNodeGen(invoke); + } + + protected MethodHandleNode(Invoke invoke) { super(invoke); MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget(); @@ -232,7 +236,7 @@ ValueNode argument = arguments.get(index); ResolvedJavaType argumentType = StampTool.typeOrNull(argument.stamp()); if (argumentType == null || (argumentType.isAssignableFrom(targetType) && !argumentType.equals(targetType))) { - PiNode piNode = graph().unique(new PiNode(argument, StampFactory.declared(targetType))); + PiNode piNode = graph().unique(PiNode.create(argument, StampFactory.declared(targetType))); arguments.set(index, piNode); } } @@ -271,10 +275,10 @@ // If there is already replacement information, use that instead. MethodCallTargetNode callTarget; if (replacementTargetMethod == null) { - callTarget = new SelfReplacingMethodCallTargetNode(invokeKind, targetMethod, targetArguments, returnType, getTargetMethod(), originalArguments, getReturnType()); + callTarget = SelfReplacingMethodCallTargetNode.create(invokeKind, targetMethod, targetArguments, returnType, getTargetMethod(), originalArguments, getReturnType()); } else { ValueNode[] args = replacementArguments.toArray(new ValueNode[replacementArguments.size()]); - callTarget = new SelfReplacingMethodCallTargetNode(invokeKind, targetMethod, targetArguments, returnType, replacementTargetMethod, args, replacementReturnType); + callTarget = SelfReplacingMethodCallTargetNode.create(invokeKind, targetMethod, targetArguments, returnType, replacementTargetMethod, args, replacementReturnType); } graph().add(callTarget); @@ -285,9 +289,9 @@ // (usually java.lang.Object). InvokeNode invoke; if (stamp() == StampFactory.forVoid()) { - invoke = new InvokeNode(callTarget, getBci(), stamp()); + invoke = InvokeNode.create(callTarget, getBci(), stamp()); } else { - invoke = new InvokeNode(callTarget, getBci()); + invoke = InvokeNode.create(callTarget, getBci()); } graph().add(invoke); invoke.setStateAfter(stateAfter()); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java Mon Aug 18 14:04:21 2014 +0200 @@ -495,8 +495,8 @@ if (nodes.isEmpty()) { // Only insert the nodes if this is the first monitorenter being lowered. JavaType returnType = initCounter.getMethod().getSignature().getReturnType(initCounter.getMethod().getDeclaringClass()); - MethodCallTargetNode callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, initCounter.getMethod(), new ValueNode[0], returnType)); - InvokeNode invoke = graph.add(new InvokeNode(callTarget, 0)); + MethodCallTargetNode callTarget = graph.add(MethodCallTargetNode.create(InvokeKind.Static, initCounter.getMethod(), new ValueNode[0], returnType)); + InvokeNode invoke = graph.add(InvokeNode.create(callTarget, 0)); invoke.setStateAfter(graph.start().stateAfter()); graph.addAfterFixed(graph.start(), invoke); @@ -508,10 +508,10 @@ returnType = checkCounter.getMethod().getSignature().getReturnType(checkCounter.getMethod().getDeclaringClass()); String msg = "unbalanced monitors in " + graph.method().format("%H.%n(%p)") + ", count = %d"; ConstantNode errMsg = ConstantNode.forConstant(HotSpotObjectConstant.forObject(msg), providers.getMetaAccess(), graph); - callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, checkCounter.getMethod(), new ValueNode[]{errMsg}, returnType)); - invoke = graph.add(new InvokeNode(callTarget, 0)); + callTarget = graph.add(MethodCallTargetNode.create(InvokeKind.Static, checkCounter.getMethod(), new ValueNode[]{errMsg}, returnType)); + invoke = graph.add(InvokeNode.create(callTarget, 0)); List stack = Collections.emptyList(); - FrameState stateAfter = new FrameState(graph.method(), BytecodeFrame.AFTER_BCI, new ValueNode[0], stack, new ValueNode[0], new MonitorIdNode[0], false, false); + FrameState stateAfter = FrameState.create(graph.method(), BytecodeFrame.AFTER_BCI, new ValueNode[0], stack, new ValueNode[0], new MonitorIdNode[0], false, false); invoke.setStateAfter(graph.add(stateAfter)); graph.addBeforeFixed(ret, invoke); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,11 @@ @NodeInfo public class ObjectCloneNode extends MacroStateSplitNode implements VirtualizableAllocation, ArrayLengthProvider { - public ObjectCloneNode(Invoke invoke) { + public static ObjectCloneNode create(Invoke invoke) { + return new ObjectCloneNodeGen(invoke); + } + + protected ObjectCloneNode(Invoke invoke) { super(invoke); } @@ -84,16 +88,16 @@ type = getConcreteType(getObject().stamp(), tool.assumptions(), tool.getMetaAccess()); if (type != null) { StructuredGraph newGraph = new StructuredGraph(); - ParameterNode param = newGraph.unique(new ParameterNode(0, getObject().stamp())); - NewInstanceNode newInstance = newGraph.add(new NewInstanceNode(type, true)); + ParameterNode param = newGraph.unique(ParameterNode.create(0, getObject().stamp())); + NewInstanceNode newInstance = newGraph.add(NewInstanceNode.create(type, true)); newGraph.addAfterFixed(newGraph.start(), newInstance); - ReturnNode returnNode = newGraph.add(new ReturnNode(newInstance)); + ReturnNode returnNode = newGraph.add(ReturnNode.create(newInstance)); newGraph.addAfterFixed(newInstance, returnNode); for (ResolvedJavaField field : type.getInstanceFields(true)) { - LoadFieldNode load = newGraph.add(new LoadFieldNode(param, field)); + LoadFieldNode load = newGraph.add(LoadFieldNode.create(param, field)); newGraph.addBeforeFixed(returnNode, load); - newGraph.addBeforeFixed(returnNode, newGraph.add(new StoreFieldNode(newInstance, field, load))); + newGraph.addBeforeFixed(returnNode, newGraph.add(StoreFieldNode.create(newInstance, field, load))); } return lowerReplacement(newGraph, tool); } @@ -109,7 +113,7 @@ /* * Looks at the given stamp and determines if it is an exact type (or can be assumed to be an * exact type) and if it is a cloneable type. - * + * * If yes, then the exact type is returned, otherwise it returns null. */ private static ResolvedJavaType getConcreteType(Stamp stamp, Assumptions assumptions, MetaAccessProvider metaAccess) { @@ -155,13 +159,13 @@ } ResolvedJavaType type = getConcreteType(obj.stamp(), tool.getAssumptions(), tool.getMetaAccessProvider()); if (type != null && !type.isArray()) { - VirtualInstanceNode newVirtual = new VirtualInstanceNode(type, true); + VirtualInstanceNode newVirtual = VirtualInstanceNode.create(type, true); ResolvedJavaField[] fields = newVirtual.getFields(); ValueNode[] state = new ValueNode[fields.length]; final LoadFieldNode[] loads = new LoadFieldNode[fields.length]; for (int i = 0; i < fields.length; i++) { - state[i] = loads[i] = new LoadFieldNode(obj, fields[i]); + state[i] = loads[i] = LoadFieldNode.create(obj, fields[i]); tool.addNode(loads[i]); } tool.createVirtualObject(newVirtual, state, Collections. emptyList()); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectGetClassNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectGetClassNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectGetClassNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,7 +41,11 @@ @NodeInfo public class ObjectGetClassNode extends MacroNode implements Virtualizable, Canonicalizable { - public ObjectGetClassNode(Invoke invoke) { + public static ObjectGetClassNode create(Invoke invoke) { + return new ObjectGetClassNodeGen(invoke); + } + + protected ObjectGetClassNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,11 @@ @NodeInfo public class ReflectionGetCallerClassNode extends MacroStateSplitNode implements Canonicalizable, Lowerable { - public ReflectionGetCallerClassNode(Invoke invoke) { + public static ReflectionGetCallerClassNode create(Invoke invoke) { + return new ReflectionGetCallerClassNodeGen(invoke); + } + + protected ReflectionGetCallerClassNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemIdentityHashCodeNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemIdentityHashCodeNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemIdentityHashCodeNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @NodeInfo public class SystemIdentityHashCodeNode extends PureFunctionMacroNode { - public SystemIdentityHashCodeNode(Invoke invoke) { + public static SystemIdentityHashCodeNode create(Invoke invoke) { + return new SystemIdentityHashCodeNodeGen(invoke); + } + + protected SystemIdentityHashCodeNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopyNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopyNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopyNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -44,6 +44,10 @@ private Kind elementKind; + public static UnsafeArrayCopyNode create(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, ValueNode layoutHelper, Kind elementKind) { + return new UnsafeArrayCopyNodeGen(src, srcPos, dest, destPos, length, layoutHelper, elementKind); + } + UnsafeArrayCopyNode(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, ValueNode layoutHelper, Kind elementKind) { super(StampFactory.forVoid()); assert layoutHelper == null || elementKind == null; @@ -56,11 +60,19 @@ this.elementKind = elementKind; } - private UnsafeArrayCopyNode(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, Kind elementKind) { + public static UnsafeArrayCopyNode create(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, Kind elementKind) { + return new UnsafeArrayCopyNodeGen(src, srcPos, dest, destPos, length, elementKind); + } + + UnsafeArrayCopyNode(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, Kind elementKind) { this(src, srcPos, dest, destPos, length, null, elementKind); } - private UnsafeArrayCopyNode(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, ValueNode layoutHelper) { + public static UnsafeArrayCopyNode create(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, ValueNode layoutHelper) { + return new UnsafeArrayCopyNodeGen(src, srcPos, dest, destPos, length, layoutHelper); + } + + UnsafeArrayCopyNode(ValueNode src, ValueNode srcPos, ValueNode dest, ValueNode destPos, ValueNode length, ValueNode layoutHelper) { this(src, srcPos, dest, destPos, length, layoutHelper, null); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Mon Aug 18 14:04:21 2014 +0200 @@ -189,14 +189,14 @@ GraphKit kit = new GraphKit(graph, providers); ParameterNode[] params = createParameters(kit, args); - ReadRegisterNode thread = kit.append(new ReadRegisterNode(providers.getRegisters().getThreadRegister(), true, false)); + ReadRegisterNode thread = kit.append(ReadRegisterNode.create(providers.getRegisters().getThreadRegister(), true, false)); ValueNode result = createTargetCall(kit, params, thread); kit.createInvoke(StubUtil.class, "handlePendingException", thread, ConstantNode.forBoolean(isObjectResult, graph)); if (isObjectResult) { InvokeNode object = kit.createInvoke(HotSpotReplacementsUtil.class, "getAndClearObjectResult", thread); result = kit.createInvoke(StubUtil.class, "verifyObject", object); } - kit.append(new ReturnNode(linkage.getDescriptor().getResultType() == void.class ? null : result)); + kit.append(ReturnNode.create(linkage.getDescriptor().getResultType() == void.class ? null : result)); if (Debug.isDumpEnabled()) { Debug.dump(graph, "Initial stub graph"); @@ -224,7 +224,7 @@ } else { stamp = StampFactory.forKind(type.getKind()); } - ParameterNode param = kit.unique(new ParameterNode(i, stamp)); + ParameterNode param = kit.unique(ParameterNode.create(i, stamp)); params[i] = param; } return params; @@ -235,9 +235,9 @@ ValueNode[] targetArguments = new ValueNode[1 + params.length]; targetArguments[0] = thread; System.arraycopy(params, 0, targetArguments, 1, params.length); - return kit.append(new StubForeignCallNode(providers.getForeignCalls(), target.getDescriptor(), targetArguments)); + return kit.append(StubForeignCallNode.create(providers.getForeignCalls(), target.getDescriptor(), targetArguments)); } else { - return kit.append(new StubForeignCallNode(providers.getForeignCalls(), target.getDescriptor(), params)); + return kit.append(StubForeignCallNode.create(providers.getForeignCalls(), target.getDescriptor(), params)); } } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Mon Aug 18 14:04:21 2014 +0200 @@ -148,7 +148,7 @@ try (Scope d = Debug.sandbox("CompilingStub", DebugScope.getConfig(), providers.getCodeCache(), debugScopeContext())) { final StructuredGraph graph = getGraph(); if (!(graph.start() instanceof StubStartNode)) { - StubStartNode newStart = graph.add(new StubStartNode(Stub.this)); + StubStartNode newStart = graph.add(StubStartNode.create(Stub.this)); newStart.setStateAfter(graph.start().stateAfter()); graph.replaceFixed(graph.start(), newStart); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java Mon Aug 18 14:04:21 2014 +0200 @@ -64,7 +64,7 @@ Method found = null; for (Method method : stubClass.getDeclaredMethods()) { if (Modifier.isStatic(method.getModifiers()) && method.getAnnotation(NodeIntrinsic.class) != null && method.getName().equals(name)) { - if (method.getAnnotation(NodeIntrinsic.class).value() == StubForeignCallNode.class) { + if (method.getAnnotation(NodeIntrinsic.class).value().equals(StubForeignCallNode.class)) { assert found == null : "found more than one foreign call named " + name + " in " + stubClass; assert method.getParameterTypes().length != 0 && method.getParameterTypes()[0] == ForeignCallDescriptor.class : "first parameter of foreign call '" + name + "' in " + stubClass + " must be of type " + ForeignCallDescriptor.class.getSimpleName(); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -110,7 +110,11 @@ */ private final Object nextPlaceholder; - public BlockPlaceholderNode(BytecodeParser builder) { + public static BlockPlaceholderNode create(BytecodeParser builder) { + return new GraphBuilderPhase_Instance_BlockPlaceholderNodeGen(builder); + } + + protected BlockPlaceholderNode(BytecodeParser builder) { super(StampFactory.forVoid()); nextPlaceholder = builder.placeholders; builder.placeholders = this; @@ -322,7 +326,7 @@ @Override protected void handleUnresolvedLoadConstant(JavaType type) { assert !graphBuilderConfig.eagerResolving(); - append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); + append(DeoptimizeNode.create(InvalidateRecompile, Unresolved)); } /** @@ -332,7 +336,7 @@ @Override protected void handleUnresolvedCheckCast(JavaType type, ValueNode object) { assert !graphBuilderConfig.eagerResolving(); - append(new FixedGuardNode(currentGraph.unique(new IsNullNode(object)), Unresolved, InvalidateRecompile)); + append(FixedGuardNode.create(currentGraph.unique(IsNullNode.create(object)), Unresolved, InvalidateRecompile)); frameState.apush(appendConstant(Constant.NULL_OBJECT)); } @@ -343,9 +347,9 @@ @Override protected void handleUnresolvedInstanceOf(JavaType type, ValueNode object) { assert !graphBuilderConfig.eagerResolving(); - BlockPlaceholderNode successor = currentGraph.add(new BlockPlaceholderNode(this)); - DeoptimizeNode deopt = currentGraph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved)); - append(new IfNode(currentGraph.unique(new IsNullNode(object)), successor, deopt, 1)); + BlockPlaceholderNode successor = currentGraph.add(BlockPlaceholderNode.create(this)); + DeoptimizeNode deopt = currentGraph.add(DeoptimizeNode.create(InvalidateRecompile, Unresolved)); + append(IfNode.create(currentGraph.unique(IsNullNode.create(object)), successor, deopt, 1)); lastInstr = successor; frameState.ipush(appendConstant(Constant.INT_0)); } @@ -356,7 +360,7 @@ @Override protected void handleUnresolvedNewInstance(JavaType type) { assert !graphBuilderConfig.eagerResolving(); - append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); + append(DeoptimizeNode.create(InvalidateRecompile, Unresolved)); } /** @@ -366,7 +370,7 @@ @Override protected void handleUnresolvedNewObjectArray(JavaType type, ValueNode length) { assert !graphBuilderConfig.eagerResolving(); - append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); + append(DeoptimizeNode.create(InvalidateRecompile, Unresolved)); } /** @@ -376,7 +380,7 @@ @Override protected void handleUnresolvedNewMultiArray(JavaType type, List dims) { assert !graphBuilderConfig.eagerResolving(); - append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); + append(DeoptimizeNode.create(InvalidateRecompile, Unresolved)); } /** @@ -387,7 +391,7 @@ @Override protected void handleUnresolvedLoadField(JavaField field, ValueNode receiver) { assert !graphBuilderConfig.eagerResolving(); - append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); + append(DeoptimizeNode.create(InvalidateRecompile, Unresolved)); } /** @@ -399,7 +403,7 @@ @Override protected void handleUnresolvedStoreField(JavaField field, ValueNode value, ValueNode receiver) { assert !graphBuilderConfig.eagerResolving(); - append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); + append(DeoptimizeNode.create(InvalidateRecompile, Unresolved)); } /** @@ -409,7 +413,7 @@ @Override protected void handleUnresolvedExceptionType(Representation representation, JavaType type) { assert !graphBuilderConfig.eagerResolving(); - append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); + append(DeoptimizeNode.create(InvalidateRecompile, Unresolved)); } /** @@ -418,7 +422,7 @@ */ protected void handleUnresolvedInvoke(JavaMethod javaMethod, InvokeKind invokeKind) { assert !graphBuilderConfig.eagerResolving(); - append(new DeoptimizeNode(InvalidateRecompile, Unresolved)); + append(DeoptimizeNode.create(InvalidateRecompile, Unresolved)); } private DispatchBeginNode handleException(ValueNode exceptionObject, int bci) { @@ -440,12 +444,12 @@ DispatchBeginNode dispatchBegin; if (exceptionObject == null) { - dispatchBegin = currentGraph.add(new ExceptionObjectNode(metaAccess)); + dispatchBegin = currentGraph.add(ExceptionObjectNode.create(metaAccess)); dispatchState.apush(dispatchBegin); dispatchState.setRethrowException(true); dispatchBegin.setStateAfter(dispatchState.create(bci)); } else { - dispatchBegin = currentGraph.add(new DispatchBeginNode()); + dispatchBegin = currentGraph.add(DispatchBeginNode.create()); dispatchState.apush(exceptionObject); dispatchBegin.setStateAfter(dispatchState.create(bci)); dispatchState.setRethrowException(true); @@ -458,82 +462,82 @@ @Override protected ValueNode genLoadIndexed(ValueNode array, ValueNode index, Kind kind) { - return new LoadIndexedNode(array, index, kind); + return LoadIndexedNode.create(array, index, kind); } @Override protected ValueNode genStoreIndexed(ValueNode array, ValueNode index, Kind kind, ValueNode value) { - return new StoreIndexedNode(array, index, kind, value); + return StoreIndexedNode.create(array, index, kind, value); } @Override protected ValueNode genIntegerAdd(Kind kind, ValueNode x, ValueNode y) { - return new IntegerAddNode(x, y); + return IntegerAddNode.create(x, y); } @Override protected ValueNode genIntegerSub(Kind kind, ValueNode x, ValueNode y) { - return new IntegerSubNode(x, y); + return IntegerSubNode.create(x, y); } @Override protected ValueNode genIntegerMul(Kind kind, ValueNode x, ValueNode y) { - return new IntegerMulNode(x, y); + return IntegerMulNode.create(x, y); } @Override protected ValueNode genFloatAdd(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { - return new FloatAddNode(x, y, isStrictFP); + return FloatAddNode.create(x, y, isStrictFP); } @Override protected ValueNode genFloatSub(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { - return new FloatSubNode(x, y, isStrictFP); + return FloatSubNode.create(x, y, isStrictFP); } @Override protected ValueNode genFloatMul(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { - return new FloatMulNode(x, y, isStrictFP); + return FloatMulNode.create(x, y, isStrictFP); } @Override protected ValueNode genFloatDiv(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { - return new FloatDivNode(x, y, isStrictFP); + return FloatDivNode.create(x, y, isStrictFP); } @Override protected ValueNode genFloatRem(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP) { - return new FloatRemNode(x, y, isStrictFP); + return FloatRemNode.create(x, y, isStrictFP); } @Override protected ValueNode genIntegerDiv(Kind kind, ValueNode x, ValueNode y) { - return new IntegerDivNode(x, y); + return IntegerDivNode.create(x, y); } @Override protected ValueNode genIntegerRem(Kind kind, ValueNode x, ValueNode y) { - return new IntegerRemNode(x, y); + return IntegerRemNode.create(x, y); } @Override protected ValueNode genNegateOp(ValueNode x) { - return (new NegateNode(x)); + return (NegateNode.create(x)); } @Override protected ValueNode genLeftShift(Kind kind, ValueNode x, ValueNode y) { - return new LeftShiftNode(x, y); + return LeftShiftNode.create(x, y); } @Override protected ValueNode genRightShift(Kind kind, ValueNode x, ValueNode y) { - return new RightShiftNode(x, y); + return RightShiftNode.create(x, y); } @Override protected ValueNode genUnsignedRightShift(Kind kind, ValueNode x, ValueNode y) { - return new UnsignedRightShiftNode(x, y); + return UnsignedRightShiftNode.create(x, y); } @Override @@ -543,37 +547,37 @@ @Override protected ValueNode genOr(Kind kind, ValueNode x, ValueNode y) { - return new OrNode(x, y); + return OrNode.create(x, y); } @Override protected ValueNode genXor(Kind kind, ValueNode x, ValueNode y) { - return new XorNode(x, y); + return XorNode.create(x, y); } @Override protected ValueNode genNormalizeCompare(ValueNode x, ValueNode y, boolean isUnorderedLess) { - return new NormalizeCompareNode(x, y, isUnorderedLess); + return NormalizeCompareNode.create(x, y, isUnorderedLess); } @Override protected ValueNode genFloatConvert(FloatConvert op, ValueNode input) { - return new FloatConvertNode(op, input); + return FloatConvertNode.create(op, input); } @Override protected ValueNode genNarrow(ValueNode input, int bitCount) { - return new NarrowNode(input, bitCount); + return NarrowNode.create(input, bitCount); } @Override protected ValueNode genSignExtend(ValueNode input, int bitCount) { - return new SignExtendNode(input, bitCount); + return SignExtendNode.create(input, bitCount); } @Override protected ValueNode genZeroExtend(ValueNode input, int bitCount) { - return new ZeroExtendNode(input, bitCount); + return ZeroExtendNode.create(input, bitCount); } @Override @@ -584,17 +588,17 @@ @Override protected ValueNode genObjectEquals(ValueNode x, ValueNode y) { - return new ObjectEqualsNode(x, y); + return ObjectEqualsNode.create(x, y); } @Override protected ValueNode genIntegerEquals(ValueNode x, ValueNode y) { - return new IntegerEqualsNode(x, y); + return IntegerEqualsNode.create(x, y); } @Override protected ValueNode genIntegerLessThan(ValueNode x, ValueNode y) { - return new IntegerLessThanNode(x, y); + return IntegerLessThanNode.create(x, y); } @Override @@ -603,49 +607,49 @@ } protected ValueNode genIfNode(ValueNode condition, ValueNode falseSuccessor, ValueNode trueSuccessor, double d) { - return new IfNode((LogicNode) condition, (FixedNode) falseSuccessor, (FixedNode) trueSuccessor, d); + return IfNode.create((LogicNode) condition, (FixedNode) falseSuccessor, (FixedNode) trueSuccessor, d); } @Override protected void genThrow() { ValueNode exception = frameState.apop(); - append(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), NullCheckException, InvalidateReprofile, true)); + append(FixedGuardNode.create(currentGraph.unique(IsNullNode.create(exception)), NullCheckException, InvalidateReprofile, true)); lastInstr.setNext(handleException(exception, bci())); } @Override protected ValueNode createCheckCast(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck, boolean forStoreCheck) { - return new CheckCastNode(type, object, profileForTypeCheck, forStoreCheck); + return CheckCastNode.create(type, object, profileForTypeCheck, forStoreCheck); } @Override protected ValueNode createInstanceOf(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck) { - return new InstanceOfNode(type, object, profileForTypeCheck); + return InstanceOfNode.create(type, object, profileForTypeCheck); } @Override protected ValueNode genConditional(ValueNode x) { - return new ConditionalNode((LogicNode) x); + return ConditionalNode.create((LogicNode) x); } @Override protected NewInstanceNode createNewInstance(ResolvedJavaType type, boolean fillContents) { - return new NewInstanceNode(type, fillContents); + return NewInstanceNode.create(type, fillContents); } @Override protected NewArrayNode createNewArray(ResolvedJavaType elementType, ValueNode length, boolean fillContents) { - return new NewArrayNode(elementType, length, fillContents); + return NewArrayNode.create(elementType, length, fillContents); } @Override protected NewMultiArrayNode createNewMultiArray(ResolvedJavaType type, List dimensions) { - return new NewMultiArrayNode(type, dimensions.toArray(new ValueNode[0])); + return NewMultiArrayNode.create(type, dimensions.toArray(new ValueNode[0])); } @Override protected ValueNode genLoadField(ValueNode receiver, ResolvedJavaField field) { - return new LoadFieldNode(receiver, field); + return LoadFieldNode.create(receiver, field); } @Override @@ -653,12 +657,12 @@ if (StampTool.isObjectNonNull(receiver.stamp())) { return; } - BlockPlaceholderNode trueSucc = currentGraph.add(new BlockPlaceholderNode(this)); - BlockPlaceholderNode falseSucc = currentGraph.add(new BlockPlaceholderNode(this)); - append(new IfNode(currentGraph.unique(new IsNullNode(receiver)), trueSucc, falseSucc, 0.01)); + BlockPlaceholderNode trueSucc = currentGraph.add(BlockPlaceholderNode.create(this)); + BlockPlaceholderNode falseSucc = currentGraph.add(BlockPlaceholderNode.create(this)); + append(IfNode.create(currentGraph.unique(IsNullNode.create(receiver)), trueSucc, falseSucc, 0.01)); lastInstr = falseSucc; - BytecodeExceptionNode exception = currentGraph.add(new BytecodeExceptionNode(metaAccess, NullPointerException.class)); + BytecodeExceptionNode exception = currentGraph.add(BytecodeExceptionNode.create(metaAccess, NullPointerException.class)); exception.setStateAfter(frameState.create(bci())); trueSucc.setNext(exception); exception.setNext(handleException(exception, bci())); @@ -666,12 +670,12 @@ @Override protected void emitBoundsCheck(ValueNode index, ValueNode length) { - BlockPlaceholderNode trueSucc = currentGraph.add(new BlockPlaceholderNode(this)); - BlockPlaceholderNode falseSucc = currentGraph.add(new BlockPlaceholderNode(this)); - append(new IfNode(currentGraph.unique(new IntegerBelowNode(index, length)), trueSucc, falseSucc, 0.99)); + BlockPlaceholderNode trueSucc = currentGraph.add(BlockPlaceholderNode.create(this)); + BlockPlaceholderNode falseSucc = currentGraph.add(BlockPlaceholderNode.create(this)); + append(IfNode.create(currentGraph.unique(IntegerBelowNode.create(index, length)), trueSucc, falseSucc, 0.99)); lastInstr = trueSucc; - BytecodeExceptionNode exception = currentGraph.add(new BytecodeExceptionNode(metaAccess, ArrayIndexOutOfBoundsException.class, index)); + BytecodeExceptionNode exception = currentGraph.add(BytecodeExceptionNode.create(metaAccess, ArrayIndexOutOfBoundsException.class, index)); exception.setStateAfter(frameState.create(bci())); falseSucc.setNext(exception); exception.setNext(handleException(exception, bci())); @@ -679,12 +683,12 @@ @Override protected ValueNode genArrayLength(ValueNode x) { - return new ArrayLengthNode(x); + return ArrayLengthNode.create(x); } @Override protected ValueNode genStoreField(ValueNode receiver, ResolvedJavaField field, ValueNode value) { - return new StoreFieldNode(receiver, field, value); + return StoreFieldNode.create(receiver, field, value); } /** @@ -785,7 +789,7 @@ private void appendInvoke(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args) { Kind resultType = targetMethod.getSignature().getReturnKind(); if (DeoptALot.getValue()) { - append(new DeoptimizeNode(DeoptimizationAction.None, RuntimeConstraint)); + append(DeoptimizeNode.create(DeoptimizationAction.None, RuntimeConstraint)); frameState.pushReturn(resultType, ConstantNode.defaultForKind(resultType, currentGraph)); return; } @@ -798,7 +802,7 @@ emitExplicitExceptions(args[0], null); if (invokeKind != InvokeKind.Special && this.optimisticOpts.useTypeCheckHints()) { JavaTypeProfile profile = profilingInfo.getTypeProfile(bci()); - args[0] = TypeProfileProxyNode.create(args[0], profile); + args[0] = TypeProfileProxyNode.proxify(args[0], profile); } } MethodCallTargetNode callTarget = currentGraph.add(createMethodCallTarget(invokeKind, targetMethod, args, returnType)); @@ -820,18 +824,18 @@ } protected MethodCallTargetNode createMethodCallTarget(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args, JavaType returnType) { - return new MethodCallTargetNode(invokeKind, targetMethod, args, returnType); + return MethodCallTargetNode.create(invokeKind, targetMethod, args, returnType); } protected InvokeNode createInvoke(CallTargetNode callTarget, Kind resultType) { - InvokeNode invoke = append(new InvokeNode(callTarget, bci())); + InvokeNode invoke = append(InvokeNode.create(callTarget, bci())); frameState.pushReturn(resultType, invoke); return invoke; } protected InvokeWithExceptionNode createInvokeWithException(CallTargetNode callTarget, Kind resultType) { DispatchBeginNode exceptionEdge = handleException(null, bci()); - InvokeWithExceptionNode invoke = append(new InvokeWithExceptionNode(callTarget, exceptionEdge, bci())); + InvokeWithExceptionNode invoke = append(InvokeWithExceptionNode.create(callTarget, exceptionEdge, bci())); frameState.pushReturn(resultType, invoke); BciBlock nextBlock = currentBlock.getSuccessor(0); invoke.setStateAfter(frameState.create(nextBlock.startBci)); @@ -851,13 +855,13 @@ throw new BailoutException("unbalanced monitors"); } - append(new ReturnNode(x)); + append(ReturnNode.create(x)); } @Override protected MonitorEnterNode genMonitorEnter(ValueNode x) { - MonitorIdNode monitorId = currentGraph.add(new MonitorIdNode(frameState.lockDepth())); - MonitorEnterNode monitorEnter = append(new MonitorEnterNode(x, monitorId)); + MonitorIdNode monitorId = currentGraph.add(MonitorIdNode.create(frameState.lockDepth())); + MonitorEnterNode monitorEnter = append(MonitorEnterNode.create(x, monitorId)); frameState.pushLock(x, monitorId); return monitorEnter; } @@ -869,7 +873,7 @@ if (GraphUtil.originalValue(lockedObject) != GraphUtil.originalValue(x)) { throw new BailoutException("unbalanced monitors: mismatch at monitorexit, %s != %s", GraphUtil.originalValue(x), GraphUtil.originalValue(lockedObject)); } - MonitorExitNode monitorExit = append(new MonitorExitNode(x, monitorId, returnValue)); + MonitorExitNode monitorExit = append(MonitorExitNode.create(x, monitorId, returnValue)); return monitorExit; } @@ -894,7 +898,7 @@ ValueNode local = frameState.loadLocal(localIndex); JsrScope scope = currentBlock.jsrScope; int retAddress = scope.nextReturnAddress(); - append(new FixedGuardNode(currentGraph.unique(new IntegerEqualsNode(local, ConstantNode.forInt(retAddress, currentGraph))), JavaSubroutineMismatch, InvalidateReprofile)); + append(FixedGuardNode.create(currentGraph.unique(IntegerEqualsNode.create(local, ConstantNode.forInt(retAddress, currentGraph))), JavaSubroutineMismatch, InvalidateReprofile)); if (!successor.jsrScope.equals(scope.pop())) { throw new JsrNotSupportedBailout("unstructured control flow (ret leaves more than one scope)"); } @@ -904,7 +908,7 @@ @Override protected void genIntegerSwitch(ValueNode value, ArrayList actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors) { double[] successorProbabilities = successorProbabilites(actualSuccessors.size(), keySuccessors, keyProbabilities); - IntegerSwitchNode switchNode = append(new IntegerSwitchNode(value, actualSuccessors.size(), keys, keyProbabilities, keySuccessors)); + IntegerSwitchNode switchNode = append(IntegerSwitchNode.create(value, actualSuccessors.size(), keys, keyProbabilities, keySuccessors)); for (int i = 0; i < actualSuccessors.size(); i++) { switchNode.setBlockSuccessor(i, createBlockTarget(successorProbabilities[i], actualSuccessors.get(i), frameState)); } @@ -999,7 +1003,7 @@ HIRFrameStateBuilder newState = state.copy(); for (BciBlock loop : exitLoops) { LoopBeginNode loopBegin = (LoopBeginNode) loop.firstInstruction; - LoopExitNode loopExit = currentGraph.add(new LoopExitNode(loopBegin)); + LoopExitNode loopExit = currentGraph.add(LoopExitNode.create(loopBegin)); if (lastLoopExit != null) { lastLoopExit.setNext(loopExit); } @@ -1022,7 +1026,7 @@ private FixedNode createTarget(double probability, BciBlock block, HIRFrameStateBuilder stateAfter) { assert probability >= 0 && probability <= 1.01 : probability; if (isNeverExecutedCode(probability)) { - return currentGraph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode)); + return currentGraph.add(DeoptimizeNode.create(InvalidateReprofile, UnreachedCode)); } else { assert block != null; return createTarget(block, stateAfter); @@ -1039,7 +1043,7 @@ * return a placeholder that later can be replaced with a MergeNode when we see * this block again. */ - block.firstInstruction = currentGraph.add(new BlockPlaceholderNode(this)); + block.firstInstruction = currentGraph.add(BlockPlaceholderNode.create(this)); Target target = checkLoopExit(block.firstInstruction, block, state); FixedNode result = target.fixed; block.entryState = target.state == state ? state.copy() : target.state; @@ -1061,7 +1065,7 @@ * the loop begin node created before. */ LoopBeginNode loopBegin = (LoopBeginNode) block.firstInstruction; - Target target = checkLoopExit(currentGraph.add(new LoopEndNode(loopBegin)), block, state); + Target target = checkLoopExit(currentGraph.add(LoopEndNode.create(loopBegin)), block, state); FixedNode result = target.fixed; ((HIRFrameStateBuilder) block.entryState).merge(loopBegin, target.state); @@ -1080,9 +1084,9 @@ BlockPlaceholderNode placeholder = (BlockPlaceholderNode) block.firstInstruction; // The EndNode for the already existing edge. - AbstractEndNode end = currentGraph.add(new EndNode()); + AbstractEndNode end = currentGraph.add(EndNode.create()); // The MergeNode that replaces the placeholder. - MergeNode mergeNode = currentGraph.add(new MergeNode()); + MergeNode mergeNode = currentGraph.add(MergeNode.create()); FixedNode next = placeholder.next(); placeholder.setNext(end); @@ -1095,7 +1099,7 @@ MergeNode mergeNode = (MergeNode) block.firstInstruction; // The EndNode for the newly merged edge. - AbstractEndNode newEnd = currentGraph.add(new EndNode()); + AbstractEndNode newEnd = currentGraph.add(EndNode.create()); Target target = checkLoopExit(newEnd, block, state); FixedNode result = target.fixed; ((HIRFrameStateBuilder) block.entryState).merge(mergeNode, target.state); @@ -1186,7 +1190,7 @@ assert frameState.stackSize() == 1 : frameState; ValueNode exception = frameState.apop(); synchronizedEpilogue(BytecodeFrame.AFTER_EXCEPTION_BCI, null); - append(new UnwindNode(exception)); + append(UnwindNode.create(exception)); } private void synchronizedEpilogue(int bci, ValueNode returnValue) { @@ -1219,9 +1223,9 @@ if (skippedType.isAssignableFrom(resolvedCatchType)) { BciBlock nextBlock = block.getSuccessorCount() == 1 ? unwindBlock() : block.getSuccessor(1); ValueNode exception = frameState.stackAt(0); - FixedNode trueSuccessor = currentGraph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode)); + FixedNode trueSuccessor = currentGraph.add(DeoptimizeNode.create(InvalidateReprofile, UnreachedCode)); FixedNode nextDispatch = createTarget(nextBlock, frameState); - append(new IfNode(currentGraph.unique(new InstanceOfNode((ResolvedJavaType) catchType, exception, null)), trueSuccessor, nextDispatch, 0)); + append(IfNode.create(currentGraph.unique(InstanceOfNode.create((ResolvedJavaType) catchType, exception, null)), trueSuccessor, nextDispatch, 0)); return; } } @@ -1230,7 +1234,7 @@ if (initialized) { BciBlock nextBlock = block.getSuccessorCount() == 1 ? unwindBlock() : block.getSuccessor(1); ValueNode exception = frameState.stackAt(0); - CheckCastNode checkCast = currentGraph.add(new CheckCastNode((ResolvedJavaType) catchType, exception, null, false)); + CheckCastNode checkCast = currentGraph.add(CheckCastNode.create((ResolvedJavaType) catchType, exception, null, false)); frameState.apop(); frameState.push(Kind.Object, checkCast); FixedNode catchSuccessor = createTarget(block.getSuccessor(0), frameState); @@ -1238,7 +1242,7 @@ frameState.push(Kind.Object, exception); FixedNode nextDispatch = createTarget(nextBlock, frameState); checkCast.setNext(catchSuccessor); - append(new IfNode(currentGraph.unique(new InstanceOfNode((ResolvedJavaType) catchType, exception, null)), checkCast, nextDispatch, 0.5)); + append(IfNode.create(currentGraph.unique(InstanceOfNode.create((ResolvedJavaType) catchType, exception, null)), checkCast, nextDispatch, 0.5)); } else { handleUnresolvedExceptionType(Representation.ObjectHub, catchType); } @@ -1260,8 +1264,8 @@ // Create the loop header block, which later will merge the backward branches of // the // loop. - AbstractEndNode preLoopEnd = currentGraph.add(new EndNode()); - LoopBeginNode loopBegin = currentGraph.add(new LoopBeginNode()); + AbstractEndNode preLoopEnd = currentGraph.add(EndNode.create()); + LoopBeginNode loopBegin = currentGraph.add(LoopBeginNode.create()); lastInstr.setNext(preLoopEnd); // Add the single non-loop predecessor of the loop header. loopBegin.addForwardEnd(preLoopEnd); @@ -1313,7 +1317,7 @@ if (block.jsrScope != JsrScope.EMPTY_SCOPE) { throw new BailoutException("OSR into a JSR scope is not supported"); } - EntryMarkerNode x = append(new EntryMarkerNode()); + EntryMarkerNode x = append(EntryMarkerNode.create()); frameState.insertProxies(x); x.setStateAfter(frameState.create(bci)); } @@ -1330,7 +1334,7 @@ frameState.clearNonLiveLocals(currentBlock, liveness, false); } if (lastInstr instanceof StateSplit) { - if (lastInstr.getClass() == BeginNode.class) { + if (lastInstr.getClass() == BeginNode.getGenClass()) { // BeginNodes do not need a frame state } else { StateSplit stateSplit = (StateSplit) lastInstr; @@ -1365,9 +1369,9 @@ private InfopointNode createInfoPointNode(InfopointReason reason) { if (graphBuilderConfig.insertFullDebugInfo()) { - return new FullInfopointNode(reason, frameState.create(bci())); + return FullInfopointNode.create(reason, frameState.create(bci())); } else { - return new SimpleInfopointNode(reason, new BytecodePosition(null, method, bci())); + return SimpleInfopointNode.create(reason, new BytecodePosition(null, method, bci())); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java Mon Aug 18 14:04:21 2014 +0200 @@ -56,7 +56,7 @@ int index = 0; if (!method.isStatic()) { // add the receiver - ParameterNode receiver = graph.unique(new ParameterNode(javaIndex, StampFactory.declaredNonNull(method.getDeclaringClass()))); + ParameterNode receiver = graph.unique(ParameterNode.create(javaIndex, StampFactory.declaredNonNull(method.getDeclaringClass()))); storeLocal(javaIndex, receiver); javaIndex = 1; index = 1; @@ -76,7 +76,7 @@ } else { stamp = StampFactory.forKind(kind); } - ParameterNode param = graph.unique(new ParameterNode(index, stamp)); + ParameterNode param = graph.unique(ParameterNode.create(index, stamp)); storeLocal(javaIndex, param); javaIndex += stackSlots(kind); index++; @@ -123,7 +123,7 @@ } public FrameState create(int bci) { - return graph.add(new FrameState(method, bci, locals, Arrays.asList(stack).subList(0, stackSize), lockedObjects, monitorIds, rethrowException, false)); + return graph.add(FrameState.create(method, bci, locals, Arrays.asList(stack).subList(0, stackSize), lockedObjects, monitorIds, rethrowException, false)); } @Override @@ -190,7 +190,7 @@ return null; } - ValuePhiNode phi = graph.addWithoutUnique(new ValuePhiNode(currentValue.stamp().unrestricted(), block)); + ValuePhiNode phi = graph.addWithoutUnique(ValuePhiNode.create(currentValue.stamp().unrestricted(), block)); for (int i = 0; i < block.phiPredecessorCount(); i++) { phi.addInput(currentValue); } @@ -288,7 +288,7 @@ } assert !block.isPhiAtMerge(value) : "phi function for this block already created"; - ValuePhiNode phi = graph.addWithoutUnique(new ValuePhiNode(value.stamp().unrestricted(), block)); + ValuePhiNode phi = graph.addWithoutUnique(ValuePhiNode.create(value.stamp().unrestricted(), block)); phi.addInput(value); return phi; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java Mon Aug 18 14:04:21 2014 +0200 @@ -86,7 +86,7 @@ return rawStride; } if (op instanceof IntegerSubNode) { - return graph().unique(new NegateNode(rawStride)); + return graph().unique(NegateNode.create(rawStride)); } throw GraalInternalError.shouldNotReachHere(); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java Mon Aug 18 14:04:21 2014 +0200 @@ -62,13 +62,13 @@ range = IntegerArithmeticNode.sub(graph, range, ConstantNode.forIntegerStamp(stamp, 1, graph)); } } - IntegerDivNode div = graph.add(new IntegerDivNode(range, iv.strideNode())); + IntegerDivNode div = graph.add(IntegerDivNode.create(range, iv.strideNode())); graph.addBeforeFixed(loop.entryPoint(), div); ConstantNode zero = ConstantNode.forIntegerStamp(stamp, 0, graph); if (assumePositive) { return div; } - return graph.unique(new ConditionalNode(graph.unique(new IntegerLessThanNode(zero, div)), div, zero)); + return graph.unique(ConditionalNode.create(graph.unique(IntegerLessThanNode.create(zero, div)), div, zero)); } public boolean isConstantMaxTripCount() { @@ -147,16 +147,16 @@ if (oneOff) { v1 = sub(graph, v1, one); } - cond = graph.unique(new IntegerLessThanNode(v1, end)); + cond = graph.unique(IntegerLessThanNode.create(v1, end)); } else { assert iv.direction() == Direction.Down; IntegerArithmeticNode v1 = add(graph, ConstantNode.forIntegerStamp(stamp, IntegerStamp.defaultMinValue(stamp.getBits()), graph), sub(graph, one, iv.strideNode())); if (oneOff) { v1 = add(graph, v1, one); } - cond = graph.unique(new IntegerLessThanNode(end, v1)); + cond = graph.unique(IntegerLessThanNode.create(end, v1)); } - overflowGuard = graph.unique(new GuardNode(cond, BeginNode.prevBegin(loop.entryPoint()), DeoptimizationReason.LoopLimitCheck, DeoptimizationAction.InvalidateRecompile, true, + overflowGuard = graph.unique(GuardNode.create(cond, BeginNode.prevBegin(loop.entryPoint()), DeoptimizationReason.LoopLimitCheck, DeoptimizationAction.InvalidateRecompile, true, Constant.NULL_OBJECT)); // TODO gd: use speculation loop.loopBegin().setOverflowGuard(overflowGuard); return overflowGuard; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedOffsetInductionVariable.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedOffsetInductionVariable.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedOffsetInductionVariable.java Mon Aug 18 14:04:21 2014 +0200 @@ -86,7 +86,7 @@ @Override public ValueNode strideNode() { if (value instanceof IntegerSubNode && base.valueNode() == value.getY()) { - return graph().unique(new NegateNode(base.strideNode())); + return graph().unique(NegateNode.create(base.strideNode())); } return base.strideNode(); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java Mon Aug 18 14:04:21 2014 +0200 @@ -312,9 +312,9 @@ if (newEarlyExit == null) { continue; } - MergeNode merge = graph.add(new MergeNode()); - AbstractEndNode originalEnd = graph.add(new EndNode()); - AbstractEndNode newEnd = graph.add(new EndNode()); + MergeNode merge = graph.add(MergeNode.create()); + AbstractEndNode originalEnd = graph.add(EndNode.create()); + AbstractEndNode newEnd = graph.add(EndNode.create()); merge.addForwardEnd(originalEnd); merge.addForwardEnd(newEnd); loopEarlyExit.setNext(originalEnd); @@ -354,9 +354,9 @@ if (newVpn != null) { PhiNode phi; if (vpn instanceof ValueProxyNode) { - phi = graph.addWithoutUnique(new ValuePhiNode(vpn.stamp(), merge)); + phi = graph.addWithoutUnique(ValuePhiNode.create(vpn.stamp(), merge)); } else if (vpn instanceof GuardProxyNode) { - phi = graph.addWithoutUnique(new GuardPhiNode(merge)); + phi = graph.addWithoutUnique(GuardPhiNode.create(merge)); } else { throw GraalInternalError.shouldNotReachHere(); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java Mon Aug 18 14:04:21 2014 +0200 @@ -154,7 +154,7 @@ if (value != null) { return value; } - BeginNode newValue = graph.add(new BeginNode()); + BeginNode newValue = graph.add(BeginNode.create()); seenNode.put(original, newValue); return newValue; } @@ -163,7 +163,7 @@ if (value != null) { return value; } - BeginNode newValue = graph.add(new BeginNode()); + BeginNode newValue = graph.add(BeginNode.create()); seenNode.put(original, newValue); return newValue; } @@ -172,7 +172,7 @@ if (value != null) { return value; } - EndNode newValue = graph.add(new EndNode()); + EndNode newValue = graph.add(EndNode.create()); seenNode.put(original, newValue); return newValue; } @@ -189,11 +189,11 @@ private static PhiNode patchPhi(StructuredGraph graph, PhiNode phi, MergeNode merge) { PhiNode ret; if (phi instanceof ValuePhiNode) { - ret = new ValuePhiNode(phi.stamp(), merge); + ret = ValuePhiNode.create(phi.stamp(), merge); } else if (phi instanceof GuardPhiNode) { - ret = new GuardPhiNode(merge); + ret = GuardPhiNode.create(merge); } else if (phi instanceof MemoryPhiNode) { - ret = new MemoryPhiNode(merge, ((MemoryPhiNode) phi).getLocationIdentity()); + ret = MemoryPhiNode.create(merge, ((MemoryPhiNode) phi).getLocationIdentity()); } else { throw GraalInternalError.shouldNotReachHere(); } @@ -312,12 +312,12 @@ if (endsToMerge.size() == 1) { AbstractEndNode end = endsToMerge.get(0); assert end.usages().isEmpty(); - newExit = graph.add(new BeginNode()); + newExit = graph.add(BeginNode.create()); end.replaceAtPredecessor(newExit); end.safeDelete(); } else { assert endsToMerge.size() > 1; - MergeNode newExitMerge = graph.add(new MergeNode()); + MergeNode newExitMerge = graph.add(MergeNode.create()); newExit = newExitMerge; FrameState state = loopBegin.stateAfter(); FrameState duplicateState = null; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentWhole.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentWhole.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentWhole.java Mon Aug 18 14:04:21 2014 +0200 @@ -79,7 +79,7 @@ public Node replacement(Node o) { if (o == entry) { if (endNode == null) { - endNode = graph.add(new EndNode()); + endNode = graph.add(EndNode.create()); } return endNode; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeGenerator.java --- a/graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeGenerator.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeGenerator.java Mon Aug 18 14:04:21 2014 +0200 @@ -23,6 +23,7 @@ package com.oracle.graal.nodeinfo.processor; import static com.oracle.truffle.dsl.processor.java.ElementUtils.*; +import static java.util.Arrays.*; import static javax.lang.model.element.Modifier.*; import java.util.*; @@ -60,6 +61,11 @@ this.NodeSuccessorList = getType("com.oracle.graal.graph.NodeSuccessorList"); } + /** + * Returns a type element given a canonical name. + * + * @throw {@link NoClassDefFoundError} if a type element does not exist for {@code name} + */ public TypeElement getType(String name) { TypeElement typeElement = env.getProcessingEnv().getElementUtils().getTypeElement(name); if (typeElement == null) { @@ -121,14 +127,11 @@ } } - public boolean isAssignable(Element from, Element to) { + public boolean isAssignableWithErasure(Element from, Element to) { Types types = env.getProcessingEnv().getTypeUtils(); TypeMirror fromType = types.erasure(from.asType()); TypeMirror toType = types.erasure(to.asType()); - boolean res = types.isAssignable(fromType, toType); - // System.out.printf("%s:%s is %sassignable to %s:%s%n", from, fromType, res ? "" : "NOT ", -// to, toType); - return res; + return types.isAssignable(fromType, toType); } public void scanFields(TypeElement node, FieldScanner scanner) { @@ -151,7 +154,7 @@ throw new ElementException(field, "Field cannot be both input and successor"); } else if (isNonOptionalInput && isOptionalInput) { throw new ElementException(field, "Inputs must be either optional or non-optional"); - } else if (isAssignable(field, NodeInputList)) { + } else if (isAssignableWithErasure(field, NodeInputList)) { if (!modifiers.contains(FINAL)) { throw new ElementException(field, "Input list field must be final"); } @@ -162,7 +165,7 @@ return; } } else { - if (!isAssignable(field, Node) && field.getKind() == ElementKind.INTERFACE) { + if (!isAssignableWithErasure(field, Node) && field.getKind() == ElementKind.INTERFACE) { throw new ElementException(field, "Input field type must be an interface or assignable to Node"); } if (modifiers.contains(FINAL)) { @@ -179,7 +182,7 @@ } } } else if (isSuccessor) { - if (isAssignable(field, NodeSuccessorList)) { + if (isAssignableWithErasure(field, NodeSuccessorList)) { if (!modifiers.contains(FINAL)) { throw new ElementException(field, "Successor list field must be final"); } @@ -190,7 +193,7 @@ return; } } else { - if (!isAssignable(field, Node)) { + if (!isAssignableWithErasure(field, Node)) { throw new ElementException(field, "Successor field must be a Node type"); } if (modifiers.contains(FINAL)) { @@ -208,13 +211,13 @@ } } else { - if (isAssignable(field, Node) && !field.getSimpleName().contentEquals("Null")) { + if (isAssignableWithErasure(field, Node) && !field.getSimpleName().contentEquals("Null")) { throw new ElementException(field, "Suspicious Node field: " + field); } - if (isAssignable(field, NodeInputList)) { + if (isAssignableWithErasure(field, NodeInputList)) { throw new ElementException(field, "Suspicious NodeInputList field"); } - if (isAssignable(field, NodeSuccessorList)) { + if (isAssignableWithErasure(field, NodeSuccessorList)) { throw new ElementException(field, "Suspicious NodeSuccessorList field"); } if (!scanner.scanDataField(field)) { @@ -226,6 +229,37 @@ } while (!isObject(getSuperType(currentClazz).asType())); } + /** + * Determines if two parameter lists contain the + * {@linkplain Types#isSameType(TypeMirror, TypeMirror) same} types. + */ + private boolean parametersMatch(List p1, List p2) { + if (p1.size() == p2.size()) { + for (int i = 0; i < p1.size(); i++) { + if (!env.getProcessingEnv().getTypeUtils().isSameType(p1.get(i).asType(), p2.get(i).asType())) { + return false; + } + } + return true; + } + return false; + } + + /** + * Searches a type for a method based on a given name and parameter types. + */ + public ExecutableElement findMethod(TypeElement type, String name, List parameters) { + List methods = ElementFilter.methodsIn(type.getEnclosedElements()); + for (ExecutableElement method : methods) { + if (method.getSimpleName().toString().equals(name)) { + if (parametersMatch(method.getParameters(), parameters)) { + return method; + } + } + } + return null; + } + public CodeCompilationUnit process(TypeElement node) { CodeCompilationUnit compilationUnit = new CodeCompilationUnit(); @@ -239,11 +273,15 @@ nodeGenElement.setSuperClass(node.asType()); for (ExecutableElement constructor : ElementFilter.constructorsIn(node.getEnclosedElements())) { - if (constructor.getModifiers().contains(Modifier.PRIVATE)) { - // ignore private constructors - continue; + if (constructor.getModifiers().contains(PUBLIC)) { + throw new ElementException(constructor, "Node class constructor must not be public"); } - nodeGenElement.add(createSuperConstructor(nodeGenElement, constructor)); + + checkFactoryMethodExists(node, newClassName, constructor); + + CodeExecutableElement subConstructor = createConstructor(nodeGenElement, constructor); + subConstructor.getModifiers().removeAll(Arrays.asList(PUBLIC, PRIVATE, PROTECTED)); + nodeGenElement.add(subConstructor); } DeclaredType generatedNode = (DeclaredType) ElementUtils.getType(getProcessingEnv(), GeneratedNode.class); @@ -257,7 +295,33 @@ return compilationUnit; } - private CodeExecutableElement createSuperConstructor(TypeElement type, ExecutableElement element) { + /** + * Checks that a public static factory method named {@code "create"} exists in {@code node} + * whose signature matches that of a given constructor. + * + * @throws ElementException if the check fails + */ + private void checkFactoryMethodExists(TypeElement node, String newClassName, ExecutableElement constructor) { + ExecutableElement create = findMethod(node, "create", constructor.getParameters()); + if (create == null) { + Formatter f = new Formatter(); + f.format("public static %s create(", node.getSimpleName()); + String sep = ""; + Formatter callArgs = new Formatter(); + for (VariableElement v : constructor.getParameters()) { + f.format("%s%s %s", sep, ElementUtils.getSimpleName(v.asType()), v.getSimpleName()); + callArgs.format("%s%s", sep, v.getSimpleName()); + sep = ", "; + } + f.format(") { return new %s(%s); }", newClassName, callArgs); + throw new ElementException(constructor, "Missing Node class factory method '%s'", f); + } + if (!create.getModifiers().containsAll(asList(PUBLIC, STATIC))) { + throw new ElementException(constructor, "Node class factory method must be public and static"); + } + } + + private CodeExecutableElement createConstructor(TypeElement type, ExecutableElement element) { CodeExecutableElement executable = CodeExecutableElement.clone(getProcessingEnv(), element); // to create a constructor we have to set the return type to null.(TODO needs fix) diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeProcessor.java --- a/graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeProcessor.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodeinfo.processor/src/com/oracle/graal/nodeinfo/processor/GraphNodeProcessor.java Mon Aug 18 14:04:21 2014 +0200 @@ -47,7 +47,11 @@ } void errorMessage(Element element, String format, Object... args) { - processingEnv.getMessager().printMessage(Kind.ERROR, String.format(format, args), element); + message(Kind.ERROR, element, format, args); + } + + void message(Kind kind, Element element, String format, Object... args) { + processingEnv.getMessager().printMessage(kind, String.format(format, args), element); } /** @@ -124,6 +128,8 @@ } catch (Throwable t) { if (!isBug367599(t)) { reportException(element, t); + } else { + message(Kind.NOTE, element, t.toString()); } } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodeinfo/src/com/oracle/graal/nodeinfo/GeneratedNode.java --- a/graal/com.oracle.graal.nodeinfo/src/com/oracle/graal/nodeinfo/GeneratedNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodeinfo/src/com/oracle/graal/nodeinfo/GeneratedNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -25,7 +25,7 @@ import java.lang.annotation.*; /** - * Denotes a Node class derived from a {@link NodeInfo} annotated Node type. + * Denotes a Node subclass generated on the basis of a {@link NodeInfo} annotation on a Node type. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/NegateNodeCanonicalizationTest.java --- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/NegateNodeCanonicalizationTest.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/NegateNodeCanonicalizationTest.java Mon Aug 18 14:04:21 2014 +0200 @@ -48,7 +48,7 @@ for (byte i : a) { ConstantNode node = ConstantNode.forByte(i, graph); Constant expected = Constant.forInt(-i); - assertEquals(expected, new NegateNode(node).evalConst(node.asConstant())); + assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant())); } } @@ -58,7 +58,7 @@ for (char i : a) { ConstantNode node = ConstantNode.forChar(i, graph); Constant expected = Constant.forInt(-i); - assertEquals(expected, new NegateNode(node).evalConst(node.asConstant())); + assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant())); } } @@ -68,7 +68,7 @@ for (short i : a) { ConstantNode node = ConstantNode.forShort(i, graph); Constant expected = Constant.forInt(-i); - assertEquals(expected, new NegateNode(node).evalConst(node.asConstant())); + assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant())); } } @@ -78,7 +78,7 @@ for (int i : a) { ConstantNode node = ConstantNode.forInt(i, graph); Constant expected = Constant.forInt(-i); - assertEquals(expected, new NegateNode(node).evalConst(node.asConstant())); + assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant())); } } @@ -88,7 +88,7 @@ for (long i : a) { ConstantNode node = ConstantNode.forLong(i, graph); Constant expected = Constant.forLong(-i); - assertEquals(expected, new NegateNode(node).evalConst(node.asConstant())); + assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant())); } } @@ -98,7 +98,7 @@ for (float i : a) { ConstantNode node = ConstantNode.forFloat(i, graph); Constant expected = Constant.forFloat(-i); - assertEquals(expected, new NegateNode(node).evalConst(node.asConstant())); + assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant())); } } @@ -108,7 +108,7 @@ for (double i : a) { ConstantNode node = ConstantNode.forDouble(i, graph); Constant expected = Constant.forDouble(-i); - assertEquals(expected, new NegateNode(node).evalConst(node.asConstant())); + assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant())); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractFixedGuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractFixedGuardNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractFixedGuardNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -87,15 +87,15 @@ public DeoptimizeNode lowerToIf() { FixedNode next = next(); setNext(null); - DeoptimizeNode deopt = graph().add(new DeoptimizeNode(action, reason)); + DeoptimizeNode deopt = graph().add(DeoptimizeNode.create(action, reason)); deopt.setStateBefore(stateBefore()); IfNode ifNode; BeginNode noDeoptSuccessor; if (negated) { - ifNode = graph().add(new IfNode(condition, deopt, next, 0)); + ifNode = graph().add(IfNode.create(condition, deopt, next, 0)); noDeoptSuccessor = ifNode.falseSuccessor(); } else { - ifNode = graph().add(new IfNode(condition, next, deopt, 1)); + ifNode = graph().add(IfNode.create(condition, next, deopt, 1)); noDeoptSuccessor = ifNode.trueSuccessor(); } ((FixedWithNextNode) predecessor()).setNext(ifNode); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,11 +38,23 @@ @NodeInfo(allowedUsageTypes = {InputType.Guard, InputType.Anchor}) public class BeginNode extends FixedWithNextNode implements LIRLowerable, Simplifiable, GuardingNode, AnchoringNode, IterableNodeType { - public BeginNode() { + public static BeginNode create() { + return new BeginNodeGen(); + } + + public static Class getGenClass() { + return BeginNodeGen.class; + } + + protected BeginNode() { super(StampFactory.forVoid()); } - public BeginNode(Stamp stamp) { + public static BeginNode create(Stamp stamp) { + return new BeginNodeGen(stamp); + } + + protected BeginNode(Stamp stamp) { super(stamp); } @@ -50,7 +62,7 @@ if (with instanceof BeginNode) { return (BeginNode) with; } - BeginNode begin = with.graph().add(new BeginNode()); + BeginNode begin = with.graph().add(BeginNode.create()); begin.setNext(with); return begin; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -50,7 +50,11 @@ @Input private final NodeInputList arguments; - public BreakpointNode(ValueNode... arguments) { + public static BreakpointNode create(ValueNode[] arguments) { + return new BreakpointNodeGen(arguments); + } + + protected BreakpointNode(ValueNode... arguments) { super(StampFactory.forVoid()); this.arguments = new NodeInputList<>(this, arguments); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConditionAnchorNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConditionAnchorNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConditionAnchorNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,11 +35,19 @@ @Input(InputType.Condition) private LogicNode condition; private boolean negated; - public ConditionAnchorNode(LogicNode condition) { + public static ConditionAnchorNode create(LogicNode condition) { + return new ConditionAnchorNodeGen(condition); + } + + protected ConditionAnchorNode(LogicNode condition) { this(condition, false); } - public ConditionAnchorNode(LogicNode condition, boolean negated) { + public static ConditionAnchorNode create(LogicNode condition, boolean negated) { + return new ConditionAnchorNodeGen(condition, negated); + } + + protected ConditionAnchorNode(LogicNode condition, boolean negated) { super(StampFactory.forVoid()); this.negated = negated; this.condition = condition; @@ -65,14 +73,14 @@ public Node canonical(CanonicalizerTool tool, Node forValue) { if (condition instanceof LogicNegationNode) { LogicNegationNode negation = (LogicNegationNode) condition; - return new ConditionAnchorNode(negation.getValue(), !negated); + return ConditionAnchorNode.create(negation.getValue(), !negated); } if (condition instanceof LogicConstantNode) { LogicConstantNode c = (LogicConstantNode) condition; if (c.getValue() != negated) { return null; } else { - return new ValueAnchorNode(null); + return ValueAnchorNode.create(null); } } return this; @@ -81,7 +89,7 @@ @Override public void lower(LoweringTool tool) { if (graph().getGuardsStage() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { - ValueAnchorNode newAnchor = graph().add(new ValueAnchorNode(null)); + ValueAnchorNode newAnchor = graph().add(ValueAnchorNode.create(null)); graph().replaceFixedWithFixed(this, newAnchor); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -46,7 +46,7 @@ private static ConstantNode createPrimitive(Constant value) { assert value.getKind() != Kind.Object; - return new ConstantNode(value, StampFactory.forConstant(value)); + return ConstantNode.create(value, StampFactory.forConstant(value)); } /** @@ -54,6 +54,10 @@ * * @param value the constant */ + public static ConstantNode create(Constant value, Stamp stamp) { + return new ConstantNodeGen(value, stamp); + } + protected ConstantNode(Constant value, Stamp stamp) { super(stamp); assert stamp != null; @@ -109,7 +113,7 @@ return forInt(constant.asInt(), graph); } if (constant.getKind() == Kind.Object) { - return unique(graph, new ConstantNode(constant, StampFactory.forConstant(constant, metaAccess))); + return unique(graph, ConstantNode.create(constant, StampFactory.forConstant(constant, metaAccess))); } else { return unique(graph, createPrimitive(constant)); } @@ -120,18 +124,18 @@ return forInt(constant.asInt()); } if (constant.getKind() == Kind.Object) { - return new ConstantNode(constant, StampFactory.forConstant(constant, metaAccess)); + return ConstantNode.create(constant, StampFactory.forConstant(constant, metaAccess)); } else { return createPrimitive(constant); } } public static ConstantNode forConstant(Stamp stamp, Constant constant, MetaAccessProvider metaAccess, StructuredGraph graph) { - return graph.unique(new ConstantNode(constant, stamp.constant(constant, metaAccess))); + return graph.unique(ConstantNode.create(constant, stamp.constant(constant, metaAccess))); } public static ConstantNode forConstant(Stamp stamp, Constant constant, MetaAccessProvider metaAccess) { - return new ConstantNode(constant, stamp.constant(constant, metaAccess)); + return ConstantNode.create(constant, stamp.constant(constant, metaAccess)); } /** @@ -315,7 +319,7 @@ private static ConstantNode forIntegerBits(int bits, Constant constant, StructuredGraph graph) { long value = constant.asLong(); long bounds = SignExtendNode.signExtend(value, bits); - return unique(graph, new ConstantNode(constant, StampFactory.forInteger(bits, bounds, bounds))); + return unique(graph, ConstantNode.create(constant, StampFactory.forInteger(bits, bounds, bounds))); } /** @@ -329,7 +333,7 @@ private static ConstantNode forIntegerBits(int bits, Constant constant) { long value = constant.asLong(); long bounds = SignExtendNode.signExtend(value, bits); - return new ConstantNode(constant, StampFactory.forInteger(bits, bounds, bounds)); + return ConstantNode.create(constant, StampFactory.forInteger(bits, bounds, bounds)); } /** diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,11 +34,19 @@ private final int debugId; private final Constant speculation; - public DeoptimizeNode(DeoptimizationAction action, DeoptimizationReason reason) { + public static DeoptimizeNode create(DeoptimizationAction action, DeoptimizationReason reason) { + return new DeoptimizeNodeGen(action, reason); + } + + protected DeoptimizeNode(DeoptimizationAction action, DeoptimizationReason reason) { this(action, reason, 0, Constant.NULL_OBJECT, null); } - public DeoptimizeNode(DeoptimizationAction action, DeoptimizationReason reason, int debugId, Constant speculation, FrameState stateBefore) { + public static DeoptimizeNode create(DeoptimizationAction action, DeoptimizationReason reason, int debugId, Constant speculation, FrameState stateBefore) { + return new DeoptimizeNodeGen(action, reason, debugId, speculation, stateBefore); + } + + protected DeoptimizeNode(DeoptimizationAction action, DeoptimizationReason reason, int debugId, Constant speculation, FrameState stateBefore) { super(stateBefore); assert action != null; assert reason != null; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @NodeInfo public class DirectCallTargetNode extends LoweredCallTargetNode { - public DirectCallTargetNode(List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType, InvokeKind invokeKind) { + public static DirectCallTargetNode create(List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType, InvokeKind invokeKind) { + return new DirectCallTargetNodeGen(arguments, returnStamp, signature, target, callType, invokeKind); + } + + protected DirectCallTargetNode(List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType, InvokeKind invokeKind) { super(arguments, returnStamp, signature, target, callType, invokeKind); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DispatchBeginNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DispatchBeginNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DispatchBeginNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,7 +31,15 @@ @NodeInfo public class DispatchBeginNode extends BeginStateSplitNode { - public DispatchBeginNode() { + public static DispatchBeginNode create() { + return new DispatchBeginNodeGen(); + } + + protected DispatchBeginNode() { + } + + public static DispatchBeginNode create(Stamp stamp) { + return new DispatchBeginNodeGen(stamp); } protected DispatchBeginNode(Stamp stamp) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @Input private ValueNode actionAndReason; @Input private ValueNode speculation; - public DynamicDeoptimizeNode(ValueNode actionAndReason, ValueNode speculation) { + public static DynamicDeoptimizeNode create(ValueNode actionAndReason, ValueNode speculation) { + return new DynamicDeoptimizeNodeGen(actionAndReason, speculation); + } + + protected DynamicDeoptimizeNode(ValueNode actionAndReason, ValueNode speculation) { this.actionAndReason = actionAndReason; this.speculation = speculation; } @@ -65,8 +69,8 @@ if (actionAndReason.isConstant() && speculation.isConstant()) { Constant constant = actionAndReason.asConstant(); Constant speculationConstant = speculation.asConstant(); - DeoptimizeNode newDeopt = new DeoptimizeNode(tool.getMetaAccess().decodeDeoptAction(constant), tool.getMetaAccess().decodeDeoptReason(constant), tool.getMetaAccess().decodeDebugId( - constant), speculationConstant, stateBefore()); + DeoptimizeNode newDeopt = DeoptimizeNode.create(tool.getMetaAccess().decodeDeoptAction(constant), tool.getMetaAccess().decodeDeoptReason(constant), + tool.getMetaAccess().decodeDebugId(constant), speculationConstant, stateBefore()); return newDeopt; } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EndNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EndNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EndNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -26,4 +26,14 @@ @NodeInfo(allowedUsageTypes = {InputType.Association}) public class EndNode extends AbstractEndNode { + public static EndNode create() { + return new EndNodeGen(); + } + + public static Class getGenClass() { + return EndNodeGen.class; + } + + EndNode() { + } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,6 +35,13 @@ @NodeInfo(allowedUsageTypes = {InputType.Association}) public class EntryMarkerNode extends BeginStateSplitNode implements IterableNodeType, Simplifiable, LIRLowerable { + public static EntryMarkerNode create() { + return new EntryMarkerNodeGen(); + } + + EntryMarkerNode() { + } + @Override public void simplify(SimplifierTool tool) { // this node should not be removed, this overrides BeginNode.simplify diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,11 +32,19 @@ @NodeInfo(nameTemplate = "FixedGuard(!={p#negated}) {p#reason/s}", allowedUsageTypes = {InputType.Guard}) public class FixedGuardNode extends AbstractFixedGuardNode implements Lowerable, IterableNodeType { - public FixedGuardNode(LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action) { + public static FixedGuardNode create(LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action) { + return new FixedGuardNodeGen(condition, deoptReason, action); + } + + protected FixedGuardNode(LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action) { this(condition, deoptReason, action, false); } - public FixedGuardNode(LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated) { + public static FixedGuardNode create(LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated) { + return new FixedGuardNodeGen(condition, deoptReason, action, negated); + } + + protected FixedGuardNode(LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated) { super(condition, deoptReason, action, negated); } @@ -52,7 +60,7 @@ tool.deleteBranch(next); } - DeoptimizeNode deopt = graph().add(new DeoptimizeNode(getAction(), getReason())); + DeoptimizeNode deopt = graph().add(DeoptimizeNode.create(getAction(), getReason())); deopt.setStateBefore(stateBefore()); setNext(deopt); } @@ -66,7 +74,7 @@ if (graph().getGuardsStage() == StructuredGraph.GuardsStage.FLOATING_GUARDS) { ValueNode guard = tool.createGuard(this, condition(), getReason(), getAction(), isNegated()).asNode(); this.replaceAtUsages(guard); - ValueAnchorNode newAnchor = graph().add(new ValueAnchorNode(guard.asNode())); + ValueAnchorNode newAnchor = graph().add(ValueAnchorNode.create(guard.asNode())); graph().replaceFixedWithFixed(this, newAnchor); } else { lowerToIf().lower(tool); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java Mon Aug 18 14:04:21 2014 +0200 @@ -87,7 +87,12 @@ * @param monitorIds one MonitorIdNode for each locked object * @param virtualObjectMappings a description of the current state for every virtual object */ - public FrameState(FrameState outerFrameState, ResolvedJavaMethod method, int bci, List values, int localsSize, int stackSize, boolean rethrowException, boolean duringCall, + public static FrameState create(FrameState outerFrameState, ResolvedJavaMethod method, int bci, List values, int localsSize, int stackSize, boolean rethrowException, + boolean duringCall, List monitorIds, List virtualObjectMappings) { + return new FrameStateGen(outerFrameState, method, bci, values, localsSize, stackSize, rethrowException, duringCall, monitorIds, virtualObjectMappings); + } + + protected FrameState(FrameState outerFrameState, ResolvedJavaMethod method, int bci, List values, int localsSize, int stackSize, boolean rethrowException, boolean duringCall, List monitorIds, List virtualObjectMappings) { assert stackSize >= 0; this.outerFrameState = outerFrameState; @@ -110,13 +115,22 @@ * * @param bci marker bci, needs to be < 0 */ - public FrameState(int bci) { + public static FrameState create(int bci) { + return new FrameStateGen(bci); + } + + protected FrameState(int bci) { this(null, null, bci, Collections. emptyList(), 0, 0, false, false, Collections. emptyList(), Collections. emptyList()); assert bci == BytecodeFrame.BEFORE_BCI || bci == BytecodeFrame.AFTER_BCI || bci == BytecodeFrame.AFTER_EXCEPTION_BCI || bci == BytecodeFrame.UNKNOWN_BCI || bci == BytecodeFrame.INVALID_FRAMESTATE_BCI; } - public FrameState(ResolvedJavaMethod method, int bci, ValueNode[] locals, List stack, ValueNode[] locks, MonitorIdNode[] monitorIds, boolean rethrowException, boolean duringCall) { + public static FrameState create(ResolvedJavaMethod method, int bci, ValueNode[] locals, List stack, ValueNode[] locks, MonitorIdNode[] monitorIds, boolean rethrowException, + boolean duringCall) { + return new FrameStateGen(method, bci, locals, stack, locks, monitorIds, rethrowException, duringCall); + } + + protected FrameState(ResolvedJavaMethod method, int bci, ValueNode[] locals, List stack, ValueNode[] locks, MonitorIdNode[] monitorIds, boolean rethrowException, boolean duringCall) { this(null, method, bci, createValues(locals, stack, locks), locals.length, stack.size(), rethrowException, duringCall, Arrays.asList(monitorIds), Collections. emptyList()); } @@ -193,7 +207,7 @@ * Gets a copy of this frame state. */ public FrameState duplicate(int newBci) { - return graph().add(new FrameState(outerFrameState(), method, newBci, values, localsSize, stackSize, rethrowException, duringCall, monitorIds, virtualObjectMappings)); + return graph().add(FrameState.create(outerFrameState(), method, newBci, values, localsSize, stackSize, rethrowException, duringCall, monitorIds, virtualObjectMappings)); } /** @@ -217,7 +231,7 @@ for (EscapeObjectState state : virtualObjectMappings) { newVirtualMappings.add(state.duplicateWithVirtualState()); } - return graph().add(new FrameState(newOuterFrameState, method, bci, values, localsSize, stackSize, rethrowException, duringCall, monitorIds, newVirtualMappings)); + return graph().add(FrameState.create(newOuterFrameState, method, bci, values, localsSize, stackSize, rethrowException, duringCall, monitorIds, newVirtualMappings)); } /** @@ -257,7 +271,7 @@ int newStackSize = copy.size() - localsSize; copy.addAll(values.subList(localsSize + stackSize, values.size())); - return graph().add(new FrameState(outerFrameState(), newMethod, newBci, copy, localsSize, newStackSize, newRethrowException, false, monitorIds, virtualObjectMappings)); + return graph().add(FrameState.create(outerFrameState(), newMethod, newBci, copy, localsSize, newStackSize, newRethrowException, false, monitorIds, virtualObjectMappings)); } /** diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ public class FullInfopointNode extends InfopointNode implements LIRLowerable, NodeWithState { @Input(InputType.State) private FrameState state; - public FullInfopointNode(InfopointReason reason, FrameState state) { + public static FullInfopointNode create(InfopointReason reason, FrameState state) { + return new FullInfopointNodeGen(reason, state); + } + + protected FullInfopointNode(InfopointReason reason, FrameState state) { super(reason); this.state = state; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -50,7 +50,11 @@ private DeoptimizationAction action; private boolean negated; - public GuardNode(LogicNode condition, AnchoringNode anchor, DeoptimizationReason reason, DeoptimizationAction action, boolean negated, Constant speculation) { + public static GuardNode create(LogicNode condition, AnchoringNode anchor, DeoptimizationReason reason, DeoptimizationAction action, boolean negated, Constant speculation) { + return new GuardNodeGen(condition, anchor, reason, action, negated, speculation); + } + + protected GuardNode(LogicNode condition, AnchoringNode anchor, DeoptimizationReason reason, DeoptimizationAction action, boolean negated, Constant speculation) { super(StampFactory.forVoid(), anchor); this.condition = condition; this.reason = reason; @@ -99,7 +103,7 @@ public Node canonical(CanonicalizerTool tool) { if (condition() instanceof LogicNegationNode) { LogicNegationNode negation = (LogicNegationNode) condition(); - return new GuardNode(negation.getValue(), getAnchor(), reason, action, !negated, speculation); + return GuardNode.create(negation.getValue(), getAnchor(), reason, action, !negated, speculation); } if (condition() instanceof LogicConstantNode) { LogicConstantNode c = (LogicConstantNode) condition(); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardPhiNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,12 +35,20 @@ @OptionalInput(InputType.Guard) final NodeInputList values; - public GuardPhiNode(MergeNode merge) { + public static GuardPhiNode create(MergeNode merge) { + return new GuardPhiNodeGen(merge); + } + + protected GuardPhiNode(MergeNode merge) { super(StampFactory.forVoid(), merge); this.values = new NodeInputList<>(this); } - public GuardPhiNode(MergeNode merge, ValueNode[] values) { + public static GuardPhiNode create(MergeNode merge, ValueNode[] values) { + return new GuardPhiNodeGen(merge, values); + } + + protected GuardPhiNode(MergeNode merge, ValueNode[] values) { super(StampFactory.forVoid(), merge); this.values = new NodeInputList<>(this, values); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardProxyNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardProxyNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @Input(InputType.Guard) private GuardingNode value; - public GuardProxyNode(GuardingNode value, BeginNode proxyPoint) { + public static GuardProxyNode create(GuardingNode value, BeginNode proxyPoint) { + return new GuardProxyNodeGen(value, proxyPoint); + } + + protected GuardProxyNode(GuardingNode value, BeginNode proxyPoint) { super(StampFactory.forVoid(), proxyPoint); this.value = value; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardedValueNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardedValueNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardedValueNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -42,13 +42,21 @@ @Input private ValueNode object; private final Stamp piStamp; - public GuardedValueNode(ValueNode object, GuardingNode guard, Stamp stamp) { + public static GuardedValueNode create(ValueNode object, GuardingNode guard, Stamp stamp) { + return new GuardedValueNodeGen(object, guard, stamp); + } + + protected GuardedValueNode(ValueNode object, GuardingNode guard, Stamp stamp) { super(stamp, guard); this.object = object; this.piStamp = stamp; } - public GuardedValueNode(ValueNode object, GuardingNode guard) { + public static GuardedValueNode create(ValueNode object, GuardingNode guard) { + return new GuardedValueNodeGen(object, guard); + } + + protected GuardedValueNode(ValueNode object, GuardingNode guard) { this(object, guard, object.stamp()); } @@ -85,7 +93,7 @@ if (stamp().equals(object().stamp())) { return object(); } else { - return new PiNode(object(), stamp()); + return PiNode.create(object(), stamp()); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -68,8 +68,12 @@ /** * Constructor for {@link #guardingNonNull(Object)} node intrinsic. */ - private GuardingPiNode(ValueNode object) { - this(object, object.graph().unique(new IsNullNode(object)), true, DeoptimizationReason.NullCheckException, DeoptimizationAction.None, object.stamp().join(StampFactory.objectNonNull())); + public static GuardingPiNode create(ValueNode object) { + return new GuardingPiNodeGen(object); + } + + GuardingPiNode(ValueNode object) { + this(object, object.graph().unique(IsNullNode.create(object)), true, DeoptimizationReason.NullCheckException, DeoptimizationAction.None, object.stamp().join(StampFactory.objectNonNull())); } /** @@ -80,7 +84,11 @@ * @param negateCondition the guard succeeds if {@code condition != negateCondition} * @param stamp the refined type of the object if the guard succeeds */ - public GuardingPiNode(ValueNode object, ValueNode condition, boolean negateCondition, DeoptimizationReason reason, DeoptimizationAction action, Stamp stamp) { + public static GuardingPiNode create(ValueNode object, ValueNode condition, boolean negateCondition, DeoptimizationReason reason, DeoptimizationAction action, Stamp stamp) { + return new GuardingPiNodeGen(object, condition, negateCondition, reason, action, stamp); + } + + protected GuardingPiNode(ValueNode object, ValueNode condition, boolean negateCondition, DeoptimizationReason reason, DeoptimizationAction action, Stamp stamp) { super(stamp); assert stamp != null; this.piStamp = stamp; @@ -94,9 +102,9 @@ @Override public void lower(LoweringTool tool) { GuardingNode guard = tool.createGuard(next(), condition, reason, action, negated); - ValueAnchorNode anchor = graph().add(new ValueAnchorNode((ValueNode) guard)); + ValueAnchorNode anchor = graph().add(ValueAnchorNode.create((ValueNode) guard)); if (usages().isNotEmpty()) { - PiNode pi = graph().unique(new PiNode(object, stamp(), (ValueNode) guard)); + PiNode pi = graph().unique(PiNode.create(object, stamp(), (ValueNode) guard)); replaceAtUsages(pi); } graph().replaceFixedWithFixed(this, anchor); @@ -119,19 +127,19 @@ public Node canonical(CanonicalizerTool tool) { if (stamp() == StampFactory.illegal(object.getKind())) { // The guard always fails - return new DeoptimizeNode(action, reason); + return DeoptimizeNode.create(action, reason); } if (condition instanceof LogicConstantNode) { LogicConstantNode c = (LogicConstantNode) condition; if (c.getValue() == negated) { // The guard always fails - return new DeoptimizeNode(action, reason); + return DeoptimizeNode.create(action, reason); } else if (stamp().equals(object().stamp())) { // The guard always succeeds, and does not provide new type information return object; } else { // The guard always succeeds, and provides new type information - return new PiNode(object, stamp()); + return PiNode.create(object, stamp()); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -61,11 +61,19 @@ condition = x; } - public IfNode(LogicNode condition, FixedNode trueSuccessor, FixedNode falseSuccessor, double trueSuccessorProbability) { + public static IfNode create(LogicNode condition, FixedNode trueSuccessor, FixedNode falseSuccessor, double trueSuccessorProbability) { + return new IfNodeGen(condition, trueSuccessor, falseSuccessor, trueSuccessorProbability); + } + + protected IfNode(LogicNode condition, FixedNode trueSuccessor, FixedNode falseSuccessor, double trueSuccessorProbability) { this(condition, BeginNode.begin(trueSuccessor), BeginNode.begin(falseSuccessor), trueSuccessorProbability); } - public IfNode(LogicNode condition, BeginNode trueSuccessor, BeginNode falseSuccessor, double trueSuccessorProbability) { + public static IfNode create(LogicNode condition, BeginNode trueSuccessor, BeginNode falseSuccessor, double trueSuccessorProbability) { + return new IfNodeGen(condition, trueSuccessor, falseSuccessor, trueSuccessorProbability); + } + + protected IfNode(LogicNode condition, BeginNode trueSuccessor, BeginNode falseSuccessor, double trueSuccessorProbability) { super(StampFactory.forVoid()); this.condition = condition; this.falseSuccessor = falseSuccessor; @@ -143,7 +151,7 @@ setTrueSuccessor(null); setFalseSuccessor(null); LogicNegationNode negation = (LogicNegationNode) condition(); - IfNode newIfNode = graph().add(new IfNode(negation.getValue(), falseSucc, trueSucc, 1 - trueSuccessorProbability)); + IfNode newIfNode = graph().add(IfNode.create(negation.getValue(), falseSucc, trueSucc, 1 - trueSuccessorProbability)); predecessor().replaceFirstSuccessor(this, newIfNode); GraphUtil.killWithUnusedFloatingInputs(this); return; @@ -212,7 +220,8 @@ do { BeginNode trueSucc = trueSuccessor(); BeginNode falseSucc = falseSuccessor(); - if (trueSucc.getClass() == BeginNode.class && falseSucc.getClass() == BeginNode.class && trueSucc.next() instanceof FixedWithNextNode && falseSucc.next() instanceof FixedWithNextNode) { + if (trueSucc.getClass() == BeginNode.getGenClass() && falseSucc.getClass() == BeginNode.getGenClass() && trueSucc.next() instanceof FixedWithNextNode && + falseSucc.next() instanceof FixedWithNextNode) { FixedWithNextNode trueNext = (FixedWithNextNode) trueSucc.next(); FixedWithNextNode falseNext = (FixedWithNextNode) falseSucc.next(); NodeClass nodeClass = trueNext.getNodeClass(); @@ -268,7 +277,7 @@ */ if (lessThan2.getX() == lessThan.getX() && lessThan2.getY().stamp() instanceof IntegerStamp && ((IntegerStamp) lessThan2.getY().stamp()).isPositive() && sameDestination(trueSuccessor(), ifNode2.falseSuccessor)) { - below = graph().unique(new IntegerBelowNode(lessThan2.getX(), lessThan2.getY())); + below = graph().unique(IntegerBelowNode.create(lessThan2.getX(), lessThan2.getY())); // swap direction BeginNode tmp = falseSucc; falseSucc = trueSucc; @@ -283,14 +292,14 @@ Constant positive = lessThan2.getX().asConstant(); if (positive != null && positive.asLong() > 0 && positive.asLong() < positive.getKind().getMaxValue()) { ConstantNode newLimit = ConstantNode.forIntegerKind(positive.getKind(), positive.asLong() + 1, graph()); - below = graph().unique(new IntegerBelowNode(lessThan.getX(), newLimit)); + below = graph().unique(IntegerBelowNode.create(lessThan.getX(), newLimit)); } } if (below != null) { ifNode2.setTrueSuccessor(null); ifNode2.setFalseSuccessor(null); - IfNode newIfNode = graph().add(new IfNode(below, falseSucc, trueSucc, 1 - trueSuccessorProbability)); + IfNode newIfNode = graph().add(IfNode.create(below, falseSucc, trueSucc, 1 - trueSuccessorProbability)); // Remove the < 0 test. tool.deleteBranch(trueSuccessor); graph().removeSplit(this, falseSuccessor); @@ -527,7 +536,7 @@ } } } - ReturnNode newReturn = graph().add(new ReturnNode(value)); + ReturnNode newReturn = graph().add(ReturnNode.create(value)); replaceAtPredecessor(newReturn); GraphUtil.killCFG(this); return true; @@ -549,7 +558,7 @@ return null; } if (trueValue.isConstant() && falseValue.isConstant()) { - return graph().unique(new ConditionalNode(condition(), trueValue, falseValue)); + return graph().unique(ConditionalNode.create(condition(), trueValue, falseValue)); } else { ConditionalNode conditional = null; ValueNode constant = null; @@ -579,7 +588,7 @@ if (otherValue.isConstant()) { double shortCutProbability = probability(trueSuccessor()); LogicNode newCondition = LogicNode.or(condition(), negateCondition, conditional.condition(), negateConditionalCondition, shortCutProbability); - return graph().unique(new ConditionalNode(newCondition, constant, otherValue)); + return graph().unique(ConditionalNode.create(newCondition, constant, otherValue)); } } return null; @@ -834,9 +843,9 @@ } else { // Need a new phi in case the frame state is used by more than the merge being // removed - MergeNode newMerge = graph().add(new MergeNode()); + MergeNode newMerge = graph().add(MergeNode.create()); PhiNode oldPhi = (PhiNode) oldMerge.usages().first(); - PhiNode newPhi = graph().addWithoutUnique(new ValuePhiNode(oldPhi.stamp(), newMerge)); + PhiNode newPhi = graph().addWithoutUnique(ValuePhiNode.create(oldPhi.stamp(), newMerge)); for (AbstractEndNode end : ends) { newPhi.addInput(phiValues.get(end)); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,7 +34,12 @@ @Input private ValueNode computedAddress; - public IndirectCallTargetNode(ValueNode computedAddress, List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType, + public static IndirectCallTargetNode create(ValueNode computedAddress, List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, + CallingConvention.Type callType, InvokeKind invokeKind) { + return new IndirectCallTargetNodeGen(computedAddress, arguments, returnStamp, signature, target, callType, invokeKind); + } + + protected IndirectCallTargetNode(ValueNode computedAddress, List arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType, InvokeKind invokeKind) { super(arguments, returnStamp, signature, target, callType, invokeKind); this.computedAddress = computedAddress; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -52,7 +52,11 @@ * @param callTarget the target method being called * @param bci the bytecode index of the original invoke (used for debug infos) */ - public InvokeNode(CallTargetNode callTarget, int bci) { + public static InvokeNode create(CallTargetNode callTarget, int bci) { + return new InvokeNodeGen(callTarget, bci); + } + + protected InvokeNode(CallTargetNode callTarget, int bci) { this(callTarget, bci, callTarget.returnStamp()); } @@ -63,7 +67,11 @@ * @param bci the bytecode index of the original invoke (used for debug infos) * @param stamp the stamp to be used for this value */ - public InvokeNode(CallTargetNode callTarget, int bci, Stamp stamp) { + public static InvokeNode create(CallTargetNode callTarget, int bci, Stamp stamp) { + return new InvokeNodeGen(callTarget, bci, stamp); + } + + protected InvokeNode(CallTargetNode callTarget, int bci, Stamp stamp) { super(stamp); this.callTarget = callTarget; this.bci = bci; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -48,7 +48,11 @@ private boolean useForInlining; private double exceptionProbability; - public InvokeWithExceptionNode(CallTargetNode callTarget, BeginNode exceptionEdge, int bci) { + public static InvokeWithExceptionNode create(CallTargetNode callTarget, BeginNode exceptionEdge, int bci) { + return new InvokeWithExceptionNodeGen(callTarget, exceptionEdge, bci); + } + + protected InvokeWithExceptionNode(CallTargetNode callTarget, BeginNode exceptionEdge, int bci) { super(callTarget.returnStamp()); this.exceptionEdge = exceptionEdge; this.bci = bci; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/KillingBeginNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/KillingBeginNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/KillingBeginNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,7 +31,11 @@ private LocationIdentity locationIdentity; - public KillingBeginNode(LocationIdentity locationIdentity) { + public static KillingBeginNode create(LocationIdentity locationIdentity) { + return new KillingBeginNodeGen(locationIdentity); + } + + protected KillingBeginNode(LocationIdentity locationIdentity) { this.locationIdentity = locationIdentity; } @@ -39,7 +43,7 @@ if (with instanceof KillingBeginNode) { return (KillingBeginNode) with; } - KillingBeginNode begin = with.graph().add(new KillingBeginNode(locationIdentity)); + KillingBeginNode begin = with.graph().add(KillingBeginNode.create(locationIdentity)); begin.setNext(with); return begin; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicConstantNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicConstantNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicConstantNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,6 +34,10 @@ public final boolean value; + public static LogicConstantNode create(boolean value) { + return new LogicConstantNodeGen(value); + } + protected LogicConstantNode(boolean value) { super(); this.value = value; @@ -47,7 +51,7 @@ * @return a node representing the boolean */ public static LogicConstantNode forBoolean(boolean v, Graph graph) { - return graph.unique(new LogicConstantNode(v)); + return graph.unique(LogicConstantNode.create(v)); } /** @@ -57,7 +61,7 @@ * @return a node representing the boolean */ public static LogicConstantNode forBoolean(boolean v) { - return new LogicConstantNode(v); + return LogicConstantNode.create(v); } /** diff -r cc7aaa92c27d -r 06c15e88d383 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 Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNegationNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @Input(InputType.Condition) private LogicNode value; - public LogicNegationNode(LogicNode value) { + public static LogicNegationNode create(LogicNode value) { + return new LogicNegationNodeGen(value); + } + + protected LogicNegationNode(LogicNode value) { this.value = value; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,8 +41,8 @@ public static LogicNode and(LogicNode a, boolean negateA, LogicNode b, boolean negateB, double shortCircuitProbability) { StructuredGraph graph = a.graph(); - ShortCircuitOrNode notAorNotB = graph.unique(new ShortCircuitOrNode(a, !negateA, b, !negateB, shortCircuitProbability)); - return graph.unique(new LogicNegationNode(notAorNotB)); + ShortCircuitOrNode notAorNotB = graph.unique(ShortCircuitOrNode.create(a, !negateA, b, !negateB, shortCircuitProbability)); + return graph.unique(LogicNegationNode.create(notAorNotB)); } public static LogicNode or(LogicNode a, LogicNode b, double shortCircuitProbability) { @@ -50,6 +50,6 @@ } public static LogicNode or(LogicNode a, boolean negateA, LogicNode b, boolean negateB, double shortCircuitProbability) { - return a.graph().unique(new ShortCircuitOrNode(a, negateA, b, negateB, shortCircuitProbability)); + return a.graph().unique(ShortCircuitOrNode.create(a, negateA, b, negateB, shortCircuitProbability)); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,11 @@ private int unswitches; @OptionalInput(InputType.Guard) private GuardingNode overflowGuard; - public LoopBeginNode() { + public static LoopBeginNode create() { + return new LoopBeginNodeGen(); + } + + protected LoopBeginNode() { loopFrequency = 1; } @@ -190,7 +194,7 @@ for (LoopExitNode loopexit : loopExits().snapshot()) { loopexit.removeProxies(); FrameState stateAfter = loopexit.stateAfter(); - graph().replaceFixedWithFixed(loopexit, graph().add(new BeginNode())); + graph().replaceFixedWithFixed(loopexit, graph().add(BeginNode.create())); if (stateAfter != null && stateAfter.isAlive() && stateAfter.usages().isEmpty()) { GraphUtil.killWithUnusedFloatingInputs(stateAfter); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,11 @@ private boolean canSafepoint; private int endIndex; - public LoopEndNode(LoopBeginNode begin) { + public static LoopEndNode create(LoopBeginNode begin) { + return new LoopEndNodeGen(begin); + } + + protected LoopEndNode(LoopBeginNode begin) { int idx = begin.nextEndIndex(); assert idx >= 0; this.endIndex = idx; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,7 +31,11 @@ @Input(InputType.Association) private LoopBeginNode loopBegin; - public LoopExitNode(LoopBeginNode loop) { + public static LoopExitNode create(LoopBeginNode loop) { + return new LoopExitNodeGen(loop); + } + + protected LoopExitNode(LoopBeginNode loop) { assert loop != null; loopBegin = loop; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryMapNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryMapNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryMapNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -49,7 +49,11 @@ return true; } - public MemoryMapNode(Map mmap) { + public static MemoryMapNode create(Map mmap) { + return new MemoryMapNodeGen(mmap); + } + + protected MemoryMapNode(Map mmap) { super(StampFactory.forVoid()); locationIdentities = new ArrayList<>(mmap.keySet()); nodes = new NodeInputList<>(this, mmap.values()); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryPhiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryPhiNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MemoryPhiNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,13 +37,21 @@ @Input(InputType.Memory) final NodeInputList values; private final LocationIdentity locationIdentity; - public MemoryPhiNode(MergeNode merge, LocationIdentity locationIdentity) { + public static MemoryPhiNode create(MergeNode merge, LocationIdentity locationIdentity) { + return new MemoryPhiNodeGen(merge, locationIdentity); + } + + protected MemoryPhiNode(MergeNode merge, LocationIdentity locationIdentity) { super(StampFactory.forVoid(), merge); this.locationIdentity = locationIdentity; this.values = new NodeInputList<>(this); } - public MemoryPhiNode(MergeNode merge, LocationIdentity locationIdentity, ValueNode[] values) { + public static MemoryPhiNode create(MergeNode merge, LocationIdentity locationIdentity, ValueNode[] values) { + return new MemoryPhiNodeGen(merge, locationIdentity, values); + } + + protected MemoryPhiNode(MergeNode merge, LocationIdentity locationIdentity, ValueNode[] values) { super(StampFactory.forVoid(), merge); this.locationIdentity = locationIdentity; this.values = new NodeInputList<>(this, values); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,6 +39,16 @@ */ @NodeInfo(allowedUsageTypes = {InputType.Association}) public class MergeNode extends BeginStateSplitNode implements IterableNodeType, LIRLowerable { + public static MergeNode create() { + return new MergeNodeGen(); + } + + public static Class getGenClass() { + return MergeNodeGen.class; + } + + MergeNode() { + } @Input(InputType.Association) private final NodeInputList ends = new NodeInputList<>(this); @@ -169,9 +179,9 @@ } AbstractEndNode newEnd; if (merge instanceof LoopBeginNode) { - newEnd = graph().add(new LoopEndNode((LoopBeginNode) merge)); + newEnd = graph().add(LoopEndNode.create((LoopBeginNode) merge)); } else { - newEnd = graph().add(new EndNode()); + newEnd = graph().add(EndNode.create()); merge.addForwardEnd(newEnd); } for (PhiNode phi : merge.phis()) { @@ -210,7 +220,7 @@ ValuePhiNode returnValuePhi = returnNode.result() == null || !isPhiAtMerge(returnNode.result()) ? null : (ValuePhiNode) returnNode.result(); List endNodes = forwardEnds().snapshot(); for (AbstractEndNode end : endNodes) { - ReturnNode newReturn = graph().add(new ReturnNode(returnValuePhi == null ? returnNode.result() : returnValuePhi.valueAt(end))); + ReturnNode newReturn = graph().add(ReturnNode.create(returnValuePhi == null ? returnNode.result() : returnValuePhi.valueAt(end))); if (tool != null) { tool.addToWorkList(end.predecessor()); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ParameterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ParameterNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ParameterNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @NodeInfo(nameTemplate = "Param({p#index})") public class ParameterNode extends AbstractLocalNode implements IterableNodeType { - public ParameterNode(int index, Stamp stamp) { + public static ParameterNode create(int index, Stamp stamp) { + return new ParameterNodeGen(index, stamp); + } + + protected ParameterNode(int index, Stamp stamp) { super(index, stamp); } } diff -r cc7aaa92c27d -r 06c15e88d383 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 Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -142,13 +142,17 @@ @NodeInfo static class MultipleValuesNode extends ValueNode { - public MultipleValuesNode() { + public static MultipleValuesNode create() { + return new PhiNode_MultipleValuesNodeGen(); + } + + protected MultipleValuesNode() { super(null); } } - public static final ValueNode MULTIPLE_VALUES = new MultipleValuesNode(); + public static final ValueNode MULTIPLE_VALUES = MultipleValuesNode.create(); /** * If all inputs are the same value, this value is returned, otherwise {@link #MULTIPLE_VALUES}. @@ -211,4 +215,4 @@ return merge() instanceof LoopBeginNode; } -} \ No newline at end of file +} diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiArrayNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiArrayNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,11 @@ return length; } - public PiArrayNode(ValueNode object, ValueNode length, Stamp stamp) { + public static PiArrayNode create(ValueNode object, ValueNode length, Stamp stamp) { + return new PiArrayNodeGen(object, length, stamp); + } + + protected PiArrayNode(ValueNode object, ValueNode length, Stamp stamp) { super(object, stamp); this.length = length; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -51,19 +51,31 @@ return object; } - public PiNode(ValueNode object, Stamp stamp) { + public static PiNode create(ValueNode object, Stamp stamp) { + return new PiNodeGen(object, stamp); + } + + protected PiNode(ValueNode object, Stamp stamp) { super(stamp); this.piStamp = stamp; this.object = object; } - public PiNode(ValueNode object, Stamp stamp, ValueNode anchor) { + public static PiNode create(ValueNode object, Stamp stamp, ValueNode anchor) { + return new PiNodeGen(object, stamp, anchor); + } + + protected PiNode(ValueNode object, Stamp stamp, ValueNode anchor) { super(stamp, (GuardingNode) anchor); this.object = object; this.piStamp = stamp; } - public PiNode(ValueNode object, ResolvedJavaType toType, boolean exactType, boolean nonNull) { + public static PiNode create(ValueNode object, ResolvedJavaType toType, boolean exactType, boolean nonNull) { + return new PiNodeGen(object, toType, exactType, nonNull); + } + + protected PiNode(ValueNode object, ResolvedJavaType toType, boolean exactType, boolean nonNull) { this(object, StampFactory.object(toType, exactType, nonNull || StampTool.isObjectNonNull(object.stamp()))); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -59,10 +59,10 @@ } public static ValueProxyNode forValue(ValueNode value, BeginNode exit, StructuredGraph graph) { - return graph.unique(new ValueProxyNode(value, exit)); + return graph.unique(ValueProxyNode.create(value, exit)); } public static GuardProxyNode forGuard(GuardingNode value, BeginNode exit, StructuredGraph graph) { - return graph.unique(new GuardProxyNode(value, exit)); + return graph.unique(GuardProxyNode.create(value, exit)); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,11 +43,19 @@ * @param result the instruction producing the result for this return; {@code null} if this is a * void return */ - public ReturnNode(ValueNode result) { + public static ReturnNode create(ValueNode result) { + return new ReturnNodeGen(result); + } + + protected ReturnNode(ValueNode result) { this(result, null); } - public ReturnNode(ValueNode result, MemoryMapNode memoryMap) { + public static ReturnNode create(ValueNode result, MemoryMapNode memoryMap) { + return new ReturnNodeGen(result, memoryMap); + } + + protected ReturnNode(ValueNode result, MemoryMapNode memoryMap) { super(StampFactory.forVoid()); this.result = result; this.memoryMap = memoryMap; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SafepointNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SafepointNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SafepointNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @NodeInfo public class SafepointNode extends DeoptimizingFixedWithNextNode implements LIRLowerable { - public SafepointNode() { + public static SafepointNode create() { + return new SafepointNodeGen(); + } + + protected SafepointNode() { super(StampFactory.forVoid()); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitOrNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitOrNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitOrNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,11 @@ private boolean yNegated; private double shortCircuitProbability; - public ShortCircuitOrNode(LogicNode x, boolean xNegated, LogicNode y, boolean yNegated, double shortCircuitProbability) { + public static ShortCircuitOrNode create(LogicNode x, boolean xNegated, LogicNode y, boolean yNegated, double shortCircuitProbability) { + return new ShortCircuitOrNodeGen(x, xNegated, y, yNegated, shortCircuitProbability); + } + + protected ShortCircuitOrNode(LogicNode x, boolean xNegated, LogicNode y, boolean yNegated, double shortCircuitProbability) { this.x = x; this.xNegated = xNegated; this.y = y; @@ -83,7 +87,7 @@ } if (xCond != forX || yCond != forY) { - return new ShortCircuitOrNode(xCond, xNeg, yCond, yNeg, shortCircuitProbability); + return ShortCircuitOrNode.create(xCond, xNeg, yCond, yNeg, shortCircuitProbability); } else { return this; } @@ -105,7 +109,7 @@ if (isXNegated()) { if (isYNegated()) { // !a || !a = !a - return new LogicNegationNode(forX); + return LogicNegationNode.create(forX); } else { // !a || a = true return LogicConstantNode.tautology(); @@ -125,7 +129,7 @@ return LogicConstantNode.tautology(); } else { if (isYNegated()) { - return new LogicNegationNode(forY); + return LogicNegationNode.create(forY); } else { return forY; } @@ -136,7 +140,7 @@ return LogicConstantNode.tautology(); } else { if (isXNegated()) { - return new LogicNegationNode(forX); + return LogicNegationNode.create(forX); } else { return forX; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimpleInfopointNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimpleInfopointNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimpleInfopointNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,7 +31,11 @@ public class SimpleInfopointNode extends InfopointNode implements LIRLowerable, IterableNodeType { private BytecodePosition position; - public SimpleInfopointNode(InfopointReason reason, BytecodePosition position) { + public static SimpleInfopointNode create(InfopointReason reason, BytecodePosition position) { + return new SimpleInfopointNodeGen(reason, position); + } + + protected SimpleInfopointNode(InfopointReason reason, BytecodePosition position) { super(reason); this.position = position; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,6 +31,12 @@ */ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class StartNode extends BeginStateSplitNode implements MemoryCheckpoint.Single { + public static StartNode create() { + return new StartNodeGen(); + } + + protected StartNode() { + } @Override public LocationIdentity getLocationIdentity() { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Mon Aug 18 14:04:21 2014 +0200 @@ -104,7 +104,7 @@ private StructuredGraph(String name, ResolvedJavaMethod method, long graphId, int entryBCI) { super(name); - this.setStart(add(new StartNode())); + this.setStart(add(StartNode.create())); this.method = method; this.graphId = graphId; this.entryBCI = entryBCI; @@ -374,7 +374,7 @@ if (begin.forwardEndCount() == 1) { // bypass merge and remove reduceTrivialMerge(begin); } else { // convert to merge - MergeNode merge = this.add(new MergeNode()); + MergeNode merge = this.add(MergeNode.create()); this.replaceFixedWithFixed(begin, merge); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,7 @@ private transient ResolvedJavaType lastCheckedType; private transient JavaTypeProfile lastCheckedProfile; - public static ValueNode create(ValueNode object, JavaTypeProfile profile) { + public static ValueNode proxify(ValueNode object, JavaTypeProfile profile) { if (StampTool.isExactType(object)) { return object; } @@ -55,7 +55,11 @@ // Only null profiling is not beneficial enough to keep the node around. return object; } - return object.graph().addWithoutUnique(new TypeProfileProxyNode(object, profile)); + return object.graph().addWithoutUnique(create(object, profile)); + } + + public static ValueNode create(ValueNode object, JavaTypeProfile profile) { + return new TypeProfileProxyNodeGen(object, profile); } TypeProfileProxyNode(ValueNode value, JavaTypeProfile profile) { @@ -93,7 +97,7 @@ } if (newProfile != this.profile) { Debug.log("Improved profile via other profile."); - return new TypeProfileProxyNode(forValue, newProfile); + return TypeProfileProxyNode.create(forValue, newProfile); } } else if (StampTool.typeOrNull(forValue) != null) { ResolvedJavaType type = StampTool.typeOrNull(forValue); @@ -115,7 +119,7 @@ // Only null profiling is not beneficial enough to keep the node around. return forValue; } - return new TypeProfileProxyNode(forValue, newProfile); + return TypeProfileProxyNode.create(forValue, newProfile); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,7 +39,11 @@ return exception; } - public UnwindNode(ValueNode exception) { + public static UnwindNode create(ValueNode exception) { + return new UnwindNodeGen(exception); + } + + protected UnwindNode(ValueNode exception) { super(StampFactory.forVoid()); assert exception == null || exception.getKind() == Kind.Object; this.exception = exception; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValuePhiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValuePhiNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValuePhiNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,7 +41,11 @@ * @param stamp the stamp of the value * @param merge the merge that the new phi belongs to */ - public ValuePhiNode(Stamp stamp, MergeNode merge) { + public static ValuePhiNode create(Stamp stamp, MergeNode merge) { + return new ValuePhiNodeGen(stamp, merge); + } + + protected ValuePhiNode(Stamp stamp, MergeNode merge) { super(stamp, merge); assert stamp != StampFactory.forVoid(); values = new NodeInputList<>(this); @@ -54,7 +58,11 @@ * @param merge the merge that the new phi belongs to * @param values the initial values of the phi */ - public ValuePhiNode(Stamp stamp, MergeNode merge, ValueNode[] values) { + public static ValuePhiNode create(Stamp stamp, MergeNode merge, ValueNode[] values) { + return new ValuePhiNodeGen(stamp, merge, values); + } + + protected ValuePhiNode(Stamp stamp, MergeNode merge, ValueNode[] values) { super(stamp, merge); assert stamp != StampFactory.forVoid(); this.values = new NodeInputList<>(this, values); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @Input private ValueNode value; - public ValueProxyNode(ValueNode value, BeginNode proxyPoint) { + public static ValueProxyNode create(ValueNode value, BeginNode proxyPoint) { + return new ValueProxyNodeGen(value, proxyPoint); + } + + protected ValueProxyNode(ValueNode value, BeginNode proxyPoint) { super(value.stamp(), proxyPoint); this.value = value; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,6 +39,10 @@ return new AndNodeGen(x, y); } + public static Class getGenClass() { + return AndNodeGen.class; + } + AndNode(ValueNode x, ValueNode y) { super(StampTool.and(x.stamp(), y.stamp()), x, y); assert x.stamp().isCompatible(y.stamp()); @@ -61,7 +65,7 @@ return forX; } if (forX.isConstant() && !forY.isConstant()) { - return new AndNode(forY, forX); + return AndNode.create(forY, forX); } if (forX.isConstant()) { return ConstantNode.forPrimitive(stamp(), evalConst(forX.asConstant(), forY.asConstant())); @@ -77,7 +81,7 @@ if (forX instanceof SignExtendNode) { SignExtendNode ext = (SignExtendNode) forX; if (rawY == ((1L << ext.getInputBits()) - 1)) { - return new ZeroExtendNode(ext.getValue(), ext.getResultBits()); + return ZeroExtendNode.create(ext.getValue(), ext.getResultBits()); } } if (forX.stamp() instanceof IntegerStamp) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -92,7 +92,7 @@ if (stamp instanceof IntegerStamp) { return IntegerArithmeticNode.add(graph, x, y); } else if (stamp instanceof FloatStamp) { - return graph.unique(new FloatAddNode(x, y, false)); + return graph.unique(FloatAddNode.create(x, y, false)); } else { throw GraalInternalError.shouldNotReachHere(); } @@ -104,7 +104,7 @@ if (stamp instanceof IntegerStamp) { return IntegerArithmeticNode.sub(graph, x, y); } else if (stamp instanceof FloatStamp) { - return graph.unique(new FloatSubNode(x, y, false)); + return graph.unique(FloatSubNode.create(x, y, false)); } else { throw GraalInternalError.shouldNotReachHere(); } @@ -116,7 +116,7 @@ if (stamp instanceof IntegerStamp) { return IntegerArithmeticNode.mul(graph, x, y); } else if (stamp instanceof FloatStamp) { - return graph.unique(new FloatMulNode(x, y, false)); + return graph.unique(FloatMulNode.create(x, y, false)); } else { throw GraalInternalError.shouldNotReachHere(); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BitLogicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BitLogicNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BitLogicNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -45,26 +45,26 @@ } public static BitLogicNode and(StructuredGraph graph, ValueNode v1, ValueNode v2) { - return graph.unique(new AndNode(v1, v2)); + return graph.unique(AndNode.create(v1, v2)); } public static BitLogicNode and(ValueNode v1, ValueNode v2) { - return new AndNode(v1, v2); + return AndNode.create(v1, v2); } public static BitLogicNode or(StructuredGraph graph, ValueNode v1, ValueNode v2) { - return graph.unique(new OrNode(v1, v2)); + return graph.unique(OrNode.create(v1, v2)); } public static BitLogicNode or(ValueNode v1, ValueNode v2) { - return new OrNode(v1, v2); + return OrNode.create(v1, v2); } public static BitLogicNode xor(StructuredGraph graph, ValueNode v1, ValueNode v2) { - return graph.unique(new XorNode(v1, v2)); + return graph.unique(XorNode.create(v1, v2)); } public static BitLogicNode xor(ValueNode v1, ValueNode v2) { - return new XorNode(v1, v2); + return XorNode.create(v1, v2); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -78,7 +78,7 @@ return conditionalNode.condition(); } else { assert falseResult == true; - return new LogicNegationNode(conditionalNode.condition()); + return LogicNegationNode.create(conditionalNode.condition()); } } @@ -157,18 +157,18 @@ CompareNode comparison; if (condition == Condition.EQ) { if (x.getKind() == Kind.Object) { - comparison = new ObjectEqualsNode(x, y); + comparison = ObjectEqualsNode.create(x, y); } else { assert x.getKind().isNumericInteger(); - comparison = new IntegerEqualsNode(x, y); + comparison = IntegerEqualsNode.create(x, y); } } else if (condition == Condition.LT) { assert x.getKind().isNumericInteger(); - comparison = new IntegerLessThanNode(x, y); + comparison = IntegerLessThanNode.create(x, y); } else { assert condition == Condition.BT; assert x.getKind().isNumericInteger(); - comparison = new IntegerBelowNode(x, y); + comparison = IntegerBelowNode.create(x, y); } return comparison; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -48,11 +48,19 @@ return condition; } - public ConditionalNode(LogicNode condition) { + public static ConditionalNode create(LogicNode condition) { + return new ConditionalNodeGen(condition); + } + + protected ConditionalNode(LogicNode condition) { this(condition, ConstantNode.forInt(1, condition.graph()), ConstantNode.forInt(0, condition.graph())); } - public ConditionalNode(LogicNode condition, ValueNode trueValue, ValueNode falseValue) { + public static ConditionalNode create(LogicNode condition, ValueNode trueValue, ValueNode falseValue) { + return new ConditionalNodeGen(condition, trueValue, falseValue); + } + + protected ConditionalNode(LogicNode condition, ValueNode trueValue, ValueNode falseValue) { super(trueValue.stamp().meet(falseValue.stamp())); assert trueValue.stamp().isCompatible(falseValue.stamp()); this.condition = condition; @@ -77,7 +85,7 @@ public ValueNode canonical(CanonicalizerTool tool) { if (condition instanceof LogicNegationNode) { LogicNegationNode negated = (LogicNegationNode) condition; - return new ConditionalNode(negated.getValue(), falseValue(), trueValue()); + return ConditionalNode.create(negated.getValue(), falseValue(), trueValue()); } // this optimizes the case where a value that can only be 0 or 1 is materialized to 0 or 1 @@ -119,12 +127,20 @@ generator.emitConditional(this); } - private ConditionalNode(@InjectedNodeParameter StructuredGraph graph, Condition condition, ValueNode x, ValueNode y) { + public static ConditionalNode create(@InjectedNodeParameter StructuredGraph graph, Condition condition, ValueNode x, ValueNode y) { + return new ConditionalNodeGen(graph, condition, x, y); + } + + ConditionalNode(StructuredGraph graph, Condition condition, ValueNode x, ValueNode y) { this(createCompareNode(graph, condition, x, y)); } - private ConditionalNode(ValueNode type, ValueNode object) { - this(type.graph().unique(new InstanceOfDynamicNode(type, object))); + public static ConditionalNode create(ValueNode type, ValueNode object) { + return new ConditionalNodeGen(type, object); + } + + ConditionalNode(ValueNode type, ValueNode object) { + this(type.graph().unique(InstanceOfDynamicNode.create(type, object))); } @NodeIntrinsic diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatAddNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,15 @@ @NodeInfo(shortName = "+") public class FloatAddNode extends FloatArithmeticNode { - public FloatAddNode(ValueNode x, ValueNode y, boolean isStrictFP) { + public static FloatAddNode create(ValueNode x, ValueNode y, boolean isStrictFP) { + return new FloatAddNodeGen(x, y, isStrictFP); + } + + public static Class getGenClass() { + return FloatAddNodeGen.class; + } + + protected FloatAddNode(ValueNode x, ValueNode y, boolean isStrictFP) { super(x.stamp().unrestricted(), x, y, isStrictFP); } @@ -51,7 +59,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { if (forX.isConstant() && !forY.isConstant()) { - return new FloatAddNode(forY, forX, isStrictFP()); + return FloatAddNode.create(forY, forX, isStrictFP()); } if (forX.isConstant()) { return ConstantNode.forConstant(evalConst(forX.asConstant(), forY.asConstant()), null); @@ -82,10 +90,10 @@ * that a-b produces the same result as a+(-b). */ if (forX instanceof NegateNode) { - return new FloatSubNode(forY, ((NegateNode) forX).getValue(), isStrictFP()); + return FloatSubNode.create(forY, ((NegateNode) forX).getValue(), isStrictFP()); } if (forY instanceof NegateNode) { - return new FloatSubNode(forX, ((NegateNode) forY).getValue(), isStrictFP()); + return FloatSubNode.create(forX, ((NegateNode) forY).getValue(), isStrictFP()); } return this; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatConvertNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatConvertNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,7 +41,11 @@ private final FloatConvert op; - public FloatConvertNode(FloatConvert op, ValueNode input) { + public static FloatConvertNode create(FloatConvert op, ValueNode input) { + return new FloatConvertNodeGen(op, input); + } + + protected FloatConvertNode(FloatConvert op, ValueNode input) { super(createStamp(op, input), input); this.op = op; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatDivNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatDivNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatDivNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @NodeInfo(shortName = "/") public class FloatDivNode extends FloatArithmeticNode { - public FloatDivNode(ValueNode x, ValueNode y, boolean isStrictFP) { + public static FloatDivNode create(ValueNode x, ValueNode y, boolean isStrictFP) { + return new FloatDivNodeGen(x, y, isStrictFP); + } + + protected FloatDivNode(ValueNode x, ValueNode y, boolean isStrictFP) { super(x.stamp().unrestricted(), x, y, isStrictFP); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,7 +39,11 @@ * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ - public FloatEqualsNode(ValueNode x, ValueNode y) { + public static FloatEqualsNode create(ValueNode x, ValueNode y) { + return new FloatEqualsNodeGen(x, y); + } + + protected FloatEqualsNode(ValueNode x, ValueNode y) { super(x, y); assert x.stamp() instanceof FloatStamp && y.stamp() instanceof FloatStamp : x.stamp() + " " + y.stamp(); assert x.stamp().isCompatible(y.stamp()); @@ -76,9 +80,9 @@ @Override protected CompareNode duplicateModified(ValueNode newX, ValueNode newY) { if (newX.stamp() instanceof FloatStamp && newY.stamp() instanceof FloatStamp) { - return new FloatEqualsNode(newX, newY); + return FloatEqualsNode.create(newX, newY); } else if (newX.stamp() instanceof IntegerStamp && newY.stamp() instanceof IntegerStamp) { - return new IntegerEqualsNode(newX, newY); + return IntegerEqualsNode.create(newX, newY); } throw GraalInternalError.shouldNotReachHere(); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,11 @@ * @param unorderedIsTrue whether a comparison that is undecided (involving NaNs, etc.) leads to * a "true" result */ - public FloatLessThanNode(ValueNode x, ValueNode y, boolean unorderedIsTrue) { + public static FloatLessThanNode create(ValueNode x, ValueNode y, boolean unorderedIsTrue) { + return new FloatLessThanNodeGen(x, y, unorderedIsTrue); + } + + protected FloatLessThanNode(ValueNode x, ValueNode y, boolean unorderedIsTrue) { super(x, y); assert x.stamp() instanceof FloatStamp && y.stamp() instanceof FloatStamp; assert x.stamp().isCompatible(y.stamp()); @@ -75,9 +79,9 @@ @Override protected CompareNode duplicateModified(ValueNode newX, ValueNode newY) { if (newX.stamp() instanceof FloatStamp && newY.stamp() instanceof FloatStamp) { - return new FloatLessThanNode(newX, newY, unorderedIsTrue); + return FloatLessThanNode.create(newX, newY, unorderedIsTrue); } else if (newX.stamp() instanceof IntegerStamp && newY.stamp() instanceof IntegerStamp) { - return new IntegerLessThanNode(newX, newY); + return IntegerLessThanNode.create(newX, newY); } throw GraalInternalError.shouldNotReachHere(); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatMulNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,15 @@ @NodeInfo(shortName = "*") public class FloatMulNode extends FloatArithmeticNode { - public FloatMulNode(ValueNode x, ValueNode y, boolean isStrictFP) { + public static FloatMulNode create(ValueNode x, ValueNode y, boolean isStrictFP) { + return new FloatMulNodeGen(x, y, isStrictFP); + } + + public static Class getGenClass() { + return FloatMulNodeGen.class; + } + + protected FloatMulNode(ValueNode x, ValueNode y, boolean isStrictFP) { super(x.stamp().unrestricted(), x, y, isStrictFP); } @@ -51,7 +59,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { if (forX.isConstant() && !forY.isConstant()) { - return new FloatMulNode(forY, forX, isStrictFP()); + return FloatMulNode.create(forY, forX, isStrictFP()); } if (forX.isConstant()) { return ConstantNode.forPrimitive(evalConst(forX.asConstant(), forY.asConstant())); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatRemNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatRemNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatRemNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @NodeInfo(shortName = "%") public class FloatRemNode extends FloatArithmeticNode implements Lowerable { - public FloatRemNode(ValueNode x, ValueNode y, boolean isStrictFP) { + public static FloatRemNode create(ValueNode x, ValueNode y, boolean isStrictFP) { + return new FloatRemNodeGen(x, y, isStrictFP); + } + + protected FloatRemNode(ValueNode x, ValueNode y, boolean isStrictFP) { super(x.stamp().unrestricted(), x, y, isStrictFP); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatSubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatSubNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatSubNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,7 +34,15 @@ @NodeInfo(shortName = "-") public class FloatSubNode extends FloatArithmeticNode { - public FloatSubNode(ValueNode x, ValueNode y, boolean isStrictFP) { + public static FloatSubNode create(ValueNode x, ValueNode y, boolean isStrictFP) { + return new FloatSubNodeGen(x, y, isStrictFP); + } + + public static Class getGenClass() { + return FloatSubNodeGen.class; + } + + protected FloatSubNode(ValueNode x, ValueNode y, boolean isStrictFP) { super(x.stamp().unrestricted(), x, y, isStrictFP); } @@ -63,12 +71,12 @@ switch (x.getKind()) { case Float: if (Float.compare(x.asFloat(), -0.0f) == 0) { - return new NegateNode(forY); + return NegateNode.create(forY); } break; case Double: if (Double.compare(x.asDouble(), -0.0) == 0) { - return new NegateNode(forY); + return NegateNode.create(forY); } break; default: @@ -101,7 +109,7 @@ * that a-b produces the same result as a+(-b). */ if (forY instanceof NegateNode) { - return new FloatAddNode(forX, ((NegateNode) forY).getValue(), isStrictFP()); + return FloatAddNode.create(forX, ((NegateNode) forY).getValue(), isStrictFP()); } return this; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerAddNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,7 +34,15 @@ @NodeInfo(shortName = "+") public class IntegerAddNode extends IntegerArithmeticNode implements NarrowableArithmeticNode { - public IntegerAddNode(ValueNode x, ValueNode y) { + public static IntegerAddNode create(ValueNode x, ValueNode y) { + return new IntegerAddNodeGen(x, y); + } + + public static Class getGenClass() { + return IntegerAddNodeGen.class; + } + + protected IntegerAddNode(ValueNode x, ValueNode y) { super(StampTool.add(x.stamp(), y.stamp()), x, y); } @@ -52,7 +60,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { if (forX.isConstant() && !forY.isConstant()) { - return new IntegerAddNode(forY, forX); + return IntegerAddNode.create(forY, forX); } if (forX instanceof IntegerSubNode) { IntegerSubNode sub = (IntegerSubNode) forX; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -36,26 +36,26 @@ } public static IntegerAddNode add(StructuredGraph graph, ValueNode v1, ValueNode v2) { - return graph.unique(new IntegerAddNode(v1, v2)); + return graph.unique(IntegerAddNode.create(v1, v2)); } public static IntegerAddNode add(ValueNode v1, ValueNode v2) { - return new IntegerAddNode(v1, v2); + return IntegerAddNode.create(v1, v2); } public static IntegerMulNode mul(StructuredGraph graph, ValueNode v1, ValueNode v2) { - return graph.unique(new IntegerMulNode(v1, v2)); + return graph.unique(IntegerMulNode.create(v1, v2)); } public static IntegerMulNode mul(ValueNode v1, ValueNode v2) { - return new IntegerMulNode(v1, v2); + return IntegerMulNode.create(v1, v2); } public static IntegerSubNode sub(StructuredGraph graph, ValueNode v1, ValueNode v2) { - return graph.unique(new IntegerSubNode(v1, v2)); + return graph.unique(IntegerSubNode.create(v1, v2)); } public static IntegerSubNode sub(ValueNode v1, ValueNode v2) { - return new IntegerSubNode(v1, v2); + return IntegerSubNode.create(v1, v2); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ - public IntegerBelowNode(ValueNode x, ValueNode y) { + public static IntegerBelowNode create(ValueNode x, ValueNode y) { + return new IntegerBelowNodeGen(x, y); + } + + protected IntegerBelowNode(ValueNode x, ValueNode y) { super(x, y); assert x.stamp() instanceof IntegerStamp; assert y.stamp() instanceof IntegerStamp; @@ -75,13 +79,13 @@ } if (forX.isConstant() && forX.asConstant().asLong() == 0) { // 0 |<| y is the same as 0 != y - return new LogicNegationNode(CompareNode.createCompareNode(Condition.EQ, forX, forY)); + return LogicNegationNode.create(CompareNode.createCompareNode(Condition.EQ, forX, forY)); } return this; } @Override protected CompareNode duplicateModified(ValueNode newX, ValueNode newY) { - return new IntegerBelowNode(newX, newY); + return IntegerBelowNode.create(newX, newY); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -97,13 +97,13 @@ if (toStamp.getBits() == fromStamp.getBits()) { result = input; } else if (toStamp.getBits() < fromStamp.getBits()) { - result = new NarrowNode(input, toStamp.getBits()); + result = NarrowNode.create(input, toStamp.getBits()); } else if (zeroExtend) { // toStamp.getBits() > fromStamp.getBits() - result = new ZeroExtendNode(input, toStamp.getBits()); + result = ZeroExtendNode.create(input, toStamp.getBits()); } else { // toStamp.getBits() > fromStamp.getBits() - result = new SignExtendNode(input, toStamp.getBits()); + result = SignExtendNode.create(input, toStamp.getBits()); } IntegerStamp resultStamp = (IntegerStamp) result.stamp(); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,7 +34,11 @@ @NodeInfo(shortName = "/") public class IntegerDivNode extends FixedBinaryNode implements Lowerable, LIRLowerable { - public IntegerDivNode(ValueNode x, ValueNode y) { + public static IntegerDivNode create(ValueNode x, ValueNode y) { + return new IntegerDivNodeGen(x, y); + } + + protected IntegerDivNode(ValueNode x, ValueNode y) { super(StampTool.div(x.stamp(), y.stamp()), x, y); } @@ -57,7 +61,7 @@ return forX; } if (c == -1) { - return new NegateNode(forX); + return NegateNode.create(forX); } long abs = Math.abs(c); if (CodeUtil.isPowerOf2(abs) && forX.stamp() instanceof IntegerStamp) { @@ -67,13 +71,13 @@ // no rounding if dividend is positive or if its low bits are always 0 if (stampX.canBeNegative() || (stampX.upMask() & (abs - 1)) != 0) { int bits = PrimitiveStamp.getBits(stamp()); - RightShiftNode sign = new RightShiftNode(forX, ConstantNode.forInt(bits - 1)); - UnsignedRightShiftNode round = new UnsignedRightShiftNode(sign, ConstantNode.forInt(bits - log2)); + RightShiftNode sign = RightShiftNode.create(forX, ConstantNode.forInt(bits - 1)); + UnsignedRightShiftNode round = UnsignedRightShiftNode.create(sign, ConstantNode.forInt(bits - log2)); dividend = IntegerArithmeticNode.add(dividend, round); } - RightShiftNode shift = new RightShiftNode(dividend, ConstantNode.forInt(log2)); + RightShiftNode shift = RightShiftNode.create(dividend, ConstantNode.forInt(log2)); if (c < 0) { - return new NegateNode(shift); + return NegateNode.create(shift); } return shift; } @@ -86,7 +90,7 @@ IntegerRemNode integerRemNode = (IntegerRemNode) integerSubNode.getY(); if (integerSubNode.stamp().isCompatible(this.stamp()) && integerRemNode.stamp().isCompatible(this.stamp()) && integerSubNode.getX() == integerRemNode.getX() && forY == integerRemNode.getY()) { - return new IntegerDivNode(integerSubNode.getX(), forY); + return IntegerDivNode.create(integerSubNode.getX(), forY); } } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -40,7 +40,11 @@ * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ - public IntegerEqualsNode(ValueNode x, ValueNode y) { + public static IntegerEqualsNode create(ValueNode x, ValueNode y) { + return new IntegerEqualsNodeGen(x, y); + } + + protected IntegerEqualsNode(ValueNode x, ValueNode y) { super(x, y); assert !x.getKind().isNumericFloat() && x.getKind() != Kind.Object; assert !y.getKind().isNumericFloat() && y.getKind() != Kind.Object; @@ -63,9 +67,9 @@ ValueNode b = mirrored ? normalizeNode.getX() : normalizeNode.getY(); if (normalizeNode.getX().getKind() == Kind.Double || normalizeNode.getX().getKind() == Kind.Float) { - return new FloatEqualsNode(a, b); + return FloatEqualsNode.create(a, b); } else { - return new IntegerEqualsNode(a, b); + return IntegerEqualsNode.create(a, b); } } return this; @@ -74,9 +78,9 @@ @Override protected CompareNode duplicateModified(ValueNode newX, ValueNode newY) { if (newX.stamp() instanceof FloatStamp && newY.stamp() instanceof FloatStamp) { - return new FloatEqualsNode(newX, newY); + return FloatEqualsNode.create(newX, newY); } else if (newX.stamp() instanceof IntegerStamp && newY.stamp() instanceof IntegerStamp) { - return new IntegerEqualsNode(newX, newY); + return IntegerEqualsNode.create(newX, newY); } throw GraalInternalError.shouldNotReachHere(); } @@ -96,7 +100,7 @@ if (constant.asLong() == 0) { if (nonConstant instanceof AndNode) { AndNode andNode = (AndNode) nonConstant; - return new IntegerTestNode(andNode.getX(), andNode.getY()); + return IntegerTestNode.create(andNode.getX(), andNode.getY()); } else if (nonConstant instanceof ShiftNode) { if (nonConstant instanceof LeftShiftNode) { LeftShiftNode shift = (LeftShiftNode) nonConstant; @@ -104,10 +108,10 @@ int mask = shift.getShiftAmountMask(); int amount = shift.getY().asConstant().asInt() & mask; if (shift.getX().getKind() == Kind.Int) { - return new IntegerTestNode(shift.getX(), ConstantNode.forInt(-1 >>> amount)); + return IntegerTestNode.create(shift.getX(), ConstantNode.forInt(-1 >>> amount)); } else { assert shift.getX().getKind() == Kind.Long; - return new IntegerTestNode(shift.getX(), ConstantNode.forLong(-1L >>> amount)); + return IntegerTestNode.create(shift.getX(), ConstantNode.forLong(-1L >>> amount)); } } } else if (nonConstant instanceof RightShiftNode) { @@ -116,10 +120,10 @@ int mask = shift.getShiftAmountMask(); int amount = shift.getY().asConstant().asInt() & mask; if (shift.getX().getKind() == Kind.Int) { - return new IntegerTestNode(shift.getX(), ConstantNode.forInt(-1 << amount)); + return IntegerTestNode.create(shift.getX(), ConstantNode.forInt(-1 << amount)); } else { assert shift.getX().getKind() == Kind.Long; - return new IntegerTestNode(shift.getX(), ConstantNode.forLong(-1L << amount)); + return IntegerTestNode.create(shift.getX(), ConstantNode.forLong(-1L << amount)); } } } else if (nonConstant instanceof UnsignedRightShiftNode) { @@ -128,10 +132,10 @@ int mask = shift.getShiftAmountMask(); int amount = shift.getY().asConstant().asInt() & mask; if (shift.getX().getKind() == Kind.Int) { - return new IntegerTestNode(shift.getX(), ConstantNode.forInt(-1 << amount)); + return IntegerTestNode.create(shift.getX(), ConstantNode.forInt(-1 << amount)); } else { assert shift.getX().getKind() == Kind.Long; - return new IntegerTestNode(shift.getX(), ConstantNode.forLong(-1L << amount)); + return IntegerTestNode.create(shift.getX(), ConstantNode.forLong(-1L << amount)); } } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -40,7 +40,11 @@ * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ - public IntegerLessThanNode(ValueNode x, ValueNode y) { + public static IntegerLessThanNode create(ValueNode x, ValueNode y) { + return new IntegerLessThanNodeGen(x, y); + } + + protected IntegerLessThanNode(ValueNode x, ValueNode y) { super(x, y); assert !x.getKind().isNumericFloat() && x.getKind() != Kind.Object; assert !y.getKind().isNumericFloat() && y.getKind() != Kind.Object; @@ -64,9 +68,9 @@ ValueNode b = mirrored ? normalizeNode.getX() : normalizeNode.getY(); if (normalizeNode.getX().getKind() == Kind.Double || normalizeNode.getX().getKind() == Kind.Float) { - return new FloatLessThanNode(a, b, mirrored ^ normalizeNode.isUnorderedLess); + return FloatLessThanNode.create(a, b, mirrored ^ normalizeNode.isUnorderedLess); } else { - return new IntegerLessThanNode(a, b); + return IntegerLessThanNode.create(a, b); } } return this; @@ -91,7 +95,7 @@ } if (forX.stamp() instanceof IntegerStamp && forY.stamp() instanceof IntegerStamp) { if (IntegerStamp.sameSign((IntegerStamp) forX.stamp(), (IntegerStamp) forY.stamp())) { - return new IntegerBelowNode(forX, forY); + return IntegerBelowNode.create(forX, forY); } } return this; @@ -100,9 +104,9 @@ @Override protected CompareNode duplicateModified(ValueNode newX, ValueNode newY) { if (newX.stamp() instanceof FloatStamp && newY.stamp() instanceof FloatStamp) { - return new FloatLessThanNode(newX, newY, true); + return FloatLessThanNode.create(newX, newY, true); } else if (newX.stamp() instanceof IntegerStamp && newY.stamp() instanceof IntegerStamp) { - return new IntegerLessThanNode(newX, newY); + return IntegerLessThanNode.create(newX, newY); } throw GraalInternalError.shouldNotReachHere(); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,7 +34,15 @@ @NodeInfo(shortName = "*") public class IntegerMulNode extends IntegerArithmeticNode implements NarrowableArithmeticNode { - public IntegerMulNode(ValueNode x, ValueNode y) { + public static IntegerMulNode create(ValueNode x, ValueNode y) { + return new IntegerMulNodeGen(x, y); + } + + public static Class getGenClass() { + return IntegerMulNodeGen.class; + } + + protected IntegerMulNode(ValueNode x, ValueNode y) { super(x.stamp().unrestricted(), x, y); assert x.stamp().isCompatible(y.stamp()); } @@ -48,7 +56,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { if (forX.isConstant() && !forY.isConstant()) { - return new IntegerMulNode(forY, forX); + return IntegerMulNode.create(forY, forX); } if (forX.isConstant()) { return ConstantNode.forPrimitive(evalConst(forX.asConstant(), forY.asConstant())); @@ -62,9 +70,9 @@ } long abs = Math.abs(c); if (abs > 0 && CodeUtil.isPowerOf2(abs)) { - LeftShiftNode shift = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(abs))); + LeftShiftNode shift = LeftShiftNode.create(forX, ConstantNode.forInt(CodeUtil.log2(abs))); if (c < 0) { - return new NegateNode(shift); + return NegateNode.create(shift); } else { return shift; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @NodeInfo(shortName = "%") public class IntegerRemNode extends FixedBinaryNode implements Lowerable, LIRLowerable { - public IntegerRemNode(ValueNode x, ValueNode y) { + public static IntegerRemNode create(ValueNode x, ValueNode y) { + return new IntegerRemNodeGen(x, y); + } + + protected IntegerRemNode(ValueNode x, ValueNode y) { super(StampTool.rem(x.stamp(), y.stamp()), x, y); } @@ -55,7 +59,7 @@ if (c == 1 || c == -1) { return ConstantNode.forIntegerStamp(stamp(), 0); } else if (c > 0 && CodeUtil.isPowerOf2(c) && forX.stamp() instanceof IntegerStamp && ((IntegerStamp) forX.stamp()).isPositive()) { - return new AndNode(forX, ConstantNode.forIntegerStamp(stamp(), c - 1)); + return AndNode.create(forX, ConstantNode.forIntegerStamp(stamp(), c - 1)); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,15 @@ @NodeInfo(shortName = "-") public class IntegerSubNode extends IntegerArithmeticNode implements NarrowableArithmeticNode { - public IntegerSubNode(ValueNode x, ValueNode y) { + public static IntegerSubNode create(ValueNode x, ValueNode y) { + return new IntegerSubNodeGen(x, y); + } + + public static Class getGenClass() { + return IntegerSubNodeGen.class; + } + + protected IntegerSubNode(ValueNode x, ValueNode y) { super(StampTool.sub(x.stamp(), y.stamp()), x, y); } @@ -69,18 +77,18 @@ IntegerSubNode x = (IntegerSubNode) forX; if (x.getX() == forY) { // (a - b) - a - return new NegateNode(x.getY()); + return NegateNode.create(x.getY()); } } if (forY instanceof IntegerAddNode) { IntegerAddNode y = (IntegerAddNode) forY; if (y.getX() == forX) { // a - (a + b) - return new NegateNode(y.getY()); + return NegateNode.create(y.getY()); } if (y.getY() == forX) { // b - (a + b) - return new NegateNode(y.getX()); + return NegateNode.create(y.getX()); } } else if (forY instanceof IntegerSubNode) { IntegerSubNode y = (IntegerSubNode) forY; @@ -108,7 +116,7 @@ } else if (forX.isConstant()) { long c = forX.asConstant().asLong(); if (c == 0) { - return new NegateNode(forY); + return NegateNode.create(forY); } return BinaryNode.reassociate(this, ValueNode.isConstantPredicate(), forX, forY); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,7 +41,11 @@ * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ - public IntegerTestNode(ValueNode x, ValueNode y) { + public static IntegerTestNode create(ValueNode x, ValueNode y) { + return new IntegerTestNodeGen(x, y); + } + + protected IntegerTestNode(ValueNode x, ValueNode y) { super(x, y); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,7 +41,11 @@ * * @param object the instruction producing the object to check against null */ - public IsNullNode(ValueNode object) { + public static IsNullNode create(ValueNode object) { + return new IsNullNodeGen(object); + } + + protected IsNullNode(ValueNode object) { super(object); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @NodeInfo(shortName = "<<") public class LeftShiftNode extends ShiftNode { - public LeftShiftNode(ValueNode x, ValueNode y) { + public static LeftShiftNode create(ValueNode x, ValueNode y) { + return new LeftShiftNodeGen(x, y); + } + + protected LeftShiftNode(ValueNode x, ValueNode y) { super(x, y); } @@ -74,19 +78,19 @@ if (total != (total & mask)) { return ConstantNode.forIntegerKind(getKind(), 0); } - return new LeftShiftNode(other.getX(), ConstantNode.forInt(total)); + return LeftShiftNode.create(other.getX(), ConstantNode.forInt(total)); } else if ((other instanceof RightShiftNode || other instanceof UnsignedRightShiftNode) && otherAmount == amount) { if (getKind() == Kind.Long) { - return new AndNode(other.getX(), ConstantNode.forLong(-1L << amount)); + return AndNode.create(other.getX(), ConstantNode.forLong(-1L << amount)); } else { assert getKind() == Kind.Int; - return new AndNode(other.getX(), ConstantNode.forInt(-1 << amount)); + return AndNode.create(other.getX(), ConstantNode.forInt(-1 << amount)); } } } } if (originalAmout != amount) { - return new LeftShiftNode(forX, ConstantNode.forInt(amount)); + return LeftShiftNode.create(forX, ConstantNode.forInt(amount)); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NarrowNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NarrowNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NarrowNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,11 @@ @NodeInfo public class NarrowNode extends IntegerConvertNode { - public NarrowNode(ValueNode input, int resultBits) { + public static NarrowNode create(ValueNode input, int resultBits) { + return new NarrowNodeGen(input, resultBits); + } + + protected NarrowNode(ValueNode input, int resultBits) { super(StampTool.narrowingConversion(input.stamp(), resultBits), input, resultBits); } @@ -73,7 +77,7 @@ // zzzzzzzz yyyyxxxx -(narrow)-> yyyyxxxx -(narrow)-> xxxx // ==> zzzzzzzz yyyyxxxx -(narrow)-> xxxx NarrowNode other = (NarrowNode) forValue; - return new NarrowNode(other.getValue(), getResultBits()); + return NarrowNode.create(other.getValue(), getResultBits()); } else if (forValue instanceof IntegerConvertNode) { // SignExtendNode or ZeroExtendNode IntegerConvertNode other = (IntegerConvertNode) forValue; @@ -84,16 +88,16 @@ } else if (getResultBits() < other.getInputBits()) { // yyyyxxxx -(extend)-> zzzzzzzz yyyyxxxx -(narrow)-> xxxx // ==> yyyyxxxx -(narrow)-> xxxx - return new NarrowNode(other.getValue(), getResultBits()); + return NarrowNode.create(other.getValue(), getResultBits()); } else { if (other instanceof SignExtendNode) { // sxxx -(sign-extend)-> ssssssss sssssxxx -(narrow)-> sssssxxx // ==> sxxx -(sign-extend)-> sssssxxx - return new SignExtendNode(other.getValue(), getResultBits()); + return SignExtendNode.create(other.getValue(), getResultBits()); } else if (other instanceof ZeroExtendNode) { // xxxx -(zero-extend)-> 00000000 00000xxx -(narrow)-> 0000xxxx // ==> xxxx -(zero-extend)-> 0000xxxx - return new ZeroExtendNode(other.getValue(), getResultBits()); + return ZeroExtendNode.create(other.getValue(), getResultBits()); } } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -47,7 +47,11 @@ * * @param value the instruction producing the value that is input to this instruction */ - public NegateNode(ValueNode value) { + public static NegateNode create(ValueNode value) { + return new NegateNodeGen(value); + } + + protected NegateNode(ValueNode value) { super(StampTool.negate(value.stamp()), value); } @@ -78,7 +82,7 @@ } if (forValue instanceof IntegerSubNode) { IntegerSubNode sub = (IntegerSubNode) forValue; - return new IntegerSubNode(sub.getY(), sub.getX()); + return IntegerSubNode.create(sub.getY(), sub.getX()); } return this; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -47,7 +47,11 @@ * @param isUnorderedLess true when an unordered floating point comparison is interpreted as * less, false when greater. */ - public NormalizeCompareNode(ValueNode x, ValueNode y, boolean isUnorderedLess) { + public static NormalizeCompareNode create(ValueNode x, ValueNode y, boolean isUnorderedLess) { + return new NormalizeCompareNodeGen(x, y, isUnorderedLess); + } + + protected NormalizeCompareNode(ValueNode x, ValueNode y, boolean isUnorderedLess) { super(StampFactory.forKind(Kind.Int), x, y); this.isUnorderedLess = isUnorderedLess; } @@ -63,15 +67,15 @@ LogicNode equalComp; LogicNode lessComp; if (getX().stamp() instanceof FloatStamp) { - equalComp = graph().unique(new FloatEqualsNode(getX(), getY())); - lessComp = graph().unique(new FloatLessThanNode(getX(), getY(), isUnorderedLess)); + equalComp = graph().unique(FloatEqualsNode.create(getX(), getY())); + lessComp = graph().unique(FloatLessThanNode.create(getX(), getY(), isUnorderedLess)); } else { - equalComp = graph().unique(new IntegerEqualsNode(getX(), getY())); - lessComp = graph().unique(new IntegerLessThanNode(getX(), getY())); + equalComp = graph().unique(IntegerEqualsNode.create(getX(), getY())); + lessComp = graph().unique(IntegerLessThanNode.create(getX(), getY())); } - ConditionalNode equalValue = graph().unique(new ConditionalNode(equalComp, ConstantNode.forInt(0, graph()), ConstantNode.forInt(1, graph()))); - ConditionalNode value = graph().unique(new ConditionalNode(lessComp, ConstantNode.forInt(-1, graph()), equalValue)); + ConditionalNode equalValue = graph().unique(ConditionalNode.create(equalComp, ConstantNode.forInt(0, graph()), ConstantNode.forInt(1, graph()))); + ConditionalNode value = graph().unique(ConditionalNode.create(lessComp, ConstantNode.forInt(-1, graph()), equalValue)); graph().replaceFloating(this, value); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NotNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NotNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NotNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -53,7 +53,11 @@ * * @param x the instruction producing the value that is input to this instruction */ - public NotNode(ValueNode x) { + public static NotNode create(ValueNode x) { + return new NotNodeGen(x); + } + + protected NotNode(ValueNode x) { super(StampTool.not(x.stamp()), x); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -40,7 +40,11 @@ * @param x the instruction producing the first input to the instruction * @param y the instruction that produces the second input to this instruction */ - public ObjectEqualsNode(ValueNode x, ValueNode y) { + public static ObjectEqualsNode create(ValueNode x, ValueNode y) { + return new ObjectEqualsNodeGen(x, y); + } + + protected ObjectEqualsNode(ValueNode x, ValueNode y) { super(x, y); assert x.getKind() == Kind.Object; assert y.getKind() == Kind.Object; @@ -68,9 +72,9 @@ return LogicConstantNode.contradiction(); } if (StampTool.isObjectAlwaysNull(forX)) { - return new IsNullNode(forY); + return IsNullNode.create(forY); } else if (StampTool.isObjectAlwaysNull(forY)) { - return new IsNullNode(forX); + return IsNullNode.create(forX); } return this; } @@ -81,7 +85,7 @@ Constant otherUnboxed = tool.getConstantReflectionProvider().unboxPrimitive(other.asConstant()); if (otherUnboxed != null && otherUnboxed.getKind() == Kind.Boolean) { int expectedValue = otherUnboxed.asBoolean() ? 1 : 0; - IntegerEqualsNode equals = new IntegerEqualsNode(state.getEntry(0), ConstantNode.forInt(expectedValue, graph())); + IntegerEqualsNode equals = IntegerEqualsNode.create(state.getEntry(0), ConstantNode.forInt(expectedValue, graph())); tool.addNode(equals); tool.replaceWithValue(equals); } else { @@ -112,7 +116,7 @@ /* * One of the two objects has identity, the other doesn't. In code, this looks like * "Integer.valueOf(a) == new Integer(b)", which is always false. - * + * * In other words: an object created via valueOf can never be equal to one created * by new in the same compilation unit. */ @@ -122,7 +126,7 @@ assert stateX.getVirtualObject().entryCount() == 1 && stateY.getVirtualObject().entryCount() == 1; assert stateX.getVirtualObject().type().equals(stateY.getVirtualObject().type()); assert stateX.getVirtualObject().entryKind(0).getStackKind() == Kind.Int || stateX.getVirtualObject().entryKind(0) == Kind.Long; - IntegerEqualsNode equals = new IntegerEqualsNode(stateX.getEntry(0), stateY.getEntry(0)); + IntegerEqualsNode equals = IntegerEqualsNode.create(stateX.getEntry(0), stateY.getEntry(0)); tool.addNode(equals); tool.replaceWithValue(equals); } else { @@ -134,6 +138,6 @@ @Override protected CompareNode duplicateModified(ValueNode newX, ValueNode newY) { - return new ObjectEqualsNode(newX, newY); + return ObjectEqualsNode.create(newX, newY); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/OrNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/OrNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/OrNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,15 @@ @NodeInfo(shortName = "|") public class OrNode extends BitLogicNode { - public OrNode(ValueNode x, ValueNode y) { + public static OrNode create(ValueNode x, ValueNode y) { + return new OrNodeGen(x, y); + } + + public static Class getGenClass() { + return OrNodeGen.class; + } + + OrNode(ValueNode x, ValueNode y) { super(StampTool.or(x.stamp(), y.stamp()), x, y); assert x.stamp().isCompatible(y.stamp()); } @@ -57,7 +65,7 @@ return forX; } if (forX.isConstant() && !forY.isConstant()) { - return new OrNode(forY, forX); + return create(forY, forX); } if (forX.isConstant()) { return ConstantNode.forPrimitive(stamp(), evalConst(forX.asConstant(), forY.asConstant())); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,11 +39,19 @@ @NodeInfo public class ReinterpretNode extends UnaryNode implements ArithmeticLIRLowerable { - private ReinterpretNode(Kind to, ValueNode value) { + public static ReinterpretNode create(Kind to, ValueNode value) { + return new ReinterpretNodeGen(to, value); + } + + ReinterpretNode(Kind to, ValueNode value) { this(StampFactory.forKind(to), value); } - public ReinterpretNode(Stamp to, ValueNode value) { + public static ReinterpretNode create(Stamp to, ValueNode value) { + return new ReinterpretNodeGen(to, value); + } + + protected ReinterpretNode(Stamp to, ValueNode value) { super(to, value); assert to instanceof PrimitiveStamp; } @@ -91,7 +99,7 @@ } if (forValue instanceof ReinterpretNode) { ReinterpretNode reinterpret = (ReinterpretNode) forValue; - return new ReinterpretNode(stamp(), reinterpret.getValue()); + return ReinterpretNode.create(stamp(), reinterpret.getValue()); } return this; } @@ -103,7 +111,7 @@ } public static ValueNode reinterpret(Kind toKind, ValueNode value) { - return value.graph().unique(new ReinterpretNode(toKind, value)); + return value.graph().unique(ReinterpretNode.create(toKind, value)); } @NodeIntrinsic diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,7 +34,11 @@ @NodeInfo(shortName = ">>") public class RightShiftNode extends ShiftNode { - public RightShiftNode(ValueNode x, ValueNode y) { + public static RightShiftNode create(ValueNode x, ValueNode y) { + return new RightShiftNodeGen(x, y); + } + + protected RightShiftNode(ValueNode x, ValueNode y) { super(x, y); } @@ -57,7 +61,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { if (forX.stamp() instanceof IntegerStamp && ((IntegerStamp) forX.stamp()).isPositive()) { - return new UnsignedRightShiftNode(forX, forY); + return UnsignedRightShiftNode.create(forX, forY); } if (forX.isConstant() && forY.isConstant()) { return ConstantNode.forPrimitive(evalConst(forX.asConstant(), forY.asConstant())); @@ -91,14 +95,14 @@ * full shift for this kind */ assert total >= mask; - return new RightShiftNode(other.getX(), ConstantNode.forInt(mask)); + return RightShiftNode.create(other.getX(), ConstantNode.forInt(mask)); } - return new RightShiftNode(other.getX(), ConstantNode.forInt(total)); + return RightShiftNode.create(other.getX(), ConstantNode.forInt(total)); } } } if (originalAmout != amount) { - return new RightShiftNode(forX, ConstantNode.forInt(amount)); + return RightShiftNode.create(forX, ConstantNode.forInt(amount)); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SignExtendNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SignExtendNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SignExtendNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,11 @@ @NodeInfo public class SignExtendNode extends IntegerConvertNode { - public SignExtendNode(ValueNode input, int resultBits) { + public static SignExtendNode create(ValueNode input, int resultBits) { + return new SignExtendNodeGen(input, resultBits); + } + + protected SignExtendNode(ValueNode input, int resultBits) { super(StampTool.signExtend(input.stamp(), resultBits), input, resultBits); } @@ -79,13 +83,13 @@ // sxxx -(sign-extend)-> ssss sxxx -(sign-extend)-> ssssssss sssssxxx // ==> sxxx -(sign-extend)-> ssssssss sssssxxx SignExtendNode other = (SignExtendNode) forValue; - return new SignExtendNode(other.getValue(), getResultBits()); + return SignExtendNode.create(other.getValue(), getResultBits()); } else if (forValue instanceof ZeroExtendNode) { ZeroExtendNode other = (ZeroExtendNode) forValue; if (other.getResultBits() > other.getInputBits()) { // sxxx -(zero-extend)-> 0000 sxxx -(sign-extend)-> 00000000 0000sxxx // ==> sxxx -(zero-extend)-> 00000000 0000sxxx - return new ZeroExtendNode(other.getValue(), getResultBits()); + return ZeroExtendNode.create(other.getValue(), getResultBits()); } } @@ -94,7 +98,7 @@ if ((inputStamp.upMask() & (1L << (getInputBits() - 1))) == 0L) { // 0xxx -(sign-extend)-> 0000 0xxx // ==> 0xxx -(zero-extend)-> 0000 0xxx - return new ZeroExtendNode(forValue, getResultBits()); + return ZeroExtendNode.create(forValue, getResultBits()); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @NodeInfo(shortName = "|/|") public class UnsignedDivNode extends FixedBinaryNode implements Lowerable, LIRLowerable { - public UnsignedDivNode(ValueNode x, ValueNode y) { + public static UnsignedDivNode create(ValueNode x, ValueNode y) { + return new UnsignedDivNodeGen(x, y); + } + + protected UnsignedDivNode(ValueNode x, ValueNode y) { super(x.stamp().unrestricted(), x, y); } @@ -50,7 +54,7 @@ return forX; } if (CodeUtil.isPowerOf2(c)) { - return new UnsignedRightShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(c))); + return UnsignedRightShiftNode.create(forX, ConstantNode.forInt(CodeUtil.log2(c))); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @NodeInfo(shortName = "|%|") public class UnsignedRemNode extends FixedBinaryNode implements Lowerable, LIRLowerable { - public UnsignedRemNode(ValueNode x, ValueNode y) { + public static UnsignedRemNode create(ValueNode x, ValueNode y) { + return new UnsignedRemNodeGen(x, y); + } + + protected UnsignedRemNode(ValueNode x, ValueNode y) { super(x.stamp().unrestricted(), x, y); } @@ -49,7 +53,7 @@ if (c == 1) { return ConstantNode.forIntegerStamp(stamp(), 0); } else if (CodeUtil.isPowerOf2(c)) { - return new AndNode(forX, ConstantNode.forIntegerStamp(stamp(), c - 1)); + return AndNode.create(forX, ConstantNode.forIntegerStamp(stamp(), c - 1)); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @NodeInfo(shortName = ">>>") public class UnsignedRightShiftNode extends ShiftNode { - public UnsignedRightShiftNode(ValueNode x, ValueNode y) { + public static UnsignedRightShiftNode create(ValueNode x, ValueNode y) { + return new UnsignedRightShiftNodeGen(x, y); + } + + protected UnsignedRightShiftNode(ValueNode x, ValueNode y) { super(x, y); } @@ -74,19 +78,19 @@ if (total != (total & mask)) { return ConstantNode.forIntegerKind(getKind(), 0); } - return new UnsignedRightShiftNode(other.getX(), ConstantNode.forInt(total)); + return UnsignedRightShiftNode.create(other.getX(), ConstantNode.forInt(total)); } else if (other instanceof LeftShiftNode && otherAmount == amount) { if (getKind() == Kind.Long) { - return new AndNode(other.getX(), ConstantNode.forLong(-1L >>> amount)); + return AndNode.create(other.getX(), ConstantNode.forLong(-1L >>> amount)); } else { assert getKind() == Kind.Int; - return new AndNode(other.getX(), ConstantNode.forInt(-1 >>> amount)); + return AndNode.create(other.getX(), ConstantNode.forInt(-1 >>> amount)); } } } } if (originalAmout != amount) { - return new UnsignedRightShiftNode(forX, ConstantNode.forInt(amount)); + return UnsignedRightShiftNode.create(forX, ConstantNode.forInt(amount)); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,15 @@ @NodeInfo(shortName = "^") public class XorNode extends BitLogicNode { - public XorNode(ValueNode x, ValueNode y) { + public static XorNode create(ValueNode x, ValueNode y) { + return new XorNodeGen(x, y); + } + + public static Class getGenClass() { + return XorNodeGen.class; + } + + protected XorNode(ValueNode x, ValueNode y) { super(StampTool.xor(x.stamp(), y.stamp()), x, y); assert x.stamp().isCompatible(y.stamp()); } @@ -57,7 +65,7 @@ return ConstantNode.forIntegerStamp(stamp(), 0); } if (forX.isConstant() && !forY.isConstant()) { - return new XorNode(forY, forX); + return XorNode.create(forY, forX); } if (forX.isConstant()) { return ConstantNode.forPrimitive(stamp(), evalConst(forX.asConstant(), forY.asConstant())); @@ -67,7 +75,7 @@ if ((rawY & mask) == 0) { return forX; } else if ((rawY & mask) == mask) { - return new NotNode(forX); + return NotNode.create(forX); } return BinaryNode.reassociate(this, ValueNode.isConstantPredicate(), forX, forY); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ZeroExtendNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ZeroExtendNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ZeroExtendNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @NodeInfo public class ZeroExtendNode extends IntegerConvertNode { - public ZeroExtendNode(ValueNode input, int resultBits) { + public static ZeroExtendNode create(ValueNode input, int resultBits) { + return new ZeroExtendNodeGen(input, resultBits); + } + + protected ZeroExtendNode(ValueNode input, int resultBits) { super(StampTool.zeroExtend(input.stamp(), resultBits), input, resultBits); } @@ -89,7 +93,7 @@ // xxxx -(zero-extend)-> 0000 xxxx -(zero-extend)-> 00000000 0000xxxx // ==> xxxx -(zero-extend)-> 00000000 0000xxxx ZeroExtendNode other = (ZeroExtendNode) forValue; - return new ZeroExtendNode(other.getValue(), getResultBits()); + return ZeroExtendNode.create(other.getValue(), getResultBits()); } if (forValue instanceof NarrowNode) { NarrowNode narrow = (NarrowNode) forValue; diff -r cc7aaa92c27d -r 06c15e88d383 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 Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -44,7 +44,11 @@ private final String group; private final boolean withContext; - public DynamicCounterNode(String name, String group, ValueNode increment, boolean withContext) { + public static DynamicCounterNode create(String name, String group, ValueNode increment, boolean withContext) { + return new DynamicCounterNodeGen(name, group, increment, withContext); + } + + DynamicCounterNode(String name, String group, ValueNode increment, boolean withContext) { super(StampFactory.forVoid()); this.name = name; this.group = group; @@ -75,7 +79,7 @@ public static void addCounterBefore(String group, String name, long increment, boolean withContext, FixedNode position) { StructuredGraph graph = position.graph(); - graph.addBeforeFixed(position, position.graph().add(new DynamicCounterNode(name, group, ConstantNode.forLong(increment, position.graph()), withContext))); + graph.addBeforeFixed(position, position.graph().add(DynamicCounterNode.create(name, group, ConstantNode.forLong(increment, position.graph()), withContext))); } @NodeIntrinsic diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/WeakCounterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/WeakCounterNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/WeakCounterNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @Input private ValueNode checkedValue; - public WeakCounterNode(String group, String name, ValueNode increment, boolean addContext, ValueNode checkedValue) { + public static WeakCounterNode create(String group, String name, ValueNode increment, boolean addContext, ValueNode checkedValue) { + return new WeakCounterNodeGen(group, name, increment, addContext, checkedValue); + } + + WeakCounterNode(String group, String name, ValueNode increment, boolean addContext, ValueNode checkedValue) { super(group, name, increment, addContext); this.checkedValue = checkedValue; } @@ -61,7 +65,7 @@ public static void addCounterBefore(String group, String name, long increment, boolean addContext, ValueNode checkedValue, FixedNode position) { StructuredGraph graph = position.graph(); - WeakCounterNode counter = graph.add(new WeakCounterNode(name, group, ConstantNode.forLong(increment, graph), addContext, checkedValue)); + WeakCounterNode counter = graph.add(WeakCounterNode.create(name, group, ConstantNode.forLong(increment, graph), addContext, checkedValue)); graph.addBeforeFixed(position, counter); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -53,7 +53,11 @@ public static AddLocationNode create(LocationNode x, LocationNode y, Graph graph) { assert x.getValueKind().equals(y.getValueKind()) && x.getLocationIdentity() == y.getLocationIdentity(); - return graph.unique(new AddLocationNode(x, y)); + return graph.unique(AddLocationNode.create(x, y)); + } + + public static AddLocationNode create(ValueNode x, ValueNode y) { + return new AddLocationNodeGen(x, y); } AddLocationNode(ValueNode x, ValueNode y) { @@ -102,7 +106,7 @@ AddLocationNode otherAdd = (AddLocationNode) other; LocationNode newInner = otherAdd.canonical(constant, otherAdd.getX()); if (newInner != otherAdd) { - return new AddLocationNode(newInner, otherAdd.getY()); + return AddLocationNode.create(newInner, otherAdd.getY()); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -44,7 +44,11 @@ private final Kind boxingKind; - public BoxNode(ValueNode value, ResolvedJavaType resultType, Kind boxingKind) { + public static BoxNode create(ValueNode value, ResolvedJavaType resultType, Kind boxingKind) { + return new BoxNodeGen(value, resultType, boxingKind); + } + + BoxNode(ValueNode value, ResolvedJavaType resultType, Kind boxingKind) { super(StampFactory.exactNonNull(resultType), value); this.boxingKind = boxingKind; } @@ -72,7 +76,7 @@ ValueNode v = tool.getReplacedValue(getValue()); ResolvedJavaType type = StampTool.typeOrNull(stamp()); - VirtualBoxingNode newVirtual = new VirtualBoxingNode(type, boxingKind); + VirtualBoxingNode newVirtual = VirtualBoxingNode.create(type, boxingKind); assert newVirtual.getFields().length == 1; tool.createVirtualObject(newVirtual, new ValueNode[]{v}, Collections. emptyList()); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -53,7 +53,11 @@ @Input private ValueNode probability; @Input private ValueNode condition; - public BranchProbabilityNode(ValueNode probability, ValueNode condition) { + public static BranchProbabilityNode create(ValueNode probability, ValueNode condition) { + return new BranchProbabilityNodeGen(probability, condition); + } + + BranchProbabilityNode(ValueNode probability, ValueNode condition) { super(condition.stamp()); this.probability = probability; this.condition = condition; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BytecodeExceptionNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BytecodeExceptionNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BytecodeExceptionNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,7 +39,11 @@ private final Class exceptionClass; @Input private final NodeInputList arguments; - public BytecodeExceptionNode(MetaAccessProvider metaAccess, Class exceptionClass, ValueNode... arguments) { + public static BytecodeExceptionNode create(MetaAccessProvider metaAccess, Class exceptionClass, ValueNode... arguments) { + return new BytecodeExceptionNodeGen(metaAccess, exceptionClass, arguments); + } + + BytecodeExceptionNode(MetaAccessProvider metaAccess, Class exceptionClass, ValueNode... arguments) { super(StampFactory.exactNonNull(metaAccess.lookupJavaType(exceptionClass))); this.exceptionClass = exceptionClass; this.arguments = new NodeInputList<>(this, arguments); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,11 @@ return (LocationNode) location; } - public ComputeAddressNode(ValueNode object, ValueNode location, Stamp stamp) { + public static ComputeAddressNode create(ValueNode object, ValueNode location, Stamp stamp) { + return new ComputeAddressNodeGen(object, location, stamp); + } + + ComputeAddressNode(ValueNode object, ValueNode location, Stamp stamp) { super(stamp); this.object = object; this.location = location; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,11 +41,11 @@ private final long displacement; public static ConstantLocationNode create(LocationIdentity identity, Kind kind, long displacement, Graph graph) { - return graph.unique(new ConstantLocationNode(identity, kind, displacement)); + return graph.unique(ConstantLocationNode.create(identity, kind, displacement)); } public static ConstantLocationNode create(LocationIdentity identity, Kind kind, long displacement) { - return new ConstantLocationNode(identity, kind, displacement); + return new ConstantLocationNodeGen(identity, kind, displacement); } ConstantLocationNode(LocationIdentity identity, Kind kind, long displacement) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedValueAnchorNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedValueAnchorNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FixedValueAnchorNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -36,7 +36,11 @@ return object; } - public FixedValueAnchorNode(ValueNode object) { + public static FixedValueAnchorNode create(ValueNode object) { + return new FixedValueAnchorNodeGen(object); + } + + FixedValueAnchorNode(ValueNode object) { super(StampFactory.forNodeIntrinsic()); this.object = object; diff -r cc7aaa92c27d -r 06c15e88d383 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 Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,15 +39,27 @@ @OptionalInput(InputType.Memory) private MemoryNode lastLocationAccess; - public FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp) { + public static FloatingReadNode create(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp) { + return new FloatingReadNodeGen(object, location, lastLocationAccess, stamp); + } + + FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp) { this(object, location, lastLocationAccess, stamp, null, BarrierType.NONE); } - public FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard) { + public static FloatingReadNode create(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard) { + return new FloatingReadNodeGen(object, location, lastLocationAccess, stamp, guard); + } + + FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard) { this(object, location, lastLocationAccess, stamp, guard, BarrierType.NONE); } - public FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard, BarrierType barrierType) { + public static FloatingReadNode create(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard, BarrierType barrierType) { + return new FloatingReadNodeGen(object, location, lastLocationAccess, stamp, guard, barrierType); + } + + FloatingReadNode(ValueNode object, LocationNode location, MemoryNode lastLocationAccess, Stamp stamp, GuardingNode guard, BarrierType barrierType) { super(object, location, stamp, guard, barrierType); this.lastLocationAccess = lastLocationAccess; } @@ -71,14 +83,14 @@ @Override public Node canonical(CanonicalizerTool tool) { if (object() instanceof PiNode && ((PiNode) object()).getGuard() == getGuard()) { - return new FloatingReadNode(((PiNode) object()).getOriginalNode(), location(), getLastLocationAccess(), stamp(), getGuard(), getBarrierType()); + return FloatingReadNode.create(((PiNode) object()).getOriginalNode(), location(), getLastLocationAccess(), stamp(), getGuard(), getBarrierType()); } return ReadNode.canonicalizeRead(this, location(), object(), tool); } @Override public FixedAccessNode asFixedNode() { - return graph().add(new ReadNode(object(), accessLocation(), stamp(), getGuard(), getBarrierType())); + return graph().add(ReadNode.create(object(), accessLocation(), stamp(), getGuard(), getBarrierType())); } @Override diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -44,25 +44,41 @@ private final ForeignCallDescriptor descriptor; - public ForeignCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, ValueNode... arguments) { + public static ForeignCallNode create(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, ValueNode... arguments) { + return new ForeignCallNodeGen(foreignCalls, descriptor, arguments); + } + + ForeignCallNode(ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, ValueNode... arguments) { super(StampFactory.forKind(Kind.fromJavaClass(descriptor.getResultType()))); this.arguments = new NodeInputList<>(this, arguments); this.descriptor = descriptor; this.foreignCalls = foreignCalls; } - public ForeignCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, List arguments) { + public static ForeignCallNode create(ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, List arguments) { + return new ForeignCallNodeGen(foreignCalls, descriptor, arguments); + } + + ForeignCallNode(ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, List arguments) { this(foreignCalls, descriptor, StampFactory.forKind(Kind.fromJavaClass(descriptor.getResultType())), arguments); } - public ForeignCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, Stamp stamp, List arguments) { + public static ForeignCallNode create(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, Stamp stamp, List arguments) { + return new ForeignCallNodeGen(foreignCalls, descriptor, stamp, arguments); + } + + ForeignCallNode(ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, Stamp stamp, List arguments) { super(stamp); this.arguments = new NodeInputList<>(this, arguments); this.descriptor = descriptor; this.foreignCalls = foreignCalls; } - protected ForeignCallNode(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, Stamp stamp) { + public static ForeignCallNode create(@InjectedNodeParameter ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, Stamp stamp) { + return new ForeignCallNodeGen(foreignCalls, descriptor, stamp); + } + + protected ForeignCallNode(ForeignCallsProvider foreignCalls, ForeignCallDescriptor descriptor, Stamp stamp) { super(stamp); this.arguments = new NodeInputList<>(this); this.descriptor = descriptor; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -66,14 +66,14 @@ } public static IndexedLocationNode create(LocationIdentity identity, Kind kind, long displacement, ValueNode index, Graph graph, int indexScaling) { - return graph.unique(new IndexedLocationNode(identity, kind, displacement, index, indexScaling)); + return graph.unique(IndexedLocationNode.create(identity, kind, displacement, index, indexScaling)); } public static IndexedLocationNode create(LocationIdentity identity, Kind kind, long displacement, ValueNode index, int indexScaling) { - return new IndexedLocationNode(identity, kind, displacement, index, indexScaling); + return new IndexedLocationNodeGen(identity, kind, displacement, index, indexScaling); } - public IndexedLocationNode(LocationIdentity identity, Kind kind, long displacement, ValueNode index, int indexScaling) { + IndexedLocationNode(LocationIdentity identity, Kind kind, long displacement, ValueNode index, int indexScaling) { super(StampFactory.forVoid()); assert index != null; assert indexScaling != 0; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -51,7 +51,11 @@ * @param keyProbabilities the probabilities of the keys * @param keySuccessors the successor index for each key */ - public IntegerSwitchNode(ValueNode value, BeginNode[] successors, int[] keys, double[] keyProbabilities, int[] keySuccessors) { + public static IntegerSwitchNode create(ValueNode value, BeginNode[] successors, int[] keys, double[] keyProbabilities, int[] keySuccessors) { + return new IntegerSwitchNodeGen(value, successors, keys, keyProbabilities, keySuccessors); + } + + IntegerSwitchNode(ValueNode value, BeginNode[] successors, int[] keys, double[] keyProbabilities, int[] keySuccessors) { super(value, successors, keySuccessors, keyProbabilities); assert keySuccessors.length == keys.length + 1; assert keySuccessors.length == keyProbabilities.length; @@ -77,7 +81,11 @@ * @param keyProbabilities the probabilities of the keys * @param keySuccessors the successor index for each key */ - public IntegerSwitchNode(ValueNode value, int successorCount, int[] keys, double[] keyProbabilities, int[] keySuccessors) { + public static IntegerSwitchNode create(ValueNode value, int successorCount, int[] keys, double[] keyProbabilities, int[] keySuccessors) { + return new IntegerSwitchNodeGen(value, successorCount, keys, keyProbabilities, keySuccessors); + } + + IntegerSwitchNode(ValueNode value, int successorCount, int[] keys, double[] keyProbabilities, int[] keySuccessors) { this(value, new BeginNode[successorCount], keys, keyProbabilities, keySuccessors); } @@ -191,7 +199,7 @@ } BeginNode[] successorsArray = newSuccessors.toArray(new BeginNode[newSuccessors.size()]); - IntegerSwitchNode newSwitch = graph().add(new IntegerSwitchNode(value(), successorsArray, newKeys, newKeyProbabilities, newKeySuccessors)); + IntegerSwitchNode newSwitch = graph().add(IntegerSwitchNode.create(value(), successorsArray, newKeys, newKeyProbabilities, newKeySuccessors)); ((FixedWithNextNode) predecessor()).setNext(newSwitch); GraphUtil.killWithUnusedFloatingInputs(this); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -36,7 +36,11 @@ private final boolean compressible; - public JavaReadNode(ValueNode object, LocationNode location, BarrierType barrierType, boolean compressible) { + public static JavaReadNode create(ValueNode object, LocationNode location, BarrierType barrierType, boolean compressible) { + return new JavaReadNodeGen(object, location, barrierType, compressible); + } + + JavaReadNode(ValueNode object, LocationNode location, BarrierType barrierType, boolean compressible) { super(object, location, StampFactory.forKind(location.getValueKind()), barrierType); this.compressible = compressible; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,11 @@ private final boolean compressible; - public JavaWriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean compressible, boolean initialization) { + public static JavaWriteNode create(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean compressible, boolean initialization) { + return new JavaWriteNodeGen(object, value, location, barrierType, compressible, initialization); + } + + JavaWriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean compressible, boolean initialization) { super(object, value, location, barrierType, initialization); this.compressible = compressible; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,12 +43,20 @@ return value; } - public LoadHubNode(ValueNode value, Kind kind) { + public static LoadHubNode create(ValueNode value, Kind kind) { + return new LoadHubNodeGen(value, kind); + } + + LoadHubNode(ValueNode value, Kind kind) { super(getKind(kind), null); this.value = value; } - public LoadHubNode(ValueNode value, Kind kind, ValueNode guard) { + public static LoadHubNode create(ValueNode value, Kind kind, ValueNode guard) { + return new LoadHubNodeGen(value, kind, guard); + } + + LoadHubNode(ValueNode value, Kind kind, ValueNode guard) { super(getKind(kind), (GuardingNode) guard); assert value != guard; this.value = value; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -45,7 +45,11 @@ return hub; } - public LoadMethodNode(ResolvedJavaMethod method, ResolvedJavaType receiverType, ValueNode hub, Kind kind) { + public static LoadMethodNode create(ResolvedJavaMethod method, ResolvedJavaType receiverType, ValueNode hub, Kind kind) { + return new LoadMethodNodeGen(method, receiverType, hub, kind); + } + + LoadMethodNode(ResolvedJavaMethod method, ResolvedJavaType receiverType, ValueNode hub, Kind kind) { super(kind == Kind.Object ? StampFactory.objectNonNull() : StampFactory.forKind(kind)); this.receiverType = receiverType; this.hub = hub; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -47,7 +47,11 @@ /** * @param barriers a mask of the barrier constants defined in {@link MemoryBarriers} */ - public MembarNode(int barriers) { + public static MembarNode create(int barriers) { + return new MembarNodeGen(barriers); + } + + MembarNode(int barriers) { super(StampFactory.forVoid()); this.barriers = barriers; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/NullCheckNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/NullCheckNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/NullCheckNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @Input private ValueNode object; - public NullCheckNode(ValueNode object) { + public static NullCheckNode create(ValueNode object) { + return new NullCheckNodeGen(object); + } + + NullCheckNode(ValueNode object) { super(StampFactory.forVoid()); this.object = object; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRLocalNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRLocalNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRLocalNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -30,7 +30,11 @@ @NodeInfo(nameTemplate = "OSRLocal({p#index})") public class OSRLocalNode extends AbstractLocalNode implements IterableNodeType { - public OSRLocalNode(int index, Stamp stamp) { + public static OSRLocalNode create(int index, Stamp stamp) { + return new OSRLocalNodeGen(index, stamp); + } + + OSRLocalNode(int index, Stamp stamp) { super(index, stamp); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -29,6 +29,12 @@ @NodeInfo public class OSRStartNode extends StartNode implements Lowerable { + public static OSRStartNode create() { + return new OSRStartNodeGen(); + } + + OSRStartNode() { + } @Override public void lower(LoweringTool tool) { diff -r cc7aaa92c27d -r 06c15e88d383 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 Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,19 +38,35 @@ @NodeInfo public class ReadNode extends FloatableAccessNode implements LIRLowerable, Canonicalizable, PiPushable, Virtualizable, GuardingNode { - public ReadNode(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) { + public static ReadNode create(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) { + return new ReadNodeGen(object, location, stamp, barrierType); + } + + ReadNode(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType) { super(object, location, stamp, null, barrierType); } - public ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) { + public static ReadNode create(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) { + return new ReadNodeGen(object, location, stamp, guard, barrierType); + } + + ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType) { super(object, location, stamp, guard, barrierType); } - public ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, FrameState stateBefore) { + public static ReadNode create(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, FrameState stateBefore) { + return new ReadNodeGen(object, location, stamp, guard, barrierType, nullCheck, stateBefore); + } + + ReadNode(ValueNode object, ValueNode location, Stamp stamp, GuardingNode guard, BarrierType barrierType, boolean nullCheck, FrameState stateBefore) { super(object, location, stamp, guard, barrierType, nullCheck, stateBefore); } - private ReadNode(ValueNode object, ValueNode location, ValueNode guard, BarrierType barrierType) { + public static ReadNode create(ValueNode object, ValueNode location, ValueNode guard, BarrierType barrierType) { + return new ReadNodeGen(object, location, guard, barrierType); + } + + ReadNode(ValueNode object, ValueNode location, ValueNode guard, BarrierType barrierType) { /* * Used by node intrinsics. Really, you can trust me on that! Since the initial value for * location is a parameter, i.e., a ParameterNode, the constructor cannot use the declared @@ -72,14 +88,14 @@ GuardingNode guard = getGuard(); if (guard != null && !(guard instanceof FixedNode)) { // The guard is necessary even if the read goes away. - return new ValueAnchorNode((ValueNode) guard); + return ValueAnchorNode.create((ValueNode) guard); } else { // Read without usages or guard can be safely removed. return null; } } if (object() instanceof PiNode && ((PiNode) object()).getGuard() == getGuard()) { - return new ReadNode(((PiNode) object()).getOriginalNode(), location(), stamp(), getGuard(), getBarrierType(), getNullCheck(), stateBefore()); + return ReadNode.create(((PiNode) object()).getOriginalNode(), location(), stamp(), getGuard(), getBarrierType(), getNullCheck(), stateBefore()); } if (!getNullCheck()) { return canonicalizeRead(this, location(), object(), tool); @@ -92,7 +108,7 @@ @Override public FloatingAccessNode asFloatingNode(MemoryNode lastLocationAccess) { - return graph().unique(new FloatingReadNode(object(), location(), lastLocationAccess, stamp(), getGuard(), getBarrierType())); + return graph().unique(FloatingReadNode.create(object(), location(), lastLocationAccess, stamp(), getGuard(), getBarrierType())); } @Override diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,6 +41,10 @@ return object; } + public static StoreHubNode create(ValueNode object, ValueNode value) { + return new StoreHubNodeGen(object, value); + } + StoreHubNode(ValueNode object, ValueNode value) { super(StampFactory.forVoid()); this.value = value; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,11 @@ private final Kind boxingKind; - public UnboxNode(ValueNode value, Kind boxingKind) { + public static UnboxNode create(ValueNode value, Kind boxingKind) { + return new UnboxNodeGen(value, boxingKind); + } + + UnboxNode(ValueNode value, Kind boxingKind) { super(StampFactory.forKind(boxingKind.getStackKind()), value); this.boxingKind = boxingKind; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -42,17 +42,29 @@ @Input private ValueNode object; - public UnsafeCastNode(ValueNode object, Stamp stamp) { + public static UnsafeCastNode create(ValueNode object, Stamp stamp) { + return new UnsafeCastNodeGen(object, stamp); + } + + UnsafeCastNode(ValueNode object, Stamp stamp) { super(stamp); this.object = object; } - public UnsafeCastNode(ValueNode object, Stamp stamp, ValueNode anchor) { + public static UnsafeCastNode create(ValueNode object, Stamp stamp, ValueNode anchor) { + return new UnsafeCastNodeGen(object, stamp, anchor); + } + + UnsafeCastNode(ValueNode object, Stamp stamp, ValueNode anchor) { super(stamp, (GuardingNode) anchor); this.object = object; } - public UnsafeCastNode(ValueNode object, ResolvedJavaType toType, boolean exactType, boolean nonNull) { + public static UnsafeCastNode create(ValueNode object, ResolvedJavaType toType, boolean exactType, boolean nonNull) { + return new UnsafeCastNodeGen(object, toType, exactType, nonNull); + } + + UnsafeCastNode(ValueNode object, ResolvedJavaType toType, boolean exactType, boolean nonNull) { this(object, toType.getKind() == Kind.Object ? StampFactory.object(toType, exactType, nonNull || StampTool.isObjectNonNull(object.stamp())) : StampFactory.forKind(toType.getKind())); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,11 +39,19 @@ public class UnsafeLoadNode extends UnsafeAccessNode implements Lowerable, Virtualizable { @OptionalInput(InputType.Condition) private LogicNode guardingCondition; - public UnsafeLoadNode(ValueNode object, ValueNode offset, Kind accessKind, LocationIdentity locationIdentity) { + public static UnsafeLoadNode create(ValueNode object, ValueNode offset, Kind accessKind, LocationIdentity locationIdentity) { + return new UnsafeLoadNodeGen(object, offset, accessKind, locationIdentity); + } + + UnsafeLoadNode(ValueNode object, ValueNode offset, Kind accessKind, LocationIdentity locationIdentity) { this(object, offset, accessKind, locationIdentity, null); } - public UnsafeLoadNode(ValueNode object, ValueNode offset, Kind accessKind, LocationIdentity locationIdentity, LogicNode condition) { + public static UnsafeLoadNode create(ValueNode object, ValueNode offset, Kind accessKind, LocationIdentity locationIdentity, LogicNode condition) { + return new UnsafeLoadNodeGen(object, offset, accessKind, locationIdentity, condition); + } + + UnsafeLoadNode(ValueNode object, ValueNode offset, Kind accessKind, LocationIdentity locationIdentity, LogicNode condition) { super(StampFactory.forKind(accessKind.getStackKind()), object, offset, accessKind, locationIdentity); this.guardingCondition = condition; } @@ -77,12 +85,12 @@ @Override protected ValueNode cloneAsFieldAccess(ResolvedJavaField field) { - return new LoadFieldNode(object(), field); + return LoadFieldNode.create(object(), field); } @Override protected ValueNode cloneAsArrayAccess(ValueNode location, LocationIdentity identity) { - return new UnsafeLoadNode(object(), location, accessKind(), identity, guardingCondition); + return UnsafeLoadNode.create(object(), location, accessKind(), identity, guardingCondition); } @SuppressWarnings({"unchecked", "unused"}) diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,11 +41,19 @@ @Input private ValueNode value; @OptionalInput(InputType.State) private FrameState stateAfter; - public UnsafeStoreNode(ValueNode object, ValueNode offset, ValueNode value, Kind accessKind, LocationIdentity locationIdentity) { + public static UnsafeStoreNode create(ValueNode object, ValueNode offset, ValueNode value, Kind accessKind, LocationIdentity locationIdentity) { + return new UnsafeStoreNodeGen(object, offset, value, accessKind, locationIdentity); + } + + UnsafeStoreNode(ValueNode object, ValueNode offset, ValueNode value, Kind accessKind, LocationIdentity locationIdentity) { this(object, offset, value, accessKind, locationIdentity, null); } - public UnsafeStoreNode(ValueNode object, ValueNode offset, ValueNode value, Kind accessKind, LocationIdentity locationIdentity, FrameState stateAfter) { + public static UnsafeStoreNode create(ValueNode object, ValueNode offset, ValueNode value, Kind accessKind, LocationIdentity locationIdentity, FrameState stateAfter) { + return new UnsafeStoreNodeGen(object, offset, value, accessKind, locationIdentity, stateAfter); + } + + UnsafeStoreNode(ValueNode object, ValueNode offset, ValueNode value, Kind accessKind, LocationIdentity locationIdentity, FrameState stateAfter) { super(StampFactory.forVoid(), object, offset, accessKind, locationIdentity); this.value = value; this.stateAfter = stateAfter; @@ -109,12 +117,12 @@ @Override protected ValueNode cloneAsFieldAccess(ResolvedJavaField field) { - return new StoreFieldNode(object(), field, value(), stateAfter()); + return StoreFieldNode.create(object(), field, value(), stateAfter()); } @Override protected ValueNode cloneAsArrayAccess(ValueNode location, LocationIdentity identity) { - return new UnsafeStoreNode(object(), location, value, accessKind(), identity, stateAfter()); + return UnsafeStoreNode.create(object(), location, value, accessKind(), identity, stateAfter()); } public FrameState getState() { diff -r cc7aaa92c27d -r 06c15e88d383 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 Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @OptionalInput(InputType.Guard) private ValueNode anchored; - public ValueAnchorNode(ValueNode value) { + public static ValueAnchorNode create(ValueNode value) { + return new ValueAnchorNodeGen(value); + } + + ValueAnchorNode(ValueNode value) { super(StampFactory.forVoid()); this.anchored = value; } diff -r cc7aaa92c27d -r 06c15e88d383 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 Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -36,15 +36,27 @@ @NodeInfo public class WriteNode extends AbstractWriteNode implements LIRLowerable, Simplifiable, Virtualizable { - public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType) { + public static WriteNode create(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType) { + return new WriteNodeGen(object, value, location, barrierType); + } + + WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType) { super(object, value, location, barrierType); } - public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean initialization) { + public static WriteNode create(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean initialization) { + return new WriteNodeGen(object, value, location, barrierType, initialization); + } + + WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, boolean initialization) { super(object, value, location, barrierType, initialization); } - public WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, GuardingNode guard, boolean initialization) { + public static WriteNode create(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, GuardingNode guard, boolean initialization) { + return new WriteNodeGen(object, value, location, barrierType, guard, initialization); + } + + WriteNode(ValueNode object, ValueNode value, ValueNode location, BarrierType barrierType, GuardingNode guard, boolean initialization) { super(object, value, location, barrierType, guard, initialization); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -48,6 +48,10 @@ * @param length the node that produces the length for this allocation. * @param fillContents determines whether the array elements should be initialized to zero/null. */ + public static AbstractNewArrayNode create(Stamp stamp, ValueNode length, boolean fillContents) { + return new AbstractNewArrayNodeGen(stamp, length, fillContents); + } + protected AbstractNewArrayNode(Stamp stamp, ValueNode length, boolean fillContents) { super(stamp, fillContents); this.length = length; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewObjectNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewObjectNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -46,6 +46,10 @@ * @param stamp the stamp of the newly created object * @param fillContents determines if the object's contents should be initialized to zero/null. */ + public static AbstractNewObjectNode create(Stamp stamp, boolean fillContents) { + return new AbstractNewObjectNodeGen(stamp, fillContents); + } + protected AbstractNewObjectNode(Stamp stamp, boolean fillContents) { super(stamp); this.fillContents = fillContents; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -46,7 +46,11 @@ return array; } - public ArrayLengthNode(ValueNode array) { + public static ArrayLengthNode create(ValueNode array) { + return new ArrayLengthNodeGen(array); + } + + ArrayLengthNode(ValueNode array) { super(StampFactory.positiveInt()); this.array = array; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -44,7 +44,11 @@ private final LocationIdentity locationIdentity; - public AtomicReadAndAddNode(ValueNode object, ValueNode offset, ValueNode delta, LocationIdentity locationIdentity) { + public static AtomicReadAndAddNode create(ValueNode object, ValueNode offset, ValueNode delta, LocationIdentity locationIdentity) { + return new AtomicReadAndAddNodeGen(object, offset, delta, locationIdentity); + } + + AtomicReadAndAddNode(ValueNode object, ValueNode offset, ValueNode delta, LocationIdentity locationIdentity) { super(StampFactory.forKind(delta.getKind())); this.object = object; this.offset = offset; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndWriteNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndWriteNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndWriteNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -46,7 +46,11 @@ private final Kind valueKind; private final LocationIdentity locationIdentity; - public AtomicReadAndWriteNode(ValueNode object, ValueNode offset, ValueNode newValue, Kind valueKind, LocationIdentity locationIdentity) { + public static AtomicReadAndWriteNode create(ValueNode object, ValueNode offset, ValueNode newValue, Kind valueKind, LocationIdentity locationIdentity) { + return new AtomicReadAndWriteNodeGen(object, offset, newValue, valueKind, locationIdentity); + } + + AtomicReadAndWriteNode(ValueNode object, ValueNode offset, ValueNode newValue, Kind valueKind, LocationIdentity locationIdentity) { super(StampFactory.forKind(newValue.getKind())); this.object = object; this.offset = offset; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -49,7 +49,11 @@ * @param hub the type being cast to * @param object the object being cast */ - public CheckCastDynamicNode(ValueNode hub, ValueNode object, boolean forStoreCheck) { + public static CheckCastDynamicNode create(ValueNode hub, ValueNode object, boolean forStoreCheck) { + return new CheckCastDynamicNodeGen(hub, object, forStoreCheck); + } + + CheckCastDynamicNode(ValueNode hub, ValueNode object, boolean forStoreCheck) { super(object.stamp()); this.hub = hub; this.object = object; @@ -97,7 +101,7 @@ if (forHub.isConstant()) { ResolvedJavaType t = tool.getConstantReflection().asJavaType(forHub.asConstant()); if (t != null) { - return new CheckCastNode(t, forObject, null, forStoreCheck); + return CheckCastNode.create(t, forObject, null, forStoreCheck); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -59,7 +59,11 @@ * @param type the type being cast to * @param object the instruction producing the object */ - public CheckCastNode(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile, boolean forStoreCheck) { + public static CheckCastNode create(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile, boolean forStoreCheck) { + return new CheckCastNodeGen(type, object, profile, forStoreCheck); + } + + CheckCastNode(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile, boolean forStoreCheck) { super(StampFactory.declared(type)); assert type != null; this.type = type; @@ -111,12 +115,12 @@ condition = LogicConstantNode.contradiction(graph()); stamp = StampFactory.declared(type); } else if (StampTool.isObjectNonNull(object)) { - condition = graph().addWithoutUnique(new InstanceOfNode(type, object, profile)); + condition = graph().addWithoutUnique(InstanceOfNode.create(type, object, profile)); } else { if (profile != null && profile.getNullSeen() == TriState.FALSE) { - FixedGuardNode nullCheck = graph().add(new FixedGuardNode(graph().unique(new IsNullNode(object)), UnreachedCode, InvalidateReprofile, true)); - PiNode nullGuarded = graph().unique(new PiNode(object, object().stamp().join(StampFactory.objectNonNull()), nullCheck)); - InstanceOfNode typeTest = graph().addWithoutUnique(new InstanceOfNode(type, nullGuarded, profile)); + FixedGuardNode nullCheck = graph().add(FixedGuardNode.create(graph().unique(IsNullNode.create(object)), UnreachedCode, InvalidateReprofile, true)); + PiNode nullGuarded = graph().unique(PiNode.create(object, object().stamp().join(StampFactory.objectNonNull()), nullCheck)); + InstanceOfNode typeTest = graph().addWithoutUnique(InstanceOfNode.create(type, nullGuarded, profile)); graph().addBeforeFixed(this, nullCheck); condition = typeTest; /* @@ -130,11 +134,11 @@ } else { // TODO (ds) replace with probability of null-seen when available double shortCircuitProbability = NOT_FREQUENT_PROBABILITY; - InstanceOfNode typeTest = graph().addWithoutUnique(new InstanceOfNode(type, object, profile)); - condition = LogicNode.or(graph().unique(new IsNullNode(object)), typeTest, shortCircuitProbability); + InstanceOfNode typeTest = graph().addWithoutUnique(InstanceOfNode.create(type, object, profile)); + condition = LogicNode.or(graph().unique(IsNullNode.create(object)), typeTest, shortCircuitProbability); } } - GuardingPiNode checkedObject = graph().add(new GuardingPiNode(theValue, condition, false, forStoreCheck ? ArrayStoreException : ClassCastException, InvalidateReprofile, stamp)); + GuardingPiNode checkedObject = graph().add(GuardingPiNode.create(theValue, condition, false, forStoreCheck ? ArrayStoreException : ClassCastException, InvalidateReprofile, stamp)); graph().replaceFixedWithFixed(this, checkedObject); checkedObject.lower(tool); } @@ -166,7 +170,7 @@ if (exactType != null && !exactType.equals(type)) { // Propagate more precise type information to usages of the checkcast. tool.assumptions().recordConcreteSubtype(type, exactType); - return new CheckCastNode(exactType, object, profile, forStoreCheck); + return CheckCastNode.create(exactType, object, profile, forStoreCheck); } } @@ -181,7 +185,7 @@ CheckCastNode ccn = (CheckCastNode) predecessor(); if (ccn != null && ccn.type != null && ccn == object && ccn.forStoreCheck == forStoreCheck && ccn.type.isAssignableFrom(type)) { StructuredGraph graph = ccn.graph(); - CheckCastNode newccn = graph.add(new CheckCastNode(type, ccn.object, ccn.profile, ccn.forStoreCheck)); + CheckCastNode newccn = graph.add(CheckCastNode.create(type, ccn.object, ccn.profile, ccn.forStoreCheck)); graph.replaceFixedWithFixed(ccn, newccn); replaceAtUsages(newccn); graph.removeFixed(this); diff -r cc7aaa92c27d -r 06c15e88d383 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 Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -46,7 +46,11 @@ private final Kind valueKind; private final LocationIdentity locationIdentity; - public CompareAndSwapNode(ValueNode object, ValueNode offset, ValueNode expected, ValueNode newValue, Kind valueKind, LocationIdentity locationIdentity) { + public static CompareAndSwapNode create(ValueNode object, ValueNode offset, ValueNode expected, ValueNode newValue, Kind valueKind, LocationIdentity locationIdentity) { + return new CompareAndSwapNodeGen(object, offset, expected, newValue, valueKind, locationIdentity); + } + + CompareAndSwapNode(ValueNode object, ValueNode offset, ValueNode expected, ValueNode newValue, Kind valueKind, LocationIdentity locationIdentity) { super(StampFactory.forKind(Kind.Boolean.getStackKind())); assert expected.stamp().isCompatible(newValue.stamp()); this.object = object; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -42,11 +42,19 @@ @Input private ValueNode elementType; - public DynamicNewArrayNode(ValueNode elementType, ValueNode length) { + public static DynamicNewArrayNode create(ValueNode elementType, ValueNode length) { + return new DynamicNewArrayNodeGen(elementType, length); + } + + DynamicNewArrayNode(ValueNode elementType, ValueNode length) { this(elementType, length, true); } - public DynamicNewArrayNode(ValueNode elementType, ValueNode length, boolean fillContents) { + public static DynamicNewArrayNode create(ValueNode elementType, ValueNode length, boolean fillContents) { + return new DynamicNewArrayNodeGen(elementType, length, fillContents); + } + + DynamicNewArrayNode(ValueNode elementType, ValueNode length, boolean fillContents) { super(StampFactory.objectNonNull(), length, fillContents); this.elementType = elementType; } @@ -61,7 +69,7 @@ ResolvedJavaType javaType = tool.getConstantReflection().asJavaType(elementType.asConstant()); if (javaType != null && !javaType.equals(tool.getMetaAccess().lookupJavaType(void.class))) { ValueNode length = length(); - NewArrayNode newArray = graph().add(new NewArrayNode(javaType, length.isAlive() ? length : graph().addOrUniqueWithInputs(length), fillContents())); + NewArrayNode newArray = graph().add(NewArrayNode.create(javaType, length.isAlive() ? length : graph().addOrUniqueWithInputs(length), fillContents())); List snapshot = inputs().snapshot(); graph().replaceFixedWithFixed(this, newArray); for (Node input : snapshot) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewInstanceNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewInstanceNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewInstanceNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,7 +34,11 @@ @Input private ValueNode clazz; - public DynamicNewInstanceNode(ValueNode clazz, boolean fillContents) { + public static DynamicNewInstanceNode create(ValueNode clazz, boolean fillContents) { + return new DynamicNewInstanceNodeGen(clazz, fillContents); + } + + DynamicNewInstanceNode(ValueNode clazz, boolean fillContents) { super(StampFactory.objectNonNull(), fillContents); this.clazz = clazz; } @@ -44,7 +48,7 @@ if (clazz.isConstant()) { ResolvedJavaType type = tool.getConstantReflection().asJavaType(clazz.asConstant()); if (type != null && type.isInitialized() && !type.isArray() && !type.isInterface() && !type.isPrimitive()) { - return new NewInstanceNode(type, fillContents()); + return NewInstanceNode.create(type, fillContents()); } } return this; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -36,7 +36,11 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class ExceptionObjectNode extends DispatchBeginNode implements Lowerable, MemoryCheckpoint.Single { - public ExceptionObjectNode(MetaAccessProvider metaAccess) { + public static ExceptionObjectNode create(MetaAccessProvider metaAccess) { + return new ExceptionObjectNodeGen(metaAccess); + } + + ExceptionObjectNode(MetaAccessProvider metaAccess) { super(StampFactory.declaredNonNull(metaAccess.lookupJavaType(Throwable.class))); } @@ -53,8 +57,8 @@ * deopts can float in between the begin node and the load exception node. */ LocationIdentity locationsKilledByInvoke = ((InvokeWithExceptionNode) predecessor()).getLocationIdentity(); - BeginNode entry = graph().add(new KillingBeginNode(locationsKilledByInvoke)); - LoadExceptionObjectNode loadException = graph().add(new LoadExceptionObjectNode(stamp())); + BeginNode entry = graph().add(KillingBeginNode.create(locationsKilledByInvoke)); + LoadExceptionObjectNode loadException = graph().add(LoadExceptionObjectNode.create(stamp())); loadException.setStateAfter(stateAfter()); replaceAtUsages(InputType.Value, loadException); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -44,7 +44,11 @@ * @param mirror the {@link Class} value representing the target target type of the test * @param object the object being tested */ - public InstanceOfDynamicNode(ValueNode mirror, ValueNode object) { + public static InstanceOfDynamicNode create(ValueNode mirror, ValueNode object) { + return new InstanceOfDynamicNodeGen(mirror, object); + } + + InstanceOfDynamicNode(ValueNode mirror, ValueNode object) { this.mirror = mirror; this.object = object; assert mirror.getKind() == Kind.Object : mirror.getKind(); @@ -64,7 +68,7 @@ if (t.isPrimitive()) { return LogicConstantNode.contradiction(); } else { - return new InstanceOfNode(t, forObject, null); + return InstanceOfNode.create(t, forObject, null); } } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -45,7 +45,11 @@ * @param type the target type of the instanceof check * @param object the object being tested by the instanceof */ - public InstanceOfNode(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile) { + public static InstanceOfNode create(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile) { + return new InstanceOfNodeGen(type, object, profile); + } + + InstanceOfNode(ResolvedJavaType type, ValueNode object, JavaTypeProfile profile) { super(object); this.type = type; this.profile = profile; @@ -114,7 +118,7 @@ if (!nonNull) { // the instanceof matches if the object is non-null, so return true // depending on the null-ness. - return new LogicNegationNode(new IsNullNode(forValue)); + return LogicNegationNode.create(IsNullNode.create(forValue)); } } return null; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -30,7 +30,11 @@ @NodeInfo public class LoadExceptionObjectNode extends AbstractStateSplit implements Lowerable { - public LoadExceptionObjectNode(Stamp stamp) { + public static LoadExceptionObjectNode create(Stamp stamp) { + return new LoadExceptionObjectNodeGen(stamp); + } + + LoadExceptionObjectNode(Stamp stamp) { super(stamp); } diff -r cc7aaa92c27d -r 06c15e88d383 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 Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -45,7 +45,11 @@ * @param object the receiver object * @param field the compiler interface field */ - public LoadFieldNode(ValueNode object, ResolvedJavaField field) { + public static LoadFieldNode create(ValueNode object, ResolvedJavaField field) { + return new LoadFieldNodeGen(object, field); + } + + protected LoadFieldNode(ValueNode object, ResolvedJavaField field) { super(createStamp(field), object, field); } @@ -78,7 +82,7 @@ } } if (!isStatic() && forObject.isNullConstant()) { - return new DeoptimizeNode(DeoptimizationAction.None, DeoptimizationReason.NullCheckException); + return DeoptimizeNode.create(DeoptimizationAction.None, DeoptimizationReason.NullCheckException); } return this; } @@ -114,7 +118,7 @@ for (int i = 0; i < phi.valueCount(); i++) { constantNodes[i] = ConstantNode.forConstant(constants[i], metaAccess); } - return new ValuePhiNode(stamp(), phi.merge(), constantNodes); + return ValuePhiNode.create(stamp(), phi.merge(), constantNodes); } return null; } diff -r cc7aaa92c27d -r 06c15e88d383 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 Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -42,7 +42,11 @@ * @param index the instruction producing the index * @param elementKind the element type */ - public LoadIndexedNode(ValueNode array, ValueNode index, Kind elementKind) { + public static LoadIndexedNode create(ValueNode array, ValueNode index, Kind elementKind) { + return new LoadIndexedNodeGen(array, index, elementKind); + } + + LoadIndexedNode(ValueNode array, ValueNode index, Kind elementKind) { super(createStamp(array, elementKind), array, index, elementKind); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -40,7 +40,11 @@ @Input private ValueNode newValue; @OptionalInput(InputType.State) private FrameState stateAfter; - public LoweredAtomicReadAndWriteNode(ValueNode object, LocationNode location, ValueNode newValue, BarrierType barrierType) { + public static LoweredAtomicReadAndWriteNode create(ValueNode object, LocationNode location, ValueNode newValue, BarrierType barrierType) { + return new LoweredAtomicReadAndWriteNodeGen(object, location, newValue, barrierType); + } + + LoweredAtomicReadAndWriteNode(ValueNode object, LocationNode location, ValueNode newValue, BarrierType barrierType) { super(object, location, newValue.stamp().unrestricted(), barrierType); this.newValue = newValue; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -61,7 +61,11 @@ return newValue; } - public LoweredCompareAndSwapNode(ValueNode object, LocationNode location, ValueNode expectedValue, ValueNode newValue, BarrierType barrierType) { + public static LoweredCompareAndSwapNode create(ValueNode object, LocationNode location, ValueNode expectedValue, ValueNode newValue, BarrierType barrierType) { + return new LoweredCompareAndSwapNodeGen(object, location, expectedValue, newValue, barrierType); + } + + LoweredCompareAndSwapNode(ValueNode object, LocationNode location, ValueNode expectedValue, ValueNode newValue, BarrierType barrierType) { super(object, location, StampFactory.forKind(Kind.Boolean.getStackKind()), barrierType); assert expectedValue.getKind() == newValue.getKind(); this.expectedValue = expectedValue; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,11 @@ /** * @param arguments */ - public MethodCallTargetNode(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType) { + public static MethodCallTargetNode create(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType) { + return new MethodCallTargetNodeGen(invokeKind, targetMethod, arguments, returnType); + } + + MethodCallTargetNode(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType) { super(arguments, targetMethod, invokeKind); this.returnType = returnType; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -40,7 +40,11 @@ * * @param object the instruction producing the object */ - public MonitorEnterNode(ValueNode object, MonitorIdNode monitorId) { + public static MonitorEnterNode create(ValueNode object, MonitorIdNode monitorId) { + return new MonitorEnterNodeGen(object, monitorId); + } + + MonitorEnterNode(ValueNode object, MonitorIdNode monitorId) { super(object, monitorId); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -44,7 +44,11 @@ /** * Creates a new MonitorExitNode. */ - public MonitorExitNode(ValueNode object, MonitorIdNode monitorId, ValueNode escapedReturnValue) { + public static MonitorExitNode create(ValueNode object, MonitorIdNode monitorId, ValueNode escapedReturnValue) { + return new MonitorExitNodeGen(object, monitorId, escapedReturnValue); + } + + MonitorExitNode(ValueNode object, MonitorIdNode monitorId, ValueNode escapedReturnValue) { super(object, monitorId); this.escapedReturnValue = escapedReturnValue; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorIdNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorIdNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorIdNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ private int lockDepth; - public MonitorIdNode(int lockDepth) { + public static MonitorIdNode create(int lockDepth) { + return new MonitorIdNodeGen(lockDepth); + } + + MonitorIdNode(int lockDepth) { super(StampFactory.forVoid()); this.lockDepth = lockDepth; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -47,7 +47,11 @@ * @param length the node that produces the length for this allocation. * @param fillContents determines whether the array elements should be initialized to zero/null. */ - public NewArrayNode(ResolvedJavaType elementType, ValueNode length, boolean fillContents) { + public static NewArrayNode create(ResolvedJavaType elementType, ValueNode length, boolean fillContents) { + return new NewArrayNodeGen(elementType, length, fillContents); + } + + NewArrayNode(ResolvedJavaType elementType, ValueNode length, boolean fillContents) { super(StampFactory.exactNonNull(elementType.getArrayClass()), length, fillContents); } @@ -77,7 +81,7 @@ for (int i = 0; i < constantLength; i++) { state[i] = defaultForKind; } - VirtualObjectNode virtualObject = new VirtualArrayNode(elementType(), constantLength); + VirtualObjectNode virtualObject = VirtualArrayNode.create(elementType(), constantLength); tool.createVirtualObject(virtualObject, state, Collections. emptyList()); tool.replaceWithVirtual(virtualObject); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -47,7 +47,11 @@ * @param fillContents determines whether the new object's fields should be initialized to * zero/null. */ - public NewInstanceNode(ResolvedJavaType type, boolean fillContents) { + public static NewInstanceNode create(ResolvedJavaType type, boolean fillContents) { + return new NewInstanceNodeGen(type, fillContents); + } + + NewInstanceNode(ResolvedJavaType type, boolean fillContents) { super(StampFactory.exactNonNull(type), fillContents); assert !type.isArray() && !type.isInterface() && !type.isPrimitive(); this.instanceClass = type; @@ -69,7 +73,7 @@ * they're excluded from escape analysis. */ if (!tool.getMetaAccessProvider().lookupJavaType(Reference.class).isAssignableFrom(instanceClass)) { - VirtualInstanceNode virtualObject = new VirtualInstanceNode(instanceClass(), true); + VirtualInstanceNode virtualObject = VirtualInstanceNode.create(instanceClass(), true); ResolvedJavaField[] fields = virtualObject.getFields(); ValueNode[] state = new ValueNode[fields.length]; for (int i = 0; i < state.length; i++) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -56,7 +56,11 @@ * @param type the element type of the array * @param dimensions the node which produce the dimensions for this array */ - public NewMultiArrayNode(ResolvedJavaType type, ValueNode[] dimensions) { + public static NewMultiArrayNode create(ResolvedJavaType type, ValueNode[] dimensions) { + return new NewMultiArrayNodeGen(type, dimensions); + } + + NewMultiArrayNode(ResolvedJavaType type, ValueNode[] dimensions) { super(StampFactory.exactNonNull(type)); this.type = type; this.dimensions = new NodeInputList<>(this, dimensions); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,7 +41,11 @@ @OptionalInput(InputType.State) private FrameState deoptState; @Input private ValueNode value; - public RegisterFinalizerNode(ValueNode value) { + public static RegisterFinalizerNode create(ValueNode value) { + return new RegisterFinalizerNodeGen(value); + } + + RegisterFinalizerNode(ValueNode value) { super(StampFactory.forVoid()); this.value = value; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/SelfReplacingMethodCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/SelfReplacingMethodCallTargetNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/SelfReplacingMethodCallTargetNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,7 @@ /** * A SelfReplacingMethodCallTargetNode replaces itself in the graph when being lowered with a * {@link MethodCallTargetNode} that calls the stored replacement target method. - * + * * This node is used for method handle call nodes which have a constant call target but are not * inlined. */ @@ -44,7 +44,12 @@ private final JavaType replacementReturnType; @Input private final NodeInputList replacementArguments; - public SelfReplacingMethodCallTargetNode(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType, ResolvedJavaMethod replacementTargetMethod, + public static SelfReplacingMethodCallTargetNode create(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType, + ResolvedJavaMethod replacementTargetMethod, ValueNode[] replacementArguments, JavaType replacementReturnType) { + return new SelfReplacingMethodCallTargetNodeGen(invokeKind, targetMethod, arguments, returnType, replacementTargetMethod, replacementArguments, replacementReturnType); + } + + SelfReplacingMethodCallTargetNode(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] arguments, JavaType returnType, ResolvedJavaMethod replacementTargetMethod, ValueNode[] replacementArguments, JavaType replacementReturnType) { super(invokeKind, targetMethod, arguments, returnType); this.replacementTargetMethod = replacementTargetMethod; @@ -68,7 +73,7 @@ public void lower(LoweringTool tool) { InvokeKind invokeKind = replacementTargetMethod.isStatic() ? InvokeKind.Static : InvokeKind.Special; MethodCallTargetNode replacement = graph().add( - new MethodCallTargetNode(invokeKind, replacementTargetMethod, replacementArguments.toArray(new ValueNode[replacementArguments.size()]), replacementReturnType)); + MethodCallTargetNode.create(invokeKind, replacementTargetMethod, replacementArguments.toArray(new ValueNode[replacementArguments.size()]), replacementReturnType)); // Replace myself... this.replaceAndDelete(replacement); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -63,12 +63,20 @@ * @param field the compiler interface field * @param value the node representing the value to store to the field */ - public StoreFieldNode(ValueNode object, ResolvedJavaField field, ValueNode value) { + public static StoreFieldNode create(ValueNode object, ResolvedJavaField field, ValueNode value) { + return new StoreFieldNodeGen(object, field, value); + } + + StoreFieldNode(ValueNode object, ResolvedJavaField field, ValueNode value) { super(StampFactory.forVoid(), object, field); this.value = value; } - public StoreFieldNode(ValueNode object, ResolvedJavaField field, ValueNode value, FrameState stateAfter) { + public static StoreFieldNode create(ValueNode object, ResolvedJavaField field, ValueNode value, FrameState stateAfter) { + return new StoreFieldNodeGen(object, field, value, stateAfter); + } + + StoreFieldNode(ValueNode object, ResolvedJavaField field, ValueNode value, FrameState stateAfter) { super(StampFactory.forVoid(), object, field); this.value = value; this.stateAfter = stateAfter; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -64,7 +64,11 @@ * @param elementKind the element type * @param value the value to store into the array */ - public StoreIndexedNode(ValueNode array, ValueNode index, Kind elementKind, ValueNode value) { + public static StoreIndexedNode create(ValueNode array, ValueNode index, Kind elementKind, ValueNode value) { + return new StoreIndexedNodeGen(array, index, elementKind, value); + } + + StoreIndexedNode(ValueNode array, ValueNode index, Kind elementKind, ValueNode value) { super(StampFactory.forVoid(), array, index, elementKind); this.value = value; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -53,7 +53,11 @@ * @param keyProbabilities the probabilities of the keys * @param keySuccessors the successor index for each key */ - public TypeSwitchNode(ValueNode value, BeginNode[] successors, ResolvedJavaType[] keys, double[] keyProbabilities, int[] keySuccessors) { + public static TypeSwitchNode create(ValueNode value, BeginNode[] successors, ResolvedJavaType[] keys, double[] keyProbabilities, int[] keySuccessors) { + return new TypeSwitchNodeGen(value, successors, keys, keyProbabilities, keySuccessors); + } + + TypeSwitchNode(ValueNode value, BeginNode[] successors, ResolvedJavaType[] keys, double[] keyProbabilities, int[] keySuccessors) { super(value, successors, keySuccessors, keyProbabilities); assert successors.length <= keys.length + 1; assert keySuccessors.length == keyProbabilities.length; @@ -201,7 +205,7 @@ } BeginNode[] successorsArray = newSuccessors.toArray(new BeginNode[newSuccessors.size()]); - TypeSwitchNode newSwitch = graph().add(new TypeSwitchNode(value(), successorsArray, newKeys, newKeyProbabilities, newKeySuccessors)); + TypeSwitchNode newSwitch = graph().add(TypeSwitchNode.create(value(), successorsArray, newKeys, newKeyProbabilities, newKeySuccessors)); ((FixedWithNextNode) predecessor()).setNext(newSwitch); GraphUtil.killWithUnusedFloatingInputs(this); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/AllocatedObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/AllocatedObjectNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/AllocatedObjectNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @Input private VirtualObjectNode virtualObject; @Input(InputType.Extension) private CommitAllocationNode commit; - public AllocatedObjectNode(VirtualObjectNode virtualObject) { + public static AllocatedObjectNode create(VirtualObjectNode virtualObject) { + return new AllocatedObjectNodeGen(virtualObject); + } + + AllocatedObjectNode(VirtualObjectNode virtualObject) { super(StampFactory.exactNonNull(virtualObject.type())); this.virtualObject = virtualObject; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -40,7 +40,11 @@ @Input(InputType.Association) private final NodeInputList locks = new NodeInputList<>(this); private ArrayList lockIndexes = new ArrayList<>(Arrays.asList(0)); - public CommitAllocationNode() { + public static CommitAllocationNode create() { + return new CommitAllocationNodeGen(); + } + + CommitAllocationNode() { super(StampFactory.forVoid()); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,11 @@ private final ResolvedJavaType componentType; private final int length; - public VirtualArrayNode(ResolvedJavaType componentType, int length) { + public static VirtualArrayNode create(ResolvedJavaType componentType, int length) { + return new VirtualArrayNodeGen(componentType, length); + } + + VirtualArrayNode(ResolvedJavaType componentType, int length) { super(componentType.getArrayClass(), true); this.componentType = componentType; this.length = length; @@ -137,12 +141,12 @@ @Override public VirtualArrayNode duplicate() { - return new VirtualArrayNode(componentType, length); + return VirtualArrayNode.create(componentType, length); } @Override public ValueNode getMaterializedRepresentation(FixedNode fixed, ValueNode[] entries, LockState locks) { - return new AllocatedObjectNode(this); + return AllocatedObjectNode.create(this); } public ValueNode length() { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualBoxingNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualBoxingNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualBoxingNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,20 +32,24 @@ private final Kind boxingKind; - public VirtualBoxingNode(ResolvedJavaType type, Kind boxingKind) { + public static VirtualBoxingNode create(ResolvedJavaType type, Kind boxingKind) { + return new VirtualBoxingNodeGen(type, boxingKind); + } + + VirtualBoxingNode(ResolvedJavaType type, Kind boxingKind) { super(type, false); this.boxingKind = boxingKind; } @Override public VirtualBoxingNode duplicate() { - return new VirtualBoxingNode(type(), boxingKind); + return VirtualBoxingNode.create(type(), boxingKind); } @Override public ValueNode getMaterializedRepresentation(FixedNode fixed, ValueNode[] entries, LockState locks) { assert entries.length == 1; assert locks == null; - return new BoxNode(entries[0], type(), boxingKind); + return BoxNode.create(entries[0], type(), boxingKind); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,11 +32,19 @@ private final ResolvedJavaType type; private final ResolvedJavaField[] fields; - public VirtualInstanceNode(ResolvedJavaType type, boolean hasIdentity) { + public static VirtualInstanceNode create(ResolvedJavaType type, boolean hasIdentity) { + return new VirtualInstanceNodeGen(type, hasIdentity); + } + + VirtualInstanceNode(ResolvedJavaType type, boolean hasIdentity) { this(type, type.getInstanceFields(true), hasIdentity); } - public VirtualInstanceNode(ResolvedJavaType type, ResolvedJavaField[] fields, boolean hasIdentity) { + public static VirtualInstanceNode create(ResolvedJavaType type, ResolvedJavaField[] fields, boolean hasIdentity) { + return new VirtualInstanceNodeGen(type, fields, hasIdentity); + } + + protected VirtualInstanceNode(ResolvedJavaType type, ResolvedJavaField[] fields, boolean hasIdentity) { super(type, hasIdentity); this.type = type; this.fields = fields; @@ -97,11 +105,11 @@ @Override public VirtualInstanceNode duplicate() { - return new VirtualInstanceNode(type, fields, super.hasIdentity()); + return VirtualInstanceNode.create(type, fields, super.hasIdentity()); } @Override public ValueNode getMaterializedRepresentation(FixedNode fixed, ValueNode[] entries, LockState locks) { - return new AllocatedObjectNode(this); + return AllocatedObjectNode.create(this); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -716,9 +716,9 @@ PiNode piNode; if (isNull) { ConstantNode nullObject = ConstantNode.defaultForKind(Kind.Object, graph); - piNode = graph.unique(new PiNode(nullObject, StampFactory.forConstant(nullObject.getValue(), metaAccess), replacementAnchor.asNode())); + piNode = graph.unique(PiNode.create(nullObject, StampFactory.forConstant(nullObject.getValue(), metaAccess), replacementAnchor.asNode())); } else { - piNode = graph.unique(new PiNode(object, StampFactory.declared(type, nonNull), replacementAnchor.asNode())); + piNode = graph.unique(PiNode.create(object, StampFactory.declared(type, nonNull), replacementAnchor.asNode())); } checkCast.replaceAtUsages(piNode); graph.removeFixed(checkCast); @@ -770,7 +770,7 @@ if (replacement != null) { if (replacementAnchor != null && !(replacementAnchor instanceof BeginNode)) { - ValueAnchorNode anchor = graph.add(new ValueAnchorNode(replacementAnchor)); + ValueAnchorNode anchor = graph.add(ValueAnchorNode.create(replacementAnchor)); graph.addBeforeFixed(ifNode, anchor); } for (Node n : survivingSuccessor.usages().snapshot()) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -122,7 +122,7 @@ IfNode ifNode = (IfNode) deoptBegin.predecessor(); BeginNode otherBegin = ifNode.trueSuccessor(); LogicNode conditionNode = ifNode.condition(); - FixedGuardNode guard = graph.add(new FixedGuardNode(conditionNode, deoptReason, deoptAction, deoptBegin == ifNode.trueSuccessor())); + FixedGuardNode guard = graph.add(FixedGuardNode.create(conditionNode, deoptReason, deoptAction, deoptBegin == ifNode.trueSuccessor())); FixedWithNextNode pred = (FixedWithNextNode) ifNode.predecessor(); BeginNode survivingSuccessor; if (deoptBegin == ifNode.trueSuccessor()) { @@ -160,7 +160,7 @@ FixedNode next = deoptPred.next(); if (!(next instanceof DeoptimizeNode)) { - DeoptimizeNode newDeoptNode = graph.add(new DeoptimizeNode(deoptAction, deoptReason)); + DeoptimizeNode newDeoptNode = graph.add(DeoptimizeNode.create(deoptAction, deoptReason)); deoptPred.setNext(newDeoptNode); assert deoptPred == newDeoptNode.predecessor(); GraphUtil.killCFG(next); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeoptimizationGroupingPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeoptimizationGroupingPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeoptimizationGroupingPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -55,10 +55,10 @@ } MergeNode merge; if (target instanceof AbstractDeoptimizeNode) { - merge = graph.add(new MergeNode()); - EndNode firstEnd = graph.add(new EndNode()); - reasonActionPhi = graph.addWithoutUnique(new ValuePhiNode(StampFactory.forKind(Kind.Int), merge)); - speculationPhi = graph.addWithoutUnique(new ValuePhiNode(StampFactory.forKind(Kind.Object), merge)); + merge = graph.add(MergeNode.create()); + EndNode firstEnd = graph.add(EndNode.create()); + reasonActionPhi = graph.addWithoutUnique(ValuePhiNode.create(StampFactory.forKind(Kind.Int), merge)); + speculationPhi = graph.addWithoutUnique(ValuePhiNode.create(StampFactory.forKind(Kind.Object), merge)); merge.addForwardEnd(firstEnd); reasonActionPhi.addInput(((AbstractDeoptimizeNode) target).getActionAndReason(context.getMetaAccess())); speculationPhi.addInput(((AbstractDeoptimizeNode) target).getSpeculation(context.getMetaAccess())); @@ -66,14 +66,14 @@ exitLoops((AbstractDeoptimizeNode) target, firstEnd, cfg); - merge.setNext(graph.add(new DynamicDeoptimizeNode(reasonActionPhi, speculationPhi))); + merge.setNext(graph.add(DynamicDeoptimizeNode.create(reasonActionPhi, speculationPhi))); obsoletes = new LinkedList<>(); obsoletes.add((AbstractDeoptimizeNode) target); target = merge; } else { merge = (MergeNode) target; } - EndNode newEnd = graph.add(new EndNode()); + EndNode newEnd = graph.add(EndNode.create()); merge.addForwardEnd(newEnd); reasonActionPhi.addInput(deopt.getActionAndReason(context.getMetaAccess())); speculationPhi.addInput(deopt.getSpeculation(context.getMetaAccess())); @@ -95,7 +95,7 @@ Block block = cfg.blockFor(deopt); Loop loop = block.getLoop(); while (loop != null) { - end.graph().addBeforeFixed(end, end.graph().add(new LoopExitNode((LoopBeginNode) loop.getHeader().getBeginNode()))); + end.graph().addBeforeFixed(end, end.graph().add(LoopExitNode.create((LoopBeginNode) loop.getHeader().getBeginNode()))); loop = loop.getParent(); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -72,16 +72,16 @@ } ifNode.clearSuccessors(); Graph graph = ifNode.graph(); - MergeNode trueTargetMerge = graph.add(new MergeNode()); + MergeNode trueTargetMerge = graph.add(MergeNode.create()); trueTargetMerge.setNext(trueTarget); - EndNode firstTrueEnd = graph.add(new EndNode()); - EndNode secondTrueEnd = graph.add(new EndNode()); + EndNode firstTrueEnd = graph.add(EndNode.create()); + EndNode secondTrueEnd = graph.add(EndNode.create()); trueTargetMerge.addForwardEnd(firstTrueEnd); trueTargetMerge.addForwardEnd(secondTrueEnd); BeginNode firstTrueTarget = BeginNode.begin(firstTrueEnd); BeginNode secondTrueTarget = BeginNode.begin(secondTrueEnd); - BeginNode secondIf = BeginNode.begin(graph.add(new IfNode(y, yNegated ? falseTarget : secondTrueTarget, yNegated ? secondTrueTarget : falseTarget, secondIfProbability))); - IfNode firstIf = graph.add(new IfNode(x, xNegated ? secondIf : firstTrueTarget, xNegated ? firstTrueTarget : secondIf, firstIfProbability)); + BeginNode secondIf = BeginNode.begin(graph.add(IfNode.create(y, yNegated ? falseTarget : secondTrueTarget, yNegated ? secondTrueTarget : falseTarget, secondIfProbability))); + IfNode firstIf = graph.add(IfNode.create(x, xNegated ? secondIf : firstTrueTarget, xNegated ? firstTrueTarget : secondIf, firstIfProbability)); ifNode.replaceAtPredecessor(firstIf); ifNode.safeDelete(); } @@ -90,8 +90,8 @@ ValueNode trueTarget = conditional.trueValue(); ValueNode falseTarget = conditional.falseValue(); Graph graph = conditional.graph(); - ConditionalNode secondConditional = graph.unique(new ConditionalNode(y, yNegated ? falseTarget : trueTarget, yNegated ? trueTarget : falseTarget)); - ConditionalNode firstConditional = graph.unique(new ConditionalNode(x, xNegated ? secondConditional : trueTarget, xNegated ? trueTarget : secondConditional)); + ConditionalNode secondConditional = graph.unique(ConditionalNode.create(y, yNegated ? falseTarget : trueTarget, yNegated ? trueTarget : falseTarget)); + ConditionalNode firstConditional = graph.unique(ConditionalNode.create(x, xNegated ? secondConditional : trueTarget, xNegated ? trueTarget : secondConditional)); conditional.replaceAndDelete(firstConditional); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -186,7 +186,7 @@ } else { MemoryPhiNode phi = null; if (existingPhis == null || (phi = existingPhis.remove(key)) == null) { - phi = merge.graph().addWithoutUnique(new MemoryPhiNode(merge, key)); + phi = merge.graph().addWithoutUnique(MemoryPhiNode.create(merge, key)); } for (int j = 0; j < mergedStatesCount; j++) { phi.addInput(ValueNodeUtil.asNode(merged)); @@ -291,7 +291,7 @@ assert MemoryCheckpoint.TypeAssertion.correctType(node) : node; if (createMemoryMapNodes && node instanceof ReturnNode) { - ((ReturnNode) node).setMemoryMap(node.graph().unique(new MemoryMapNode(state.lastMemorySnapshot))); + ((ReturnNode) node).setMemoryMap(node.graph().unique(MemoryMapNode.create(state.lastMemorySnapshot))); } return state; } @@ -331,7 +331,7 @@ ValueAnchorNode anchor = null; GuardingNode guard = accessNode.getGuard(); if (guard != null) { - anchor = graph.add(new ValueAnchorNode(guard.asNode())); + anchor = graph.add(ValueAnchorNode.create(guard.asNode())); graph.addAfterFixed(accessNode, anchor); } graph.replaceFixedWithFloating(accessNode, floatingNode); @@ -385,7 +385,7 @@ for (LocationIdentity location : modifiedLocations) { if (!updateExistingPhis || !phis.containsKey(location)) { - MemoryPhiNode phi = loop.graph().addWithoutUnique(new MemoryPhiNode(loop, location)); + MemoryPhiNode phi = loop.graph().addWithoutUnique(MemoryPhiNode.create(loop, location)); phi.addInput(ValueNodeUtil.asNode(initialState.getLastLocationAccess(location))); phis.put(location, phi); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -162,9 +162,9 @@ private void lowerToIf(GuardNode guard) { StructuredGraph graph = guard.graph(); - BeginNode fastPath = graph.add(new BeginNode()); + BeginNode fastPath = graph.add(BeginNode.create()); @SuppressWarnings("deprecation") - DeoptimizeNode deopt = graph.add(new DeoptimizeNode(guard.action(), guard.reason(), useGuardIdAsDebugId ? guard.getId() : 0, guard.getSpeculation(), null)); + DeoptimizeNode deopt = graph.add(DeoptimizeNode.create(guard.action(), guard.reason(), useGuardIdAsDebugId ? guard.getId() : 0, guard.getSpeculation(), null)); BeginNode deoptBranch = BeginNode.begin(deopt); BeginNode trueSuccessor; BeginNode falseSuccessor; @@ -176,7 +176,7 @@ trueSuccessor = fastPath; falseSuccessor = deoptBranch; } - IfNode ifNode = graph.add(new IfNode(guard.condition(), trueSuccessor, falseSuccessor, trueSuccessor == fastPath ? 1 : 0)); + IfNode ifNode = graph.add(IfNode.create(guard.condition(), trueSuccessor, falseSuccessor, trueSuccessor == fastPath ? 1 : 0)); guard.replaceAndDelete(fastPath); insert(ifNode, fastPath); } @@ -185,7 +185,7 @@ Loop loop = block.getLoop(); StructuredGraph graph = deopt.graph(); while (loop != null) { - LoopExitNode exit = graph.add(new LoopExitNode((LoopBeginNode) loop.getHeader().getBeginNode())); + LoopExitNode exit = graph.add(LoopExitNode.create((LoopBeginNode) loop.getHeader().getBeginNode())); graph.addBeforeFixed(deopt, exit); loop = loop.getParent(); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoopSafepointInsertionPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoopSafepointInsertionPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoopSafepointInsertionPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,7 @@ if (GenLoopSafepoints.getValue()) { for (LoopEndNode loopEndNode : graph.getNodes(LoopEndNode.class)) { if (loopEndNode.canSafepoint()) { - SafepointNode safepointNode = graph.add(new SafepointNode()); + SafepointNode safepointNode = graph.add(SafepointNode.create()); graph.addBeforeFixed(loopEndNode, safepointNode); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -51,7 +51,11 @@ static class DummyGuardHandle extends ValueNode implements GuardedNode { @Input(InputType.Guard) private GuardingNode guard; - public DummyGuardHandle(GuardingNode guard) { + public static DummyGuardHandle create(GuardingNode guard) { + return new LoweringPhase_DummyGuardHandleGen(guard); + } + + protected DummyGuardHandle(GuardingNode guard) { super(StampFactory.forVoid()); this.guard = guard; } @@ -138,13 +142,13 @@ } StructuredGraph graph = before.graph(); if (condition.graph().getGuardsStage().ordinal() >= StructuredGraph.GuardsStage.FIXED_DEOPTS.ordinal()) { - FixedGuardNode fixedGuard = graph.add(new FixedGuardNode(condition, deoptReason, action, negated)); + FixedGuardNode fixedGuard = graph.add(FixedGuardNode.create(condition, deoptReason, action, negated)); graph.addBeforeFixed(before, fixedGuard); - DummyGuardHandle handle = graph.add(new DummyGuardHandle(fixedGuard)); + DummyGuardHandle handle = graph.add(DummyGuardHandle.create(fixedGuard)); fixedGuard.lower(this); return handle.getGuard(); } else { - GuardNode newGuard = graph.unique(new GuardNode(condition, guardAnchor, deoptReason, action, negated, Constant.NULL_OBJECT)); + GuardNode newGuard = graph.unique(GuardNode.create(condition, guardAnchor, deoptReason, action, negated, Constant.NULL_OBJECT)); if (OptEliminateGuards.getValue()) { activeGuards.markAndGrow(newGuard); } @@ -337,7 +341,7 @@ // FixedWithNextNode is followed by some kind of BeginNode. // For example the when a FixedGuard followed by a loop exit is lowered to a // control-split + deopt. - BeginNode begin = node.graph().add(new BeginNode()); + BeginNode begin = node.graph().add(BeginNode.create()); nextLastFixed.replaceFirstSuccessor(nextNode, begin); begin.setNext(nextNode); nextLastFixed = begin; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/OptimizeGuardAnchorsPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/OptimizeGuardAnchorsPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/OptimizeGuardAnchorsPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -110,7 +110,7 @@ if (otherGuards.size() == successorCount - 1) { BeginNode anchor = computeOptimalAnchor(cfg.get(), BeginNode.prevBegin(controlSplit)); - GuardNode newGuard = controlSplit.graph().unique(new GuardNode(guard.condition(), anchor, guard.reason(), guard.action(), guard.negated(), guard.getSpeculation())); + GuardNode newGuard = controlSplit.graph().unique(GuardNode.create(guard.condition(), anchor, guard.reason(), guard.action(), guard.negated(), guard.getSpeculation())); for (GuardNode otherGuard : otherGuards) { otherGuard.replaceAndDelete(newGuard); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -64,7 +64,11 @@ @NodeInfo static class DummyAnchorNode extends FixedWithNextNode implements GuardingNode { - public DummyAnchorNode() { + public static DummyAnchorNode create() { + return new TailDuplicationPhase_DummyAnchorNodeGen(); + } + + protected DummyAnchorNode() { super(StampFactory.forVoid()); } } @@ -339,7 +343,7 @@ * @return The new {@link ValueAnchorNode} that was created. */ private DummyAnchorNode addValueAnchor() { - DummyAnchorNode anchor = graph.add(new DummyAnchorNode()); + DummyAnchorNode anchor = graph.add(DummyAnchorNode.create()); graph.addAfterFixed(merge, anchor); merge.replaceAtUsages(InputType.Guard, anchor); merge.replaceAtUsages(InputType.Anchor, anchor); @@ -449,8 +453,8 @@ * @return The newly created end node. */ private AbstractEndNode createNewMerge(FixedNode successor, FrameState stateAfterMerge) { - MergeNode newBottomMerge = graph.add(new MergeNode()); - AbstractEndNode newBottomEnd = graph.add(new EndNode()); + MergeNode newBottomMerge = graph.add(MergeNode.create()); + AbstractEndNode newBottomEnd = graph.add(EndNode.create()); newBottomMerge.addForwardEnd(newBottomEnd); newBottomMerge.setStateAfter(stateAfterMerge); ((FixedWithNextNode) successor.predecessor()).setNext(newBottomEnd); @@ -524,7 +528,7 @@ ValueNode node = (ValueNode) duplicated; PhiNode newPhi = bottomPhis.get(node); if (newPhi == null) { - newPhi = graph.addWithoutUnique(new ValuePhiNode(node.stamp().unrestricted(), newBottomMerge)); + newPhi = graph.addWithoutUnique(ValuePhiNode.create(node.stamp().unrestricted(), newBottomMerge)); bottomPhis.put(node, newPhi); newPhi.addInput(node); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/UseTrappingNullChecksPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/UseTrappingNullChecksPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/UseTrappingNullChecksPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -162,7 +162,7 @@ IsNullNode isNullNode = (IsNullNode) condition; BeginNode nonTrappingContinuation = ifNode.falseSuccessor(); BeginNode trappingContinuation = ifNode.trueSuccessor(); - NullCheckNode trappingNullCheck = deopt.graph().add(new NullCheckNode(isNullNode.getValue())); + NullCheckNode trappingNullCheck = deopt.graph().add(NullCheckNode.create(isNullNode.getValue())); trappingNullCheck.setStateBefore(deopt.stateBefore()); deopt.graph().replaceSplit(ifNode, trappingNullCheck, nonTrappingContinuation); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/BaseReduction.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/BaseReduction.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/BaseReduction.java Mon Aug 18 14:04:21 2014 +0200 @@ -97,7 +97,7 @@ metricUnconditionalDeoptInserted.increment(); StructuredGraph graph = fixed.graph(); // have to insert a FixedNode other than a ControlSinkNode - FixedGuardNode buckStopsHere = graph.add(new FixedGuardNode(falseConstant, deoptReason, DeoptimizationAction.None)); + FixedGuardNode buckStopsHere = graph.add(FixedGuardNode.create(falseConstant, deoptReason, DeoptimizationAction.None)); if (goesBeforeFixed) { fixed.replaceAtPredecessor(buckStopsHere); } else { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/CheckCastReduction.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/CheckCastReduction.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/CheckCastReduction.java Mon Aug 18 14:04:21 2014 +0200 @@ -231,7 +231,7 @@ * (1 of 3) definitely-non-null */ // addWithoutUnique for the same reason as in CheckCastNode.lower() - condition = graph.addWithoutUnique(new InstanceOfNode(toType, subject, profile)); + condition = graph.addWithoutUnique(InstanceOfNode.create(toType, subject, profile)); reasoner.added.add(condition); resultStamp = FlowUtil.asNonNullStamp(resultStamp); // TODO fix in CheckCastNode.lower() @@ -240,15 +240,15 @@ /* * (2 of 3) null-not-seen-in-profiling */ - IsNullNode isNN = graph.unique(new IsNullNode(subject)); + IsNullNode isNN = graph.unique(IsNullNode.create(subject)); reasoner.added.add(isNN); - FixedGuardNode nullCheck = graph.add(new FixedGuardNode(isNN, UnreachedCode, InvalidateReprofile, true)); + FixedGuardNode nullCheck = graph.add(FixedGuardNode.create(isNN, UnreachedCode, InvalidateReprofile, true)); graph.addBeforeFixed(checkCast, nullCheck); // not calling wrapInPiNode() because we don't want to rememberSubstitution() - PiNode nonNullGuarded = graph.unique(new PiNode(subject, FlowUtil.asNonNullStamp(subjectStamp), nullCheck)); + PiNode nonNullGuarded = graph.unique(PiNode.create(subject, FlowUtil.asNonNullStamp(subjectStamp), nullCheck)); reasoner.added.add(nonNullGuarded); // addWithoutUnique for the same reason as in CheckCastNode.lower() - condition = graph.addWithoutUnique(new InstanceOfNode(toType, nonNullGuarded, profile)); + condition = graph.addWithoutUnique(InstanceOfNode.create(toType, nonNullGuarded, profile)); reasoner.added.add(condition); resultStamp = FlowUtil.asNonNullStamp(resultStamp); } else { @@ -256,9 +256,9 @@ * (3 of 3) runtime-null-check-needed */ // addWithoutUnique for the same reason as in CheckCastNode.lower() - InstanceOfNode typeTest = graph.addWithoutUnique(new InstanceOfNode(toType, subject, profile)); + InstanceOfNode typeTest = graph.addWithoutUnique(InstanceOfNode.create(toType, subject, profile)); reasoner.added.add(typeTest); - LogicNode nullTest = graph.unique(new IsNullNode(subject)); + LogicNode nullTest = graph.unique(IsNullNode.create(subject)); reasoner.added.add(nullTest); // TODO (ds) replace with probability of null-seen when available final double shortCircuitProbability = NOT_FREQUENT_PROBABILITY; @@ -271,7 +271,7 @@ * Add a cast-guard (checking only what needs to be checked) and a PiNode (to be used in * place of the CheckCastNode). */ - FixedGuardNode castGuard = graph.add(new FixedGuardNode(condition, checkCast.isForStoreCheck() ? ArrayStoreException : ClassCastException, InvalidateReprofile)); + FixedGuardNode castGuard = graph.add(FixedGuardNode.create(condition, checkCast.isForStoreCheck() ? ArrayStoreException : ClassCastException, InvalidateReprofile)); graph.addBeforeFixed(checkCast, castGuard); assert FlowUtil.isLegalObjectStamp(resultStamp); @@ -280,7 +280,7 @@ if (!FlowUtil.lacksUsages(checkCast)) { // not calling wrapInPiNode() because we don't want to rememberSubstitution() - PiNode checkedObject = graph.unique(new PiNode(subject, resultStamp, castGuard)); + PiNode checkedObject = graph.unique(PiNode.create(subject, resultStamp, castGuard)); reasoner.added.add(checkedObject); assert !precisionLoss(originalCheckCastObject, checkedObject); assert !precisionLoss(subject, checkedObject); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/EquationalReasoner.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/EquationalReasoner.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/EquationalReasoner.java Mon Aug 18 14:04:21 2014 +0200 @@ -664,7 +664,7 @@ try (Debug.Scope s = Debug.scope("Downcast", payload)) { assert payload != anchor : payload.graph().toString(); metricDowncasting.increment(); - PiNode result = graph.unique(new PiNode(payload, newStamp, anchor.asNode())); + PiNode result = graph.unique(PiNode.create(payload, newStamp, anchor.asNode())); // we've possibly got a new node in the graph --- bookkeeping is in order. added.add(result); if (remember) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowSensitiveReduction.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowSensitiveReduction.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowSensitiveReduction.java Mon Aug 18 14:04:21 2014 +0200 @@ -499,9 +499,9 @@ * state-tracking. TODO the assumption here is that the code emitted for the resulting * FixedGuardNode is as efficient as for NullCheckNode. */ - IsNullNode isNN = graph.unique(new IsNullNode(object)); + IsNullNode isNN = graph.unique(IsNullNode.create(object)); reasoner.added.add(isNN); - FixedGuardNode nullCheck = graph.add(new FixedGuardNode(isNN, UnreachedCode, InvalidateReprofile, true)); + FixedGuardNode nullCheck = graph.add(FixedGuardNode.create(isNN, UnreachedCode, InvalidateReprofile, true)); graph.replaceFixedWithFixed(ncn, nullCheck); state.trackNN(object, nullCheck); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/GuardingPiReduction.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/GuardingPiReduction.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/GuardingPiReduction.java Mon Aug 18 14:04:21 2014 +0200 @@ -141,7 +141,7 @@ * FixedGuardNode allows tracking the condition via a GuardingNode, thus potentially * triggering simplifications down the road. */ - FixedGuardNode fixedGuard = graph.add(new FixedGuardNode(envelope.condition(), envelope.getReason(), envelope.getAction(), envelope.isNegated())); + FixedGuardNode fixedGuard = graph.add(FixedGuardNode.create(envelope.condition(), envelope.getReason(), envelope.getAction(), envelope.isNegated())); graph.addBeforeFixed(envelope, fixedGuard); /* @@ -152,7 +152,7 @@ if (!FlowUtil.lacksUsages(envelope)) { // not calling wrapInPiNode() because we don't want to rememberSubstitution() - PiNode replacement = graph.unique(new PiNode(envelope.object(), envelope.stamp(), fixedGuard)); + PiNode replacement = graph.unique(PiNode.create(envelope.object(), envelope.stamp(), fixedGuard)); reasoner.added.add(replacement); // before removing the GuardingPiNode replace its usages envelope.replaceAtUsages(replacement); @@ -281,7 +281,7 @@ * TODO The GuardingPiNode has an outgoing stamp whose narrowing goes beyond what * the condition checks. That's suspicious. */ - PiNode replacement = graph.unique(new PiNode(payload, envelope.stamp())); + PiNode replacement = graph.unique(PiNode.create(payload, envelope.stamp())); reasoner.added.add(replacement); removeGuardingPiNode(envelope, replacement); return true; @@ -295,7 +295,7 @@ Witness w = state.typeInfo(payload); GuardingNode nonNullAnchor = (w != null && w.isNonNull()) ? w.guard() : null; if (nonNullAnchor != null) { - PiNode replacement = graph.unique(new PiNode(payload, envelope.stamp(), nonNullAnchor.asNode())); + PiNode replacement = graph.unique(PiNode.create(payload, envelope.stamp(), nonNullAnchor.asNode())); reasoner.added.add(replacement); removeGuardingPiNode(envelope, replacement); return true; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java Mon Aug 18 14:04:21 2014 +0200 @@ -27,6 +27,7 @@ import static com.oracle.graal.compiler.common.GraalOptions.*; import static com.oracle.graal.compiler.common.type.StampFactory.*; +import java.lang.reflect.*; import java.util.*; import com.oracle.graal.api.code.*; @@ -175,7 +176,7 @@ public static void replaceInvokeCallTarget(Invoke invoke, StructuredGraph graph, InvokeKind invokeKind, ResolvedJavaMethod targetMethod) { MethodCallTargetNode oldCallTarget = (MethodCallTargetNode) invoke.callTarget(); - MethodCallTargetNode newCallTarget = graph.add(new MethodCallTargetNode(invokeKind, targetMethod, oldCallTarget.arguments().toArray(new ValueNode[0]), oldCallTarget.returnType())); + MethodCallTargetNode newCallTarget = graph.add(MethodCallTargetNode.create(invokeKind, targetMethod, oldCallTarget.arguments().toArray(new ValueNode[0]), oldCallTarget.returnType())); invoke.asNode().replaceFirstInput(oldCallTarget, newCallTarget); } @@ -185,7 +186,7 @@ private static GuardedValueNode createAnchoredReceiver(StructuredGraph graph, GuardingNode anchor, ValueNode receiver, Stamp stamp) { // to avoid that floating reads on receiver fields float above the type check - return graph.unique(new GuardedValueNode(receiver, anchor, stamp)); + return graph.unique(GuardedValueNode.create(receiver, anchor, stamp)); } /** @@ -301,7 +302,7 @@ // get rid of memory kill BeginNode begin = invokeWithException.next(); if (begin instanceof KillingBeginNode) { - BeginNode newBegin = new BeginNode(); + BeginNode newBegin = BeginNode.create(); graph.addAfterFixed(begin, graph.add(newBegin)); begin.replaceAtUsages(newBegin); graph.removeFixed(begin); @@ -309,7 +310,7 @@ } else { if (unwindNode != null) { UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode); - DeoptimizeNode deoptimizeNode = graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler)); + DeoptimizeNode deoptimizeNode = graph.add(DeoptimizeNode.create(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler)); unwindDuplicate.replaceAndDelete(deoptimizeNode); } } @@ -340,7 +341,7 @@ for (ReturnNode returnNode : returnNodes) { returnDuplicates.add((ReturnNode) duplicates.get(returnNode)); } - MergeNode merge = graph.add(new MergeNode()); + MergeNode merge = graph.add(MergeNode.create()); merge.setStateAfter(stateAfter); ValueNode returnValue = mergeReturns(merge, returnDuplicates, canonicalizedNodes); invokeNode.replaceAtUsages(returnValue); @@ -442,12 +443,12 @@ MergeNode merge = (MergeNode) fixedStateSplit; while (merge.isAlive()) { AbstractEndNode end = merge.forwardEnds().first(); - DeoptimizeNode deoptimizeNode = graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler)); + DeoptimizeNode deoptimizeNode = graph.add(DeoptimizeNode.create(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler)); end.replaceAtPredecessor(deoptimizeNode); GraphUtil.killCFG(end); } } else { - FixedNode deoptimizeNode = graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler)); + FixedNode deoptimizeNode = graph.add(DeoptimizeNode.create(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler)); if (fixedStateSplit instanceof BeginNode) { deoptimizeNode = BeginNode.begin(deoptimizeNode); } @@ -464,12 +465,12 @@ for (ReturnNode returnNode : returnNodes) { // create and wire up a new EndNode - EndNode endNode = merge.graph().add(new EndNode()); + EndNode endNode = merge.graph().add(EndNode.create()); merge.addForwardEnd(endNode); if (returnNode.result() != null) { if (returnValuePhi == null) { - returnValuePhi = merge.graph().addWithoutUnique(new ValuePhiNode(returnNode.result().stamp().unrestricted(), merge)); + returnValuePhi = merge.graph().addWithoutUnique(ValuePhiNode.create(returnNode.result().stamp().unrestricted(), merge)); if (canonicalizedNodes != null) { canonicalizedNodes.add(returnValuePhi); } @@ -501,9 +502,9 @@ StructuredGraph graph = callTarget.graph(); ValueNode firstParam = callTarget.arguments().get(0); if (firstParam.getKind() == Kind.Object && !StampTool.isObjectNonNull(firstParam)) { - IsNullNode condition = graph.unique(new IsNullNode(firstParam)); + IsNullNode condition = graph.unique(IsNullNode.create(firstParam)); Stamp stamp = firstParam.stamp().join(objectNonNull()); - GuardingPiNode nonNullReceiver = graph.add(new GuardingPiNode(firstParam, condition, true, NullCheckException, InvalidateReprofile, stamp)); + GuardingPiNode nonNullReceiver = graph.add(GuardingPiNode.create(firstParam, condition, true, NullCheckException, InvalidateReprofile, stamp)); graph.addBeforeFixed(invoke.asNode(), nonNullReceiver); callTarget.replaceFirstInput(firstParam, nonNullReceiver); return nonNullReceiver; @@ -546,7 +547,8 @@ private static FixedWithNextNode createMacroNodeInstance(Class macroNodeClass, Invoke invoke) throws GraalInternalError { try { - return macroNodeClass.getConstructor(Invoke.class).newInstance(invoke); + Method factory = macroNodeClass.getDeclaredMethod("create", Invoke.class); + return (FixedWithNextNode) factory.invoke(null, invoke); } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) { throw new GraalGraphInternalError(e).addContext(invoke.asNode()).addContext("macroSubstitution", macroNodeClass); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java Mon Aug 18 14:04:21 2014 +0200 @@ -172,12 +172,12 @@ ValueNode originalReceiver = ((MethodCallTargetNode) invoke.callTarget()).receiver(); // setup merge and phi nodes for results and exceptions - MergeNode returnMerge = graph.add(new MergeNode()); + MergeNode returnMerge = graph.add(MergeNode.create()); returnMerge.setStateAfter(invoke.stateAfter()); PhiNode returnValuePhi = null; if (invoke.asNode().getKind() != Kind.Void) { - returnValuePhi = graph.addWithoutUnique(new ValuePhiNode(invoke.asNode().stamp().unrestricted(), returnMerge)); + returnValuePhi = graph.addWithoutUnique(ValuePhiNode.create(invoke.asNode().stamp().unrestricted(), returnMerge)); } MergeNode exceptionMerge = null; @@ -186,11 +186,11 @@ InvokeWithExceptionNode invokeWithException = (InvokeWithExceptionNode) invoke; ExceptionObjectNode exceptionEdge = (ExceptionObjectNode) invokeWithException.exceptionEdge(); - exceptionMerge = graph.add(new MergeNode()); + exceptionMerge = graph.add(MergeNode.create()); FixedNode exceptionSux = exceptionEdge.next(); graph.addBeforeFixed(exceptionSux, exceptionMerge); - exceptionObjectPhi = graph.addWithoutUnique(new ValuePhiNode(StampFactory.forKind(Kind.Object), exceptionMerge)); + exceptionObjectPhi = graph.addWithoutUnique(ValuePhiNode.create(StampFactory.forKind(Kind.Object), exceptionMerge)); exceptionMerge.setStateAfter(exceptionEdge.stateAfter().duplicateModified(invoke.stateAfter().bci, true, Kind.Object, exceptionObjectPhi)); } @@ -205,7 +205,7 @@ if (shouldFallbackToInvoke()) { unknownTypeSux = createInvocationBlock(graph, invoke, returnMerge, returnValuePhi, exceptionMerge, exceptionObjectPhi, false); } else { - unknownTypeSux = graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated)); + unknownTypeSux = graph.add(DeoptimizeNode.create(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated)); } successors[successors.length - 1] = BeginNode.begin(unknownTypeSux); @@ -329,7 +329,7 @@ private Collection inlineSingleMethod(StructuredGraph graph, MetaAccessProvider metaAccess, Assumptions assumptions) { assert concretes.size() == 1 && inlineableElements.length == 1 && ptypes.size() > 1 && !shouldFallbackToInvoke() && notRecordedTypeProbability == 0; - BeginNode calleeEntryNode = graph.add(new BeginNode()); + BeginNode calleeEntryNode = graph.add(BeginNode.create()); BeginNode unknownTypeSux = createUnknownTypeSuccessor(graph); BeginNode[] successors = new BeginNode[]{calleeEntryNode, unknownTypeSux}; @@ -344,7 +344,7 @@ assert ptypes.size() >= 1; ValueNode nonNullReceiver = InliningUtil.nonNullReceiver(invoke); Kind hubKind = ((MethodCallTargetNode) invoke.callTarget()).targetMethod().getDeclaringClass().getEncoding(ResolvedJavaType.Representation.ObjectHub).getKind(); - LoadHubNode hub = graph.unique(new LoadHubNode(nonNullReceiver, hubKind)); + LoadHubNode hub = graph.unique(LoadHubNode.create(nonNullReceiver, hubKind)); if (!invokeIsOnlySuccessor && chooseMethodDispatch()) { assert successors.length == concretes.size() + 1; @@ -375,9 +375,9 @@ ResolvedJavaType receiverType = invoke.getReceiverType(); FixedNode lastSucc = successors[concretes.size()]; for (int i = concretes.size() - 1; i >= 0; --i) { - LoadMethodNode method = graph.add(new LoadMethodNode(concretes.get(i), receiverType, hub, constantMethods[i].getKind())); + LoadMethodNode method = graph.add(LoadMethodNode.create(concretes.get(i), receiverType, hub, constantMethods[i].getKind())); CompareNode methodCheck = CompareNode.createCompareNode(graph, Condition.EQ, method, constantMethods[i]); - IfNode ifNode = graph.add(new IfNode(methodCheck, successors[i], lastSucc, probability[i])); + IfNode ifNode = graph.add(IfNode.create(methodCheck, successors[i], lastSucc, probability[i])); method.setNext(ifNode); lastSucc = method; } @@ -408,7 +408,7 @@ keyProbabilities[i] /= totalProbability; } - TypeSwitchNode typeSwitch = graph.add(new TypeSwitchNode(hub, successors, keys, keyProbabilities, keySuccessors)); + TypeSwitchNode typeSwitch = graph.add(TypeSwitchNode.create(hub, successors, keys, keyProbabilities, keySuccessors)); FixedWithNextNode pred = (FixedWithNextNode) invoke.asNode().predecessor(); pred.setNext(typeSwitch); return false; @@ -462,10 +462,10 @@ private static BeginNode createInvocationBlock(StructuredGraph graph, Invoke invoke, MergeNode returnMerge, PhiNode returnValuePhi, MergeNode exceptionMerge, PhiNode exceptionObjectPhi, boolean useForInlining) { Invoke duplicatedInvoke = duplicateInvokeForInlining(graph, invoke, exceptionMerge, exceptionObjectPhi, useForInlining); - BeginNode calleeEntryNode = graph.add(new BeginNode()); + BeginNode calleeEntryNode = graph.add(BeginNode.create()); calleeEntryNode.setNext(duplicatedInvoke.asNode()); - AbstractEndNode endNode = graph.add(new EndNode()); + AbstractEndNode endNode = graph.add(EndNode.create()); duplicatedInvoke.setNext(endNode); returnMerge.addForwardEnd(endNode); @@ -500,7 +500,7 @@ // set new state (pop old exception object, push new one) newExceptionEdge.setStateAfter(stateAfterException.duplicateModified(stateAfterException.bci, stateAfterException.rethrowException(), Kind.Object, newExceptionEdge)); - AbstractEndNode endNode = graph.add(new EndNode()); + AbstractEndNode endNode = graph.add(EndNode.create()); newExceptionEdge.setNext(endNode); exceptionMerge.addForwardEnd(endNode); exceptionObjectPhi.addInput(newExceptionEdge); @@ -538,7 +538,7 @@ } private void devirtualizeWithTypeSwitch(StructuredGraph graph, InvokeKind kind, ResolvedJavaMethod target, MetaAccessProvider metaAccess) { - BeginNode invocationEntry = graph.add(new BeginNode()); + BeginNode invocationEntry = graph.add(BeginNode.create()); BeginNode unknownTypeSux = createUnknownTypeSuccessor(graph); BeginNode[] successors = new BeginNode[]{invocationEntry, unknownTypeSux}; createDispatchOnTypeBeforeInvoke(graph, successors, true, metaAccess); @@ -551,7 +551,7 @@ } private static BeginNode createUnknownTypeSuccessor(StructuredGraph graph) { - return BeginNode.begin(graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated))); + return BeginNode.begin(graph.add(DeoptimizeNode.create(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated))); } @Override diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/TypeGuardInlineInfo.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/TypeGuardInlineInfo.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/TypeGuardInlineInfo.java Mon Aug 18 14:04:21 2014 +0200 @@ -104,10 +104,10 @@ private void createGuard(StructuredGraph graph, MetaAccessProvider metaAccess) { ValueNode nonNullReceiver = InliningUtil.nonNullReceiver(invoke); ConstantNode typeHub = ConstantNode.forConstant(type.getEncoding(ResolvedJavaType.Representation.ObjectHub), metaAccess, graph); - LoadHubNode receiverHub = graph.unique(new LoadHubNode(nonNullReceiver, typeHub.getKind())); + LoadHubNode receiverHub = graph.unique(LoadHubNode.create(nonNullReceiver, typeHub.getKind())); CompareNode typeCheck = CompareNode.createCompareNode(graph, Condition.EQ, receiverHub, typeHub); - FixedGuardNode guard = graph.add(new FixedGuardNode(typeCheck, DeoptimizationReason.TypeCheckedInliningViolated, DeoptimizationAction.InvalidateReprofile)); + FixedGuardNode guard = graph.add(FixedGuardNode.create(typeCheck, DeoptimizationReason.TypeCheckedInliningViolated, DeoptimizationAction.InvalidateReprofile)); assert invoke.predecessor() != null; ValueNode anchoredReceiver = InliningUtil.createAnchoredReceiver(graph, guard, type, nonNullReceiver, true); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/ComputeInliningRelevance.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/ComputeInliningRelevance.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/ComputeInliningRelevance.java Mon Aug 18 14:04:21 2014 +0200 @@ -116,7 +116,7 @@ parent = loops.get(null); break; } else { - assert current.getClass() == MergeNode.class : current; + assert current.getClass() == MergeNode.getGenClass() : current; // follow any path upwards - it doesn't matter which one current = ((MergeNode) current).forwardEndAt(0); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java Mon Aug 18 14:04:21 2014 +0200 @@ -175,9 +175,9 @@ printProperty(bit, "true"); } } - if (node.getClass() == BeginNode.class) { + if (node.getClass() == BeginNode.getGenClass()) { printProperty("shortName", "B"); - } else if (node.getClass() == AbstractEndNode.class) { + } else if (node.getClass() == EndNode.getGenClass()) { printProperty("shortName", "E"); } if (node.predecessor() != null) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java --- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java Mon Aug 18 14:04:21 2014 +0200 @@ -182,7 +182,7 @@ Arguments args = new Arguments(key, graph.getGuardsStage(), tool.getLoweringStage()); args.add("input", convert.getValue()); - args.add("result", graph.unique(new AMD64FloatConvertNode(convert.stamp(), convert.getOp(), convert.getValue()))); + args.add("result", graph.unique(AMD64FloatConvertNode.create(convert.stamp(), convert.getOp(), convert.getValue()))); SnippetTemplate template = template(args); Debug.log("Lowering %s in %s: node=%s, template=%s, arguments=%s", convert.getOp(), graph, convert, template, args); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java --- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,8 @@ private final FloatConvert op; - public AMD64FloatConvertNode(Stamp stamp, FloatConvert op, ValueNode value) { +public static AMD64FloatConvertNode create(Stamp stamp, FloatConvert op, ValueNode value) { return new AMD64FloatConvertNodeGen(stamp, op, value); } + protected AMD64FloatConvertNode(Stamp stamp, FloatConvert op, ValueNode value) { super(stamp, value); this.op = op; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements.hsail/src/com/oracle/graal/replacements/hsail/HSAILMathIntrinsicsNode.java --- a/graal/com.oracle.graal.replacements.hsail/src/com/oracle/graal/replacements/hsail/HSAILMathIntrinsicsNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements.hsail/src/com/oracle/graal/replacements/hsail/HSAILMathIntrinsicsNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -75,7 +75,11 @@ * @param x the argument to the math operation * @param op the math operation */ - public HSAILMathIntrinsicsNode(ValueNode x, HSAILArithmetic op) { + public static HSAILMathIntrinsicsNode create(ValueNode x, HSAILArithmetic op) { + return new HSAILMathIntrinsicsNodeGen(x, op); + } + + protected HSAILMathIntrinsicsNode(ValueNode x, HSAILArithmetic op) { super(StampFactory.forKind(x.getKind())); this.param = x; this.operation = op; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CheckCastTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CheckCastTest.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CheckCastTest.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,7 @@ protected void replaceProfile(StructuredGraph graph, JavaTypeProfile profile) { CheckCastNode ccn = graph.getNodes().filter(CheckCastNode.class).first(); if (ccn != null) { - CheckCastNode ccnNew = graph.add(new CheckCastNode(ccn.type(), ccn.object(), profile, false)); + CheckCastNode ccnNew = graph.add(CheckCastNode.create(ccn.type(), ccn.object(), profile, false)); graph.replaceFixedWithFixed(ccn, ccnNew); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java Mon Aug 18 14:04:21 2014 +0200 @@ -50,7 +50,7 @@ protected void replaceProfile(StructuredGraph graph, JavaTypeProfile profile) { InstanceOfNode ion = graph.getNodes().filter(InstanceOfNode.class).first(); if (ion != null) { - InstanceOfNode ionNew = graph.unique(new InstanceOfNode(ion.type(), ion.getValue(), profile)); + InstanceOfNode ionNew = graph.unique(InstanceOfNode.create(ion.type(), ion.getValue(), profile)); graph.replaceFloating(ion, ionNew); } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java Mon Aug 18 14:04:21 2014 +0200 @@ -63,7 +63,7 @@ dimensionNodes[i] = ConstantNode.forInt(dimensions[i], graph); } - NewMultiArrayNode repl = graph.add(new NewMultiArrayNode(arrayType, dimensionNodes)); + NewMultiArrayNode repl = graph.add(NewMultiArrayNode.create(arrayType, dimensionNodes)); graph.replaceFixedWithFixed(node, repl); forceCompile = true; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/NodeIntrinsicVerifier.java --- a/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/NodeIntrinsicVerifier.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/NodeIntrinsicVerifier.java Mon Aug 18 14:04:21 2014 +0200 @@ -94,7 +94,7 @@ env.getMessager().printMessage(Kind.ERROR, String.format("Cannot make @NodeIntrinsic for abstract node class %s.", nodeClass.getSimpleName()), element, annotation); } else { TypeMirror[] constructorSignature = constructorSignature(intrinsicMethod); - findConstructor(nodeClass, constructorSignature, intrinsicMethod, annotation); + findFactory(nodeClass, constructorSignature, intrinsicMethod, annotation); } } else { env.getMessager().printMessage(Kind.ERROR, String.format("The class %s is not a Node subclass.", nodeClass.getSimpleName()), element, annotation); @@ -122,37 +122,40 @@ return parameters; } - private void findConstructor(TypeElement nodeClass, TypeMirror[] signature, ExecutableElement intrinsicMethod, AnnotationMirror intrinsicAnnotation) { - List constructors = ElementFilter.constructorsIn(nodeClass.getEnclosedElements()); + private void findFactory(TypeElement nodeClass, TypeMirror[] signature, ExecutableElement intrinsicMethod, AnnotationMirror intrinsicAnnotation) { + List methods = ElementFilter.methodsIn(nodeClass.getEnclosedElements()); List failureReasons = new ArrayList<>(); - nextConstructor: for (ExecutableElement constructor : constructors) { + nextMethod: for (ExecutableElement method : methods) { + if (!method.getSimpleName().contentEquals("create") || !method.getModifiers().contains(Modifier.STATIC)) { + continue; + } int sIdx = 0; - int cIdx = 0; - while (cIdx < constructor.getParameters().size()) { - VariableElement parameter = constructor.getParameters().get(cIdx++); + int mIdx = 0; + while (mIdx < method.getParameters().size()) { + VariableElement parameter = method.getParameters().get(mIdx++); if (parameter.getAnnotation(InjectedNodeParameter.class) != null) { // skip injected parameters continue; } TypeMirror paramType = parameter.asType(); - if (cIdx == constructor.getParameters().size() && paramType.getKind() == TypeKind.ARRAY) { - // last argument of constructor is varargs, match remaining intrinsic arguments + if (mIdx == method.getParameters().size() && paramType.getKind() == TypeKind.ARRAY) { + // last argument of method is varargs, match remaining intrinsic arguments TypeMirror varargsType = ((ArrayType) paramType).getComponentType(); while (sIdx < signature.length) { if (!isTypeCompatible(varargsType, signature[sIdx++])) { - failureReasons.add(String.format("Constructor %s failed because the types of argument %d are incompatible: %s != %s", constructor, sIdx, varargsType, signature[sIdx - 1])); - continue nextConstructor; + failureReasons.add(String.format("Factory method %s failed because the types of argument %d are incompatible: %s != %s", method, sIdx, varargsType, signature[sIdx - 1])); + continue nextMethod; } } } else if (sIdx >= signature.length) { // too many arguments in intrinsic method - failureReasons.add(String.format("Too many arguments for %s", constructor)); - continue nextConstructor; + failureReasons.add(String.format("Too many arguments for %s", method)); + continue nextMethod; } else if (!isTypeCompatible(paramType, signature[sIdx++])) { - failureReasons.add(String.format("Constructor %s failed because the types of argument %d are incompatible: %s != %s", constructor, sIdx, paramType, signature[sIdx - 1])); - continue nextConstructor; + failureReasons.add(String.format("Factory method %s failed because the types of argument %d are incompatible: %s != %s", method, sIdx, paramType, signature[sIdx - 1])); + continue nextMethod; } } @@ -162,12 +165,12 @@ } // too many arguments in constructor - failureReasons.add(String.format("Not enough arguments for %s", constructor)); + failureReasons.add(String.format("Not enough arguments for %s", method)); } // not found if (failureReasons.isEmpty()) { - env.getMessager().printMessage(Kind.ERROR, "Could not find matching constructor for node intrinsic.", intrinsicMethod, intrinsicAnnotation); + env.getMessager().printMessage(Kind.ERROR, "Could not find matching factory method for node intrinsic.", intrinsicMethod, intrinsicAnnotation); } else { for (String reason : failureReasons) { env.getMessager().printMessage(Kind.ERROR, reason, intrinsicMethod, intrinsicAnnotation); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/CollapseFrameForSingleSideEffectPhase.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/CollapseFrameForSingleSideEffectPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/CollapseFrameForSingleSideEffectPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -228,7 +228,7 @@ assert bci == AFTER_BCI || bci == AFTER_EXCEPTION_BCI || bci == INVALID_FRAMESTATE_BCI; FrameState currentStateAfter = node.stateAfter(); if (currentStateAfter != null || !replaceOnly) { - node.setStateAfter(graph.add(new FrameState(bci))); + node.setStateAfter(graph.add(FrameState.create(bci))); if (currentStateAfter != null && currentStateAfter.usages().isEmpty()) { GraphUtil.killWithUnusedFloatingInputs(currentStateAfter); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java Mon Aug 18 14:04:21 2014 +0200 @@ -113,7 +113,7 @@ ConstantLocationNode location = createFieldLocation(graph, field, false); assert location != null : "Field that is loaded must not be eliminated"; - ReadNode memoryRead = graph.add(new ReadNode(object, location, loadStamp, fieldLoadBarrierType(field))); + ReadNode memoryRead = graph.add(ReadNode.create(object, location, loadStamp, fieldLoadBarrierType(field))); ValueNode readValue = implicitLoadConvert(graph, field.getKind(), memoryRead); loadField.replaceAtUsages(readValue); graph.replaceFixed(loadField, memoryRead); @@ -121,9 +121,9 @@ memoryRead.setGuard(createNullCheck(object, memoryRead, tool)); if (loadField.isVolatile()) { - MembarNode preMembar = graph.add(new MembarNode(JMM_PRE_VOLATILE_READ)); + MembarNode preMembar = graph.add(MembarNode.create(JMM_PRE_VOLATILE_READ)); graph.addBeforeFixed(memoryRead, preMembar); - MembarNode postMembar = graph.add(new MembarNode(JMM_POST_VOLATILE_READ)); + MembarNode postMembar = graph.add(MembarNode.create(JMM_POST_VOLATILE_READ)); graph.addAfterFixed(memoryRead, postMembar); } } @@ -141,15 +141,15 @@ graph.removeFixed(storeField); return; } - WriteNode memoryWrite = graph.add(new WriteNode(object, value, location, fieldStoreBarrierType(storeField.field()))); + WriteNode memoryWrite = graph.add(WriteNode.create(object, value, location, fieldStoreBarrierType(storeField.field()))); memoryWrite.setStateAfter(storeField.stateAfter()); graph.replaceFixedWithFixed(storeField, memoryWrite); memoryWrite.setGuard(createNullCheck(object, memoryWrite, tool)); if (storeField.isVolatile()) { - MembarNode preMembar = graph.add(new MembarNode(JMM_PRE_VOLATILE_WRITE)); + MembarNode preMembar = graph.add(MembarNode.create(JMM_PRE_VOLATILE_WRITE)); graph.addBeforeFixed(memoryWrite, preMembar); - MembarNode postMembar = graph.add(new MembarNode(JMM_POST_VOLATILE_WRITE)); + MembarNode postMembar = graph.add(MembarNode.create(JMM_POST_VOLATILE_WRITE)); graph.addAfterFixed(memoryWrite, postMembar); } } @@ -160,7 +160,7 @@ LocationNode location = createArrayLocation(graph, elementKind, loadIndexed.index(), false); Stamp loadStamp = loadStamp(loadIndexed.stamp(), elementKind); - ReadNode memoryRead = graph.add(new ReadNode(loadIndexed.array(), location, loadStamp, BarrierType.NONE)); + ReadNode memoryRead = graph.add(ReadNode.create(loadIndexed.array(), location, loadStamp, BarrierType.NONE)); ValueNode readValue = implicitLoadConvert(graph, elementKind, memoryRead); memoryRead.setGuard(createBoundsCheck(loadIndexed, tool)); @@ -184,20 +184,20 @@ if (arrayType != null && StampTool.isExactType(array)) { ResolvedJavaType elementType = arrayType.getComponentType(); if (!elementType.isJavaLangObject()) { - checkCastNode = graph.add(new CheckCastNode(elementType, value, null, true)); + checkCastNode = graph.add(CheckCastNode.create(elementType, value, null, true)); graph.addBeforeFixed(storeIndexed, checkCastNode); value = checkCastNode; } } else { ValueNode arrayClass = createReadHub(graph, array, boundsCheck); ValueNode componentHub = createReadArrayComponentHub(graph, arrayClass, storeIndexed); - checkCastNode = graph.add(new CheckCastDynamicNode(componentHub, value, true)); + checkCastNode = graph.add(CheckCastDynamicNode.create(componentHub, value, true)); graph.addBeforeFixed(storeIndexed, checkCastNode); value = checkCastNode; } } - WriteNode memoryWrite = graph.add(new WriteNode(array, implicitStoreConvert(graph, elementKind, value), location, arrayStoreBarrierType(storeIndexed.elementKind()))); + WriteNode memoryWrite = graph.add(WriteNode.create(array, implicitStoreConvert(graph, elementKind, value), location, arrayStoreBarrierType(storeIndexed.elementKind()))); memoryWrite.setGuard(boundsCheck); memoryWrite.setStateAfter(storeIndexed.stateAfter()); graph.replaceFixedWithFixed(storeIndexed, memoryWrite); @@ -213,7 +213,7 @@ ValueNode array = arrayLengthNode.array(); ConstantLocationNode location = ConstantLocationNode.create(ARRAY_LENGTH_LOCATION, Kind.Int, arrayLengthOffset(), graph); - ReadNode arrayLengthRead = graph.add(new ReadNode(array, location, StampFactory.positiveInt(), BarrierType.NONE)); + ReadNode arrayLengthRead = graph.add(ReadNode.create(array, location, StampFactory.positiveInt(), BarrierType.NONE)); arrayLengthRead.setGuard(createNullCheck(array, arrayLengthNode, tool)); graph.replaceFixedWithFixed(arrayLengthNode, arrayLengthRead); } @@ -235,7 +235,7 @@ ValueNode expectedValue = implicitStoreConvert(graph, valueKind, cas.expected()); ValueNode newValue = implicitStoreConvert(graph, valueKind, cas.newValue()); - LoweredCompareAndSwapNode atomicNode = graph.add(new LoweredCompareAndSwapNode(cas.object(), location, expectedValue, newValue, compareAndSwapBarrierType(cas))); + LoweredCompareAndSwapNode atomicNode = graph.add(LoweredCompareAndSwapNode.create(cas.object(), location, expectedValue, newValue, compareAndSwapBarrierType(cas))); atomicNode.setStateAfter(cas.stateAfter()); graph.replaceFixedWithFixed(cas, atomicNode); } @@ -247,7 +247,7 @@ ValueNode newValue = implicitStoreConvert(graph, valueKind, n.newValue()); - LoweredAtomicReadAndWriteNode memoryRead = graph.add(new LoweredAtomicReadAndWriteNode(n.object(), location, newValue, atomicReadAndWriteBarrierType(n))); + LoweredAtomicReadAndWriteNode memoryRead = graph.add(LoweredAtomicReadAndWriteNode.create(n.object(), location, newValue, atomicReadAndWriteBarrierType(n))); memoryRead.setStateAfter(n.stateAfter()); ValueNode readValue = implicitLoadConvert(graph, valueKind, memoryRead); @@ -258,7 +258,7 @@ protected void lowerUnsafeLoadNode(UnsafeLoadNode load, @SuppressWarnings("unused") LoweringTool tool) { StructuredGraph graph = load.graph(); if (load.getGuardingCondition() != null) { - ConditionAnchorNode valueAnchorNode = graph.add(new ConditionAnchorNode(load.getGuardingCondition())); + ConditionAnchorNode valueAnchorNode = graph.add(ConditionAnchorNode.create(load.getGuardingCondition())); ReadNode memoryRead = createUnsafeRead(graph, load, valueAnchorNode); graph.replaceFixedWithFixed(load, valueAnchorNode); graph.addAfterFixed(valueAnchorNode, memoryRead); @@ -277,7 +277,7 @@ Kind readKind = load.accessKind(); LocationNode location = createLocation(load); Stamp loadStamp = loadStamp(load.stamp(), readKind, compressible); - ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, loadStamp, guard, BarrierType.NONE)); + ReadNode memoryRead = graph.add(ReadNode.create(load.object(), location, loadStamp, guard, BarrierType.NONE)); ValueNode readValue = implicitLoadConvert(graph, readKind, memoryRead, compressible); load.replaceAtUsages(readValue); return memoryRead; @@ -290,7 +290,7 @@ boolean compressible = store.value().getKind() == Kind.Object; Kind valueKind = store.accessKind(); ValueNode value = implicitStoreConvert(graph, valueKind, store.value(), compressible); - WriteNode write = graph.add(new WriteNode(object, value, location, unsafeStoreBarrierType(store))); + WriteNode write = graph.add(WriteNode.create(object, value, location, unsafeStoreBarrierType(store))); write.setStateAfter(store.stateAfter()); graph.replaceFixedWithFixed(store, write); } @@ -300,7 +300,7 @@ Kind valueKind = read.location().getValueKind(); Stamp loadStamp = loadStamp(read.stamp(), valueKind, read.isCompressible()); - ReadNode memoryRead = graph.add(new ReadNode(read.object(), read.location(), loadStamp, read.getBarrierType())); + ReadNode memoryRead = graph.add(ReadNode.create(read.object(), read.location(), loadStamp, read.getBarrierType())); ValueNode readValue = implicitLoadConvert(graph, valueKind, memoryRead, read.isCompressible()); memoryRead.setGuard(read.getGuard()); read.replaceAtUsages(readValue); @@ -312,7 +312,7 @@ Kind valueKind = write.location().getValueKind(); ValueNode value = implicitStoreConvert(graph, valueKind, write.value(), write.isCompressible()); - WriteNode memoryWrite = graph.add(new WriteNode(write.object(), value, write.location(), write.getBarrierType(), write.isInitialization())); + WriteNode memoryWrite = graph.add(WriteNode.create(write.object(), value, write.location(), write.getBarrierType(), write.isInitialization())); memoryWrite.setStateAfter(write.stateAfter()); graph.replaceFixedWithFixed(write, memoryWrite); memoryWrite.setGuard(write.getGuard()); @@ -331,9 +331,9 @@ int entryCount = virtual.entryCount(); AbstractNewObjectNode newObject; if (virtual instanceof VirtualInstanceNode) { - newObject = graph.add(new NewInstanceNode(virtual.type(), true)); + newObject = graph.add(NewInstanceNode.create(virtual.type(), true)); } else { - newObject = graph.add(new NewArrayNode(((VirtualArrayNode) virtual).componentType(), ConstantNode.forInt(entryCount, graph), true)); + newObject = graph.add(NewArrayNode.create(((VirtualArrayNode) virtual).componentType(), ConstantNode.forInt(entryCount, graph), true)); } recursiveLowerings.add(newObject); graph.addBeforeFixed(commit, newObject); @@ -368,7 +368,7 @@ barrierType = arrayInitializationBarrier(entryKind); } if (location != null) { - WriteNode write = new WriteNode(newObject, implicitStoreConvert(graph, entryKind, value), location, barrierType); + WriteNode write = WriteNode.create(newObject, implicitStoreConvert(graph, entryKind, value), location, barrierType); graph.addAfterFixed(newObject, graph.add(write)); } } @@ -400,7 +400,7 @@ barrierType = BarrierType.PRECISE; } if (location != null) { - WriteNode write = new WriteNode(newObject, implicitStoreConvert(graph, Kind.Object, allocValue), location, barrierType); + WriteNode write = WriteNode.create(newObject, implicitStoreConvert(graph, Kind.Object, allocValue), location, barrierType); graph.addBeforeFixed(commit, graph.add(write)); } } @@ -421,13 +421,13 @@ public static void finishAllocatedObjects(LoweringTool tool, CommitAllocationNode commit, ValueNode[] allocations) { StructuredGraph graph = commit.graph(); for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) { - FixedValueAnchorNode anchor = graph.add(new FixedValueAnchorNode(allocations[objIndex])); + FixedValueAnchorNode anchor = graph.add(FixedValueAnchorNode.create(allocations[objIndex])); allocations[objIndex] = anchor; graph.addBeforeFixed(commit, anchor); } for (int objIndex = 0; objIndex < commit.getVirtualObjects().size(); objIndex++) { for (MonitorIdNode monitorId : commit.getLocks(objIndex)) { - MonitorEnterNode enter = graph.add(new MonitorEnterNode(allocations[objIndex], monitorId)); + MonitorEnterNode enter = graph.add(MonitorEnterNode.create(allocations[objIndex], monitorId)); graph.addBeforeFixed(commit, enter); enter.lower(tool); } @@ -528,10 +528,10 @@ switch (kind) { case Byte: case Short: - return graph.unique(new SignExtendNode(value, 32)); + return graph.unique(SignExtendNode.create(value, 32)); case Boolean: case Char: - return graph.unique(new ZeroExtendNode(value, 32)); + return graph.unique(ZeroExtendNode.create(value, 32)); } return value; } @@ -544,10 +544,10 @@ switch (kind) { case Boolean: case Byte: - return graph.unique(new NarrowNode(value, 8)); + return graph.unique(NarrowNode.create(value, 8)); case Char: case Short: - return graph.unique(new NarrowNode(value, 16)); + return graph.unique(NarrowNode.create(value, 16)); } return value; } @@ -613,7 +613,7 @@ } if (signExtend) { // If we were using sign extended values before restore the sign extension. - offset = offset.graph().addOrUnique(new SignExtendNode(offset, 64)); + offset = offset.graph().addOrUnique(SignExtendNode.create(offset, 64)); } return IndexedLocationNode.create(locationIdentity, accessKind, displacement, offset, offset.graph(), indexScaling); } @@ -629,7 +629,7 @@ ValueNode arrayLength = readArrayLength(array, tool.getConstantReflection()); if (arrayLength == null) { Stamp stamp = StampFactory.positiveInt(); - ReadNode readArrayLength = graph.add(new ReadNode(array, ConstantLocationNode.create(ARRAY_LENGTH_LOCATION, Kind.Int, arrayLengthOffset(), graph), stamp, BarrierType.NONE)); + ReadNode readArrayLength = graph.add(ReadNode.create(array, ConstantLocationNode.create(ARRAY_LENGTH_LOCATION, Kind.Int, arrayLengthOffset(), graph), stamp, BarrierType.NONE)); graph.addBeforeFixed(n, readArrayLength); readArrayLength.setGuard(createNullCheck(array, readArrayLength, tool)); arrayLength = readArrayLength; @@ -646,14 +646,14 @@ } } - return tool.createGuard(n, graph.unique(new IntegerBelowNode(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile); + return tool.createGuard(n, graph.unique(IntegerBelowNode.create(n.index(), arrayLength)), BoundsCheckException, InvalidateReprofile); } protected GuardingNode createNullCheck(ValueNode object, FixedNode before, LoweringTool tool) { if (StampTool.isObjectNonNull(object)) { return null; } - return tool.createGuard(before, before.graph().unique(new IsNullNode(object)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true); + return tool.createGuard(before, before.graph().unique(IsNullNode.create(object)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true); } @Override diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraphKit.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraphKit.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraphKit.java Mon Aug 18 14:04:21 2014 +0200 @@ -131,7 +131,7 @@ JavaType returnType = signature.getReturnType(null); assert checkArgs(method, args); MethodCallTargetNode callTarget = graph.add(createMethodCallTarget(invokeKind, method, args, returnType, bci)); - InvokeNode invoke = append(new InvokeNode(callTarget, bci)); + InvokeNode invoke = append(InvokeNode.create(callTarget, bci)); if (frameStateBuilder != null) { if (invoke.getKind() != Kind.Void) { @@ -146,7 +146,7 @@ } protected MethodCallTargetNode createMethodCallTarget(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args, JavaType returnType, @SuppressWarnings("unused") int bci) { - return new MethodCallTargetNode(invokeKind, targetMethod, args, returnType); + return MethodCallTargetNode.create(invokeKind, targetMethod, args, returnType); } /** @@ -246,9 +246,9 @@ * @param trueProbability The estimated probability the the condition is true */ public void startIf(LogicNode condition, double trueProbability) { - BeginNode thenSuccessor = graph.add(new BeginNode()); - BeginNode elseSuccessor = graph.add(new BeginNode()); - append(new IfNode(condition, thenSuccessor, elseSuccessor, trueProbability)); + BeginNode thenSuccessor = graph.add(BeginNode.create()); + BeginNode elseSuccessor = graph.add(BeginNode.create()); + append(IfNode.create(condition, thenSuccessor, elseSuccessor, trueProbability)); lastFixedNode = null; IfStructure s = new IfStructure(); @@ -298,12 +298,12 @@ if (thenPart != null && elsePart != null) { /* Both parts are alive, we need a real merge. */ - EndNode thenEnd = graph.add(new EndNode()); + EndNode thenEnd = graph.add(EndNode.create()); graph.addAfterFixed(thenPart, thenEnd); - EndNode elseEnd = graph.add(new EndNode()); + EndNode elseEnd = graph.add(EndNode.create()); graph.addAfterFixed(elsePart, elseEnd); - MergeNode merge = graph.add(new MergeNode()); + MergeNode merge = graph.add(MergeNode.create()); merge.addForwardEnd(thenEnd); merge.addForwardEnd(elseEnd); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java Mon Aug 18 14:04:21 2014 +0200 @@ -160,7 +160,7 @@ // Can simply use the phi result if the same materialized values are expected. return result; } else { - return graph.unique(new ConditionalNode(asCondition(trueValue), t, f)); + return graph.unique(ConditionalNode.create(asCondition(trueValue), t, f)); } } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -85,15 +85,15 @@ ResolvedJavaType[] parameterTypes = resolveJavaTypes(target.toParameterTypes(), declaringClass); - // Prepare the arguments for the reflective constructor call on the node class. - Constant[] nodeConstructorArguments = prepareArguments(methodCallTargetNode, parameterTypes, target, false); - if (nodeConstructorArguments == null) { + // Prepare the arguments for the reflective factory method call on the node class. + Constant[] nodeFactoryArguments = prepareArguments(methodCallTargetNode, parameterTypes, target, false); + if (nodeFactoryArguments == null) { return false; } // Create the new node instance. ResolvedJavaType c = getNodeClass(target, intrinsic); - Node newInstance = createNodeInstance(graph, c, parameterTypes, methodCallTargetNode.invoke().asNode().stamp(), intrinsic.setStampFromReturnType(), nodeConstructorArguments); + Node newInstance = createNodeInstance(graph, c, parameterTypes, methodCallTargetNode.invoke().asNode().stamp(), intrinsic.setStampFromReturnType(), nodeFactoryArguments); // Replace the invoke with the new node. newInstance = graph.addOrUnique(newInstance); @@ -150,7 +150,7 @@ /** * Converts the arguments of an invoke node to object values suitable for use as the arguments - * to a reflective invocation of a Java constructor or method. + * to a reflective invocation of a Java method. * * @param folding specifies if the invocation is for handling a {@link Fold} annotation * @return the arguments for the reflective invocation or null if an argument of {@code invoke} @@ -209,35 +209,38 @@ } private Node createNodeInstance(StructuredGraph graph, ResolvedJavaType nodeClass, ResolvedJavaType[] parameterTypes, Stamp invokeStamp, boolean setStampFromReturnType, - Constant[] nodeConstructorArguments) { - ResolvedJavaMethod constructor = null; + Constant[] nodeFactoryArguments) { + ResolvedJavaMethod factory = null; Constant[] arguments = null; - for (ResolvedJavaMethod c : nodeClass.getDeclaredConstructors()) { - Constant[] match = match(graph, c, parameterTypes, nodeConstructorArguments); + for (ResolvedJavaMethod m : nodeClass.getDeclaredMethods()) { + if (m.getName().equals("create") && !m.isSynthetic()) { + Constant[] match = match(graph, m, parameterTypes, nodeFactoryArguments); - if (match != null) { - if (constructor == null) { - constructor = c; - arguments = match; - } else { - throw new GraalInternalError("Found multiple constructors in %s compatible with signature %s: %s, %s", nodeClass.toJavaName(), sigString(parameterTypes), constructor, c); + if (match != null) { + if (factory == null) { + factory = m; + arguments = match; + } else { + throw new GraalInternalError("Found multiple factory methods in %s compatible with signature %s: %s, %s", nodeClass.toJavaName(), sigString(parameterTypes), + factory.format("%n(%p)%r"), m.format("%n(%p)%r")); + } } } } - if (constructor == null) { - throw new GraalInternalError("Could not find constructor in %s compatible with signature %s", nodeClass.toJavaName(), sigString(parameterTypes)); + if (factory == null) { + throw new GraalInternalError("Could not find factory method in %s compatible with signature %s", nodeClass.toJavaName(), sigString(parameterTypes)); } try { - ValueNode intrinsicNode = (ValueNode) snippetReflection.asObject(constructor.newInstance(arguments)); + ValueNode intrinsicNode = (ValueNode) snippetReflection.asObject(factory.invoke(null, arguments)); if (setStampFromReturnType) { intrinsicNode.setStamp(invokeStamp); } return intrinsicNode; } catch (Exception e) { - throw new RuntimeException(constructor + Arrays.toString(nodeConstructorArguments), e); + throw new RuntimeException(factory + Arrays.toString(nodeFactoryArguments), e); } } @@ -261,14 +264,14 @@ return false; } - private Constant[] match(StructuredGraph graph, ResolvedJavaMethod c, ResolvedJavaType[] parameterTypes, Constant[] nodeConstructorArguments) { + private Constant[] match(StructuredGraph graph, ResolvedJavaMethod m, ResolvedJavaType[] parameterTypes, Constant[] nodeFactoryArguments) { Constant[] arguments = null; Constant[] injected = null; - ResolvedJavaType[] signature = resolveJavaTypes(c.getSignature().toParameterTypes(null), c.getDeclaringClass()); + ResolvedJavaType[] signature = resolveJavaTypes(m.getSignature().toParameterTypes(null), m.getDeclaringClass()); MetaAccessProvider metaAccess = providers.getMetaAccess(); for (int i = 0; i < signature.length; i++) { - if (c.getParameterAnnotation(InjectedNodeParameter.class, i) != null) { + if (m.getParameterAnnotation(InjectedNodeParameter.class, i) != null) { injected = injected == null ? new Constant[1] : Arrays.copyOf(injected, injected.length + 1); if (signature[i].equals(metaAccess.lookupJavaType(MetaAccessProvider.class))) { injected[injected.length - 1] = snippetReflection.forObject(metaAccess); @@ -279,24 +282,24 @@ } else if (signature[i].equals(metaAccess.lookupJavaType(SnippetReflectionProvider.class))) { injected[injected.length - 1] = snippetReflection.forObject(snippetReflection); } else { - throw new GraalInternalError("Cannot handle injected argument of type %s in %s", signature[i].toJavaName(), c.format("%H.%n(%p)")); + throw new GraalInternalError("Cannot handle injected argument of type %s in %s", signature[i].toJavaName(), m.format("%H.%n(%p)")); } } else { if (i > 0) { // Chop injected arguments from signature signature = Arrays.copyOfRange(signature, i, signature.length); } - assert !containsInjected(c, i, signature.length); + assert !containsInjected(m, i, signature.length); break; } } if (Arrays.equals(parameterTypes, signature)) { // Exact match - arguments = nodeConstructorArguments; + arguments = nodeFactoryArguments; } else if (signature.length > 0 && signature[signature.length - 1].isArray()) { - // Last constructor parameter is an array, so check if we have a vararg match + // Last parameter is an array, so check if we have a vararg match int fixedArgs = signature.length - 1; if (parameterTypes.length < fixedArgs) { return null; @@ -309,17 +312,17 @@ ResolvedJavaType componentType = signature[fixedArgs].getComponentType(); assert componentType != null; - for (int i = fixedArgs; i < nodeConstructorArguments.length; i++) { + for (int i = fixedArgs; i < nodeFactoryArguments.length; i++) { if (!parameterTypes[i].equals(componentType)) { return null; } } - arguments = Arrays.copyOf(nodeConstructorArguments, fixedArgs + 1); - arguments[fixedArgs] = componentType.newArray(nodeConstructorArguments.length - fixedArgs); + arguments = Arrays.copyOf(nodeFactoryArguments, fixedArgs + 1); + arguments[fixedArgs] = componentType.newArray(nodeFactoryArguments.length - fixedArgs); Object varargs = snippetReflection.asObject(arguments[fixedArgs]); - for (int i = fixedArgs; i < nodeConstructorArguments.length; i++) { - Array.set(varargs, i - fixedArgs, snippetReflection.asBoxedValue(nodeConstructorArguments[i])); + for (int i = fixedArgs; i < nodeFactoryArguments.length; i++) { + Array.set(varargs, i - fixedArgs, snippetReflection.asBoxedValue(nodeFactoryArguments[i])); } } else { return null; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Mon Aug 18 14:04:21 2014 +0200 @@ -571,7 +571,7 @@ MetaAccessProvider metaAccess = providers.getMetaAccess(); if (MethodsElidedInSnippets != null && methodToParse.getSignature().getReturnKind() == Kind.Void && MethodFilter.matches(MethodsElidedInSnippets, methodToParse)) { - graph.addAfterFixed(graph.start(), graph.add(new ReturnNode(null))); + graph.addAfterFixed(graph.start(), graph.add(ReturnNode.create(null))); } else { createGraphBuilder(metaAccess, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(graph); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Mon Aug 18 14:04:21 2014 +0200 @@ -360,7 +360,11 @@ final Varargs varargs; - public VarargsPlaceholderNode(Varargs varargs, MetaAccessProvider metaAccess) { + public static VarargsPlaceholderNode create(Varargs varargs, MetaAccessProvider metaAccess) { + return new SnippetTemplate_VarargsPlaceholderNodeGen(varargs, metaAccess); + } + + protected VarargsPlaceholderNode(Varargs varargs, MetaAccessProvider metaAccess) { super(StampFactory.exactNonNull(metaAccess.lookupJavaType(varargs.componentType).getArrayClass())); this.varargs = varargs; } @@ -547,7 +551,7 @@ nodeReplacements.put(snippetGraph.getParameter(i), ConstantNode.forConstant(constantArg, metaAccess, snippetCopy)); } else if (args.info.isVarargsParameter(i)) { Varargs varargs = (Varargs) args.values[i]; - VarargsPlaceholderNode placeholder = snippetCopy.unique(new VarargsPlaceholderNode(varargs, providers.getMetaAccess())); + VarargsPlaceholderNode placeholder = snippetCopy.unique(VarargsPlaceholderNode.create(varargs, providers.getMetaAccess())); nodeReplacements.put(snippetGraph.getParameter(i), placeholder); placeholders[i] = placeholder; } @@ -575,7 +579,7 @@ assert parameterCount < 10000; int idx = (i + 1) * 10000 + j; assert idx >= parameterCount : "collision in parameter numbering"; - ParameterNode local = snippetCopy.unique(new ParameterNode(idx, stamp)); + ParameterNode local = snippetCopy.unique(ParameterNode.create(idx, stamp)); params[j] = local; } parameters[i] = params; @@ -586,7 +590,7 @@ if (usage instanceof LoadIndexedNode) { LoadIndexedNode loadIndexed = (LoadIndexedNode) usage; Debug.dump(snippetCopy, "Before replacing %s", loadIndexed); - LoadSnippetVarargParameterNode loadSnippetParameter = snippetCopy.add(new LoadSnippetVarargParameterNode(params, loadIndexed.index(), loadIndexed.stamp())); + LoadSnippetVarargParameterNode loadSnippetParameter = snippetCopy.add(LoadSnippetVarargParameterNode.create(params, loadIndexed.index(), loadIndexed.stamp())); snippetCopy.replaceFixedWithFixed(loadIndexed, loadSnippetParameter); Debug.dump(snippetCopy, "After replacing %s", loadIndexed); } else if (usage instanceof StoreIndexedNode) { @@ -672,7 +676,7 @@ new FloatingReadPhase(false, true, false).apply(snippetCopy); - MemoryAnchorNode memoryAnchor = snippetCopy.add(new MemoryAnchorNode()); + MemoryAnchorNode memoryAnchor = snippetCopy.add(MemoryAnchorNode.create()); snippetCopy.start().replaceAtUsages(InputType.Memory, memoryAnchor); this.snippet = snippetCopy; @@ -691,12 +695,12 @@ } else if (returnNodes.size() == 1) { this.returnNode = returnNodes.get(0); } else { - MergeNode merge = snippet.add(new MergeNode()); + MergeNode merge = snippet.add(MergeNode.create()); List memMaps = returnNodes.stream().map(n -> n.getMemoryMap()).collect(Collectors.toList()); ValueNode returnValue = InliningUtil.mergeReturns(merge, returnNodes, null); - this.returnNode = snippet.add(new ReturnNode(returnValue)); + this.returnNode = snippet.add(ReturnNode.create(returnValue)); MemoryMapImpl mmap = FloatingReadPhase.mergeMemoryMaps(merge, memMaps, false); - MemoryMapNode memoryMap = snippet.unique(new MemoryMapNode(mmap.getMap())); + MemoryMapNode memoryMap = snippet.unique(MemoryMapNode.create(mmap.getMap())); this.returnNode.setMemoryMap(memoryMap); for (MemoryMapNode mm : memMaps) { if (mm != memoryMap && mm.isAlive()) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -50,7 +50,11 @@ /** Length of both arrays. */ @Input private ValueNode length; - public ArrayEqualsNode(ValueNode array1, ValueNode array2, ValueNode length) { + public static ArrayEqualsNode create(ValueNode array1, ValueNode array2, ValueNode length) { + return new ArrayEqualsNodeGen(array1, array2, length); + } + + protected ArrayEqualsNode(ValueNode array1, ValueNode array2, ValueNode length) { super(StampFactory.forKind(Kind.Boolean)); assert array1.stamp().equals(array2.stamp()); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,11 @@ private final boolean compileTimeAssertion; private final String message; - public AssertionNode(boolean compileTimeAssertion, ValueNode value, String message) { + public static AssertionNode create(boolean compileTimeAssertion, ValueNode value, String message) { + return new AssertionNodeGen(compileTimeAssertion, value, message); + } + + protected AssertionNode(boolean compileTimeAssertion, ValueNode value, String message) { super(StampFactory.forVoid()); this.value = value; this.compileTimeAssertion = compileTimeAssertion; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitCountNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitCountNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitCountNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @NodeInfo public class BitCountNode extends UnaryNode implements LIRLowerable { - public BitCountNode(ValueNode value) { + public static BitCountNode create(ValueNode value) { + return new BitCountNodeGen(value); + } + + protected BitCountNode(ValueNode value) { super(StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value); assert value.getKind() == Kind.Int || value.getKind() == Kind.Long; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanForwardNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanForwardNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanForwardNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,11 @@ @NodeInfo public class BitScanForwardNode extends UnaryNode implements LIRLowerable { - public BitScanForwardNode(ValueNode value) { + public static BitScanForwardNode create(ValueNode value) { + return new BitScanForwardNodeGen(value); + } + + protected BitScanForwardNode(ValueNode value) { super(StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value); assert value.getKind() == Kind.Int || value.getKind() == Kind.Long; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanReverseNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanReverseNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanReverseNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,11 @@ @NodeInfo public class BitScanReverseNode extends UnaryNode implements LIRLowerable { - public BitScanReverseNode(ValueNode value) { + public static BitScanReverseNode create(ValueNode value) { + return new BitScanReverseNodeGen(value); + } + + protected BitScanReverseNode(ValueNode value) { super(StampFactory.forInteger(Kind.Int, 0, ((PrimitiveStamp) value.stamp()).getBits()), value); assert value.getKind() == Kind.Int || value.getKind() == Kind.Long; } diff -r cc7aaa92c27d -r 06c15e88d383 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 Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,11 @@ private final int displacement; private final LocationIdentity locationIdentity; - public DirectObjectStoreNode(ValueNode object, int displacement, ValueNode offset, ValueNode value, LocationIdentity locationIdentity) { + public static DirectObjectStoreNode create(ValueNode object, int displacement, ValueNode offset, ValueNode value, LocationIdentity locationIdentity) { + return new DirectObjectStoreNodeGen(object, displacement, offset, value, locationIdentity); + } + + protected DirectObjectStoreNode(ValueNode object, int displacement, ValueNode offset, ValueNode value, LocationIdentity locationIdentity) { super(StampFactory.forVoid()); this.object = object; this.value = value; @@ -61,7 +65,7 @@ @Override public void lower(LoweringTool tool) { IndexedLocationNode location = IndexedLocationNode.create(locationIdentity, value.getKind(), displacement, offset, graph(), 1); - JavaWriteNode write = graph().add(new JavaWriteNode(object, value, location, BarrierType.NONE, value.getKind() == Kind.Object, false)); + JavaWriteNode write = graph().add(JavaWriteNode.create(object, value, location, BarrierType.NONE, value.getKind() == Kind.Object, false)); graph().replaceFixedWithFixed(this, write); tool.getLowerer().lower(write, tool); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,7 +41,11 @@ @Input private ValueNode address; private final Kind readKind; - public DirectReadNode(ValueNode address, Kind readKind) { + public static DirectReadNode create(ValueNode address, Kind readKind) { + return new DirectReadNodeGen(address, readKind); + } + + protected DirectReadNode(ValueNode address, Kind readKind) { super(StampFactory.forKind(readKind)); this.address = address; this.readKind = readKind; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectStoreNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectStoreNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectStoreNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -42,7 +42,11 @@ @Input private ValueNode value; private final Kind kind; - public DirectStoreNode(ValueNode address, ValueNode value, Kind kind) { + public static DirectStoreNode create(ValueNode address, ValueNode value, Kind kind) { + return new DirectStoreNodeGen(address, value, kind); + } + + protected DirectStoreNode(ValueNode address, ValueNode value, Kind kind) { super(StampFactory.forVoid()); this.address = address; this.value = value; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ExplodeLoopNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ExplodeLoopNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ExplodeLoopNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,7 +39,11 @@ @NodeInfo public class ExplodeLoopNode extends FixedWithNextNode { - public ExplodeLoopNode() { + public static ExplodeLoopNode create() { + return new ExplodeLoopNodeGen(); + } + + protected ExplodeLoopNode() { super(StampFactory.forVoid()); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/LoadSnippetVarargParameterNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/LoadSnippetVarargParameterNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/LoadSnippetVarargParameterNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,7 +39,11 @@ @Input private final NodeInputList parameters; - public LoadSnippetVarargParameterNode(ParameterNode[] locals, ValueNode index, Stamp stamp) { + public static LoadSnippetVarargParameterNode create(ParameterNode[] locals, ValueNode index, Stamp stamp) { + return new LoadSnippetVarargParameterNodeGen(locals, index, stamp); + } + + protected LoadSnippetVarargParameterNode(ParameterNode[] locals, ValueNode index, Stamp stamp) { super(stamp); this.index = index; this.parameters = new NodeInputList<>(this, locals); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -66,6 +66,10 @@ private final JavaType returnType; private final InvokeKind invokeKind; + public static MacroNode create(Invoke invoke) { + return new MacroNodeGen(invoke); + } + protected MacroNode(Invoke invoke) { super(StampFactory.forKind(((MethodCallTargetNode) invoke.callTarget()).targetMethod().getSignature().getReturnKind())); MethodCallTargetNode methodCallTarget = (MethodCallTargetNode) invoke.callTarget(); @@ -184,8 +188,8 @@ } protected InvokeNode createInvoke() { - MethodCallTargetNode callTarget = graph().add(new MethodCallTargetNode(invokeKind, targetMethod, arguments.toArray(new ValueNode[arguments.size()]), returnType)); - InvokeNode invoke = graph().add(new InvokeNode(callTarget, bci)); + MethodCallTargetNode callTarget = graph().add(MethodCallTargetNode.create(invokeKind, targetMethod, arguments.toArray(new ValueNode[arguments.size()]), returnType)); + InvokeNode invoke = graph().add(InvokeNode.create(callTarget, bci)); if (stateAfter() != null) { invoke.setStateAfter(stateAfter().duplicate()); if (getKind() != Kind.Void) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroStateSplitNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroStateSplitNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroStateSplitNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,6 +39,10 @@ @OptionalInput(InputType.State) private FrameState stateAfter; + public static MacroStateSplitNode create(Invoke invoke) { + return new MacroStateSplitNodeGen(invoke); + } + protected MacroStateSplitNode(Invoke invoke) { super(invoke); this.stateAfter = invoke.stateAfter(); @@ -71,7 +75,7 @@ } assert invoke.stateAfter().bci == BytecodeFrame.AFTER_BCI; // Here we need to fix the bci of the invoke - InvokeNode newInvoke = snippetGraph.add(new InvokeNode(invoke.callTarget(), getBci())); + InvokeNode newInvoke = snippetGraph.add(InvokeNode.create(invoke.callTarget(), getBci())); newInvoke.setStateAfter(invoke.stateAfter()); snippetGraph.replaceFixedWithFixed((InvokeNode) invoke.asNode(), newInvoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MathIntrinsicNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MathIntrinsicNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MathIntrinsicNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -51,7 +51,11 @@ return operation; } - public MathIntrinsicNode(ValueNode value, Operation op) { + public static MathIntrinsicNode create(ValueNode value, Operation op) { + return new MathIntrinsicNodeGen(value, op); + } + + protected MathIntrinsicNode(ValueNode value, Operation op) { super(StampFactory.forKind(Kind.Double), value); assert value.stamp() instanceof FloatStamp && PrimitiveStamp.getBits(value.stamp()) == 64; this.operation = op; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MemoryAnchorNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MemoryAnchorNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MemoryAnchorNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @NodeInfo(allowedUsageTypes = {InputType.Memory}) public class MemoryAnchorNode extends FixedWithNextNode implements LIRLowerable, MemoryNode, Canonicalizable { - public MemoryAnchorNode() { + public static MemoryAnchorNode create() { + return new MemoryAnchorNodeGen(); + } + + protected MemoryAnchorNode() { super(StampFactory.forVoid()); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReadRegisterNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReadRegisterNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReadRegisterNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -53,7 +53,11 @@ */ private final boolean incoming; - public ReadRegisterNode(Register register, Kind kind, boolean directUse, boolean incoming) { + public static ReadRegisterNode create(Register register, Kind kind, boolean directUse, boolean incoming) { + return new ReadRegisterNodeGen(register, kind, directUse, incoming); + } + + protected ReadRegisterNode(Register register, Kind kind, boolean directUse, boolean incoming) { super(StampFactory.forKind(kind)); assert register != null; this.register = register; @@ -65,7 +69,11 @@ * Constructor to be used by node intrinsics where the stamp is inferred from the intrinsic * definition. */ - public ReadRegisterNode(Register register, boolean directUse, boolean incoming) { + public static ReadRegisterNode create(Register register, boolean directUse, boolean incoming) { + return new ReadRegisterNodeGen(register, directUse, incoming); + } + + protected ReadRegisterNode(Register register, boolean directUse, boolean incoming) { super(StampFactory.forNodeIntrinsic()); assert register != null; this.register = register; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReverseBytesNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReverseBytesNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReverseBytesNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -34,7 +34,11 @@ @NodeInfo public class ReverseBytesNode extends UnaryNode implements LIRLowerable { - public ReverseBytesNode(ValueNode value) { + public static ReverseBytesNode create(ValueNode value) { + return new ReverseBytesNodeGen(value); + } + + protected ReverseBytesNode(ValueNode value) { super(StampFactory.forKind(value.getKind()), value); assert getKind() == Kind.Int || getKind() == Kind.Long; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/WriteRegisterNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/WriteRegisterNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/WriteRegisterNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -45,7 +45,11 @@ */ @Input private ValueNode value; - public WriteRegisterNode(Register register, ValueNode value) { + public static WriteRegisterNode create(Register register, ValueNode value) { + return new WriteRegisterNodeGen(register, value); + } + + protected WriteRegisterNode(Register register, ValueNode value) { super(StampFactory.forVoid()); this.register = register; this.value = value; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java --- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Mon Aug 18 14:04:21 2014 +0200 @@ -119,7 +119,7 @@ public DirectCallNode createDirectCallNode(CallTarget target) { if (target instanceof OptimizedCallTarget) { - return OptimizedDirectCallNode.create((OptimizedCallTarget) target); + return new OptimizedDirectCallNode((OptimizedCallTarget) target); } else { throw new IllegalStateException(String.format("Unexpected call target class %s!", target.getClass())); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedDirectCallNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedDirectCallNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedDirectCallNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,7 @@ private final TruffleSplittingStrategy splittingStrategy; - private OptimizedDirectCallNode(OptimizedCallTarget target) { + public OptimizedDirectCallNode(OptimizedCallTarget target) { super(target); if (TruffleCompilerOptions.TruffleSplittingNew.getValue()) { this.splittingStrategy = new DefaultTruffleSplittingStrategyNew(this); @@ -199,8 +199,4 @@ splittingStrategy.forceSplitting(); return true; } - - public static OptimizedDirectCallNode create(OptimizedCallTarget target) { - return new OptimizedDirectCallNode(target); - } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Mon Aug 18 14:04:21 2014 +0200 @@ -276,7 +276,7 @@ boolean removeAllocation = runtimeExceptionClass.isAssignableFrom(declaringClass) || errorClass.isAssignableFrom(declaringClass); boolean isControlFlowException = controlFlowExceptionClass.isAssignableFrom(exceptionType); if (removeAllocation && !isControlFlowException) { - DeoptimizeNode deoptNode = methodCallTargetNode.graph().add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.UnreachedCode)); + DeoptimizeNode deoptNode = methodCallTargetNode.graph().add(DeoptimizeNode.create(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.UnreachedCode)); FixedNode invokeNode = methodCallTargetNode.invoke().asNode(); invokeNode.replaceAtPredecessor(deoptNode); GraphUtil.killCFG(invokeNode); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/AssumptionNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/AssumptionNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/AssumptionNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -37,7 +37,11 @@ @NodeInfo public class AssumptionNode extends MacroNode implements com.oracle.graal.graph.IterableNodeType, Simplifiable { - public AssumptionNode(Invoke invoke) { + public static AssumptionNode create(Invoke invoke) { + return new AssumptionNodeGen(invoke); + } + + protected AssumptionNode(Invoke invoke) { super(invoke); assert super.arguments.size() == 1; } @@ -80,7 +84,7 @@ graph.replaceFixedWithFloating(this, ConstantNode.forBoolean(false, graph())); } else { tool.deleteBranch(this.next()); - this.replaceAndDelete(graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.None))); + this.replaceAndDelete(graph.add(DeoptimizeNode.create(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.None))); } } } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/BailoutNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/BailoutNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/BailoutNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -33,7 +33,11 @@ @NodeInfo public class BailoutNode extends MacroNode implements Canonicalizable { - public BailoutNode(Invoke invoke) { + public static BailoutNode create(Invoke invoke) { + return new BailoutNodeGen(invoke); + } + + protected BailoutNode(Invoke invoke) { super(invoke); assert arguments.size() == 1; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/LoadIndexedFinalNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/LoadIndexedFinalNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/LoadIndexedFinalNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -45,7 +45,11 @@ * @param index the instruction producing the index * @param elementKind the element type */ - public LoadIndexedFinalNode(ValueNode array, ValueNode index, Kind elementKind) { + public static LoadIndexedFinalNode create(ValueNode array, ValueNode index, Kind elementKind) { + return new LoadIndexedFinalNodeGen(array, index, elementKind); + } + + protected LoadIndexedFinalNode(ValueNode array, ValueNode index, Kind elementKind) { super(createStamp(array, elementKind), array, index, elementKind); } @@ -76,7 +80,7 @@ @Override public void lower(LoweringTool tool) { - LoadIndexedNode loadIndexedNode = graph().add(new LoadIndexedNode(array(), index(), elementKind())); + LoadIndexedNode loadIndexedNode = graph().add(LoadIndexedNode.create(array(), index(), elementKind())); graph().replaceFixedWithFixed(this, loadIndexedNode); loadIndexedNode.lower(tool); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,7 +39,11 @@ @NodeInfo public class IntegerAddExactNode extends IntegerAddNode implements IntegerExactArithmeticNode { - public IntegerAddExactNode(ValueNode x, ValueNode y) { + public static IntegerAddExactNode create(ValueNode x, ValueNode y) { + return new IntegerAddExactNodeGen(x, y); + } + + protected IntegerAddExactNode(ValueNode x, ValueNode y) { super(x, y); assert x.stamp().isCompatible(y.stamp()) && x.stamp() instanceof IntegerStamp; } @@ -53,7 +57,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { if (forX.isConstant() && !forY.isConstant()) { - return new IntegerAddExactNode(forY, forX); + return IntegerAddExactNode.create(forY, forX); } if (forX.isConstant()) { return canonicalXconstant(forX, forY); @@ -85,7 +89,7 @@ @Override public IntegerExactArithmeticSplitNode createSplit(BeginNode next, BeginNode deopt) { - return graph().add(new IntegerAddExactSplitNode(stamp(), getX(), getY(), next, deopt)); + return graph().add(IntegerAddExactSplitNode.create(stamp(), getX(), getY(), next, deopt)); } @Override diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactSplitNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactSplitNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactSplitNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,7 +31,11 @@ @NodeInfo public class IntegerAddExactSplitNode extends IntegerExactArithmeticSplitNode { - public IntegerAddExactSplitNode(Stamp stamp, ValueNode x, ValueNode y, BeginNode next, BeginNode overflowSuccessor) { + public static IntegerAddExactSplitNode create(Stamp stamp, ValueNode x, ValueNode y, BeginNode next, BeginNode overflowSuccessor) { + return new IntegerAddExactSplitNodeGen(stamp, x, y, next, overflowSuccessor); + } + + protected IntegerAddExactSplitNode(Stamp stamp, ValueNode x, ValueNode y, BeginNode next, BeginNode overflowSuccessor) { super(stamp, x, y, next, overflowSuccessor); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerExactArithmeticSplitNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerExactArithmeticSplitNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerExactArithmeticSplitNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -80,8 +80,8 @@ FixedWithNextNode previous = tool.lastFixedNode(); FixedNode next = previous.next(); previous.setNext(null); - DeoptimizeNode deopt = floatingNode.graph().add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.ArithmeticException)); - BeginNode normalBegin = floatingNode.graph().add(new BeginNode()); + DeoptimizeNode deopt = floatingNode.graph().add(DeoptimizeNode.create(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.ArithmeticException)); + BeginNode normalBegin = floatingNode.graph().add(BeginNode.create()); normalBegin.setNext(next); IntegerExactArithmeticSplitNode split = node.createSplit(normalBegin, BeginNode.begin(deopt)); previous.setNext(split); diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,7 +38,11 @@ @NodeInfo public class IntegerMulExactNode extends IntegerMulNode implements IntegerExactArithmeticNode { - public IntegerMulExactNode(ValueNode x, ValueNode y) { + public static IntegerMulExactNode create(ValueNode x, ValueNode y) { + return new IntegerMulExactNodeGen(x, y); + } + + protected IntegerMulExactNode(ValueNode x, ValueNode y) { super(x, y); assert x.stamp().isCompatible(y.stamp()) && x.stamp() instanceof IntegerStamp; } @@ -46,7 +50,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { if (forX.isConstant() && !forY.isConstant()) { - return new IntegerMulExactNode(forY, forX); + return IntegerMulExactNode.create(forY, forX); } if (forX.isConstant()) { return canonicalXconstant(forX, forY); @@ -81,7 +85,7 @@ @Override public IntegerExactArithmeticSplitNode createSplit(BeginNode next, BeginNode deopt) { - return graph().add(new IntegerMulExactSplitNode(stamp(), getX(), getY(), next, deopt)); + return graph().add(IntegerMulExactSplitNode.create(stamp(), getX(), getY(), next, deopt)); } @Override diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactSplitNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactSplitNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactSplitNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,7 +31,11 @@ @NodeInfo public class IntegerMulExactSplitNode extends IntegerExactArithmeticSplitNode { - public IntegerMulExactSplitNode(Stamp stamp, ValueNode x, ValueNode y, BeginNode next, BeginNode overflowSuccessor) { + public static IntegerMulExactSplitNode create(Stamp stamp, ValueNode x, ValueNode y, BeginNode next, BeginNode overflowSuccessor) { + return new IntegerMulExactSplitNodeGen(stamp, x, y, next, overflowSuccessor); + } + + protected IntegerMulExactSplitNode(Stamp stamp, ValueNode x, ValueNode y, BeginNode next, BeginNode overflowSuccessor) { super(stamp, x, y, next, overflowSuccessor); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulHighNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulHighNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulHighNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,11 +38,19 @@ @NodeInfo(shortName = "*H") public class IntegerMulHighNode extends IntegerArithmeticNode { - public IntegerMulHighNode(ValueNode x, ValueNode y) { + public static IntegerMulHighNode create(ValueNode x, ValueNode y) { + return new IntegerMulHighNodeGen(x, y); + } + + protected IntegerMulHighNode(ValueNode x, ValueNode y) { this(x.stamp().unrestricted(), x, y); } - public IntegerMulHighNode(Stamp stamp, ValueNode x, ValueNode y) { + public static IntegerMulHighNode create(Stamp stamp, ValueNode x, ValueNode y) { + return new IntegerMulHighNodeGen(stamp, x, y); + } + + protected IntegerMulHighNode(Stamp stamp, ValueNode x, ValueNode y) { super(stamp, x, y); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -40,7 +40,11 @@ @NodeInfo public class IntegerSubExactNode extends IntegerSubNode implements IntegerExactArithmeticNode { - public IntegerSubExactNode(ValueNode x, ValueNode y) { + public static IntegerSubExactNode create(ValueNode x, ValueNode y) { + return new IntegerSubExactNodeGen(x, y); + } + + protected IntegerSubExactNode(ValueNode x, ValueNode y) { super(x, y); assert x.stamp().isCompatible(y.stamp()) && x.stamp() instanceof IntegerStamp; } @@ -86,7 +90,7 @@ @Override public IntegerExactArithmeticSplitNode createSplit(BeginNode next, BeginNode deopt) { - return graph().add(new IntegerSubExactSplitNode(stamp(), getX(), getY(), next, deopt)); + return graph().add(IntegerSubExactSplitNode.create(stamp(), getX(), getY(), next, deopt)); } @Override diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactSplitNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactSplitNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactSplitNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -31,7 +31,11 @@ @NodeInfo public class IntegerSubExactSplitNode extends IntegerExactArithmeticSplitNode { - public IntegerSubExactSplitNode(Stamp stamp, ValueNode x, ValueNode y, BeginNode next, BeginNode overflowSuccessor) { + public static IntegerSubExactSplitNode create(Stamp stamp, ValueNode x, ValueNode y, BeginNode next, BeginNode overflowSuccessor) { + return new IntegerSubExactSplitNodeGen(stamp, x, y, next, overflowSuccessor); + } + + protected IntegerSubExactSplitNode(Stamp stamp, ValueNode x, ValueNode y, BeginNode next, BeginNode overflowSuccessor) { super(stamp, x, y, next, overflowSuccessor); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/UnsignedMulHighNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/UnsignedMulHighNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/UnsignedMulHighNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -38,11 +38,19 @@ @NodeInfo(shortName = "|*H|") public class UnsignedMulHighNode extends IntegerArithmeticNode { - public UnsignedMulHighNode(ValueNode x, ValueNode y) { + public static UnsignedMulHighNode create(ValueNode x, ValueNode y) { + return new UnsignedMulHighNodeGen(x, y); + } + + protected UnsignedMulHighNode(ValueNode x, ValueNode y) { this(x.stamp().unrestricted(), x, y); } - public UnsignedMulHighNode(Stamp stamp, ValueNode x, ValueNode y) { + public static UnsignedMulHighNode create(Stamp stamp, ValueNode x, ValueNode y) { + return new UnsignedMulHighNodeGen(stamp, x, y); + } + + protected UnsignedMulHighNode(Stamp stamp, ValueNode x, ValueNode y) { super(stamp, x, y); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/CompilationConstantNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/CompilationConstantNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/CompilationConstantNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -30,7 +30,11 @@ @NodeInfo public class CompilationConstantNode extends NeverPartOfCompilationNode implements Canonicalizable { - public CompilationConstantNode(Invoke invoke) { + public static CompilationConstantNode create(Invoke invoke) { + return new CompilationConstantNodeGen(invoke); + } + + protected CompilationConstantNode(Invoke invoke) { super(invoke, "The value could not be reduced to a compile time constant."); assert arguments.size() == 1; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverInlineMacroNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverInlineMacroNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverInlineMacroNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -30,7 +30,11 @@ @NodeInfo public class NeverInlineMacroNode extends MacroStateSplitNode implements com.oracle.graal.graph.IterableNodeType { - public NeverInlineMacroNode(Invoke invoke) { + public static NeverInlineMacroNode create(Invoke invoke) { + return new NeverInlineMacroNodeGen(invoke); + } + + protected NeverInlineMacroNode(Invoke invoke) { super(invoke); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverPartOfCompilationNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverPartOfCompilationNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverPartOfCompilationNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,11 +32,19 @@ private final String message; - public NeverPartOfCompilationNode(Invoke invoke) { + public static NeverPartOfCompilationNode create(Invoke invoke) { + return new NeverPartOfCompilationNodeGen(invoke); + } + + protected NeverPartOfCompilationNode(Invoke invoke) { this(invoke, "This code path should never be part of a compilation."); } - public NeverPartOfCompilationNode(Invoke invoke, String message) { + public static NeverPartOfCompilationNode create(Invoke invoke, String message) { + return new NeverPartOfCompilationNodeGen(invoke, message); + } + + protected NeverPartOfCompilationNode(Invoke invoke, String message) { super(invoke); this.message = message; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/ForceMaterializeNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/ForceMaterializeNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/ForceMaterializeNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -32,7 +32,11 @@ @Input private ValueNode object; - public ForceMaterializeNode(ValueNode object) { + public static ForceMaterializeNode create(ValueNode object) { + return new ForceMaterializeNodeGen(object); + } + + protected ForceMaterializeNode(ValueNode object) { super(StampFactory.forVoid()); this.object = object; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/MaterializeFrameNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/MaterializeFrameNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/MaterializeFrameNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -35,7 +35,11 @@ @Input private ValueNode frame; - public MaterializeFrameNode(ValueNode frame) { + public static MaterializeFrameNode create(ValueNode frame) { + return new MaterializeFrameNodeGen(frame); + } + + protected MaterializeFrameNode(ValueNode frame) { super(frame.stamp()); this.frame = frame; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -51,13 +51,21 @@ @Input private ValueNode descriptor; @Input private ValueNode arguments; - public NewFrameNode(Stamp stamp, ValueNode descriptor, ValueNode arguments) { + public static NewFrameNode create(Stamp stamp, ValueNode descriptor, ValueNode arguments) { + return new NewFrameNodeGen(stamp, descriptor, arguments); + } + + protected NewFrameNode(Stamp stamp, ValueNode descriptor, ValueNode arguments) { super(stamp); this.descriptor = descriptor; this.arguments = arguments; } - public NewFrameNode(ResolvedJavaType frameType, ValueNode descriptor, ValueNode arguments) { + public static NewFrameNode create(ResolvedJavaType frameType, ValueNode descriptor, ValueNode arguments) { + return new NewFrameNodeGen(frameType, descriptor, arguments); + } + + protected NewFrameNode(ResolvedJavaType frameType, ValueNode descriptor, ValueNode arguments) { this(StampFactory.exactNonNull(frameType), descriptor, arguments); } @@ -120,7 +128,7 @@ if (fixed instanceof MaterializeFrameNode || fixed instanceof AbstractEndNode) { // We need to conservatively assume that a materialization of a virtual frame can also // happen at a merge point. - return new AllocatedObjectNode(virtualNode); + return AllocatedObjectNode.create(virtualNode); } String escapeReason; if (fixed instanceof StoreFieldNode) { @@ -153,10 +161,10 @@ ResolvedJavaField primitiveLocalsField = findField(frameFields, "primitiveLocals"); ResolvedJavaField tagsField = findField(frameFields, "tags"); - VirtualObjectNode virtualFrame = new VirtualInstanceNode(frameType, frameFields, false); - VirtualObjectNode virtualFrameObjectArray = new VirtualArrayNode((ResolvedJavaType) localsField.getType().getComponentType(), frameSize); - VirtualObjectNode virtualFramePrimitiveArray = new VirtualArrayNode((ResolvedJavaType) primitiveLocalsField.getType().getComponentType(), frameSize); - VirtualObjectNode virtualFrameTagArray = new VirtualArrayNode((ResolvedJavaType) tagsField.getType().getComponentType(), frameSize); + VirtualObjectNode virtualFrame = VirtualInstanceNode.create(frameType, frameFields, false); + VirtualObjectNode virtualFrameObjectArray = VirtualArrayNode.create((ResolvedJavaType) localsField.getType().getComponentType(), frameSize); + VirtualObjectNode virtualFramePrimitiveArray = VirtualArrayNode.create((ResolvedJavaType) primitiveLocalsField.getType().getComponentType(), frameSize); + VirtualObjectNode virtualFrameTagArray = VirtualArrayNode.create((ResolvedJavaType) tagsField.getType().getComponentType(), frameSize); ValueNode[] objectArrayEntryState = new ValueNode[frameSize]; ValueNode[] primitiveArrayEntryState = new ValueNode[frameSize]; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadFinalNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadFinalNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadFinalNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -48,7 +48,11 @@ @Input private ValueNode location; private final Kind accessKind; - public CustomizedUnsafeLoadFinalNode(ValueNode object, ValueNode offset, ValueNode condition, ValueNode location, Kind accessKind) { + public static CustomizedUnsafeLoadFinalNode create(ValueNode object, ValueNode offset, ValueNode condition, ValueNode location, Kind accessKind) { + return new CustomizedUnsafeLoadFinalNodeGen(object, offset, condition, location, accessKind); + } + + protected CustomizedUnsafeLoadFinalNode(ValueNode object, ValueNode offset, ValueNode condition, ValueNode location, Kind accessKind) { super(StampFactory.forKind(accessKind.getStackKind())); this.object = object; this.offset = offset; @@ -96,7 +100,7 @@ } else { locationIdentity = ObjectLocationIdentity.create(location.asConstant()); } - UnsafeLoadNode result = graph().add(new UnsafeLoadNode(object, offset, accessKind, locationIdentity, compare)); + UnsafeLoadNode result = graph().add(UnsafeLoadNode.create(object, offset, accessKind, locationIdentity, compare)); graph().replaceFixedWithFixed(this, result); result.lower(tool); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadMacroNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadMacroNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeLoadMacroNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -46,7 +46,11 @@ private static final int CONDITION_ARGUMENT_INDEX = 2; private static final int LOCATION_ARGUMENT_INDEX = 3; - public CustomizedUnsafeLoadMacroNode(Invoke invoke) { + public static CustomizedUnsafeLoadMacroNode create(Invoke invoke) { + return new CustomizedUnsafeLoadMacroNodeGen(invoke); + } + + protected CustomizedUnsafeLoadMacroNode(Invoke invoke) { super(invoke, "The location argument could not be resolved to a constant."); assert arguments.size() == ARGUMENT_COUNT; } @@ -66,7 +70,7 @@ } CompareNode compare = CompareNode.createCompareNode(Condition.EQ, conditionArgument, ConstantNode.forBoolean(true)); Kind returnKind = this.getTargetMethod().getSignature().getReturnKind(); - return new UnsafeLoadNode(objectArgument, offsetArgument, returnKind, locationIdentity, compare); + return UnsafeLoadNode.create(objectArgument, offsetArgument, returnKind, locationIdentity, compare); } return this; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeStoreMacroNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeStoreMacroNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomizedUnsafeStoreMacroNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -43,7 +43,11 @@ private static final int VALUE_ARGUMENT_INDEX = 2; private static final int LOCATION_ARGUMENT_INDEX = 3; - public CustomizedUnsafeStoreMacroNode(Invoke invoke) { + public static CustomizedUnsafeStoreMacroNode create(Invoke invoke) { + return new CustomizedUnsafeStoreMacroNodeGen(invoke); + } + + protected CustomizedUnsafeStoreMacroNode(Invoke invoke) { super(invoke, "The location argument could not be resolved to a constant."); assert arguments.size() == ARGUMENT_COUNT; } @@ -62,7 +66,7 @@ locationIdentity = ObjectLocationIdentity.create(locationArgument.asConstant()); } - return new UnsafeStoreNode(objectArgument, offsetArgument, valueArgument, this.getTargetMethod().getSignature().getParameterKind(VALUE_ARGUMENT_INDEX), locationIdentity, stateAfter()); + return UnsafeStoreNode.create(objectArgument, offsetArgument, valueArgument, this.getTargetMethod().getSignature().getParameterKind(VALUE_ARGUMENT_INDEX), locationIdentity, stateAfter()); } return this; } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/UnsafeTypeCastMacroNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/UnsafeTypeCastMacroNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/UnsafeTypeCastMacroNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -45,7 +45,11 @@ private static final int NONNULL_ARGUMENT_INDEX = 3; private static final int ARGUMENT_COUNT = 4; - public UnsafeTypeCastMacroNode(Invoke invoke) { + public static UnsafeTypeCastMacroNode create(Invoke invoke) { + return new UnsafeTypeCastMacroNodeGen(invoke); + } + + protected UnsafeTypeCastMacroNode(Invoke invoke) { super(invoke, "The class of the unsafe cast could not be reduced to a compile time constant."); assert arguments.size() == ARGUMENT_COUNT; } @@ -65,8 +69,8 @@ } else { Stamp stamp = StampFactory.declared(lookupJavaType, nonNullArgument.asConstant().asInt() != 0); ConditionAnchorNode valueAnchorNode = graph().add( - new ConditionAnchorNode(CompareNode.createCompareNode(graph(), Condition.EQ, conditionArgument, ConstantNode.forBoolean(true, graph())))); - PiNode piCast = graph().unique(new PiNode(objectArgument, stamp, valueAnchorNode)); + ConditionAnchorNode.create(CompareNode.createCompareNode(graph(), Condition.EQ, conditionArgument, ConstantNode.forBoolean(true, graph())))); + PiNode piCast = graph().unique(PiNode.create(objectArgument, stamp, valueAnchorNode)); replaceAtUsages(piCast); graph().replaceFixedWithFixed(this, valueAnchorNode); } diff -r cc7aaa92c27d -r 06c15e88d383 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 Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java Mon Aug 18 14:04:21 2014 +0200 @@ -39,14 +39,18 @@ return materializedValue; } - public MaterializedObjectState(VirtualObjectNode object, ValueNode materializedValue) { + public static MaterializedObjectState create(VirtualObjectNode object, ValueNode materializedValue) { + return new MaterializedObjectStateGen(object, materializedValue); + } + + protected MaterializedObjectState(VirtualObjectNode object, ValueNode materializedValue) { super(object); this.materializedValue = materializedValue; } @Override public MaterializedObjectState duplicateWithVirtualState() { - return graph().addWithoutUnique(new MaterializedObjectState(object(), materializedValue)); + return graph().addWithoutUnique(MaterializedObjectState.create(object(), materializedValue)); } @Override diff -r cc7aaa92c27d -r 06c15e88d383 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 Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java Mon Aug 18 14:04:21 2014 +0200 @@ -41,13 +41,21 @@ return values; } - public VirtualObjectState(VirtualObjectNode object, ValueNode[] values) { + public static VirtualObjectState create(VirtualObjectNode object, ValueNode[] values) { + return new VirtualObjectStateGen(object, values); + } + + protected VirtualObjectState(VirtualObjectNode object, ValueNode[] values) { super(object); assert object.entryCount() == values.length; this.values = new NodeInputList<>(this, values); } - public VirtualObjectState(VirtualObjectNode object, List values) { + public static VirtualObjectState create(VirtualObjectNode object, List values) { + return new VirtualObjectStateGen(object, values); + } + + protected VirtualObjectState(VirtualObjectNode object, List values) { super(object); assert object.entryCount() == values.size(); this.values = new NodeInputList<>(this, values); @@ -55,7 +63,7 @@ @Override public VirtualObjectState duplicateWithVirtualState() { - return graph().addWithoutUnique(new VirtualObjectState(object(), values)); + return graph().addWithoutUnique(VirtualObjectState.create(object(), values)); } @Override diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationClosure.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationClosure.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationClosure.java Mon Aug 18 14:04:21 2014 +0200 @@ -125,7 +125,7 @@ if (initialState.getReadCache().get(entry.getKey()) != entry.getValue()) { ValueNode value = exitState.getReadCache(entry.getKey().object, entry.getKey().identity, this); if (!(value instanceof ProxyNode) || ((ProxyNode) value).proxyPoint() != exitNode) { - ProxyNode proxy = new ValueProxyNode(value, exitNode); + ProxyNode proxy = ValueProxyNode.create(value, exitNode); effects.addFloatingNode(proxy, "readCacheProxy"); entry.setValue(proxy); } diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeBlockState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeBlockState.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeBlockState.java Mon Aug 18 14:04:21 2014 +0200 @@ -90,7 +90,7 @@ if (fixed.predecessor() instanceof CommitAllocationNode) { commit = (CommitAllocationNode) fixed.predecessor(); } else { - commit = graph.add(new CommitAllocationNode()); + commit = graph.add(CommitAllocationNode.create()); graph.addBeforeFixed(fixed, commit); } for (AllocatedObjectNode obj : objects) { diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Mon Aug 18 14:04:21 2014 +0200 @@ -188,9 +188,9 @@ } } } - v = new VirtualObjectState(obj.virtual, fieldState); + v = VirtualObjectState.create(obj.virtual, fieldState); } else { - v = new MaterializedObjectState(obj.virtual, obj.getMaterializedValue()); + v = MaterializedObjectState.create(obj.virtual, obj.getMaterializedValue()); } effects.addVirtualMapping(frameState, v); } @@ -237,7 +237,7 @@ ValueNode value = obj.getEntry(i); if (!(value instanceof VirtualObjectNode || value.isConstant())) { if (exitNode.loopBegin().isPhiAtMerge(value) || initialObj == null || !initialObj.isVirtual() || initialObj.getEntry(i) != value) { - ProxyNode proxy = new ValueProxyNode(value, exitNode); + ProxyNode proxy = ValueProxyNode.create(value, exitNode); obj.setEntry(i, proxy); effects.addFloatingNode(proxy, "virtualProxy"); } @@ -247,7 +247,7 @@ if (initialObj == null || initialObj.isVirtual()) { ProxyNode proxy = proxies.get(obj.virtual); if (proxy == null) { - proxy = new ValueProxyNode(obj.getMaterializedValue(), exitNode); + proxy = ValueProxyNode.create(obj.getMaterializedValue(), exitNode); effects.addFloatingNode(proxy, "proxy"); } else { effects.replaceFirstInput(proxy, proxy.value(), obj.getMaterializedValue()); @@ -282,7 +282,7 @@ protected PhiNode getCachedPhi(T virtual, Stamp stamp) { ValuePhiNode result = materializedPhis.get(virtual); if (result == null) { - result = new ValuePhiNode(stamp, merge); + result = ValuePhiNode.create(stamp, merge); materializedPhis.put(virtual, result); } return result; @@ -456,11 +456,11 @@ for (int i = 1; i < objStates.length; i++) { ValueNode[] fields = objStates[i].getEntries(); if (phis[valueIndex] == null && values[valueIndex] != fields[valueIndex]) { - phis[valueIndex] = new ValuePhiNode(values[valueIndex].stamp().unrestricted(), merge); + phis[valueIndex] = ValuePhiNode.create(values[valueIndex].stamp().unrestricted(), merge); } } if (phis[valueIndex] != null && !phis[valueIndex].stamp().isCompatible(values[valueIndex].stamp())) { - phis[valueIndex] = new ValuePhiNode(values[valueIndex].stamp().unrestricted(), merge); + phis[valueIndex] = ValuePhiNode.create(values[valueIndex].stamp().unrestricted(), merge); } if (twoSlotKinds != null && twoSlotKinds[valueIndex] != null) { // skip an entry after a long/double value that occupies two int slots diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationClosure.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationClosure.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationClosure.java Mon Aug 18 14:04:21 2014 +0200 @@ -89,7 +89,7 @@ ValueNode cachedValue = state.getCacheEntry(identifier); if (cachedValue != null) { if (read.getGuard() != null && !(read.getGuard() instanceof FixedNode)) { - effects.addFixedNodeBefore(new ValueAnchorNode((ValueNode) read.getGuard()), read); + effects.addFixedNodeBefore(ValueAnchorNode.create((ValueNode) read.getGuard()), read); } effects.replaceAtUsages(read, cachedValue); addScalarAlias(read, cachedValue); @@ -174,7 +174,7 @@ if (exitNode.graph().hasValueProxies()) { for (Map.Entry, ValueNode> entry : exitState.getReadCache().entrySet()) { if (initialState.getReadCache().get(entry.getKey()) != entry.getValue()) { - ProxyNode proxy = new ValueProxyNode(exitState.getCacheEntry(entry.getKey()), exitNode); + ProxyNode proxy = ValueProxyNode.create(exitState.getCacheEntry(entry.getKey()), exitNode); effects.addFloatingNode(proxy, "readCacheProxy"); entry.setValue(proxy); } @@ -203,7 +203,7 @@ protected PhiNode getCachedPhi(T virtual, Stamp stamp) { ValuePhiNode result = materializedPhis.get(virtual); if (result == null) { - result = new ValuePhiNode(stamp, merge); + result = ValuePhiNode.create(stamp, merge); materializedPhis.put(virtual, result); } return result; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -56,13 +56,21 @@ public static SnippetLocationNode create(SnippetReflectionProvider snippetReflection, ValueNode identity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling, Graph graph) { - return graph.unique(new SnippetLocationNode(snippetReflection, identity, kind, displacement, index, indexScaling)); + return graph.unique(SnippetLocationNode.create(snippetReflection, identity, kind, displacement, index, indexScaling)); + } + + public static SnippetLocationNode create(SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement) { + return new SnippetLocationNodeGen(snippetReflection, locationIdentity, kind, displacement); } SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement) { this(snippetReflection, locationIdentity, kind, displacement, null, null); } + public static SnippetLocationNode create(SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling) { + return new SnippetLocationNodeGen(snippetReflection, locationIdentity, kind, displacement, index, indexScaling); + } + SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling) { super(StampFactory.object()); this.snippetReflection = snippetReflection; diff -r cc7aaa92c27d -r 06c15e88d383 graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java --- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java Mon Aug 18 14:04:21 2014 +0200 @@ -42,12 +42,16 @@ public static WordCastNode wordToObject(ValueNode input, Kind wordKind) { assert input.getKind() == wordKind; - return new WordCastNode(StampFactory.object(), input); + return WordCastNode.create(StampFactory.object(), input); } public static WordCastNode objectToWord(ValueNode input, Kind wordKind) { assert input.getKind() == Kind.Object; - return new WordCastNode(StampFactory.forKind(wordKind), input); + return WordCastNode.create(StampFactory.forKind(wordKind), input); + } + + public static WordCastNode create(Stamp stamp, ValueNode input) { + return new WordCastNodeGen(stamp, input); } WordCastNode(Stamp stamp, ValueNode input) { diff -r cc7aaa92c27d -r 06c15e88d383 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 Mon Aug 18 13:49:25 2014 +0200 +++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java Mon Aug 18 14:04:21 2014 +0200 @@ -157,9 +157,9 @@ * depends on elementKind. Therefore, just create a new node and replace the old one. */ if (node instanceof LoadIndexedNode) { - graph.replaceFixedWithFixed(node, graph.add(new LoadIndexedNode(node.array(), node.index(), wordKind))); + graph.replaceFixedWithFixed(node, graph.add(LoadIndexedNode.create(node.array(), node.index(), wordKind))); } else if (node instanceof StoreIndexedNode) { - graph.replaceFixedWithFixed(node, graph.add(new StoreIndexedNode(node.array(), node.index(), wordKind, ((StoreIndexedNode) node).value()))); + graph.replaceFixedWithFixed(node, graph.add(StoreIndexedNode.create(node.array(), node.index(), wordKind, ((StoreIndexedNode) node).value()))); } else { throw GraalInternalError.shouldNotReachHere(); } @@ -213,7 +213,7 @@ case NOT: assert arguments.size() == 1; - replace(invoke, graph.unique(new XorNode(arguments.get(0), ConstantNode.forIntegerKind(wordKind, -1, graph)))); + replace(invoke, graph.unique(XorNode.create(arguments.get(0), ConstantNode.forIntegerKind(wordKind, -1, graph)))); break; case READ_POINTER: @@ -282,7 +282,7 @@ case FROM_ARRAY: assert arguments.size() == 2; - replace(invoke, graph.unique(new ComputeAddressNode(arguments.get(0), arguments.get(1), StampFactory.forKind(wordKind)))); + replace(invoke, graph.unique(ComputeAddressNode.create(arguments.get(0), arguments.get(1), StampFactory.forKind(wordKind)))); break; case TO_OBJECT: @@ -316,14 +316,14 @@ if (toKind == Kind.Int) { assert value.getKind() == Kind.Long; - return graph.unique(new NarrowNode(value, 32)); + return graph.unique(NarrowNode.create(value, 32)); } else { assert toKind == Kind.Long; assert value.getKind().getStackKind() == Kind.Int; if (unsigned) { - return graph.unique(new ZeroExtendNode(value, 64)); + return graph.unique(ZeroExtendNode.create(value, 64)); } else { - return graph.unique(new SignExtendNode(value, 64)); + return graph.unique(SignExtendNode.create(value, 64)); } } } @@ -335,13 +335,8 @@ */ private static ValueNode createBinaryNodeInstance(Class nodeClass, ValueNode left, ValueNode right) { try { - try { - Constructor constructor = nodeClass.getConstructor(ValueNode.class, ValueNode.class); - return constructor.newInstance(left, right); - } catch (NoSuchMethodException e) { - Method create = nodeClass.getDeclaredMethod("create", ValueNode.class, ValueNode.class); - return (ValueNode) create.invoke(null, left, right); - } + Method factory = nodeClass.getDeclaredMethod("create", ValueNode.class, ValueNode.class); + return (ValueNode) factory.invoke(null, left, right); } catch (Throwable ex) { throw new GraalInternalError(ex).addContext(nodeClass.getName()); } @@ -358,11 +353,11 @@ CompareNode comparison; if (condition == Condition.EQ || condition == Condition.NE) { - comparison = new IntegerEqualsNode(a, b); + comparison = IntegerEqualsNode.create(a, b); } else if (condition.isUnsigned()) { - comparison = new IntegerBelowNode(a, b); + comparison = IntegerBelowNode.create(a, b); } else { - comparison = new IntegerLessThanNode(a, b); + comparison = IntegerLessThanNode.create(a, b); } ConstantNode trueValue = ConstantNode.forInt(1, graph); @@ -373,7 +368,7 @@ trueValue = falseValue; falseValue = temp; } - ConditionalNode materialize = graph.unique(new ConditionalNode(graph.unique(comparison), trueValue, falseValue)); + ConditionalNode materialize = graph.unique(ConditionalNode.create(graph.unique(comparison), trueValue, falseValue)); return materialize; } @@ -398,7 +393,7 @@ } protected ValueNode readOp(StructuredGraph graph, ValueNode base, Invoke invoke, LocationNode location, BarrierType barrierType, boolean compressible) { - JavaReadNode read = graph.add(new JavaReadNode(base, location, barrierType, compressible)); + JavaReadNode read = graph.add(JavaReadNode.create(base, location, barrierType, compressible)); graph.addBeforeFixed(invoke.asNode(), read); /* * The read must not float outside its block otherwise it may float above an explicit zero @@ -413,7 +408,7 @@ final BarrierType barrier = (op == Opcode.WRITE_BARRIERED ? BarrierType.PRECISE : BarrierType.NONE); final boolean compressible = (op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED); final boolean initialize = (op == Opcode.INITIALIZE); - JavaWriteNode write = graph.add(new JavaWriteNode(base, value, location, barrier, compressible, initialize)); + JavaWriteNode write = graph.add(JavaWriteNode.create(base, value, location, barrier, compressible, initialize)); write.setStateAfter(invoke.stateAfter()); graph.addBeforeFixed(invoke.asNode(), write); return write;