# HG changeset patch # User Josef Eisl # Date 1443000878 -7200 # Node ID fdfe748e98d8cc33f8884887429b1de574384543 # Parent b7ccafc71a9d24ebe762b4898bc732bed00cf367 Move NeverSpillConstants to BackendOptions. diff -r b7ccafc71a9d -r fdfe748e98d8 graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/BackendOptions.java --- 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 LIROptSSILinearScan = new OptionValue<>(false); @Option(help = "Enable experimental Trace Register Allocation.", type = OptionType.Debug) public static final OptionValue TraceRA = new OptionValue<>(false); + @Option(help = "Never spill constant intervals.", type = OptionType.Debug) + public static final OptionValue NeverSpillConstants = new StableOptionValue<>(false); // @formatter:on } diff -r b7ccafc71a9d -r fdfe748e98d8 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java --- 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 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();