Added "optimize" flag to settings everywhere
This commit is contained in:
committed by
Alexander Udalov
parent
433c9cd4a5
commit
0e683b0b99
+2
-2
@@ -33,7 +33,7 @@ public class CompilerArgumentsUtil {
|
||||
"false".equalsIgnoreCase(option);
|
||||
}
|
||||
|
||||
public static String getWrongInlineOptionErrorMessage(@Nullable String inline) {
|
||||
return "Wrong value for inline option: '" + inline + "'. Should be 'on'/'off' or 'true'/'false'";
|
||||
public static String getWrongCheckOptionErrorMessage(@Nullable String option, @Nullable String value) {
|
||||
return "Wrong value for " + option + " option: '" + value + "'. Should be 'on'/'off' or 'true'/'false'";
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -79,6 +79,10 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
|
||||
@ValueDescription("{on,off}")
|
||||
public String inline;
|
||||
|
||||
@Argument(value = "optimize", description = "Optimization mode (default is on)")
|
||||
@ValueDescription("{on,off}")
|
||||
public String optimize;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String executableScriptFileName() {
|
||||
|
||||
@@ -39,6 +39,9 @@ public class JVMConfigurationKeys {
|
||||
public static final CompilerConfigurationKey<Boolean> ENABLE_INLINE =
|
||||
CompilerConfigurationKey.create("enable inline");
|
||||
|
||||
public static final CompilerConfigurationKey<Boolean> ENABLE_OPTIMIZATION =
|
||||
CompilerConfigurationKey.create("enable optimization");
|
||||
|
||||
public static final CompilerConfigurationKey<File> INCREMENTAL_CACHE_BASE_DIR =
|
||||
CompilerConfigurationKey.create("incremental cache base dir");
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler;
|
||||
import org.jetbrains.jet.cli.jvm.repl.ReplFromTerminal;
|
||||
import org.jetbrains.jet.codegen.CompilationException;
|
||||
import org.jetbrains.jet.codegen.inline.InlineCodegenUtil;
|
||||
import org.jetbrains.jet.codegen.optimization.OptimizationUtils;
|
||||
import org.jetbrains.jet.config.CommonConfigurationKeys;
|
||||
import org.jetbrains.jet.config.CompilerConfiguration;
|
||||
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
|
||||
@@ -116,6 +117,8 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
configuration.put(JVMConfigurationKeys.GENERATE_NOT_NULL_PARAMETER_ASSERTIONS, arguments.notNullParamAssertions);
|
||||
configuration.put(JVMConfigurationKeys.ENABLE_INLINE,
|
||||
CompilerArgumentsUtil.optionToBooleanFlag(arguments.inline, InlineCodegenUtil.DEFAULT_INLINE_FLAG));
|
||||
configuration.put(JVMConfigurationKeys.ENABLE_OPTIMIZATION,
|
||||
CompilerArgumentsUtil.optionToBooleanFlag(arguments.optimize, OptimizationUtils.DEFAULT_OPTIMIZATION_FLAG));
|
||||
|
||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector);
|
||||
|
||||
@@ -209,7 +212,11 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
super.checkArguments(argument);
|
||||
|
||||
if (!CompilerArgumentsUtil.checkOption(argument.inline)) {
|
||||
throw new IllegalArgumentException(CompilerArgumentsUtil.getWrongInlineOptionErrorMessage(argument.inline));
|
||||
throw new IllegalArgumentException(CompilerArgumentsUtil.getWrongCheckOptionErrorMessage("inline", argument.inline));
|
||||
}
|
||||
|
||||
if (!CompilerArgumentsUtil.checkOption(argument.optimize)) {
|
||||
throw new IllegalArgumentException(CompilerArgumentsUtil.getWrongCheckOptionErrorMessage("optimize", argument.optimize));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.jetbrains.jet.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.jet.cli.jvm.JVMConfigurationKeys;
|
||||
import org.jetbrains.jet.codegen.*;
|
||||
import org.jetbrains.jet.codegen.inline.InlineCodegenUtil;
|
||||
import org.jetbrains.jet.codegen.optimization.OptimizationUtils;
|
||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||
import org.jetbrains.jet.codegen.state.Progress;
|
||||
import org.jetbrains.jet.config.CommonConfigurationKeys;
|
||||
@@ -344,6 +345,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
configuration.get(JVMConfigurationKeys.GENERATE_NOT_NULL_PARAMETER_ASSERTIONS, false),
|
||||
GenerationState.GenerateClassFilter.GENERATE_ALL,
|
||||
configuration.get(JVMConfigurationKeys.ENABLE_INLINE, InlineCodegenUtil.DEFAULT_INLINE_FLAG),
|
||||
configuration.get(JVMConfigurationKeys.ENABLE_OPTIMIZATION, OptimizationUtils.DEFAULT_OPTIMIZATION_FLAG),
|
||||
packagesWithRemovedFiles,
|
||||
moduleId,
|
||||
diagnosticHolder,
|
||||
|
||||
Reference in New Issue
Block a user