Mercurial > hg > graal-compiler
changeset 5756:f1ceb218882d
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 03 Jul 2012 17:50:42 +0200 |
parents | 12e5956a8fdd (diff) 17d2c3b72762 (current diff) |
children | 0ed5c283c55d |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LoopTransformPhase.java |
diffstat | 19 files changed, 68 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.boot.test/src/com/oracle/graal/boot/BigBangTest.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.boot.test/src/com/oracle/graal/boot/BigBangTest.java Tue Jul 03 17:50:42 2012 +0200 @@ -30,14 +30,14 @@ public void helloWorldTest() { BootImageGenerator generator = new BootImageGenerator(); generator.addEntryMethod(TestPrograms.class, "helloWorldTest"); - Assert.assertArrayEquals(generator.getBigBang().printState(), new int[]{3, 118, 58, 21}); + Assert.assertArrayEquals(generator.getBigBang().printState(), new int[]{3, 148, 66, 24}); } @Test public void formattedOutputTest() { BootImageGenerator generator = new BootImageGenerator(); generator.addEntryMethod(TestPrograms.class, "formattedOutputTest"); - Assert.assertArrayEquals(generator.getBigBang().printState(), new int[]{15, 979, 346, 98}); + Assert.assertArrayEquals(generator.getBigBang().printState(), new int[]{19, 1668, 611, 179}); } @@ -60,6 +60,13 @@ public void arrayListTest() { BootImageGenerator generator = new BootImageGenerator(); generator.addEntryMethod(TestPrograms.class, "arrayListTest"); + Assert.assertArrayEquals(generator.getBigBang().printState(), new int[]{2, 28, 5, 3}); + } + + @Test + public void arrayListTestWithCalls() { + BootImageGenerator generator = new BootImageGenerator(); + generator.addEntryMethod(TestPrograms.class, "arrayListTestWithCalls"); Assert.assertArrayEquals(generator.getBigBang().printState(), new int[]{2, 20, 3, 2}); } }
--- a/graal/com.oracle.graal.boot.test/src/com/oracle/graal/boot/TestPrograms.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.boot.test/src/com/oracle/graal/boot/TestPrograms.java Tue Jul 03 17:50:42 2012 +0200 @@ -53,8 +53,26 @@ newArr[0].testMethod(); } + @SuppressWarnings("unchecked") + public static void arrayListTestWithCalls() { + ArrayList list = createNewArrayList(); + list.add(new TestObject()); + TestObject[] newArr = (TestObject[]) list.toArray(new TestObject[0]); + TestObject t2 = newArr[0].testMethod(); + t2.testMethod2(); + } + + private static ArrayList createNewArrayList() { + return new ArrayList(); + } + public static class TestObject { - public void testMethod() { + public TestObject testMethod() { + return new TestObject(); + } + + public void testMethod2() { + } } }
--- a/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/ArrayTypeElement.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/ArrayTypeElement.java Tue Jul 03 17:50:42 2012 +0200 @@ -52,6 +52,13 @@ if (type == null) { System.out.println("FATAL error: Array access without type!"); System.out.println(load.array()); + if (load.array() instanceof ValueProxyNode) { + ValueProxyNode valueProxyNode = (ValueProxyNode) load.array(); + System.out.println("value proxy node stamp " + valueProxyNode.stamp()); + System.out.println("value proxy node stamp type " + valueProxyNode.objectStamp().type()); + System.out.println("value proxy source: " + valueProxyNode.value()); + System.out.println("value proxy source stamp: " + valueProxyNode.value().stamp()); + } System.out.println(((StructuredGraph) load.graph()).method()); System.exit(-1); }
--- a/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/InvokeElement.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.boot/src/com/oracle/graal/boot/meta/InvokeElement.java Tue Jul 03 17:50:42 2012 +0200 @@ -68,6 +68,7 @@ ResolvedJavaMethod method = methodCallTarget.targetMethod(); concreteTargets.add(method); MethodElement processedMethod = bb.getProcessedMethod(method); + processedMethod.addUsage(bb, this.methodCallTarget.invoke().node()); processedMethod.postParseGraph(bb); } } @@ -94,6 +95,7 @@ bb.getProcessedMethod(method).getParameter(i).postUnionTypes(bb, null, newSeenTypesTemp); } } + processedMethod.addUsage(bb, this.methodCallTarget.invoke().node()); } // Register new type for receiver.
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopTransformations.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/loop/LoopTransformations.java Tue Jul 03 17:50:42 2012 +0200 @@ -77,7 +77,7 @@ loop.inside().duplicate().insertBefore(loop); } - public static void fullUnroll(LoopEx loop, CodeCacheProvider runtime) { + public static void fullUnroll(LoopEx loop, MetaAccessProvider runtime) { //assert loop.isCounted(); //TODO (gd) strenghten : counted with known trip count int iterations = 0; LoopBeginNode loopBegin = loop.loopBegin();
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java Tue Jul 03 17:50:42 2012 +0200 @@ -45,14 +45,14 @@ private final int newNodesMark; private final TargetDescription target; private final Assumptions assumptions; - private final CodeCacheProvider runtime; + private final MetaAccessProvider runtime; private final IsImmutablePredicate immutabilityPredicate; private final Iterable<Node> initWorkingSet; private NodeWorkList workList; private Tool tool; - public CanonicalizerPhase(TargetDescription target, CodeCacheProvider runtime, Assumptions assumptions) { + public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions) { this(target, runtime, assumptions, null, 0, null); } @@ -63,7 +63,7 @@ * @param workingSet the initial working set of nodes on which the canonicalizer works, should be an auto-grow node bitmap * @param immutabilityPredicate */ - public CanonicalizerPhase(TargetDescription target, CodeCacheProvider runtime, Assumptions assumptions, Iterable<Node> workingSet, IsImmutablePredicate immutabilityPredicate) { + public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, Iterable<Node> workingSet, IsImmutablePredicate immutabilityPredicate) { this(target, runtime, assumptions, workingSet, 0, immutabilityPredicate); } @@ -71,11 +71,11 @@ * @param newNodesMark only the {@linkplain Graph#getNewNodes(int) new nodes} specified by * this mark are processed otherwise all nodes in the graph are processed */ - public CanonicalizerPhase(TargetDescription target, CodeCacheProvider runtime, Assumptions assumptions, int newNodesMark, IsImmutablePredicate immutabilityPredicate) { + public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, int newNodesMark, IsImmutablePredicate immutabilityPredicate) { this(target, runtime, assumptions, null, newNodesMark, immutabilityPredicate); } - private CanonicalizerPhase(TargetDescription target, CodeCacheProvider runtime, Assumptions assumptions, Iterable<Node> workingSet, int newNodesMark, IsImmutablePredicate immutabilityPredicate) { + private CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, Iterable<Node> workingSet, int newNodesMark, IsImmutablePredicate immutabilityPredicate) { this.newNodesMark = newNodesMark; this.target = target; this.assumptions = assumptions; @@ -255,12 +255,12 @@ private static final class Tool implements SimplifierTool { private final NodeWorkList nodeWorkSet; - private final CodeCacheProvider runtime; + private final MetaAccessProvider runtime; private final TargetDescription target; private final Assumptions assumptions; private final IsImmutablePredicate immutabilityPredicate; - public Tool(NodeWorkList nodeWorkSet, CodeCacheProvider runtime, TargetDescription target, Assumptions assumptions, IsImmutablePredicate immutabilityPredicate) { + public Tool(NodeWorkList nodeWorkSet, MetaAccessProvider runtime, TargetDescription target, Assumptions assumptions, IsImmutablePredicate immutabilityPredicate) { this.nodeWorkSet = nodeWorkSet; this.runtime = runtime; this.target = target; @@ -291,7 +291,7 @@ } @Override - public CodeCacheProvider runtime() { + public MetaAccessProvider runtime() { return runtime; }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Tue Jul 03 17:50:42 2012 +0200 @@ -965,7 +965,11 @@ return; } - MethodCallTargetNode callTarget = currentGraph.add(new MethodCallTargetNode(invokeKind, targetMethod, args, targetMethod.signature().returnType(method.holder()))); + JavaType returnType = targetMethod.signature().returnType(method.holder()); + if (graphBuilderConfig.eagerResolvingForSnippets()) { + returnType = returnType.resolve(targetMethod.holder()); + } + MethodCallTargetNode callTarget = currentGraph.add(new MethodCallTargetNode(invokeKind, targetMethod, args, returnType)); // be conservative if information was not recorded (could result in endless recompiles otherwise) if (optimisticOpts.useExceptionProbability() && profilingInfo.getExceptionSeen(bci()) == ExceptionSeen.FALSE) { ValueNode result = appendWithBCI(currentGraph.add(new InvokeNode(callTarget, bci(), graphId)));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Tue Jul 03 17:50:42 2012 +0200 @@ -158,17 +158,17 @@ public final ObjectStamp objectStamp() { assert verifyStamp(ObjectStamp.class); - return (ObjectStamp) stamp; + return (ObjectStamp) stamp(); } public final IntegerStamp integerStamp() { assert verifyStamp(IntegerStamp.class); - return (IntegerStamp) stamp; + return (IntegerStamp) stamp(); } public final FloatStamp floatStamp() { assert verifyStamp(FloatStamp.class); - return (FloatStamp) stamp; + return (FloatStamp) stamp(); } @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Tue Jul 03 17:50:42 2012 +0200 @@ -80,7 +80,7 @@ } - private ValueNode optimizeConditional(Constant constant, ConditionalNode conditionalNode, CodeCacheProvider runtime, Condition cond) { + private ValueNode optimizeConditional(Constant constant, ConditionalNode conditionalNode, MetaAccessProvider runtime, Condition cond) { Constant trueConstant = conditionalNode.trueValue().asConstant(); Constant falseConstant = conditionalNode.falseValue().asConstant();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxingMethodPool.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxingMethodPool.java Tue Jul 03 17:50:42 2012 +0200 @@ -30,12 +30,12 @@ public class BoxingMethodPool { private final Set<JavaMethod> specialMethods = new HashSet<>(); - private final CodeCacheProvider runtime; + private final MetaAccessProvider runtime; private final ResolvedJavaMethod[] boxingMethods = new ResolvedJavaMethod[Kind.values().length]; private final ResolvedJavaMethod[] unboxingMethods = new ResolvedJavaMethod[Kind.values().length]; private final ResolvedJavaField[] boxFields = new ResolvedJavaField[Kind.values().length]; - public BoxingMethodPool(CodeCacheProvider runtime) { + public BoxingMethodPool(MetaAccessProvider runtime) { this.runtime = runtime; initialize(); }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java Tue Jul 03 17:50:42 2012 +0200 @@ -60,7 +60,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { - CodeCacheProvider runtime = tool.runtime(); + MetaAccessProvider runtime = tool.runtime(); if (runtime != null && object() != null && object().isConstant() && object().kind() == Kind.Object) { if (this.location() == LocationNode.FINAL_LOCATION && location().getClass() == LocationNode.class) { Object value = object().asConstant().asObject();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadHubNode.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadHubNode.java Tue Jul 03 17:50:42 2012 +0200 @@ -49,7 +49,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { - CodeCacheProvider runtime = tool.runtime(); + MetaAccessProvider runtime = tool.runtime(); if (runtime != null) { ObjectStamp stamp = object.objectStamp();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Tue Jul 03 17:50:42 2012 +0200 @@ -43,7 +43,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { - CodeCacheProvider runtime = tool.runtime(); + MetaAccessProvider runtime = tool.runtime(); if (runtime != null && object() != null && object().isConstant() && object().kind() == Kind.Object) { if (location() == LocationNode.FINAL_LOCATION && location().getClass() == LocationNode.class) { Object value = object().asConstant().asObject();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Tue Jul 03 17:50:42 2012 +0200 @@ -51,7 +51,7 @@ assert length != null; return length; } - CodeCacheProvider runtime = tool.runtime(); + MetaAccessProvider runtime = tool.runtime(); if (runtime != null && array().isConstant() && !array().isNullConstant()) { Constant constantValue = array().asConstant(); if (constantValue != null && constantValue.isNonNull()) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java Tue Jul 03 17:50:42 2012 +0200 @@ -55,7 +55,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { - CodeCacheProvider runtime = tool.runtime(); + MetaAccessProvider runtime = tool.runtime(); if (runtime != null) { Constant constant = null; if (isStatic()) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java Tue Jul 03 17:50:42 2012 +0200 @@ -61,7 +61,7 @@ @Override public ValueNode canonical(CanonicalizerTool tool) { - CodeCacheProvider runtime = tool.runtime(); + MetaAccessProvider runtime = tool.runtime(); if (runtime != null && index().isConstant() && array().isConstant() && !array().isNullConstant()) { Constant arrayConst = array().asConstant(); if (tool.isImmutable(arrayConst)) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java Tue Jul 03 17:50:42 2012 +0200 @@ -29,7 +29,7 @@ public interface CanonicalizerTool { TargetDescription target(); Assumptions assumptions(); - CodeCacheProvider runtime(); + MetaAccessProvider runtime(); /** * Determines if a given constant is an object/array whose current
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java Tue Jul 03 17:50:42 2012 +0200 @@ -45,7 +45,7 @@ */ public class SnippetInstaller { - private final GraalCodeCacheProvider runtime; + private final MetaAccessProvider runtime; private final TargetDescription target; private final BoxingMethodPool pool; @@ -57,7 +57,7 @@ */ private final Map<ResolvedJavaMethod, StructuredGraph> graphCache; - public SnippetInstaller(GraalCodeCacheProvider runtime, TargetDescription target) { + public SnippetInstaller(MetaAccessProvider runtime, TargetDescription target) { this.runtime = runtime; this.target = target; this.pool = new BoxingMethodPool(runtime);
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationPhase.java Tue Jul 03 15:00:23 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationPhase.java Tue Jul 03 17:50:42 2012 +0200 @@ -39,10 +39,10 @@ public class SnippetIntrinsificationPhase extends Phase { - private final CodeCacheProvider runtime; + private final MetaAccessProvider runtime; private final BoxingMethodPool pool; - public SnippetIntrinsificationPhase(CodeCacheProvider runtime, BoxingMethodPool pool) { + public SnippetIntrinsificationPhase(MetaAccessProvider runtime, BoxingMethodPool pool) { this.runtime = runtime; this.pool = pool; }