diff options
author | Razvan A Lupusoru <razvan.a.lupusoru@intel.com> | 2014-09-11 14:12:17 -0700 |
---|---|---|
committer | Razvan A Lupusoru <razvan.a.lupusoru@intel.com> | 2014-09-12 23:48:06 +0000 |
commit | c80605d6f13b0f1e5ac5446c755e6d210f06b19a (patch) | |
tree | ea96813e0cd3870fcb97c2db5c496004015728fc | |
parent | ebab3bbcaa09b644acd50ec18d79cb0d239bf347 (diff) | |
download | art-c80605d6f13b0f1e5ac5446c755e6d210f06b19a.zip art-c80605d6f13b0f1e5ac5446c755e6d210f06b19a.tar.gz art-c80605d6f13b0f1e5ac5446c755e6d210f06b19a.tar.bz2 |
ART: Consider clinit elimination for inlining
Currently inliner rejects inlining method if class initialization is needed.
However, if it has been proven already that it was done, then inlining
can safely proceed.
Change-Id: Iaf1638fcfffff1bcf66010dc39090c77e009a1bb
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
-rw-r--r-- | compiler/dex/mir_optimization.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc index 7ac878f..fdabc3e 100644 --- a/compiler/dex/mir_optimization.cc +++ b/compiler/dex/mir_optimization.cc @@ -1360,11 +1360,20 @@ void MIRGraph::InlineSpecialMethods(BasicBlock* bb) { if (!method_info.FastPath()) { continue; } + InvokeType sharp_type = method_info.GetSharpType(); - if ((sharp_type != kDirect) && - (sharp_type != kStatic || method_info.NeedsClassInitialization())) { + if ((sharp_type != kDirect) && (sharp_type != kStatic)) { continue; } + + if (sharp_type == kStatic) { + bool needs_clinit = method_info.NeedsClassInitialization() && + ((mir->optimization_flags & MIR_IGNORE_CLINIT_CHECK) == 0); + if (needs_clinit) { + continue; + } + } + DCHECK(cu_->compiler_driver->GetMethodInlinerMap() != nullptr); MethodReference target = method_info.GetTargetMethod(); if (cu_->compiler_driver->GetMethodInlinerMap()->GetMethodInliner(target.dex_file) |