changeset 22687:fdfe748e98d8

Move NeverSpillConstants to BackendOptions.
author Josef Eisl <josef.eisl@jku.at>
date Wed, 23 Sep 2015 11:34:38 +0200
parents b7ccafc71a9d
children 93859a908b32
files graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/BackendOptions.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java
diffstat 2 files changed, 20 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/BackendOptions.java	Fri Sep 18 16:32:38 2015 +0200
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/BackendOptions.java	Wed Sep 23 11:34:38 2015 +0200
@@ -28,6 +28,7 @@
 import jdk.internal.jvmci.options.Option;
 import jdk.internal.jvmci.options.OptionType;
 import jdk.internal.jvmci.options.OptionValue;
+import jdk.internal.jvmci.options.StableOptionValue;
 
 /**
  * Options to control the backend configuration.
@@ -42,6 +43,8 @@
         public static final OptionValue<Boolean> LIROptSSILinearScan = new OptionValue<>(false);
         @Option(help = "Enable experimental Trace Register Allocation.", type = OptionType.Debug)
         public static final OptionValue<Boolean> TraceRA = new OptionValue<>(false);
+        @Option(help = "Never spill constant intervals.", type = OptionType.Debug)
+        public static final OptionValue<Boolean> NeverSpillConstants = new StableOptionValue<>(false);
         // @formatter:on
     }
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java	Fri Sep 18 16:32:38 2015 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java	Wed Sep 23 11:34:38 2015 +0200
@@ -46,11 +46,8 @@
 import jdk.internal.jvmci.meta.JavaConstant;
 import jdk.internal.jvmci.meta.LIRKind;
 import jdk.internal.jvmci.meta.Value;
-import jdk.internal.jvmci.options.Option;
-import jdk.internal.jvmci.options.OptionType;
-import jdk.internal.jvmci.options.OptionValue;
-import jdk.internal.jvmci.options.StableOptionValue;
 
+import com.oracle.graal.compiler.common.BackendOptions;
 import com.oracle.graal.compiler.common.alloc.ComputeBlockOrder;
 import com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig;
 import com.oracle.graal.compiler.common.cfg.AbstractBlockBase;
@@ -828,10 +825,8 @@
         }
     }
 
-    public static class Options {
-        @Option(help = "Enable temporary workaround for LIR constant optimization (see GRAAL-1272).", type = OptionType.Debug)//
-        public static final OptionValue<Boolean> NeverSpillConstants = new StableOptionValue<>(false);
-
+    protected static Boolean neverSpillConstants() {
+        return BackendOptions.UserOptions.NeverSpillConstants.getValue();
     }
 
     /**
@@ -849,23 +844,20 @@
             LoadConstantOp move = (LoadConstantOp) op;
             if (move.getConstant() instanceof JavaConstant) {
 
-                /* Temporary workaround until GRAAL-1272 is fixed. */
-                if (Options.NeverSpillConstants.getValue()) {
-                    return (JavaConstant) move.getConstant();
-                }
-
-                /*
-                 * Check if the interval has any uses which would accept an stack location (priority
-                 * == ShouldHaveRegister). Rematerialization of such intervals can result in a
-                 * degradation, because rematerialization always inserts a constant load, even if
-                 * the value is not needed in a register.
-                 */
-                Interval.UsePosList usePosList = interval.usePosList();
-                int numUsePos = usePosList.size();
-                for (int useIdx = 0; useIdx < numUsePos; useIdx++) {
-                    Interval.RegisterPriority priority = usePosList.registerPriority(useIdx);
-                    if (priority == Interval.RegisterPriority.ShouldHaveRegister) {
-                        return null;
+                if (!neverSpillConstants()) {
+                    /*
+                     * Check if the interval has any uses which would accept an stack location
+                     * (priority == ShouldHaveRegister). Rematerialization of such intervals can
+                     * result in a degradation, because rematerialization always inserts a constant
+                     * load, even if the value is not needed in a register.
+                     */
+                    Interval.UsePosList usePosList = interval.usePosList();
+                    int numUsePos = usePosList.size();
+                    for (int useIdx = 0; useIdx < numUsePos; useIdx++) {
+                        Interval.RegisterPriority priority = usePosList.registerPriority(useIdx);
+                        if (priority == Interval.RegisterPriority.ShouldHaveRegister) {
+                            return null;
+                        }
                     }
                 }
                 return (JavaConstant) move.getConstant();