changeset 9855:6898d8995866

converted more options from GraalOptions to new system (GRAAL-27)
author Doug Simon <doug.simon@oracle.com>
date Tue, 04 Jun 2013 00:35:28 +0200
parents 394f38496856
children fbeda9df497d
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java make/build-graal.xml mx/projects
diffstat 10 files changed, 68 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- 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<Boolean> VerifyUsageWithEquals = new OptionValue<>(true);
+    @Option(help = "Enable inlining")
+    public static final OptionValue<Boolean> 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 {
--- 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<Boolean> SummarizePerPhase = new OptionValue<>(false);
     @Option(help = "Send Graal IR to dump handlers on error")
     public static final OptionValue<Boolean> DumpOnError = new OptionValue<>(false);
+    @Option(help = "Enable expensive assertions")
+    public static final OptionValue<Boolean> DetailedAsserts = new OptionValue<Boolean>(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;
--- 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;
             }
--- 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));
--- 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<String> 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();
--- 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<Boolean> 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);
--- 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;
-    }
 }
--- 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<String> CompilerConfiguration = new OptionValue<>("basic");
+    // @formatter:on
+
     public static final Suites DEFAULT;
 
     private final PhaseSuite<HighTierContext> highTier;
@@ -69,7 +75,7 @@
     }
 
     public static Suites createDefaultSuites() {
-        return createSuites(GraalOptions.CompilerConfiguration);
+        return createSuites(CompilerConfiguration.getValue());
     }
 
     public static Suites createSuites(String name) {
--- 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 @@
       <src path="${src.dir}/com.oracle.graal.debug"/>
       <src path="${src.dir}/com.oracle.graal.api.replacements"/>
       <src path="${src.dir}/com.oracle.graal.nodes"/>
+      <src path="${src.dir}/com.oracle.graal.options"/>
       <src path="${src.dir}/com.oracle.graal.phases"/>
       <src path="${src.dir}/com.oracle.graal.phases.common"/>
       <src path="${src.dir}/com.oracle.graal.virtual"/>
-      <src path="${src.dir}/com.oracle.graal.options"/>
       <src path="${src.dir}/com.oracle.graal.loop"/>
       <src path="${src.dir}/com.oracle.graal.alloc"/>
       <src path="${src.dir}/com.oracle.graal.asm"/>
@@ -82,8 +82,10 @@
         <provider classname="com.oracle.graal.replacements.GraalMethodSubstitutions"/>
       </service>
       <service type="com.oracle.graal.options.OptionProvider">
+        <provider classname="com.oracle.graal.compiler.GraalCompiler_Inline"/>
         <provider classname="com.oracle.graal.compiler.GraalCompiler_VerifyUsageWithEquals"/>
         <provider classname="com.oracle.graal.compiler.GraalDebugConfig_DebugEnabled"/>
+        <provider classname="com.oracle.graal.compiler.GraalDebugConfig_DetailedAsserts"/>
         <provider classname="com.oracle.graal.compiler.GraalDebugConfig_Dump"/>
         <provider classname="com.oracle.graal.compiler.GraalDebugConfig_DumpOnError"/>
         <provider classname="com.oracle.graal.compiler.GraalDebugConfig_Log"/>
@@ -94,6 +96,7 @@
         <provider classname="com.oracle.graal.compiler.GraalDebugConfig_SummarizePerPhase"/>
         <provider classname="com.oracle.graal.compiler.GraalDebugConfig_Time"/>
         <provider classname="com.oracle.graal.hotspot.CompilationTask_SlowQueueCutoff"/>
+        <provider classname="com.oracle.graal.hotspot.HotSpotGraalRuntime_GraalRuntime"/>
         <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_BenchmarkDynamicCounters"/>
         <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_GenericDynamicCounters"/>
         <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_LogFile"/>
@@ -102,6 +105,8 @@
         <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_SlowCompileThreads"/>
         <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_Threads"/>
         <provider classname="com.oracle.graal.hotspot.bridge.VMToCompilerImpl_TimedBootstrap"/>
+        <provider classname="com.oracle.graal.phases.common.InliningPhase_AlwaysInlineIntrinsics"/>
+        <provider classname="com.oracle.graal.phases.tiers.Suites_CompilerConfiguration"/>
       </service>
       <service type="com.oracle.graal.phases.tiers.CompilerConfiguration">
         <provider classname="com.oracle.graal.compiler.phases.BasicCompilerConfiguration"/>
--- 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