# HG changeset patch # User Doug Simon # Date 1370298928 -7200 # Node ID 6898d89958666e38129553cac2fb03ad53c2292f # Parent 394f38496856a69ee9a7934595b3e5ac4a3c5ff2 converted more options from GraalOptions to new system (GRAAL-27) diff -r 394f38496856 -r 6898d8995866 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 Tue Jun 04 00:33:42 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Tue Jun 04 00:35:28 2013 +0200 @@ -56,6 +56,8 @@ // @formatter:off @Option(help = "") public static final OptionValue VerifyUsageWithEquals = new OptionValue<>(true); + @Option(help = "Enable inlining") + public static final OptionValue Inline = new OptionValue<>(true); // @formatter:on /** @@ -142,7 +144,7 @@ HighTierContext highTierContext = new HighTierContext(runtime, assumptions, replacements); - if (GraalOptions.Inline && !plan.isPhaseDisabled(InliningPhase.class)) { + if (Inline.getValue() && !plan.isPhaseDisabled(InliningPhase.class)) { if (GraalOptions.IterativeInlining) { new IterativeInliningPhase(replacements, cache, plan, optimisticOpts, GraalOptions.OptEarlyReadElimination).apply(graph, highTierContext); } else { diff -r 394f38496856 -r 6898d8995866 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java Tue Jun 04 00:33:42 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java Tue Jun 04 00:35:28 2013 +0200 @@ -56,6 +56,16 @@ public static final OptionValue SummarizePerPhase = new OptionValue<>(false); @Option(help = "Send Graal IR to dump handlers on error") public static final OptionValue DumpOnError = new OptionValue<>(false); + @Option(help = "Enable expensive assertions") + public static final OptionValue DetailedAsserts = new OptionValue(false) { + @Override + protected Boolean initialValue() { + boolean enabled = value; + // turn detailed assertions on when the general assertions are on (misusing the assert keyword for this) + assert (enabled = true) == true; + return enabled; + } + }; // @formatter:on private final DebugFilter logFilter; diff -r 394f38496856 -r 6898d8995866 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Tue Jun 04 00:33:42 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java Tue Jun 04 00:35:28 2013 +0200 @@ -22,6 +22,10 @@ */ package com.oracle.graal.compiler.alloc; +import static com.oracle.graal.api.code.ValueUtil.*; +import static com.oracle.graal.compiler.GraalDebugConfig.*; +import static com.oracle.graal.lir.LIRValueUtil.*; + import java.util.*; import com.oracle.graal.api.code.*; @@ -29,12 +33,8 @@ import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; -import com.oracle.graal.phases.*; import com.oracle.graal.phases.util.*; -import static com.oracle.graal.api.code.ValueUtil.*; -import static com.oracle.graal.lir.LIRValueUtil.*; - /** * Represents an interval in the {@linkplain LinearScan linear scan register allocator}. */ @@ -922,7 +922,7 @@ // do not add use positions for precolored intervals because they are never used if (registerPriority != RegisterPriority.None && isVariable(operand)) { - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { for (int i = 0; i < usePosList.size(); i++) { assert pos <= usePosList.usePos(i) : "already added a use-position with lower position"; if (i > 0) { @@ -1026,7 +1026,7 @@ // split list of use positions result.usePosList = usePosList.splitAt(splitPos); - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { for (int i = 0; i < usePosList.size(); i++) { assert usePosList.usePos(i) < splitPos; } diff -r 394f38496856 -r 6898d8995866 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Jun 04 00:33:42 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Tue Jun 04 00:35:28 2013 +0200 @@ -24,6 +24,7 @@ import static com.oracle.graal.api.code.CodeUtil.*; import static com.oracle.graal.api.code.ValueUtil.*; +import static com.oracle.graal.compiler.GraalDebugConfig.*; import static com.oracle.graal.lir.LIRValueUtil.*; import java.util.*; @@ -509,7 +510,7 @@ // the list is sorted by Interval.spillDefinitionPos Interval interval; interval = createUnhandledLists(mustStoreAtDefinition, null).first; - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { checkIntervals(interval); } @@ -658,7 +659,7 @@ assert index == numInstructions : "must match"; assert (index << 1) == opId : "must match: " + (index << 1); - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { for (int i = 0; i < variables.size(); i++) { assert variables.get(i) != null && variables.get(i).index == i; } @@ -705,7 +706,7 @@ } } - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { verifyInput(block, liveKill, operand); } return operand; @@ -737,7 +738,7 @@ } } - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { // fixed intervals are never live at block boundaries, so // they need not be processed in live sets // process them only in debug mode so that this can be checked @@ -861,7 +862,7 @@ } } while (changeOccurred); - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { verifyLiveness(); } @@ -869,7 +870,7 @@ Block startBlock = ir.cfg.getStartBlock(); BitSet liveInArgs = new BitSet(blockData.get(startBlock).liveIn.size()); if (!blockData.get(startBlock).liveIn.equals(liveInArgs)) { - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { reportFailure(numBlocks); } @@ -1087,7 +1088,7 @@ MoveOp move = (MoveOp) op; if (optimizeMethodArgument(move.getInput())) { StackSlot slot = asStackSlot(move.getInput()); - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { assert op.id() > 0 : "invalid id"; assert blockForId(op.id()).getPredecessorCount() == 0 : "move from stack must be in first block"; assert isVariable(move.getResult()) : "result of move must be a variable"; @@ -1508,7 +1509,7 @@ TTY.println("inserting moves at beginning of toBlock B%d", toBlock.getId()); } - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { assert ir.lir(fromBlock).get(0) instanceof StandardOp.LabelOp : "block does not start with a label"; // because the number of predecessor edges matches the number of @@ -1614,7 +1615,7 @@ assert interval != null : "interval must exist"; if (opId != -1) { - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { Block block = blockForId(opId); if (block.getSuccessorCount() <= 1 && opId == getLastLirInstructionId(block)) { // check if spill moves could have been appended at the end of this block, but @@ -1839,14 +1840,14 @@ sortIntervalsAfterAllocation(); - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { verify(); } eliminateSpillMoves(); assignLocations(); - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { verifyIntervals(); } } @@ -1986,7 +1987,7 @@ Value l1 = i1.location(); Value l2 = i2.location(); if (i1.intersects(i2) && (l1.equals(l2))) { - if (GraalOptions.DetailedAsserts) { + if (DetailedAsserts.getValue()) { TTY.println("Intervals %d and %d overlap and have the same register assigned", i1.operandNumber, i2.operandNumber); TTY.println(i1.logString(this)); TTY.println(i2.logString(this)); diff -r 394f38496856 -r 6898d8995866 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Tue Jun 04 00:33:42 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Tue Jun 04 00:35:28 2013 +0200 @@ -35,6 +35,7 @@ import com.oracle.graal.hotspot.logging.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.options.*; import com.oracle.graal.phases.*; /** @@ -84,9 +85,14 @@ runtime.compilerToVm = toVM; } + // @formatter:off + @Option(help = "The runtime configuration to use") + private static final OptionValue GraalRuntime = new OptionValue<>("basic"); + // @formatter:on + protected static HotSpotGraalRuntimeFactory findFactory(String architecture) { for (HotSpotGraalRuntimeFactory factory : ServiceLoader.loadInstalled(HotSpotGraalRuntimeFactory.class)) { - if (factory.getArchitecture().equals(architecture) && factory.getName().equals(GraalOptions.GraalRuntime)) { + if (factory.getArchitecture().equals(architecture) && factory.getName().equals(GraalRuntime.getValue())) { return factory; } } @@ -123,9 +129,9 @@ return unsafe.getInt(object, offset); } - protected/* final */CompilerToVM compilerToVm; + protected/* final */CompilerToVM compilerToVm; protected/* final */CompilerToGPU compilerToGpu; - protected/* final */VMToCompiler vmToCompiler; + protected/* final */VMToCompiler vmToCompiler; protected final HotSpotRuntime runtime; protected final TargetDescription target; @@ -138,13 +144,13 @@ private final HotSpotBackend backend; protected HotSpotGraalRuntime() { - CompilerToVM toVM = new CompilerToVMImpl(); + CompilerToVM toVM = new CompilerToVMImpl(); CompilerToGPU toGPU = new CompilerToGPUImpl(); // initialize VmToCompiler VMToCompiler toCompiler = new VMToCompilerImpl(this); - compilerToVm = toVM; + compilerToVm = toVM; compilerToGpu = toGPU; vmToCompiler = toCompiler; config = new HotSpotVMConfig(); diff -r 394f38496856 -r 6898d8995866 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Tue Jun 04 00:33:42 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Tue Jun 04 00:35:28 2013 +0200 @@ -33,6 +33,7 @@ import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; +import com.oracle.graal.options.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.PhasePlan.PhasePosition; import com.oracle.graal.phases.common.CanonicalizerPhase.CustomCanonicalizer; @@ -43,6 +44,11 @@ public class InliningPhase extends Phase { + // @formatter:off + @Option(help = "Unconditionally inline intrinsics") + public static final OptionValue AlwaysInlineIntrinsics = new OptionValue<>(false); + // @formatter:on + private final PhasePlan plan; private final MetaAccessProvider runtime; private final Assumptions compilationAssumptions; @@ -340,7 +346,7 @@ } protected boolean isIntrinsic(InlineInfo info) { - if (GraalOptions.AlwaysInlineIntrinsics) { + if (AlwaysInlineIntrinsics.getValue()) { return onlyIntrinsics(info); } else { return onlyForcedIntrinsics(info); diff -r 394f38496856 -r 6898d8995866 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Tue Jun 04 00:33:42 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Tue Jun 04 00:35:28 2013 +0200 @@ -34,12 +34,7 @@ private static final boolean ____ = false; // Checkstyle: resume - public static String CompilerConfiguration = "basic"; - public static String GraalRuntime = "basic"; - // inlining settings - public static boolean Inline = true; - public static boolean AlwaysInlineIntrinsics = ____; public static boolean Intrinsify = true; static boolean InlineMonomorphicCalls = true; static boolean InlinePolymorphicCalls = true; @@ -163,8 +158,6 @@ public static int RangeTestsSwitchDensity = 5; public static double MinTableSwitchDensity = 0.5; - public static boolean DetailedAsserts = ____; - // Runtime settings public static int StackShadowPages = 2; @@ -228,9 +221,4 @@ * @see #CheckcastMaxHints */ public static int InstanceOfMaxHints = 2; - - static { - // turn detailed assertions on when the general assertions are on (misusing the assert keyword for this) - assert (DetailedAsserts = true) == true; - } } diff -r 394f38496856 -r 6898d8995866 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java Tue Jun 04 00:33:42 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java Tue Jun 04 00:35:28 2013 +0200 @@ -25,10 +25,16 @@ import java.util.*; import com.oracle.graal.graph.*; +import com.oracle.graal.options.*; import com.oracle.graal.phases.*; public final class Suites { + // @formatter:off + @Option(help = "The compiler configuration to use") + private static final OptionValue CompilerConfiguration = new OptionValue<>("basic"); + // @formatter:on + public static final Suites DEFAULT; private final PhaseSuite highTier; @@ -69,7 +75,7 @@ } public static Suites createDefaultSuites() { - return createSuites(GraalOptions.CompilerConfiguration); + return createSuites(CompilerConfiguration.getValue()); } public static Suites createSuites(String name) { diff -r 394f38496856 -r 6898d8995866 make/build-graal.xml --- a/make/build-graal.xml Tue Jun 04 00:33:42 2013 +0200 +++ b/make/build-graal.xml Tue Jun 04 00:35:28 2013 +0200 @@ -39,10 +39,10 @@ + - @@ -82,8 +82,10 @@ + + @@ -94,6 +96,7 @@ + @@ -102,6 +105,8 @@ + + diff -r 394f38496856 -r 6898d8995866 mx/projects --- a/mx/projects Tue Jun 04 00:33:42 2013 +0200 +++ b/mx/projects Tue Jun 04 00:35:28 2013 +0200 @@ -100,7 +100,7 @@ project@com.oracle.graal.hotspot@sourceDirs=src project@com.oracle.graal.hotspot@dependencies=com.oracle.graal.replacements,com.oracle.graal.printer project@com.oracle.graal.hotspot@checkstyle=com.oracle.graal.graph -project@com.oracle.graal.hotspot@annotationProcessors=com.oracle.graal.replacements.verifier,com.oracle.graal.service.processor,com.oracle.graal.options +project@com.oracle.graal.hotspot@annotationProcessors=com.oracle.graal.replacements.verifier project@com.oracle.graal.hotspot@javaCompliance=1.7 # graal.hotspot.amd64 @@ -251,9 +251,10 @@ # graal.phases project@com.oracle.graal.phases@subDir=graal project@com.oracle.graal.phases@sourceDirs=src -project@com.oracle.graal.phases@dependencies=com.oracle.graal.nodes +project@com.oracle.graal.phases@dependencies=com.oracle.graal.nodes,com.oracle.graal.options project@com.oracle.graal.phases@checkstyle=com.oracle.graal.graph project@com.oracle.graal.phases@javaCompliance=1.7 +project@com.oracle.graal.phases@annotationProcessors=com.oracle.graal.options # graal.phases.common project@com.oracle.graal.phases.common@subDir=graal @@ -279,10 +280,10 @@ # graal.compiler project@com.oracle.graal.compiler@subDir=graal project@com.oracle.graal.compiler@sourceDirs=src -project@com.oracle.graal.compiler@dependencies=com.oracle.graal.api.runtime,com.oracle.graal.virtual,com.oracle.graal.options,com.oracle.graal.loop,com.oracle.graal.alloc,com.oracle.graal.lir +project@com.oracle.graal.compiler@dependencies=com.oracle.graal.api.runtime,com.oracle.graal.virtual,com.oracle.graal.loop,com.oracle.graal.alloc,com.oracle.graal.lir project@com.oracle.graal.compiler@checkstyle=com.oracle.graal.graph project@com.oracle.graal.compiler@javaCompliance=1.7 -project@com.oracle.graal.compiler@annotationProcessors=com.oracle.graal.service.processor,com.oracle.graal.options +project@com.oracle.graal.compiler@annotationProcessors=com.oracle.graal.service.processor # graal.compiler.amd64 project@com.oracle.graal.compiler.amd64@subDir=graal