From 695348f4b0541f4373b46eac5830cdd87f71c076 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 19 May 2020 14:42:02 +0100 Subject: Add compiler type to CompilerOptions. Let CompilerOptions hold the information whether it is AOT or JIT compilation, or Zygote JIT for shared code. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: aosp_taimen-userdebug boots. Change-Id: Id9200572406f8e43d99b8b61ef0e3edf43b52fff --- compiler/optimizing/optimizing_compiler.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'compiler/optimizing/optimizing_compiler.cc') diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 1a2d40bcfd..2d5216a6db 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -379,7 +379,6 @@ class OptimizingCompiler final : public Compiler { ArtMethod* method, bool baseline, bool osr, - bool is_shared_jit_code, VariableSizedHandleScope* handles) const; CodeGenerator* TryCompileIntrinsic(ArenaAllocator* allocator, @@ -719,7 +718,6 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* allocator, ArtMethod* method, bool baseline, bool osr, - bool is_shared_jit_code, VariableSizedHandleScope* handles) const { MaybeRecordStat(compilation_stats_.get(), MethodCompilationStat::kAttemptBytecodeCompilation); const CompilerOptions& compiler_options = GetCompilerOptions(); @@ -789,7 +787,6 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* allocator, dead_reference_safe, compiler_options.GetDebuggable(), /* osr= */ osr, - /* is_shared_jit_code= */ is_shared_jit_code, /* baseline= */ baseline); if (method != nullptr) { @@ -992,6 +989,7 @@ CompiledMethod* OptimizingCompiler::Compile(const dex::CodeItem* code_item, const DexFile& dex_file, Handle dex_cache) const { const CompilerOptions& compiler_options = GetCompilerOptions(); + DCHECK(compiler_options.IsAotCompiler()); CompiledMethod* compiled_method = nullptr; Runtime* runtime = Runtime::Current(); DCHECK(runtime->IsAotCompiler()); @@ -1050,7 +1048,6 @@ CompiledMethod* OptimizingCompiler::Compile(const dex::CodeItem* code_item, method, compiler_options.IsBaseline(), /* osr= */ false, - /* is_shared_jit_code= */ false, &handles)); } } @@ -1199,6 +1196,9 @@ bool OptimizingCompiler::JitCompile(Thread* self, bool baseline, bool osr, jit::JitLogger* jit_logger) { + const CompilerOptions& compiler_options = GetCompilerOptions(); + DCHECK(compiler_options.IsJitCompiler()); + DCHECK_EQ(compiler_options.IsJitCompilerForSharedCode(), code_cache->IsSharedRegion(*region)); StackHandleScope<3> hs(self); Handle class_loader(hs.NewHandle( method->GetDeclaringClass()->GetClassLoader())); @@ -1215,7 +1215,6 @@ bool OptimizingCompiler::JitCompile(Thread* self, ArenaAllocator allocator(runtime->GetJitArenaPool()); if (UNLIKELY(method->IsNative())) { - const CompilerOptions& compiler_options = GetCompilerOptions(); JniCompiledMethod jni_compiled_method = ArtQuickJniCompileMethod( compiler_options, access_flags, method_idx, *dex_file); std::vector> roots; @@ -1316,9 +1315,8 @@ bool OptimizingCompiler::JitCompile(Thread* self, &code_allocator, dex_compilation_unit, method, - baseline || GetCompilerOptions().IsBaseline(), + baseline || compiler_options.IsBaseline(), osr, - /* is_shared_jit_code= */ code_cache->IsSharedRegion(*region), &handles)); if (codegen.get() == nullptr) { return false; @@ -1353,7 +1351,6 @@ bool OptimizingCompiler::JitCompile(Thread* self, })); // Add debug info after we know the code location but before we update entry-point. - const CompilerOptions& compiler_options = GetCompilerOptions(); std::vector debug_info; if (compiler_options.GenerateAnyDebugInfo()) { debug::MethodDebugInfo info = {}; -- cgit v1.2.3-59-g8ed1b