From 5816ed48bc339c983b40dc493e96b97821ce7966 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Wed, 27 Nov 2013 17:04:20 +0000 Subject: Detect special methods at the end of verification. This moves special method handling to method inliner and prepares for eventual inlining of these methods. Change-Id: I51c51b940fb7bc714e33135cd61be69467861352 --- compiler/dex/quick/codegen_util.cc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'compiler/dex/quick/codegen_util.cc') diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc index bae8ff339a..65286d5d2f 100644 --- a/compiler/dex/quick/codegen_util.cc +++ b/compiler/dex/quick/codegen_util.cc @@ -19,6 +19,8 @@ #include "gc_map.h" #include "mapping_table.h" #include "mir_to_lir-inl.h" +#include "dex/quick/dex_file_method_inliner.h" +#include "dex/quick/dex_file_to_method_inliner_map.h" #include "dex/verified_methods_data.h" #include "verifier/dex_gc_map.h" #include "verifier/method_verifier.h" @@ -983,8 +985,7 @@ Mir2Lir::Mir2Lir(CompilationUnit* cu, MIRGraph* mir_graph, ArenaAllocator* arena core_spill_mask_(0), fp_spill_mask_(0), first_lir_insn_(NULL), - last_lir_insn_(NULL), - inliner_(nullptr) { + last_lir_insn_(NULL) { promotion_map_ = static_cast (arena_->Alloc((cu_->num_dalvik_registers + cu_->num_compiler_temps + 1) * sizeof(promotion_map_[0]), ArenaAllocator::kAllocRegAlloc)); @@ -1000,15 +1001,16 @@ void Mir2Lir::Materialize() { /* Allocate Registers using simple local allocation scheme */ SimpleRegAlloc(); - if (mir_graph_->IsSpecialCase()) { - /* - * Custom codegen for special cases. If for any reason the - * special codegen doesn't succeed, first_lir_insn_ will - * set to NULL; - */ - cu_->NewTimingSplit("SpecialMIR2LIR"); - SpecialMIR2LIR(mir_graph_->GetSpecialCase()); - } + /* + * Custom codegen for special cases. If for any reason the + * special codegen doesn't succeed, first_lir_insn_ will + * set to NULL; + */ + // TODO: Clean up GenSpecial() and return true only if special implementation is emitted. + // Currently, GenSpecial() returns IsSpecial() but doesn't check after SpecialMIR2LIR(). + DCHECK(cu_->compiler_driver->GetMethodInlinerMap() != nullptr); + cu_->compiler_driver->GetMethodInlinerMap()->GetMethodInliner(cu_->dex_file) + ->GenSpecial(this, cu_->method_idx); /* Convert MIR to LIR, etc. */ if (first_lir_insn_ == NULL) { -- cgit v1.2.3-59-g8ed1b