From abbb0f76b07417f13f712f54d5afddb72e3b9931 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 29 Oct 2015 18:55:58 +0000 Subject: Refactor code so that JIT can parse compiler options. Currently only the CompilerOptions class. We should also do it for the CompilerDriver options. This will fix the flakiness seen on jdwp testing, as the debuggable flag was not passed to the compiler. Change-Id: I4218dd5928c9f4fe2d6191ab11e5598e7cf84bcf --- compiler/jit/jit_compiler.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'compiler/jit/jit_compiler.cc') diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc index b563c80f7d..c1b87c9cd0 100644 --- a/compiler/jit/jit_compiler.cc +++ b/compiler/jit/jit_compiler.cc @@ -63,9 +63,18 @@ extern "C" bool jit_compile_method(void* handle, ArtMethod* method, Thread* self return jit_compiler->CompileMethod(self, method); } +// Callers of this method assume it has NO_RETURN. +NO_RETURN static void Usage(const char* fmt, ...) { + va_list ap; + va_start(ap, fmt); + std::string error; + StringAppendV(&error, fmt, ap); + LOG(FATAL) << error; + va_end(ap); + exit(EXIT_FAILURE); +} + JitCompiler::JitCompiler() : total_time_(0) { - auto* pass_manager_options = new PassManagerOptions; - pass_manager_options->SetDisablePassList("GVN,DCE,GVNCleanup"); compiler_options_.reset(new CompilerOptions( CompilerOptions::kDefaultCompilerFilter, CompilerOptions::kDefaultHugeMethodThreshold, @@ -84,9 +93,11 @@ JitCompiler::JitCompiler() : total_time_(0) { /* implicit_suspend_checks */ false, /* pic */ true, // TODO: Support non-PIC in optimizing. /* verbose_methods */ nullptr, - pass_manager_options, /* init_failure_output */ nullptr, /* abort_on_hard_verifier_failure */ false)); + for (const std::string& argument : Runtime::Current()->GetCompilerOptions()) { + compiler_options_->ParseCompilerOption(argument, Usage); + } const InstructionSet instruction_set = kRuntimeISA; for (const StringPiece option : Runtime::Current()->GetCompilerOptions()) { VLOG(compiler) << "JIT compiler option " << option; -- cgit v1.2.3-59-g8ed1b