# HG changeset patch # User Doug Simon # Date 1423702445 -3600 # Node ID a0a760b0fb5f3d4d626dbdedfb51d819d11c544b # Parent 48bdad77afcdb8bb1c2591b6e78b93203ceadb59 pulled method evolution dependencies out of Assumptions and directly into StructuredGraph diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java Thu Feb 12 01:54:05 2015 +0100 @@ -29,16 +29,16 @@ import com.oracle.graal.api.meta.*; /** - * Class for recording assumptions made during compilation. {@link OptimisticAssumption}s can only - * be recorded in an {@link Assumptions} object if it {@linkplain #useOptimisticAssumptions() - * allows} them. + * Class for recording assumptions made during compilation. */ public final class Assumptions implements Serializable, Iterable { private static final long serialVersionUID = 5152062717588239131L; /** - * Abstract base class for assumptions. + * Abstract base class for assumptions. An assumption assumes a property of the runtime that may + * be invalidated by subsequent execution (e.g., that a class has no subclasses implementing + * {@link NoFinalizableSubclass Object.finalize()}). */ public abstract static class Assumption implements Serializable { @@ -46,23 +46,9 @@ } /** - * Abstract base class for optimistic assumptions. An optimistic assumption assumes a property - * of the runtime that may be invalidated by subsequent execution (e.g., that a class has no - * subclasses implementing {@link NoFinalizableSubclass Object.finalize()}). A non-optimistic - * assumption assumes a property that will most likely only be invalidated by an external - * interface to the runtime (e.g., a {@linkplain MethodContents breakpoint is set or a class is - * redefined}). + * An assumption that a given class has no subclasses implementing {@link Object#finalize()}). */ - public abstract static class OptimisticAssumption extends Assumption { - - private static final long serialVersionUID = -1936652569665112932L; - } - - /** - * An optimistic assumption that a given class has no subclasses implementing - * {@link Object#finalize()}). - */ - public static final class NoFinalizableSubclass extends OptimisticAssumption { + public static final class NoFinalizableSubclass extends Assumption { private static final long serialVersionUID = 6451169735564055081L; @@ -94,9 +80,9 @@ } /** - * An optimistic assumption that a given type has a given unique subtype. + * An assumption that a given type has a given unique subtype. */ - public static final class ConcreteSubtype extends OptimisticAssumption { + public static final class ConcreteSubtype extends Assumption { private static final long serialVersionUID = -1457173265437676252L; @@ -142,9 +128,9 @@ } /** - * An optimistic assumption that a given virtual method has a given unique implementation. + * An assumption that a given virtual method has a given unique implementation. */ - public static final class ConcreteMethod extends OptimisticAssumption { + public static final class ConcreteMethod extends Assumption { private static final long serialVersionUID = -7636746737947390059L; @@ -196,49 +182,9 @@ } /** - * An non-optimistic assumption that the bytecodes of a given method used during compilation - * will not change. This kind of dependency may be used to invalidate and deoptimize compiled - * code when: - * + * An assumption that a given call site's method handle did not change. */ - public static final class MethodContents extends Assumption { - - private static final long serialVersionUID = -4821594103928571659L; - - public final ResolvedJavaMethod method; - - public MethodContents(ResolvedJavaMethod method) { - this.method = method; - } - - @Override - public int hashCode() { - return 31 + method.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof MethodContents) { - MethodContents other = (MethodContents) obj; - return other.method.equals(method); - } - return false; - } - - @Override - public String toString() { - return "MethodContents[method=" + method.format("%H.%n(%p)%r") + "]"; - } - } - - /** - * An optimistic assumption that a given call site's method handle did not change. - */ - public static final class CallSiteTargetValue extends OptimisticAssumption { + public static final class CallSiteTargetValue extends Assumption { private static final long serialVersionUID = 1732459941784550371L; @@ -274,26 +220,7 @@ } } - private Set assumptions; - - /** - * Specifies whether {@link OptimisticAssumption}s can be made. - */ - private boolean allowOptimisticAssumptions; - - public static final boolean ALLOW_OPTIMISTIC_ASSUMPTIONS = true; - public static final boolean DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS = false; - - /** - * Creates an object for recording assumptions. - * - * @param allowOptimisticAssumptions specifies whether {@link OptimisticAssumption}s can be - * recorded in this object - */ - public Assumptions(boolean allowOptimisticAssumptions) { - this.allowOptimisticAssumptions = allowOptimisticAssumptions; - assumptions = new HashSet<>(); - } + private final Set assumptions = new HashSet<>(); /** * Returns whether any assumptions have been registered. @@ -304,13 +231,6 @@ return assumptions.isEmpty(); } - /** - * Determines whether {@link OptimisticAssumption}s can be made. - */ - public boolean useOptimisticAssumptions() { - return allowOptimisticAssumptions; - } - @Override public int hashCode() { throw new UnsupportedOperationException("hashCode"); @@ -323,7 +243,7 @@ } if (obj instanceof Assumptions) { Assumptions that = (Assumptions) obj; - if (this.allowOptimisticAssumptions != that.allowOptimisticAssumptions || !this.assumptions.equals(that.assumptions)) { + if (!this.assumptions.equals(that.assumptions)) { return false; } return true; @@ -368,17 +288,7 @@ record(new ConcreteMethod(method, context, impl)); } - /** - * Records that {@code method} was used during the compilation. - * - * @param method a method whose contents were used - */ - public void recordMethodContents(ResolvedJavaMethod method) { - record(new MethodContents(method)); - } - public void record(Assumption assumption) { - assert allowOptimisticAssumptions || !(assumption instanceof OptimisticAssumption) : "cannot make optimistic assumption: " + assumption; assumptions.add(assumption); } @@ -399,6 +309,6 @@ @Override public String toString() { - return "Assumptions{optimistic=" + allowOptimisticAssumptions + ", assumptions=" + assumptions + "}"; + return "Assumptions[" + assumptions + "]"; } } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Thu Feb 12 01:54:05 2015 +0100 @@ -531,6 +531,11 @@ private Assumption[] assumptions; + /** + * The list of the methods whose bytecodes were used as input to the compilation. + */ + private ResolvedJavaMethod[] methods; + public CompilationResult() { this(null); } @@ -607,18 +612,36 @@ this.entryBCI = entryBCI; } + /** + * Sets the assumptions made during compilation. + */ public void setAssumptions(Assumption[] assumptions) { this.assumptions = assumptions; } /** - * Gets a fixed-size {@linkplain Arrays#asList(Object...) view} of the assumptions recorded in - * this object. + * Gets a fixed-size {@linkplain Arrays#asList(Object...) view} of the assumptions made during + * compilation. */ public Collection getAssumptions() { return assumptions == null ? Collections.emptyList() : Arrays.asList(assumptions); } + /** + * Sets the methods whose bytecodes were used as input to the compilation. + */ + public void setMethods(ResolvedJavaMethod[] methods) { + this.methods = methods; + } + + /** + * Gets a fixed-size {@linkplain Arrays#asList(Object...) view} of the methods whose bytecodes + * were used as input to the compilation. + */ + public Collection getMethods() { + return methods == null ? Collections.emptyList() : Arrays.asList(methods); + } + public DataSection getDataSection() { return dataSection; } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java Thu Feb 12 01:54:05 2015 +0100 @@ -97,7 +97,7 @@ } else { ResolvedJavaType uniqueSubtype = targetType == null ? null : targetType.findUniqueConcreteSubtype(); if (uniqueSubtype != null) { - if (assumptions.useOptimisticAssumptions()) { + if (assumptions != null) { assumptions.recordConcreteSubtype(targetType, uniqueSubtype); exact = uniqueSubtype; } else { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java --- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java Thu Feb 12 01:54:05 2015 +0100 @@ -24,6 +24,8 @@ import static com.oracle.graal.compiler.common.GraalOptions.*; +import java.util.*; + import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.*; @@ -67,8 +69,8 @@ } // emitCode - Assumptions assumptions = new Assumptions(OptAssumptions.getValue()); - GraalCompiler.emitCode(backend, assumptions, res, compilationResult, installedCodeOwner, factory); + Assumptions assumptions = OptAssumptions.getValue() ? new Assumptions() : null; + GraalCompiler.emitCode(backend, assumptions, Collections.emptySet(), res, compilationResult, installedCodeOwner, factory); return compilationResult; } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,11 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.loop.phases.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; @@ -306,7 +305,7 @@ } private void processMethod(final String snippet) { - graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + graph = parseEager(snippet, AllowAssumptions.NO); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new PartialEscapePhase(false, new CanonicalizerPhase(true)).apply(graph, context); @@ -317,7 +316,7 @@ } private void compareGraphs(final String snippet, final String referenceSnippet, final boolean loopPeeling, final boolean excludeVirtual) { - graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + graph = parseEager(snippet, AllowAssumptions.NO); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); canonicalizer.apply(graph, context); @@ -332,7 +331,7 @@ new DeadCodeEliminationPhase().apply(graph); canonicalizer.apply(graph, context); - StructuredGraph referenceGraph = parseEager(referenceSnippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.YES); new InliningPhase(new CanonicalizerPhase(true)).apply(referenceGraph, context); new DeadCodeEliminationPhase().apply(referenceGraph); new CanonicalizerPhase(true).apply(referenceGraph, context); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.debug.DelegatingDebugConfig.Feature.*; import java.io.*; @@ -45,6 +44,7 @@ import com.oracle.graal.java.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.VerifyPhase.VerificationError; import com.oracle.graal.phases.graph.*; @@ -139,7 +139,7 @@ if (matches(filters, methodName)) { executor.execute(() -> { ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m); - StructuredGraph graph = new StructuredGraph(method, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = new StructuredGraph(method, AllowAssumptions.NO); try (DebugConfigScope s = Debug.setConfig(new DelegatingDebugConfig().disable(INTERCEPT)); Debug.Scope ds = Debug.scope("CheckingGraph", graph, method)) { graphBuilderSuite.apply(graph, context); // update phi stamps diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompareCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompareCanonicalizerTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompareCanonicalizerTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,12 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; import static org.junit.Assert.*; import org.junit.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -35,7 +35,7 @@ public class CompareCanonicalizerTest extends GraalCompilerTest { private StructuredGraph getCanonicalizedGraph(String name) { - StructuredGraph graph = parseEager(name, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(name, AllowAssumptions.YES); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); return graph; } @@ -48,9 +48,9 @@ @Test public void testCanonicalComparison() { - StructuredGraph referenceGraph = parseEager("referenceCanonicalComparison", DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph referenceGraph = parseEager("referenceCanonicalComparison", AllowAssumptions.NO); for (int i = 1; i < 4; i++) { - StructuredGraph graph = parseEager("canonicalCompare" + i, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("canonicalCompare" + i, AllowAssumptions.NO); assertEquals(referenceGraph, graph); } new CanonicalizerPhase(true).apply(referenceGraph, new PhaseContext(getProviders())); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,11 +22,10 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -92,7 +91,7 @@ @Test public void testRedundantCompares() { - StructuredGraph graph = parseEager("testRedundantComparesSnippet", ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("testRedundantComparesSnippet", AllowAssumptions.YES); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); PhaseContext context = new PhaseContext(getProviders()); @@ -115,7 +114,7 @@ @Test @Ignore public void testInstanceOfCheckCastLowered() { - StructuredGraph graph = parseEager("testInstanceOfCheckCastSnippet", ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("testInstanceOfCheckCastSnippet", AllowAssumptions.YES); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); PhaseContext context = new PhaseContext(getProviders()); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,13 +22,12 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; @@ -82,12 +81,12 @@ private void test(final String snippet) { try (Scope s = Debug.scope("DegeneratedLoopsTest", new DebugDumpScope(snippet))) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, context); Debug.dump(graph, "Graph"); - StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.YES); Debug.dump(referenceGraph, "ReferenceGraph"); assertEquals(referenceGraph, graph); } catch (Throwable e) { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,13 +22,12 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -107,7 +106,7 @@ } private StructuredGraph compileSnippet(final String snippet, final int checkcasts, final int afterCanon) { - final StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + final StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); try (Scope s = Debug.scope("NestedCheckCastsTest", graph)) { Debug.dump(graph, "After parsing: " + snippet); Assert.assertEquals(checkcasts, graph.getNodes().filter(CheckCastNode.class).count()); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,20 +22,20 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import java.io.*; import java.lang.reflect.*; import java.util.*; import org.junit.*; +import com.oracle.graal.api.code.*; import com.oracle.graal.api.code.Assumptions.Assumption; import com.oracle.graal.api.code.Assumptions.NoFinalizableSubclass; import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; import com.oracle.graal.java.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; @@ -61,11 +61,11 @@ } } - private StructuredGraph parseAndProcess(Class cl, boolean allowsOptimisticAssumptions) { + private StructuredGraph parseAndProcess(Class cl, AllowAssumptions allowAssumptions) { Constructor[] constructors = cl.getConstructors(); Assert.assertTrue(constructors.length == 1); final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(constructors[0]); - StructuredGraph graph = new StructuredGraph(javaMethod, allowsOptimisticAssumptions); + StructuredGraph graph = new StructuredGraph(javaMethod, allowAssumptions); GraphBuilderConfiguration conf = GraphBuilderConfiguration.getSnippetDefault(); new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), getProviders().getConstantReflection(), conf, OptimisticOptimizations.ALL).apply(graph); @@ -75,13 +75,16 @@ return graph; } - private void checkForRegisterFinalizeNode(Class cl, boolean shouldContainFinalizer, boolean allowsOptimisticAssumptions) { - StructuredGraph graph = parseAndProcess(cl, allowsOptimisticAssumptions); + private void checkForRegisterFinalizeNode(Class cl, boolean shouldContainFinalizer, AllowAssumptions allowAssumptions) { + StructuredGraph graph = parseAndProcess(cl, allowAssumptions); Assert.assertTrue(graph.getNodes().filter(RegisterFinalizerNode.class).count() == (shouldContainFinalizer ? 1 : 0)); int noFinalizerAssumption = 0; - for (Assumption a : graph.getAssumptions()) { - if (a instanceof NoFinalizableSubclass) { - noFinalizerAssumption++; + Assumptions assumptions = graph.getAssumptions(); + if (assumptions != null) { + for (Assumption a : assumptions) { + if (a instanceof NoFinalizableSubclass) { + noFinalizerAssumption++; + } } } Assert.assertTrue(noFinalizerAssumption == (shouldContainFinalizer ? 0 : 1)); @@ -95,13 +98,13 @@ public void test1() throws ClassNotFoundException { for (int i = 0; i < 2; i++) { ClassTemplateLoader loader = new ClassTemplateLoader(); - checkForRegisterFinalizeNode(loader.findClass("NoFinalizerEverAAAA"), true, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); - checkForRegisterFinalizeNode(loader.findClass("NoFinalizerEverAAAA"), false, ALLOW_OPTIMISTIC_ASSUMPTIONS); + checkForRegisterFinalizeNode(loader.findClass("NoFinalizerEverAAAA"), true, AllowAssumptions.NO); + checkForRegisterFinalizeNode(loader.findClass("NoFinalizerEverAAAA"), false, AllowAssumptions.YES); - checkForRegisterFinalizeNode(loader.findClass("NoFinalizerYetAAAA"), false, ALLOW_OPTIMISTIC_ASSUMPTIONS); + checkForRegisterFinalizeNode(loader.findClass("NoFinalizerYetAAAA"), false, AllowAssumptions.YES); - checkForRegisterFinalizeNode(loader.findClass("WithFinalizerAAAA"), true, ALLOW_OPTIMISTIC_ASSUMPTIONS); - checkForRegisterFinalizeNode(loader.findClass("NoFinalizerYetAAAA"), true, ALLOW_OPTIMISTIC_ASSUMPTIONS); + checkForRegisterFinalizeNode(loader.findClass("WithFinalizerAAAA"), true, AllowAssumptions.YES); + checkForRegisterFinalizeNode(loader.findClass("NoFinalizerYetAAAA"), true, AllowAssumptions.YES); } } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,14 +22,13 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.common.*; @@ -59,7 +58,7 @@ private void test(final String snippet) { try (Scope s = Debug.scope("FloatingReadTest", new DebugDumpScope(snippet))) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); PhaseContext context = new PhaseContext(getProviders()); new LoweringPhase(new CanonicalizerPhase(true), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); new FloatingReadPhase().apply(graph); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.api.code.CodeUtil.*; import static com.oracle.graal.compiler.GraalCompiler.*; import static com.oracle.graal.compiler.common.GraalOptions.*; @@ -54,6 +53,7 @@ import com.oracle.graal.lir.phases.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.virtual.*; @@ -72,7 +72,7 @@ *

* White box tests for Graal compiler transformations use this pattern: *

    - *
  1. Create a graph by {@linkplain #parseEager(String, boolean) parsing} a method.
  2. + *
  3. Create a graph by {@linkplain #parseEager(String, AllowAssumptions) parsing} a method.
  4. *
  5. Manually modify the graph (e.g. replace a parameter node with a constant).
  6. *
  7. Apply a transformation to the graph.
  8. *
  9. Assert that the transformed graph is equal to an expected graph.
  10. @@ -662,7 +662,7 @@ /** * Gets installed code for a given method, compiling it first if necessary. The graph is parsed - * {@link #parseEager(ResolvedJavaMethod, boolean) eagerly}. + * {@link #parseEager(ResolvedJavaMethod, AllowAssumptions) eagerly}. */ protected InstalledCode getCode(ResolvedJavaMethod method) { return getCode(method, null); @@ -736,10 +736,10 @@ * is null. * * The default implementation in {@link GraalCompilerTest} is to call - * {@link #parseEager(ResolvedJavaMethod, boolean)}. + * {@link #parseEager(ResolvedJavaMethod, AllowAssumptions)}. */ protected StructuredGraph parseForCompile(ResolvedJavaMethod method) { - return parseEager(method, ALLOW_OPTIMISTIC_ASSUMPTIONS); + return parseEager(method, AllowAssumptions.YES); } /** @@ -816,16 +816,16 @@ * * @param methodName the name of the method in {@code this.getClass()} to be parsed */ - protected StructuredGraph parseProfiled(String methodName, boolean allowOptimisticAssumptions) { - return parseProfiled(getResolvedJavaMethod(methodName), allowOptimisticAssumptions); + protected StructuredGraph parseProfiled(String methodName, AllowAssumptions allowAssumptions) { + return parseProfiled(getResolvedJavaMethod(methodName), allowAssumptions); } /** * Parses a Java method in {@linkplain GraphBuilderConfiguration#getDefault() default} mode to * produce a graph. */ - protected StructuredGraph parseProfiled(ResolvedJavaMethod m, boolean allowOptimisticAssumptions) { - return parse1(m, getDefaultGraphBuilderSuite(), allowOptimisticAssumptions); + protected StructuredGraph parseProfiled(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) { + return parse1(m, getDefaultGraphBuilderSuite(), allowAssumptions); } /** @@ -834,30 +834,30 @@ * * @param methodName the name of the method in {@code this.getClass()} to be parsed */ - protected StructuredGraph parseEager(String methodName, boolean allowOptimisticAssumptions) { - return parseEager(getResolvedJavaMethod(methodName), allowOptimisticAssumptions); + protected StructuredGraph parseEager(String methodName, AllowAssumptions allowAssumptions) { + return parseEager(getResolvedJavaMethod(methodName), allowAssumptions); } /** * Parses a Java method in {@linkplain GraphBuilderConfiguration#getEagerDefault() eager} mode * to produce a graph. */ - protected StructuredGraph parseEager(ResolvedJavaMethod m, boolean allowOptimisticAssumptions) { - return parse1(m, getCustomGraphBuilderSuite(GraphBuilderConfiguration.getEagerDefault()), allowOptimisticAssumptions); + protected StructuredGraph parseEager(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) { + return parse1(m, getCustomGraphBuilderSuite(GraphBuilderConfiguration.getEagerDefault()), allowAssumptions); } /** * Parses a Java method in {@linkplain GraphBuilderConfiguration#getFullDebugDefault() full * debug} mode to produce a graph. */ - protected StructuredGraph parseDebug(ResolvedJavaMethod m, boolean allowOptimisticAssumptions) { - return parse1(m, getCustomGraphBuilderSuite(GraphBuilderConfiguration.getFullDebugDefault()), allowOptimisticAssumptions); + protected StructuredGraph parseDebug(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) { + return parse1(m, getCustomGraphBuilderSuite(GraphBuilderConfiguration.getFullDebugDefault()), allowAssumptions); } - private StructuredGraph parse1(ResolvedJavaMethod javaMethod, PhaseSuite graphBuilderSuite, boolean allowOptimisticAssumptions) { + private StructuredGraph parse1(ResolvedJavaMethod javaMethod, PhaseSuite graphBuilderSuite, AllowAssumptions allowAssumptions) { assert javaMethod.getAnnotation(Test.class) == null : "shouldn't parse method with @Test annotation: " + javaMethod; try (Scope ds = Debug.scope("Parsing", javaMethod)) { - StructuredGraph graph = new StructuredGraph(javaMethod, allowOptimisticAssumptions); + StructuredGraph graph = new StructuredGraph(javaMethod, allowAssumptions); graphBuilderSuite.apply(graph, new HighTierContext(providers, null, graphBuilderSuite, OptimisticOptimizations.ALL)); return graph; } catch (Throwable e) { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.graph.iterators.NodePredicates.*; import org.junit.*; @@ -30,6 +29,7 @@ import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; @@ -180,7 +180,7 @@ } private void testCombinedIf(String snippet, int count) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); PhaseContext context = new PhaseContext(getProviders()); new LoweringPhase(new CanonicalizerPhase(true), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); new FloatingReadPhase().apply(graph); @@ -193,7 +193,7 @@ } private void test(String snippet) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); ParameterNode param = graph.getNodes(ParameterNode.class).iterator().next(); ConstantNode constant = ConstantNode.forInt(0, graph); for (Node n : param.usages().filter(isNotA(FrameState.class)).snapshot()) { @@ -205,7 +205,7 @@ fs.replaceFirstInput(param, null); param.safeDelete(); } - StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.YES); assertEquals(referenceGraph, graph); } } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.api.code.CodeUtil.*; import static com.oracle.graal.compiler.GraalCompiler.*; import static com.oracle.graal.compiler.common.GraalOptions.*; @@ -38,6 +37,7 @@ import com.oracle.graal.java.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; @@ -60,7 +60,7 @@ @Test public void callInfopoints() { final ResolvedJavaMethod method = getResolvedJavaMethod("testMethod"); - final StructuredGraph graph = parseEager(method, ALLOW_OPTIMISTIC_ASSUMPTIONS); + final StructuredGraph graph = parseEager(method, AllowAssumptions.YES); CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); final CompilationResult cr = compileGraph(graph, cc, graph.method(), getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph), null, getSuites(), getLIRSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default); @@ -75,7 +75,7 @@ @Test public void lineInfopoints() { final ResolvedJavaMethod method = getResolvedJavaMethod("testMethod"); - final StructuredGraph graph = parseDebug(method, OptAssumptions.getValue()); + final StructuredGraph graph = parseDebug(method, AllowAssumptions.from(OptAssumptions.getValue())); int graphLineSPs = 0; for (FullInfopointNode ipn : graph.getNodes().filter(FullInfopointNode.class)) { if (ipn.getReason() == InfopointReason.LINE_NUMBER) { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IntegerEqualsCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IntegerEqualsCanonicalizerTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IntegerEqualsCanonicalizerTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,11 +22,10 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -114,7 +113,7 @@ } private StructuredGraph getCanonicalizedGraph(String snippet) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); new CanonicalizerPhase(false).apply(graph, new PhaseContext(getProviders())); for (FrameState state : graph.getNodes(FrameState.class).snapshot()) { state.replaceAtUsages(null); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeExceptionTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeExceptionTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeExceptionTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,12 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; import java.util.*; import org.junit.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; @@ -61,7 +61,7 @@ } private void test(String snippet) { - StructuredGraph graph = parseProfiled(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseProfiled(snippet, AllowAssumptions.NO); Map hints = new HashMap<>(); for (Invoke invoke : graph.getInvokes()) { hints.put(invoke, 1000d); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeHintsTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeHintsTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeHintsTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,13 +22,12 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import java.util.*; import org.junit.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; @@ -72,7 +71,7 @@ } private void test(String snippet) { - StructuredGraph graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO); Map hints = new HashMap<>(); for (Invoke invoke : graph.getInvokes()) { hints.put(invoke, 1000d); @@ -82,7 +81,7 @@ new InliningPhase(hints, new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); - StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.NO); assertEquals(referenceGraph, graph); } } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,11 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; @@ -89,7 +88,7 @@ private StructuredGraph getGraph(String snippet) { ResolvedJavaMethod method = getResolvedJavaMethod(snippet); - StructuredGraph graph = parseEager(method, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(method, AllowAssumptions.YES); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new CanonicalizerPhase(true).apply(graph, context); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.debug.*; @@ -31,6 +29,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.loop.phases.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -122,8 +121,8 @@ } private void test(String snippet, String referenceSnippet) { - final StructuredGraph graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); - final StructuredGraph referenceGraph = parseEager(referenceSnippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + final StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO); + final StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.NO); new LoopUnswitchingPhase().apply(graph); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.compiler.common.GraalOptions.*; import static org.junit.Assert.*; @@ -35,6 +34,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.graph.iterators.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; @@ -596,7 +596,7 @@ } private SchedulePhase getFinalSchedule(final String snippet, final TestMode mode, final SchedulingStrategy schedulingStrategy) { - final StructuredGraph graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + final StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO); try (Scope d = Debug.scope("FloatingReadTest", graph)) { try (OverrideScope s = OptionValue.override(OptScheduleOutOfLoops, schedulingStrategy == SchedulingStrategy.LATEST_OUT_OF_LOOPS, OptImplicitNullChecks, false)) { HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MergeCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MergeCanonicalizerTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MergeCanonicalizerTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,11 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -58,7 +57,7 @@ } private void testReturnCount(String snippet, int returnCount) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); Debug.dump(graph, "Graph"); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.graph.iterators.NodePredicates.*; import java.util.*; @@ -32,6 +31,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.graph.iterators.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; @@ -84,7 +84,7 @@ } private StructuredGraph parseAndProcess(String snippet) { - StructuredGraph graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO); ParameterNode param = graph.getNodes(ParameterNode.class).first(); if (param != null) { ConstantNode constant = ConstantNode.forInt(0, graph); @@ -105,7 +105,7 @@ private void test(String snippet) { StructuredGraph graph = parseAndProcess(snippet); - StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.NO); assertEquals(referenceGraph, graph); } } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/NestedLoopTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/NestedLoopTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/NestedLoopTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,14 +22,13 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.java.*; @@ -147,7 +146,7 @@ } private void test(String snippet, int rootExits, int nestedExits, int innerExits) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); Debug.dump(graph, "Graph"); ControlFlowGraph cfg = ControlFlowGraph.compute(graph, true, true, true, true); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PhiCreationTests.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PhiCreationTests.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PhiCreationTests.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,11 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; /** * In the following tests, the correct removal of redundant phis during graph building is tested. @@ -42,7 +41,7 @@ @Test public void test1() { - StructuredGraph graph = parseEager("test1Snippet", ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("test1Snippet", AllowAssumptions.YES); Assert.assertFalse(graph.getNodes().filter(ValuePhiNode.class).iterator().hasNext()); } @@ -55,7 +54,7 @@ @Test public void test2() { - StructuredGraph graph = parseEager("test2Snippet", ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("test2Snippet", AllowAssumptions.YES); Assert.assertFalse(graph.getNodes().filter(ValuePhiNode.class).iterator().hasNext()); } @@ -68,7 +67,7 @@ @Test public void test3() { - StructuredGraph graph = parseEager("test3Snippet", ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("test3Snippet", AllowAssumptions.YES); Debug.dump(graph, "Graph"); Assert.assertFalse(graph.getNodes().filter(ValuePhiNode.class).iterator().hasNext()); } @@ -84,7 +83,7 @@ @Test public void test4() { - StructuredGraph graph = parseEager("test4Snippet", ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("test4Snippet", AllowAssumptions.YES); Debug.dump(graph, "Graph"); Assert.assertFalse(graph.getNodes().filter(ValuePhiNode.class).iterator().hasNext()); } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.api.meta.*; @@ -31,6 +29,7 @@ import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; @@ -92,7 +91,7 @@ } private StructuredGraph compileTestSnippet(final String snippet) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); PhaseContext context = new PhaseContext(getProviders()); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushThroughIfTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushThroughIfTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushThroughIfTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,11 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.util.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -58,7 +57,7 @@ } private void test(String snippet, String reference) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); Debug.dump(graph, "Graph"); for (FrameState fs : graph.getNodes(FrameState.class).snapshot()) { fs.replaceAtUsages(null); @@ -67,7 +66,7 @@ new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); - StructuredGraph referenceGraph = parseEager(reference, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph referenceGraph = parseEager(reference, AllowAssumptions.YES); for (FrameState fs : referenceGraph.getNodes(FrameState.class).snapshot()) { fs.replaceAtUsages(null); GraphUtil.killWithUnusedFloatingInputs(fs); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,13 +22,12 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.common.*; @@ -82,7 +81,7 @@ try (Scope s = Debug.scope("ReadAfterCheckCastTest", new DebugDumpScope(snippet))) { // check shape of graph, with lots of assumptions. will probably fail if graph // structure changes significantly - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); PhaseContext context = new PhaseContext(getProviders()); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,11 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -244,9 +243,9 @@ } private void test(String test, String ref) { - StructuredGraph testGraph = parseEager(test, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph testGraph = parseEager(test, AllowAssumptions.NO); new CanonicalizerPhase(true).apply(testGraph, new PhaseContext(getProviders())); - StructuredGraph refGraph = parseEager(ref, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph refGraph = parseEager(ref, AllowAssumptions.NO); new CanonicalizerPhase(true).apply(refGraph, new PhaseContext(getProviders())); assertEquals(testGraph, refGraph); } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,11 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -131,11 +130,11 @@ private void test(final String snippet, final String referenceSnippet) { // No debug scope to reduce console noise for @Test(expected = ...) tests - StructuredGraph graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO); Debug.dump(graph, "Graph"); PhaseContext context = new PhaseContext(getProviders()); new CanonicalizerPhase(true).apply(graph, context); - StructuredGraph referenceGraph = parseEager(referenceSnippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.NO); assertEquals(referenceGraph, graph); } } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SchedulingTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SchedulingTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SchedulingTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; import static org.junit.Assert.*; import java.util.*; @@ -31,6 +30,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.util.*; @@ -52,7 +52,7 @@ @Test public void testValueProxyInputs() { - StructuredGraph graph = parseEager("testValueProxyInputsSnippet", ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("testValueProxyInputsSnippet", AllowAssumptions.YES); for (FrameState fs : graph.getNodes().filter(FrameState.class).snapshot()) { fs.replaceAtUsages(null); GraphUtil.killWithUnusedFloatingInputs(fs); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; import static org.junit.Assert.*; import java.util.*; @@ -31,6 +30,7 @@ import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.cfg.*; public class SimpleCFGTest extends GraalCompilerTest { @@ -41,7 +41,7 @@ @Test public void testImplies() { - StructuredGraph graph = new StructuredGraph(ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = new StructuredGraph(AllowAssumptions.YES); AbstractEndNode trueEnd = graph.add(new EndNode()); AbstractEndNode falseEnd = graph.add(new EndNode()); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,11 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -110,7 +109,7 @@ } private void testZeroReturn(String methodName) { - StructuredGraph graph = parseEager(methodName, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(methodName, AllowAssumptions.YES); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); new DeadCodeEliminationPhase().apply(graph); assertConstantReturn(graph, 0); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StraighteningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StraighteningTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StraighteningTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,11 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -88,10 +87,10 @@ private void test(final String snippet) { // No debug scope to reduce console noise for @Test(expected = ...) tests - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); Debug.dump(graph, "Graph"); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); - StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.YES); assertEquals(referenceGraph, graph); } } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.api.code.Assumptions.*; - import java.io.*; import org.junit.*; @@ -32,6 +30,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.common.*; @@ -171,7 +170,7 @@ } private void test(String snippet, String referenceSnippet) { - StructuredGraph graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO); Debug.dump(graph, "Graph"); /* * When using FlowSensitiveReductionPhase instead of ConditionalEliminationPhase, @@ -182,7 +181,7 @@ new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); // a second canonicalizer is needed to process nested MaterializeNodes new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); - StructuredGraph referenceGraph = parseEager(referenceSnippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.NO); new CanonicalizerPhase(true).apply(referenceGraph, new PhaseContext(getProviders())); assertEquals(referenceGraph, graph); } @@ -230,7 +229,7 @@ } private void testHelper(String snippet, Class clazz) { - StructuredGraph graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); Debug.dump(graph, "Graph " + snippet); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.compiler.test.backend; -import static com.oracle.graal.api.code.Assumptions.*; - import java.util.*; import org.junit.*; @@ -36,11 +34,12 @@ import com.oracle.graal.lir.*; import com.oracle.graal.lir.StandardOp.MoveOp; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; public class AllocatorTest extends BackendTest { protected void testAllocation(String snippet, final int expectedRegisters, final int expectedRegRegMoves, final int expectedSpillMoves) { - final StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + final StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); try (Scope s = Debug.scope("AllocatorTest", graph, graph.method(), getCodeCache())) { final RegisterStats stats = new RegisterStats(getLIRGenerationResult(graph).getLIR()); try (Scope s2 = Debug.scope("Assertions", stats.lir)) { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/BackendTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/BackendTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/BackendTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -23,6 +23,7 @@ package com.oracle.graal.compiler.test.backend; import static com.oracle.graal.api.code.CodeUtil.*; + import com.oracle.graal.api.code.*; import com.oracle.graal.api.code.CallingConvention.Type; import com.oracle.graal.compiler.*; diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,14 +22,13 @@ */ package com.oracle.graal.compiler.test.deopt; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -53,7 +52,7 @@ @Test public void test1() { final ResolvedJavaMethod javaMethod = getResolvedJavaMethod("testMethod"); - final StructuredGraph graph = parseEager(javaMethod, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + final StructuredGraph graph = parseEager(javaMethod, AllowAssumptions.NO); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); new DeadCodeEliminationPhase().apply(graph); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/MonitorDeoptTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/MonitorDeoptTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/MonitorDeoptTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -24,14 +24,13 @@ */ package com.oracle.graal.compiler.test.deopt; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; public final class MonitorDeoptTest extends GraalCompilerTest { @@ -136,7 +135,7 @@ public void run0() throws Throwable { ResolvedJavaMethod javaMethod = getResolvedJavaMethod("test"); - StructuredGraph graph = parseEager(javaMethod, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(javaMethod, AllowAssumptions.YES); removeLoopSafepoint(graph); CompilationResult compilationResult = compile(javaMethod, graph); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EATestBase.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EATestBase.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EATestBase.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.compiler.test.ea; -import static com.oracle.graal.api.code.Assumptions.*; - import java.util.*; import org.junit.*; @@ -34,6 +32,7 @@ import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.java.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.virtual.*; import com.oracle.graal.phases.*; @@ -150,7 +149,7 @@ protected void prepareGraph(String snippet, final boolean iterativeEscapeAnalysis) { ResolvedJavaMethod method = getResolvedJavaMethod(snippet); - graph = new StructuredGraph(method, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + graph = new StructuredGraph(method, AllowAssumptions.NO); try (Scope s = Debug.scope(getClass(), graph, method, getCodeCache())) { new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), getProviders().getConstantReflection(), GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EarlyReadEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EarlyReadEliminationTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EarlyReadEliminationTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,10 +22,9 @@ */ package com.oracle.graal.compiler.test.ea; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; @@ -41,7 +40,7 @@ @Override protected void processMethod(final String snippet) { - graph = parseEager(getResolvedJavaMethod(snippet), DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + graph = parseEager(getResolvedJavaMethod(snippet), AllowAssumptions.NO); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new EarlyReadEliminationPhase(new CanonicalizerPhase(true)).apply(graph, context); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test.ea; -import static com.oracle.graal.api.code.Assumptions.*; import static org.junit.Assert.*; import java.util.concurrent.*; @@ -32,6 +31,7 @@ import com.oracle.graal.compiler.test.*; import com.oracle.graal.compiler.test.ea.EATestBase.TestClassInt; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; @@ -84,7 +84,7 @@ } private void processMethod(final String snippet) { - graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + graph = parseEager(snippet, AllowAssumptions.YES); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new IterativeInliningPhase(new CanonicalizerPhase(true)).apply(graph, context); } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test.ea; -import static com.oracle.graal.api.code.Assumptions.*; import static org.junit.Assert.*; import java.util.*; @@ -31,6 +30,7 @@ import com.oracle.graal.compiler.test.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; @@ -244,7 +244,7 @@ } protected void processMethod(final String snippet) { - graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + graph = parseEager(snippet, AllowAssumptions.NO); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new PartialEscapePhase(false, true, new CanonicalizerPhase(true), null).apply(graph, context); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PoorMansEATest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PoorMansEATest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PoorMansEATest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.compiler.test.ea; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.compiler.test.*; @@ -31,6 +29,7 @@ import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; @@ -60,7 +59,7 @@ private void test(final String snippet) { try (Scope s = Debug.scope("PoorMansEATest", new DebugDumpScope(snippet))) { - StructuredGraph graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO); HighTierContext highTierContext = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, highTierContext); PhaseContext context = new PhaseContext(getProviders()); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test.inlining; -import static com.oracle.graal.api.code.Assumptions.*; import static org.junit.Assert.*; import org.junit.*; @@ -35,6 +34,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.java.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; @@ -232,7 +232,7 @@ private StructuredGraph getGraph(final String snippet, final boolean eagerInfopointMode) { try (Scope s = Debug.scope("InliningTest", new DebugDumpScope(snippet))) { ResolvedJavaMethod method = getResolvedJavaMethod(snippet); - StructuredGraph graph = eagerInfopointMode ? parseDebug(method, ALLOW_OPTIMISTIC_ASSUMPTIONS) : parseEager(method, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = eagerInfopointMode ? parseDebug(method, AllowAssumptions.YES) : parseEager(method, AllowAssumptions.YES); PhaseSuite graphBuilderSuite = eagerInfopointMode ? getCustomGraphBuilderSuite(GraphBuilderConfiguration.getFullDebugDefault()) : getDefaultGraphBuilderSuite(); HighTierContext context = new HighTierContext(getProviders(), null, graphBuilderSuite, OptimisticOptimizations.ALL); Debug.dump(graph, "Graph"); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.compiler.test.tutorial; -import static com.oracle.graal.api.code.Assumptions.*; - import java.lang.reflect.*; import java.util.*; import java.util.concurrent.atomic.*; @@ -39,6 +37,7 @@ import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.phases.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; import com.oracle.graal.phases.util.*; @@ -84,7 +83,7 @@ * that we want the compilation to make optimistic assumptions about runtime state such * as the loaded class hierarchy. */ - StructuredGraph graph = new StructuredGraph(method, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = new StructuredGraph(method, AllowAssumptions.YES); /* * The phases used to build the graph. Usually this is just the GraphBuilderPhase. If diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/StaticAnalysis.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/StaticAnalysis.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/StaticAnalysis.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.compiler.test.tutorial; -import static com.oracle.graal.api.code.Assumptions.*; - import java.util.*; import com.oracle.graal.api.meta.*; @@ -34,6 +32,7 @@ import com.oracle.graal.java.*; import com.oracle.graal.nodes.CallTargetNode.InvokeKind; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.util.*; @@ -211,7 +210,7 @@ * Build the Graal graph for the method using the bytecode parser provided by Graal. */ - StructuredGraph graph = new StructuredGraph(method, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = new StructuredGraph(method, AllowAssumptions.NO); /* * Support for graph dumping, IGV uses this information to show the method name of a * graph. diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu Feb 12 01:54:05 2015 +0100 @@ -279,7 +279,7 @@ LIRGenerationResult lirGen = null; lirGen = emitLIR(backend, target, schedule, graph, stub, cc, registerConfig, lirSuites); try (Scope s = Debug.scope("CodeGen", lirGen, lirGen.getLIR())) { - emitCode(backend, graph.getAssumptions(), lirGen, compilationResult, installedCodeOwner, factory); + emitCode(backend, graph.getAssumptions(), graph.getMethods(), lirGen, compilationResult, installedCodeOwner, factory); } catch (Throwable e) { throw Debug.handle(e); } @@ -363,15 +363,18 @@ return lirGenRes; } - public static void emitCode(Backend backend, Assumptions assumptions, LIRGenerationResult lirGenRes, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner, - CompilationResultBuilderFactory factory) { + public static void emitCode(Backend backend, Assumptions assumptions, Set methods, LIRGenerationResult lirGenRes, CompilationResult compilationResult, + ResolvedJavaMethod installedCodeOwner, CompilationResultBuilderFactory factory) { FrameMap frameMap = lirGenRes.getFrameMap(); CompilationResultBuilder crb = backend.newCompilationResultBuilder(lirGenRes, frameMap, compilationResult, factory); backend.emitCode(crb, lirGenRes.getLIR(), installedCodeOwner); crb.finish(); - if (!assumptions.isEmpty()) { + if (assumptions != null && !assumptions.isEmpty()) { compilationResult.setAssumptions(assumptions.toArray()); } + if (methods != null) { + compilationResult.setMethods(methods.toArray(new ResolvedJavaMethod[methods.size()])); + } if (Debug.isMeterEnabled()) { List ldp = compilationResult.getDataPatches(); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.hotspot.test; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.api.code.CodeUtil.*; import static com.oracle.graal.compiler.GraalCompiler.*; import static com.oracle.graal.compiler.common.GraalOptions.*; @@ -42,6 +41,7 @@ import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.phases.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.options.*; import com.oracle.graal.options.OptionValue.OverrideScope; @@ -205,7 +205,7 @@ } private StructuredGraph compile(String test, boolean compileAOT) { - StructuredGraph graph = parseEager(test, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(test, AllowAssumptions.YES); ResolvedJavaMethod method = graph.method(); try (OverrideScope s = OptionValue.override(ImmutableCode, compileAOT)) { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ClassSubstitutionsTests.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ClassSubstitutionsTests.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ClassSubstitutionsTests.java Thu Feb 12 01:54:05 2015 +0100 @@ -23,7 +23,6 @@ package com.oracle.graal.hotspot.test; -import static com.oracle.graal.api.code.Assumptions.*; import static org.junit.Assert.*; import org.junit.*; @@ -33,6 +32,7 @@ import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; public class ClassSubstitutionsTests extends GraalCompilerTest { @@ -44,7 +44,7 @@ protected StructuredGraph test(final String snippet) { try (Scope s = Debug.scope("ClassSubstitutionsTest", getMetaAccess().lookupJavaMethod(getMethod(snippet)))) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); compile(graph.method(), graph); assertNotInGraph(graph, Invoke.class); Debug.dump(graph, snippet); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,14 +22,13 @@ */ package com.oracle.graal.hotspot.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; public class HotSpotNmethodTest extends GraalCompilerTest { @@ -38,7 +37,7 @@ @Test public void testInstallCodeInvalidation() { final ResolvedJavaMethod testJavaMethod = getResolvedJavaMethod("foo"); - final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo", ALLOW_OPTIMISTIC_ASSUMPTIONS)); + final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo", AllowAssumptions.YES)); Assert.assertTrue(nmethod.isValid()); Object result; try { @@ -61,7 +60,7 @@ @Test public void testInstallCodeInvalidationWhileRunning() { final ResolvedJavaMethod testJavaMethod = getResolvedJavaMethod("foo"); - final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo", ALLOW_OPTIMISTIC_ASSUMPTIONS)); + final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo", AllowAssumptions.YES)); Object result; try { result = nmethod.executeVarargs(nmethod, null, null); @@ -75,7 +74,7 @@ @Test public void testInstalledCodeCalledFromCompiledCode() { final ResolvedJavaMethod testJavaMethod = getResolvedJavaMethod("foo"); - final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo", ALLOW_OPTIMISTIC_ASSUMPTIONS)); + final HotSpotNmethod nmethod = (HotSpotNmethod) getCode(testJavaMethod, parseEager("otherFoo", AllowAssumptions.YES)); Assert.assertTrue(nmethod.isValid()); try { for (int i = 0; i < ITERATION_COUNT; ++i) { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNodeSubstitutionsTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNodeSubstitutionsTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNodeSubstitutionsTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,12 +22,11 @@ */ package com.oracle.graal.hotspot.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.replacements.test.*; /** @@ -37,7 +36,7 @@ @Test public void test() { - StructuredGraph graph = new StructuredGraph(ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = new StructuredGraph(AllowAssumptions.YES); test("getNodeClass", ConstantNode.forInt(42, graph)); } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -31,6 +31,7 @@ import com.oracle.graal.compiler.test.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; public class InstalledCodeExecuteHelperTest extends GraalCompilerTest { @@ -68,8 +69,8 @@ } @Override - protected StructuredGraph parseEager(ResolvedJavaMethod m, boolean allowOptimisticAssumptions) { - StructuredGraph graph = super.parseEager(m, allowOptimisticAssumptions); + protected StructuredGraph parseEager(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) { + StructuredGraph graph = super.parseEager(m, allowAssumptions); if (argsToBind != null) { Object receiver = isStatic(m.getModifiers()) ? null : this; Object[] args = argsWithReceiver(receiver, argsToBind); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.hotspot.test; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.debug.internal.MemUseTrackerImpl.*; import static com.oracle.graal.hotspot.CompileTheWorld.*; import static com.oracle.graal.hotspot.CompileTheWorld.Options.*; @@ -35,6 +34,7 @@ import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.CompileTheWorld.Config; import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.printer.*; /** @@ -165,7 +165,7 @@ private void compileAndTime(String methodName) { // Parse in eager mode to resolve methods/fields/classes - parseEager(methodName, ALLOW_OPTIMISTIC_ASSUMPTIONS); + parseEager(methodName, AllowAssumptions.YES); // Warm up and initialize compiler phases used by this compilation for (int i = 0; i < 10; i++) { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.hotspot.test; -import static com.oracle.graal.api.code.Assumptions.*; - import java.lang.ref.*; import org.junit.*; @@ -40,6 +38,7 @@ import com.oracle.graal.hotspot.replacements.*; import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; @@ -245,7 +244,7 @@ private void testHelper(final String snippetName, final int expectedBarriers) throws Exception, SecurityException { ResolvedJavaMethod snippet = getResolvedJavaMethod(snippetName); try (Scope s = Debug.scope("WriteBarrierAdditionTest", snippet)) { - StructuredGraph graph = parseEager(snippet, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO); HighTierContext highContext = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); MidTierContext midContext = new MidTierContext(getProviders(), getCodeCache().getTarget(), OptimisticOptimizations.ALL, graph.method().getProfilingInfo(), null); new NodeIntrinsificationPhase(getProviders(), getSnippetReflection()).apply(graph); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.hotspot.test; -import static com.oracle.graal.api.code.Assumptions.*; - import java.util.*; import org.junit.*; @@ -38,6 +36,7 @@ import com.oracle.graal.hotspot.phases.*; import com.oracle.graal.hotspot.replacements.arraycopy.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; @@ -627,7 +626,7 @@ private void testPredicate(final String snippet, final GraphPredicate expectedBarriers, final int... removedBarrierIndices) { try (Scope d = Debug.scope("WriteBarrierVerificationTest", new DebugDumpScope(snippet))) { - final StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + final StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); HighTierContext highTierContext = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, highTierContext); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Thu Feb 12 01:54:05 2015 +0100 @@ -213,10 +213,10 @@ Replacements replacements = providers.getReplacements(); graph = replacements.getMethodSubstitution(method); if (graph == null || entryBCI != INVOCATION_ENTRY_BCI) { - graph = new StructuredGraph(method, entryBCI, OptAssumptions.getValue()); + graph = new StructuredGraph(method, entryBCI, AllowAssumptions.from(OptAssumptions.getValue())); } else { // Compiling method substitution - must clone the graph - graph = graph.copy(); + graph = graph.copy(graph.name, method, AllowAssumptions.from(OptAssumptions.getValue())); } InlinedBytecodes.add(method.getCodeSize()); CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java Thu Feb 12 01:54:05 2015 +0100 @@ -183,7 +183,7 @@ CallSite callSite = (CallSite) object; MethodHandle target = callSite.getTarget(); if (!(callSite instanceof ConstantCallSite)) { - if (assumptions == null || !assumptions.useOptimisticAssumptions()) { + if (assumptions == null) { return null; } assumptions.record(new Assumptions.CallSiteTargetValue(callSite, target)); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/NativeCallStubGraphBuilder.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.hotspot.nfi; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; import java.util.*; @@ -33,6 +32,7 @@ import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.word.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.virtual.*; @@ -53,7 +53,7 @@ public static StructuredGraph getGraph(HotSpotProviders providers, RawNativeCallNodeFactory factory, long functionPointer, Class returnType, Class... argumentTypes) { try { ResolvedJavaMethod method = providers.getMetaAccess().lookupJavaMethod(NativeCallStubGraphBuilder.class.getMethod("libCall", Object.class, Object.class, Object.class)); - StructuredGraph g = new StructuredGraph(method, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph g = new StructuredGraph(method, AllowAssumptions.NO); 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))); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java Thu Feb 12 01:54:05 2015 +0100 @@ -32,6 +32,7 @@ import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -72,7 +73,7 @@ Assumptions assumptions = graph().getAssumptions(); type = getConcreteType(getObject().stamp(), assumptions, tool.getMetaAccess()); if (type != null) { - StructuredGraph newGraph = new StructuredGraph(assumptions.useOptimisticAssumptions()); + StructuredGraph newGraph = new StructuredGraph(AllowAssumptions.from(assumptions != null)); ParameterNode param = newGraph.unique(new ParameterNode(0, getObject().stamp())); NewInstanceNode newInstance = newGraph.add(new NewInstanceNode(type, true)); newGraph.addAfterFixed(newGraph.start(), newInstance); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.hotspot.stubs; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.api.code.CallingConvention.Type.*; import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*; @@ -37,6 +36,7 @@ import com.oracle.graal.hotspot.replacements.*; import com.oracle.graal.hotspot.word.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.util.*; import com.oracle.graal.replacements.*; import com.oracle.graal.replacements.nodes.*; @@ -191,7 +191,7 @@ Class[] args = linkage.getDescriptor().getArgumentTypes(); boolean isObjectResult = linkage.getOutgoingCallingConvention().getReturn().getKind() == Kind.Object; - StructuredGraph graph = new StructuredGraph(toString(), null, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = new StructuredGraph(toString(), null, AllowAssumptions.NO); GraphKit kit = new HotSpotGraphKit(graph, providers); ParameterNode[] params = createParameters(kit, args); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Thu Feb 12 01:54:05 2015 +0100 @@ -157,7 +157,7 @@ if (code == null) { try (Scope d = Debug.sandbox("CompilingStub", DebugScope.getConfig(), providers.getCodeCache(), debugScopeContext())) { final StructuredGraph graph = getGraph(); - assert !graph.getAssumptions().useOptimisticAssumptions(); + assert graph.getAssumptions() == null; if (!(graph.start() instanceof StubStartNode)) { StubStartNode newStart = graph.add(new StubStartNode(Stub.this)); newStart.setStateAfter(graph.start().stateAfter()); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -32,6 +32,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; /** * Base class for the JTT tests. @@ -56,8 +57,8 @@ } @Override - protected StructuredGraph parseEager(ResolvedJavaMethod m, boolean allowOptimisticAssumptions) { - StructuredGraph graph = super.parseEager(m, allowOptimisticAssumptions); + protected StructuredGraph parseEager(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) { + StructuredGraph graph = super.parseEager(m, allowAssumptions); if (argsToBind != null) { Object receiver = isStatic(m.getModifiers()) ? null : this; Object[] args = argsWithReceiver(receiver, argsToBind); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java --- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.nodes.test; -import static com.oracle.graal.api.code.Assumptions.*; import static org.junit.Assert.*; import org.junit.*; @@ -32,6 +31,7 @@ import com.oracle.graal.compiler.common.type.ArithmeticOpTable.ShiftOp; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; /** * This class tests that integer stamps are created correctly for constants. @@ -46,7 +46,7 @@ @Before public void before() { - graph = new StructuredGraph(ALLOW_OPTIMISTIC_ASSUMPTIONS); + graph = new StructuredGraph(AllowAssumptions.YES); } @Test diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/LoopPhiCanonicalizerTest.java --- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/LoopPhiCanonicalizerTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/LoopPhiCanonicalizerTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,13 +22,12 @@ */ package com.oracle.graal.nodes.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.graph.iterators.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -58,7 +57,7 @@ @Test public void test() { - StructuredGraph graph = parseEager("loopSnippet", ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("loopSnippet", AllowAssumptions.YES); NodePredicate loopPhis = node -> node instanceof PhiNode && ((PhiNode) node).merge() instanceof LoopBeginNode; PhaseContext context = new PhaseContext(getProviders()); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/NegateNodeCanonicalizationTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.nodes.test; -import static com.oracle.graal.api.code.Assumptions.*; import static org.junit.Assert.*; import org.junit.*; @@ -30,6 +29,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; /** * This class tests that the canonicalization for constant negate nodes cover all cases. @@ -40,7 +40,7 @@ @Before public void before() { - graph = new StructuredGraph(ALLOW_OPTIMISTIC_ASSUMPTIONS); + graph = new StructuredGraph(AllowAssumptions.YES); } @Test diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Thu Feb 12 01:54:05 2015 +0100 @@ -26,7 +26,7 @@ import java.util.concurrent.atomic.*; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.Assumptions.OptimisticAssumption; +import com.oracle.graal.api.code.Assumptions.Assumption; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.graph.*; @@ -82,6 +82,17 @@ } } + /** + * Constants denoting whether or not {@link Assumption}s can be made while processing a graph. + */ + public enum AllowAssumptions { + YES, + NO; + public static AllowAssumptions from(boolean flag) { + return flag ? YES : NO; + } + } + public static final int INVOCATION_ENTRY_BCI = -1; public static final long INVALID_GRAPH_ID = -1; @@ -101,50 +112,41 @@ private final Assumptions assumptions; /** + * The methods whose bytecodes are used while constructing this graph. + */ + private Set methods = new HashSet<>(); + + /** * Creates a new Graph containing a single {@link AbstractBeginNode} as the {@link #start() * start} node. - * - * @param allowOptimisticAssumptions specifies whether {@link OptimisticAssumption}s can be made - * while processing the graph */ - public StructuredGraph(boolean allowOptimisticAssumptions) { - this(null, null, allowOptimisticAssumptions); + public StructuredGraph(AllowAssumptions allowAssumptions) { + this(null, null, allowAssumptions); } /** * Creates a new Graph containing a single {@link AbstractBeginNode} as the {@link #start() * start} node. - * - * @param allowOptimisticAssumptions specifies whether {@link OptimisticAssumption}s can be made - * while processing the graph */ - public StructuredGraph(String name, ResolvedJavaMethod method, boolean allowOptimisticAssumptions) { - this(name, method, uniqueGraphIds.incrementAndGet(), INVOCATION_ENTRY_BCI, null, allowOptimisticAssumptions); + public StructuredGraph(String name, ResolvedJavaMethod method, AllowAssumptions allowAssumptions) { + this(name, method, uniqueGraphIds.incrementAndGet(), INVOCATION_ENTRY_BCI, allowAssumptions); } - /** - * @param allowOptimisticAssumptions specifies whether {@link OptimisticAssumption}s can be made - * while processing the graph - */ - public StructuredGraph(ResolvedJavaMethod method, boolean allowOptimisticAssumptions) { - this(null, method, uniqueGraphIds.incrementAndGet(), INVOCATION_ENTRY_BCI, null, allowOptimisticAssumptions); + public StructuredGraph(ResolvedJavaMethod method, AllowAssumptions allowAssumptions) { + this(null, method, uniqueGraphIds.incrementAndGet(), INVOCATION_ENTRY_BCI, allowAssumptions); } - /** - * @param allowOptimisticAssumptions specifies whether {@link OptimisticAssumption}s can be made - * while processing the graph - */ - public StructuredGraph(ResolvedJavaMethod method, int entryBCI, boolean allowOptimisticAssumptions) { - this(null, method, uniqueGraphIds.incrementAndGet(), entryBCI, null, allowOptimisticAssumptions); + public StructuredGraph(ResolvedJavaMethod method, int entryBCI, AllowAssumptions allowAssumptions) { + this(null, method, uniqueGraphIds.incrementAndGet(), entryBCI, allowAssumptions); } - private StructuredGraph(String name, ResolvedJavaMethod method, long graphId, int entryBCI, Assumptions assumptions, boolean allowOptimisticAssumptions) { + private StructuredGraph(String name, ResolvedJavaMethod method, long graphId, int entryBCI, AllowAssumptions allowAssumptions) { super(name); this.setStart(add(new StartNode())); this.method = method; this.graphId = graphId; this.entryBCI = entryBCI; - this.assumptions = assumptions == null ? new Assumptions(allowOptimisticAssumptions) : assumptions; + this.assumptions = allowAssumptions == AllowAssumptions.YES ? new Assumptions() : null; } public Stamp getReturnStamp() { @@ -218,9 +220,17 @@ } public StructuredGraph copy(String newName, ResolvedJavaMethod newMethod) { - final boolean ignored = true; - StructuredGraph copy = new StructuredGraph(newName, newMethod, graphId, entryBCI, assumptions, ignored); - assert copy.assumptions.equals(assumptions); + return copy(newName, newMethod, AllowAssumptions.from(assumptions != null)); + } + + public StructuredGraph copy(String newName, ResolvedJavaMethod newMethod, AllowAssumptions allowAssumptions) { + StructuredGraph copy = new StructuredGraph(newName, newMethod, graphId, entryBCI, allowAssumptions); + if (allowAssumptions == AllowAssumptions.YES && assumptions != null) { + copy.assumptions.record(assumptions); + } + if (!isMethodRecordingEnabled()) { + copy.disableMethodRecording(); + } copy.setGuardsStage(getGuardsStage()); copy.isAfterFloatingReadPhase = isAfterFloatingReadPhase; copy.hasValueProxies = hasValueProxies; @@ -492,7 +502,36 @@ hasValueProxies = state; } + /** + * Gets the object for recording assumptions while constructing of this graph. + * + * @return {@code null} if assumptions cannot be made for this graph + */ public Assumptions getAssumptions() { return assumptions; } + + /** + * Disables recording of method used while constructing this graph. This can be done at most + * once and must be done before any methods are recorded. + */ + public void disableMethodRecording() { + assert methods != null : "cannot disable method recording more than once"; + assert methods.isEmpty() : "cannot disable method recording once methods have been recorded"; + methods = null; + } + + public boolean isMethodRecordingEnabled() { + return methods != null; + } + + /** + * Gets the methods whose bytecodes are used while constructing this graph. + * + * @return {@code null} if method recording has been {@linkplain #disableMethodRecording() + * disabled} + */ + public Set getMethods() { + return methods; + } } diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Thu Feb 12 01:54:05 2015 +0100 @@ -73,7 +73,7 @@ ResolvedJavaType exactType; if (objectStamp.isExactType()) { exactType = objectStamp.type(); - } else if (objectStamp.type() != null && graph().getAssumptions().useOptimisticAssumptions()) { + } else if (objectStamp.type() != null && graph().getAssumptions() != null) { exactType = objectStamp.type().findUniqueConcreteSubtype(); if (exactType != null) { graph().getAssumptions().recordConcreteSubtype(objectStamp.type(), exactType); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Thu Feb 12 01:54:05 2015 +0100 @@ -70,7 +70,7 @@ return resolveExactMethod(tool, type); } Assumptions assumptions = graph().getAssumptions(); - if (type != null && assumptions.useOptimisticAssumptions()) { + if (type != null && assumptions != null) { ResolvedJavaMethod resolvedMethod = type.findUniqueConcreteMethod(method); if (resolvedMethod != null && !type.isInterface() && method.getDeclaringClass().isAssignableFrom(type)) { assumptions.recordConcreteMethod(method, type, resolvedMethod); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Thu Feb 12 01:54:05 2015 +0100 @@ -159,7 +159,7 @@ } Assumptions assumptions = graph().getAssumptions(); - if (assumptions.useOptimisticAssumptions()) { + if (assumptions != null) { ResolvedJavaType exactType = type.findUniqueConcreteSubtype(); if (exactType != null && !exactType.equals(type)) { // Propagate more precise type information to usages of the checkcast. diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Thu Feb 12 01:54:05 2015 +0100 @@ -79,7 +79,7 @@ return result; } Assumptions assumptions = graph().getAssumptions(); - if (assumptions.useOptimisticAssumptions()) { + if (assumptions != null) { ResolvedJavaType exact = stampType.findUniqueConcreteSubtype(); if (exact != null) { result = checkInstanceOf(forValue, exact, objectStamp.nonNull(), true); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Thu Feb 12 01:54:05 2015 +0100 @@ -124,7 +124,7 @@ return resolvedMethod; } Assumptions assumptions = receiver.graph().getAssumptions(); - if (assumptions.useOptimisticAssumptions()) { + if (assumptions != null) { ResolvedJavaType uniqueConcreteType = type.findUniqueConcreteSubtype(); if (uniqueConcreteType != null) { ResolvedJavaMethod methodFromUniqueType = uniqueConcreteType.resolveConcreteMethod(targetMethod, contextType); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java Thu Feb 12 01:54:05 2015 +0100 @@ -67,7 +67,7 @@ } else if (objectStamp.type() != null && !objectStamp.type().hasFinalizableSubclass()) { // if either the declared type of receiver or the holder // can be assumed to have no finalizers - if (assumptions.useOptimisticAssumptions()) { + if (assumptions != null) { assumptions.recordNoFinalizableSubclassAssumption(objectStamp.type()); return false; } diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java Thu Feb 12 01:54:05 2015 +0100 @@ -364,7 +364,14 @@ GraphUtil.killCFG(invokeNode); // Copy assumptions from inlinee to caller - graph.getAssumptions().record(inlineGraph.getAssumptions()); + Assumptions assumptions = graph.getAssumptions(); + if (assumptions != null) { + if (inlineGraph.getAssumptions() != null) { + assumptions.record(inlineGraph.getAssumptions()); + } + } else { + assert inlineGraph.getAssumptions() == null : "cannot inline graph which makes assumptions into a graph that doesn't: " + inlineGraph + " -> " + graph; + } return duplicates; } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/AbstractInlineInfo.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/AbstractInlineInfo.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/AbstractInlineInfo.java Thu Feb 12 01:54:05 2015 +0100 @@ -24,15 +24,13 @@ import java.util.*; -import com.oracle.graal.api.meta.ResolvedJavaMethod; +import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.phases.common.CanonicalizerPhase; -import com.oracle.graal.phases.common.inlining.InliningUtil; -import com.oracle.graal.phases.common.inlining.info.elem.Inlineable; -import com.oracle.graal.phases.common.inlining.info.elem.InlineableMacroNode; -import com.oracle.graal.phases.common.inlining.info.elem.InlineableGraph; -import com.oracle.graal.phases.tiers.HighTierContext; +import com.oracle.graal.phases.common.*; +import com.oracle.graal.phases.common.inlining.*; +import com.oracle.graal.phases.common.inlining.info.elem.*; +import com.oracle.graal.phases.tiers.*; public abstract class AbstractInlineInfo implements InlineInfo { @@ -67,7 +65,10 @@ } InliningUtil.InlinedBytecodes.add(concrete.getCodeSize()); - invoke.asNode().graph().getAssumptions().recordMethodContents(concrete); + StructuredGraph graph = invoke.asNode().graph(); + if (graph.isMethodRecordingEnabled()) { + graph.getMethods().add(concrete); + } return canonicalizeNodes; } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java Thu Feb 12 01:54:05 2015 +0100 @@ -32,6 +32,7 @@ import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; import com.oracle.graal.phases.graph.*; @@ -198,7 +199,7 @@ * for cloning before modification.

    */ private static StructuredGraph parseBytecodes(ResolvedJavaMethod method, HighTierContext context, CanonicalizerPhase canonicalizer, StructuredGraph caller) { - StructuredGraph newGraph = new StructuredGraph(method, caller.getAssumptions().useOptimisticAssumptions()); + StructuredGraph newGraph = new StructuredGraph(method, AllowAssumptions.from(caller.getAssumptions() != null)); try (Debug.Scope s = Debug.scope("InlineGraph", newGraph)) { if (context.getGraphBuilderSuite() != null) { context.getGraphBuilderSuite().apply(newGraph, context); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java Thu Feb 12 01:54:05 2015 +0100 @@ -193,7 +193,7 @@ } } - if (callTarget.graph().getAssumptions().useOptimisticAssumptions()) { + if (callTarget.graph().getAssumptions() != null) { ResolvedJavaType uniqueSubtype = holder.findUniqueConcreteSubtype(); if (uniqueSubtype != null) { ResolvedJavaMethod resolvedMethod = uniqueSubtype.resolveConcreteMethod(targetMethod, contextType); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ArraysSubstitutionsTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ArraysSubstitutionsTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ArraysSubstitutionsTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,13 +22,12 @@ */ package com.oracle.graal.replacements.test; -import static com.oracle.graal.api.code.Assumptions.*; - import java.util.*; import org.junit.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; @@ -331,7 +330,7 @@ @Test public void testCanonicalLength() { - StructuredGraph graph = parseEager("testCanonicalLengthSnippet", DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("testCanonicalLengthSnippet", AllowAssumptions.NO); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); @@ -347,7 +346,7 @@ @Test public void testCanonicalEqual() { - StructuredGraph graph = parseEager("testCanonicalEqualSnippet", DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("testCanonicalEqualSnippet", AllowAssumptions.NO); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); @@ -361,7 +360,7 @@ @Test public void testVirtualEqual() { - StructuredGraph graph = parseEager("testVirtualEqualSnippet", DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("testVirtualEqualSnippet", AllowAssumptions.NO); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); @@ -379,7 +378,7 @@ @Test public void testVirtualNotEqual() { - StructuredGraph graph = parseEager("testVirtualNotEqualSnippet", DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager("testVirtualNotEqualSnippet", AllowAssumptions.NO); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, new PhaseContext(getProviders())); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/BitOpNodesTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/BitOpNodesTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/BitOpNodesTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,14 +22,13 @@ */ package com.oracle.graal.replacements.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.type.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; @@ -248,7 +247,7 @@ * @return the returned value or null if {@code expectedClass} is not found in the graph. */ private ValueNode parseAndInline(String name, Class expectedClass) { - StructuredGraph graph = parseEager(name, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(name, AllowAssumptions.YES); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.NONE); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); canonicalizer.apply(graph, context); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -27,6 +27,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.common.*; @@ -40,8 +41,8 @@ } @Override - protected StructuredGraph parseEager(ResolvedJavaMethod m, boolean allowOptimisticAssumptions) { - StructuredGraph graph = super.parseEager(m, allowOptimisticAssumptions); + protected StructuredGraph parseEager(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) { + StructuredGraph graph = super.parseEager(m, allowAssumptions); int handlers = graph.getNodes().filter(ExceptionObjectNode.class).count(); Assert.assertEquals(1, handlers); return graph; diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/EdgesTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/EdgesTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/EdgesTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.replacements.test; -import static com.oracle.graal.api.code.Assumptions.*; - import java.lang.reflect.*; import org.junit.*; @@ -34,6 +32,7 @@ import com.oracle.graal.graph.Edges.Type; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; @@ -55,7 +54,7 @@ } - StructuredGraph graph = new StructuredGraph(DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = new StructuredGraph(AllowAssumptions.NO); TestNode node; ConstantNode i1; ConstantNode i2; @@ -114,7 +113,7 @@ } ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); - StructuredGraph g = parseProfiled(javaMethod, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph g = parseProfiled(javaMethod, AllowAssumptions.NO); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); new InliningPhase(new InlineMethodSubstitutionsPolicy(), new CanonicalizerPhase(true)).apply(g, context); new CanonicalizerPhase(false).apply(g, context); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.replacements.test; -import static com.oracle.graal.api.code.Assumptions.*; import static org.junit.Assert.*; import java.lang.reflect.*; @@ -35,6 +34,7 @@ import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.common.inlining.*; @@ -49,7 +49,7 @@ protected StructuredGraph test(final String snippet) { try (Scope s = Debug.scope("MethodSubstitutionTest", getResolvedJavaMethod(snippet))) { - StructuredGraph graph = parseEager(snippet, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES); HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); Debug.dump(graph, "Graph"); new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,14 +22,13 @@ */ package com.oracle.graal.replacements.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.replacements.*; @@ -53,49 +52,49 @@ private static final ThreadLocal inliningPolicy = new ThreadLocal<>(); @Override - protected StructuredGraph parseEager(ResolvedJavaMethod m, boolean allowOptimisticAssumptions) { + protected StructuredGraph parseEager(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) { return installer.makeGraph(m, null, inliningPolicy.get(), FrameStateProcessing.CollapseFrameForSingleSideEffect); } @Test public void testRead1() { for (Kind kind : KINDS) { - assertRead(parseEager("read" + kind.name() + "1", ALLOW_OPTIMISTIC_ASSUMPTIONS), kind, true, ID); + assertRead(parseEager("read" + kind.name() + "1", AllowAssumptions.YES), kind, true, ID); } } @Test public void testRead2() { for (Kind kind : KINDS) { - assertRead(parseEager("read" + kind.name() + "2", ALLOW_OPTIMISTIC_ASSUMPTIONS), kind, true, ID); + assertRead(parseEager("read" + kind.name() + "2", AllowAssumptions.YES), kind, true, ID); } } @Test public void testRead3() { for (Kind kind : KINDS) { - assertRead(parseEager("read" + kind.name() + "3", ALLOW_OPTIMISTIC_ASSUMPTIONS), kind, true, LocationIdentity.ANY_LOCATION); + assertRead(parseEager("read" + kind.name() + "3", AllowAssumptions.YES), kind, true, LocationIdentity.ANY_LOCATION); } } @Test public void testWrite1() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "1", ALLOW_OPTIMISTIC_ASSUMPTIONS), true, ID); + assertWrite(parseEager("write" + kind.name() + "1", AllowAssumptions.YES), true, ID); } } @Test public void testWrite2() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "2", ALLOW_OPTIMISTIC_ASSUMPTIONS), true, ID); + assertWrite(parseEager("write" + kind.name() + "2", AllowAssumptions.YES), true, ID); } } @Test public void testWrite3() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "3", ALLOW_OPTIMISTIC_ASSUMPTIONS), true, LocationIdentity.ANY_LOCATION); + assertWrite(parseEager("write" + kind.name() + "3", AllowAssumptions.YES), true, LocationIdentity.ANY_LOCATION); } } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,14 +22,13 @@ */ package com.oracle.graal.replacements.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.phases.*; @@ -59,49 +58,49 @@ private static final ThreadLocal inliningPolicy = new ThreadLocal<>(); @Override - protected StructuredGraph parseEager(ResolvedJavaMethod m, boolean allowOptimisticAssumptions) { + protected StructuredGraph parseEager(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) { return installer.makeGraph(m, null, inliningPolicy.get(), FrameStateProcessing.CollapseFrameForSingleSideEffect); } @Test public void testRead1() { for (Kind kind : KINDS) { - assertRead(parseEager("read" + kind.name() + "1", ALLOW_OPTIMISTIC_ASSUMPTIONS), kind, true, ID); + assertRead(parseEager("read" + kind.name() + "1", AllowAssumptions.YES), kind, true, ID); } } @Test public void testRead2() { for (Kind kind : KINDS) { - assertRead(parseEager("read" + kind.name() + "2", ALLOW_OPTIMISTIC_ASSUMPTIONS), kind, true, ID); + assertRead(parseEager("read" + kind.name() + "2", AllowAssumptions.YES), kind, true, ID); } } @Test public void testRead3() { for (Kind kind : KINDS) { - assertRead(parseEager("read" + kind.name() + "3", ALLOW_OPTIMISTIC_ASSUMPTIONS), kind, true, LocationIdentity.ANY_LOCATION); + assertRead(parseEager("read" + kind.name() + "3", AllowAssumptions.YES), kind, true, LocationIdentity.ANY_LOCATION); } } @Test public void testWrite1() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "1", ALLOW_OPTIMISTIC_ASSUMPTIONS), true, ID); + assertWrite(parseEager("write" + kind.name() + "1", AllowAssumptions.YES), true, ID); } } @Test public void testWrite2() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "2", ALLOW_OPTIMISTIC_ASSUMPTIONS), true, ID); + assertWrite(parseEager("write" + kind.name() + "2", AllowAssumptions.YES), true, ID); } } @Test public void testWrite3() { for (Kind kind : KINDS) { - assertWrite(parseEager("write" + kind.name() + "3", ALLOW_OPTIMISTIC_ASSUMPTIONS), true, LocationIdentity.ANY_LOCATION); + assertWrite(parseEager("write" + kind.name() + "3", AllowAssumptions.YES), true, LocationIdentity.ANY_LOCATION); } } @@ -403,7 +402,7 @@ private void assertNumWordCasts(String snippetName, int expectedWordCasts) { HighTierContext context = new HighTierContext(getProviders(), null, null, OptimisticOptimizations.ALL); - StructuredGraph graph = parseEager(snippetName, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(snippetName, AllowAssumptions.YES); new CanonicalizerPhase(false).apply(graph, context); Assert.assertEquals(expectedWordCasts, graph.getNodes().filter(WordCastNode.class).count()); } diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -27,6 +27,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.replacements.*; import com.oracle.graal.replacements.ReplacementsImpl.FrameStateProcessing; import com.oracle.graal.replacements.Snippet.SnippetInliningPolicy; @@ -46,7 +47,7 @@ private static final ThreadLocal inliningPolicy = new ThreadLocal<>(); @Override - protected StructuredGraph parseEager(ResolvedJavaMethod m, boolean allowOptimisticAssumptions) { + protected StructuredGraph parseEager(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) { return installer.makeGraph(m, null, inliningPolicy.get(), FrameStateProcessing.CollapseFrameForSingleSideEffect); } diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.replacements; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.api.meta.MetaUtil.*; import static com.oracle.graal.compiler.GraalCompiler.*; import static com.oracle.graal.compiler.common.GraalOptions.*; @@ -48,6 +47,7 @@ import com.oracle.graal.java.*; import com.oracle.graal.java.GraphBuilderPhase.Instance; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; @@ -609,7 +609,7 @@ protected StructuredGraph buildInitialGraph(final ResolvedJavaMethod methodToParse) { // Replacements cannot have optimistic assumptions since they have // to be valid for the entire run of the VM. - final StructuredGraph graph = new StructuredGraph(methodToParse, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + final StructuredGraph graph = new StructuredGraph(methodToParse, AllowAssumptions.NO); try (Scope s = Debug.scope("buildInitialGraph", graph)) { MetaAccessProvider metaAccess = replacements.providers.getMetaAccess(); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.replacements; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.api.meta.LocationIdentity.*; import static com.oracle.graal.compiler.common.GraalOptions.*; import static com.oracle.graal.debug.Debug.*; @@ -50,6 +49,7 @@ import com.oracle.graal.loop.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.StructuredGraph.GuardsStage; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; @@ -565,7 +565,7 @@ PhaseContext phaseContext = new PhaseContext(providers); // Copy snippet graph, replacing constant parameters with given arguments - final StructuredGraph snippetCopy = new StructuredGraph(snippetGraph.name, snippetGraph.method(), DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + final StructuredGraph snippetCopy = new StructuredGraph(snippetGraph.name, snippetGraph.method(), AllowAssumptions.NO); Map nodeReplacements = Node.newIdentityMap(); nodeReplacements.put(snippetGraph.start(), snippetCopy.start()); @@ -1246,7 +1246,7 @@ // Inline the snippet nodes, replacing parameters with the given args in the process String name = snippet.name == null ? "{copy}" : snippet.name + "{copy}"; - StructuredGraph snippetCopy = new StructuredGraph(name, snippet.method(), DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph snippetCopy = new StructuredGraph(name, snippet.method(), AllowAssumptions.NO); StartNode entryPointNode = snippet.start(); FixedNode firstCFGNode = entryPointNode.next(); StructuredGraph replaceeGraph = replacee.graph(); diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.truffle.hotspot; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.api.code.CodeUtil.*; import static com.oracle.graal.compiler.GraalCompiler.*; import static com.oracle.graal.graph.util.CollectionsAccess.*; @@ -48,6 +47,7 @@ import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.phases.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.inlining.*; @@ -179,7 +179,7 @@ Suites suites = suitesProvider.createSuites(); LIRSuites lirSuites = suitesProvider.createLIRSuites(); removeInliningPhase(suites); - StructuredGraph graph = new StructuredGraph(javaMethod, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = new StructuredGraph(javaMethod, AllowAssumptions.NO); new GraphBuilderPhase.Instance(metaAccess, providers.getStampProvider(), providers.getConstantReflection(), GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); PhaseSuite graphBuilderSuite = getGraphBuilderSuite(suitesProvider); CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false); diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java --- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,14 +22,13 @@ */ package com.oracle.graal.truffle.test; -import static com.oracle.graal.api.code.Assumptions.*; - import org.junit.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -55,14 +54,14 @@ protected OptimizedCallTarget compileHelper(String methodName, RootNode root, Object[] arguments) { final OptimizedCallTarget compilable = (OptimizedCallTarget) Truffle.getRuntime().createCallTarget(root); - StructuredGraph actual = partialEval(compilable, arguments, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph actual = partialEval(compilable, arguments, AllowAssumptions.YES); truffleCompiler.compileMethodHelper(actual, methodName, null, getSpeculationLog(), compilable); return compilable; } protected OptimizedCallTarget assertPartialEvalEquals(String methodName, RootNode root, Object[] arguments) { final OptimizedCallTarget compilable = (OptimizedCallTarget) Truffle.getRuntime().createCallTarget(root); - StructuredGraph actual = partialEval(compilable, arguments, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph actual = partialEval(compilable, arguments, AllowAssumptions.YES); truffleCompiler.compileMethodHelper(actual, methodName, null, getSpeculationLog(), compilable); removeFrameStates(actual); StructuredGraph expected = parseForComparison(methodName); @@ -76,21 +75,21 @@ protected void assertPartialEvalNoInvokes(RootNode root, Object[] arguments) { final OptimizedCallTarget compilable = (OptimizedCallTarget) Truffle.getRuntime().createCallTarget(root); - StructuredGraph actual = partialEval(compilable, arguments, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph actual = partialEval(compilable, arguments, AllowAssumptions.YES); removeFrameStates(actual); for (MethodCallTargetNode node : actual.getNodes(MethodCallTargetNode.class)) { Assert.fail("Found invalid method call target node: " + node); } } - protected StructuredGraph partialEval(OptimizedCallTarget compilable, Object[] arguments, boolean allowOptimisticAssumptions) { + protected StructuredGraph partialEval(OptimizedCallTarget compilable, Object[] arguments, AllowAssumptions allowAssumptions) { // Executed AST so that all classes are loaded and initialized. compilable.call(arguments); compilable.call(arguments); compilable.call(arguments); try (Scope s = Debug.scope("TruffleCompilation", new TruffleDebugJavaMethod(compilable))) { - return truffleCompiler.getPartialEvaluator().createGraph(compilable, allowOptimisticAssumptions, null); + return truffleCompiler.getPartialEvaluator().createGraph(compilable, allowAssumptions, null); } catch (Throwable e) { throw Debug.handle(e); } @@ -107,7 +106,7 @@ protected StructuredGraph parseForComparison(final String methodName) { try (Scope s = Debug.scope("Truffle", new DebugDumpScope("Comparison: " + methodName))) { - StructuredGraph graph = parseEager(methodName, ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = parseEager(methodName, AllowAssumptions.YES); compile(graph.method(), graph); return graph; } catch (Throwable e) { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Thu Feb 12 01:54:05 2015 +0100 @@ -40,6 +40,7 @@ import com.oracle.graal.loop.*; import com.oracle.graal.nodes.CallTargetNode.InvokeKind; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; @@ -96,7 +97,7 @@ } } - public StructuredGraph createGraph(final OptimizedCallTarget callTarget, boolean allowOptimisticAssumptions, GraphBuilderPlugins graalPlugins) { + public StructuredGraph createGraph(final OptimizedCallTarget callTarget, AllowAssumptions allowAssumptions, GraphBuilderPlugins graalPlugins) { if (TraceTruffleCompilationHistogram.getValue() || TraceTruffleCompilationDetails.getValue()) { constantReceivers = new HashSet<>(); } @@ -107,7 +108,7 @@ throw Debug.handle(e); } - final StructuredGraph graph = new StructuredGraph(callTarget.toString(), callRootMethod, allowOptimisticAssumptions); + final StructuredGraph graph = new StructuredGraph(callTarget.toString(), callRootMethod, allowAssumptions); assert graph != null : "no graph for root method"; try (Scope s = Debug.scope("CreateGraph", graph); Indent indent = Debug.logAndIndent("createGraph %s", graph)) { @@ -277,7 +278,7 @@ } public StructuredGraph createInlineGraph(String name, StructuredGraph caller) { - StructuredGraph graph = new StructuredGraph(name, callInlinedMethod, caller.getAssumptions().useOptimisticAssumptions()); + StructuredGraph graph = new StructuredGraph(name, callInlinedMethod, AllowAssumptions.from(caller.getAssumptions() != null)); new GraphBuilderPhase.Instance(providers.getMetaAccess(), providers.getStampProvider(), providers.getConstantReflection(), configForRoot, TruffleCompilerImpl.Optimizations).apply(graph); return graph; } diff -r 48bdad77afcd -r a0a760b0fb5f 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 Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.truffle; -import static com.oracle.graal.api.code.Assumptions.*; - import java.util.*; import java.util.Map.Entry; @@ -36,6 +34,7 @@ import com.oracle.graal.graph.spi.*; import com.oracle.graal.java.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; @@ -61,7 +60,7 @@ private final HashMap, StructuredGraph> cache = new HashMap<>(); private final HashMap, Long> lastUsed = new HashMap<>(); - private final StructuredGraph markerGraph = new StructuredGraph(DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + private final StructuredGraph markerGraph = new StructuredGraph(AllowAssumptions.NO); private final ResolvedJavaType stringBuilderClass; private final ResolvedJavaType runtimeExceptionClass; @@ -120,7 +119,7 @@ lookupExceedsMaxSize(); } - StructuredGraph graph = new StructuredGraph(method, DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS); + StructuredGraph graph = new StructuredGraph(method, AllowAssumptions.NO); PhaseContext phaseContext = new PhaseContext(providers); try (Scope s = Debug.scope("TruffleCache", providers.getMetaAccess(), method)) { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Thu Feb 12 01:54:05 2015 +0100 @@ -22,14 +22,13 @@ */ package com.oracle.graal.truffle; -import static com.oracle.graal.api.code.Assumptions.*; import static com.oracle.graal.api.code.CodeUtil.*; import static com.oracle.graal.compiler.GraalCompiler.*; import java.util.*; +import com.oracle.graal.api.code.Assumptions.Assumption; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.Assumptions.Assumption; import com.oracle.graal.api.code.CallingConvention.Type; import com.oracle.graal.api.meta.*; import com.oracle.graal.api.replacements.*; @@ -43,6 +42,7 @@ import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.phases.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; @@ -123,7 +123,7 @@ GraphBuilderSuiteInfo info = createGraphBuilderSuite(); try (TimerCloseable a = PartialEvaluationTime.start(); Closeable c = PartialEvaluationMemUse.start()) { - graph = partialEvaluator.createGraph(compilable, ALLOW_OPTIMISTIC_ASSUMPTIONS, info.plugins); + graph = partialEvaluator.createGraph(compilable, AllowAssumptions.YES, info.plugins); } if (Thread.currentThread().isInterrupted()) { @@ -166,6 +166,13 @@ compilationNotify.notifyCompilationGraalTierFinished((OptimizedCallTarget) predefinedInstalledCode, graph); + if (graph.isMethodRecordingEnabled()) { + Set methods = graph.getMethods(); + result.setMethods(methods.toArray(new ResolvedJavaMethod[methods.size()])); + } else { + assert result.getMethods() == null; + } + List validAssumptions = new ArrayList<>(); Set newAssumptions = new HashSet<>(); for (Assumption assumption : graph.getAssumptions()) { diff -r 48bdad77afcd -r a0a760b0fb5f graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/AssumptionValidAssumption.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/AssumptionValidAssumption.java Wed Feb 11 21:51:26 2015 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/AssumptionValidAssumption.java Thu Feb 12 01:54:05 2015 +0100 @@ -25,7 +25,7 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.truffle.*; -public final class AssumptionValidAssumption extends Assumptions.OptimisticAssumption { +public final class AssumptionValidAssumption extends Assumptions.Assumption { private static final long serialVersionUID = 2010244979610891262L; diff -r 48bdad77afcd -r a0a760b0fb5f src/share/vm/classfile/systemDictionary.hpp --- a/src/share/vm/classfile/systemDictionary.hpp Wed Feb 11 21:51:26 2015 +0100 +++ b/src/share/vm/classfile/systemDictionary.hpp Thu Feb 12 01:54:05 2015 +0100 @@ -207,7 +207,6 @@ GRAAL_ONLY(do_klass(Assumptions_ConcreteMethod_klass, com_oracle_graal_api_code_Assumptions_ConcreteMethod, Graal)) \ GRAAL_ONLY(do_klass(Assumptions_NoFinalizableSubclass_klass, com_oracle_graal_api_code_Assumptions_NoFinalizableSubclass, Graal))\ GRAAL_ONLY(do_klass(Assumptions_ConcreteSubtype_klass, com_oracle_graal_api_code_Assumptions_ConcreteSubtype, Graal)) \ - GRAAL_ONLY(do_klass(Assumptions_MethodContents_klass, com_oracle_graal_api_code_Assumptions_MethodContents, Graal)) \ GRAAL_ONLY(do_klass(Assumptions_CallSiteTargetValue_klass, com_oracle_graal_api_code_Assumptions_CallSiteTargetValue, Graal)) \ GRAAL_ONLY(do_klass(BytecodePosition_klass, com_oracle_graal_api_code_BytecodePosition, Graal)) \ GRAAL_ONLY(do_klass(DebugInfo_klass, com_oracle_graal_api_code_DebugInfo, Graal)) \ diff -r 48bdad77afcd -r a0a760b0fb5f src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Wed Feb 11 21:51:26 2015 +0100 +++ b/src/share/vm/classfile/vmSymbols.hpp Thu Feb 12 01:54:05 2015 +0100 @@ -321,7 +321,6 @@ GRAAL_ONLY(template(com_oracle_graal_api_meta_Kind, "com/oracle/graal/api/meta/Kind")) \ GRAAL_ONLY(template(com_oracle_graal_api_meta_LIRKind, "com/oracle/graal/api/meta/LIRKind")) \ GRAAL_ONLY(template(com_oracle_graal_api_meta_AbstractValue, "com/oracle/graal/api/meta/AbstractValue")) \ - GRAAL_ONLY(template(com_oracle_graal_api_code_Assumptions_MethodContents, "com/oracle/graal/api/code/Assumptions$MethodContents")) \ GRAAL_ONLY(template(com_oracle_graal_api_code_Assumptions_ConcreteSubtype, "com/oracle/graal/api/code/Assumptions$ConcreteSubtype")) \ GRAAL_ONLY(template(com_oracle_graal_api_code_Assumptions_NoFinalizableSubclass, "com/oracle/graal/api/code/Assumptions$NoFinalizableSubclass")) \ GRAAL_ONLY(template(com_oracle_graal_api_code_Assumptions_ConcreteMethod, "com/oracle/graal/api/code/Assumptions$ConcreteMethod")) \ diff -r 48bdad77afcd -r a0a760b0fb5f src/share/vm/graal/graalCodeInstaller.cpp --- a/src/share/vm/graal/graalCodeInstaller.cpp Wed Feb 11 21:51:26 2015 +0100 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Thu Feb 12 01:54:05 2015 +0100 @@ -384,7 +384,7 @@ return new MonitorValue(owner_value, lock_data_loc, eliminated); } -void CodeInstaller::initialize_assumptions(oop compiled_code) { +void CodeInstaller::initialize_dependencies(oop compiled_code) { JavaThread* thread = JavaThread::current(); CompilerThread* compilerThread = thread->is_Compiler_thread() ? thread->as_CompilerThread() : NULL; _oop_recorder = new OopRecorder(&_arena, true); @@ -395,9 +395,7 @@ for (int i = 0; i < length; ++i) { Handle assumption = assumptions->obj_at(i); if (!assumption.is_null()) { - if (assumption->klass() == Assumptions_MethodContents::klass()) { - assumption_MethodContents(assumption); - } else if (assumption->klass() == Assumptions_NoFinalizableSubclass::klass()) { + if (assumption->klass() == Assumptions_NoFinalizableSubclass::klass()) { assumption_NoFinalizableSubclass(assumption); } else if (assumption->klass() == Assumptions_ConcreteSubtype::klass()) { assumption_ConcreteSubtype(assumption); @@ -412,6 +410,15 @@ } } } + objArrayHandle methods = CompilationResult::methods(HotSpotCompiledCode::comp(compiled_code)); + if (!methods.is_null()) { + int length = methods->length(); + for (int i = 0; i < length; ++i) { + Handle method_handle = methods->obj_at(i); + methodHandle method = getMethodFromHotSpotMethod(method_handle()); + _dependencies->assert_evol_method(method()); + } + } } // constructor used to create a method @@ -423,7 +430,7 @@ CodeBuffer buffer(buffer_blob); jobject compiled_code_obj = JNIHandles::make_local(compiled_code()); - initialize_assumptions(JNIHandles::resolve(compiled_code_obj)); + initialize_dependencies(JNIHandles::resolve(compiled_code_obj)); // Get instructions and constants CodeSections early because we need it. _instructions = buffer.insts(); @@ -638,12 +645,6 @@ return true; } -void CodeInstaller::assumption_MethodContents(Handle assumption) { - Handle method_handle = Assumptions_MethodContents::method(assumption()); - methodHandle method = getMethodFromHotSpotMethod(method_handle()); - _dependencies->assert_evol_method(method()); -} - void CodeInstaller::assumption_NoFinalizableSubclass(Handle assumption) { Handle receiverType_handle = Assumptions_NoFinalizableSubclass::receiverType(assumption()); Klass* receiverType = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(receiverType_handle)); diff -r 48bdad77afcd -r a0a760b0fb5f src/share/vm/graal/graalCodeInstaller.hpp --- a/src/share/vm/graal/graalCodeInstaller.hpp Wed Feb 11 21:51:26 2015 +0100 +++ b/src/share/vm/graal/graalCodeInstaller.hpp Thu Feb 12 01:54:05 2015 +0100 @@ -122,14 +122,13 @@ private: // extract the fields of the CompilationResult void initialize_fields(oop target_method); - void initialize_assumptions(oop target_method); + void initialize_dependencies(oop target_method); int estimate_stub_entries(); // perform data and call relocation on the CodeBuffer bool initialize_buffer(CodeBuffer& buffer); - void assumption_MethodContents(Handle assumption); void assumption_NoFinalizableSubclass(Handle assumption); void assumption_ConcreteSubtype(Handle assumption); void assumption_ConcreteMethod(Handle assumption); diff -r 48bdad77afcd -r a0a760b0fb5f src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Wed Feb 11 21:51:26 2015 +0100 +++ b/src/share/vm/graal/graalJavaAccess.hpp Thu Feb 12 01:54:05 2015 +0100 @@ -96,12 +96,10 @@ int_field(CompilationResult, totalFrameSize) \ int_field(CompilationResult, customStackAreaOffset) \ typeArrayOop_field(CompilationResult, targetCode, "[B") \ - objArrayOop_field(CompilationResult, assumptions, "[Lcom/oracle/graal/api/code/Assumptions$Assumption;") \ + objArrayOop_field(CompilationResult, assumptions, "[Lcom/oracle/graal/api/code/Assumptions$Assumption;") \ + objArrayOop_field(CompilationResult, methods, "[Lcom/oracle/graal/api/meta/ResolvedJavaMethod;") \ int_field(CompilationResult, targetCodeSize) \ end_class \ - start_class(Assumptions_MethodContents) \ - oop_field(Assumptions_MethodContents, method, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;") \ - end_class \ start_class(Assumptions_NoFinalizableSubclass) \ oop_field(Assumptions_NoFinalizableSubclass, receiverType, "Lcom/oracle/graal/api/meta/ResolvedJavaType;") \ end_class \