diff options
author | 2015-03-26 10:45:51 +0000 | |
---|---|---|
committer | 2015-03-26 10:45:52 +0000 | |
commit | c8924c6ea9e83ba3832dd5551df38ab06f4aaca9 (patch) | |
tree | 94d7d6016c5a58d6c5f31d8350330c8025baa014 /compiler/optimizing | |
parent | 9ed05c4cf76aaeee48a1eb5bbae659b0acbabe67 (diff) | |
parent | 790412959a6413a585f45fc5f77fe7106311a00c (diff) |
Merge "Use the original invoke type when inlining."
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/builder.cc | 2 | ||||
-rw-r--r-- | compiler/optimizing/inliner.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/nodes.h | 4 |
3 files changed, 8 insertions, 2 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index 8786ed419c..f81935a7c6 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -620,7 +620,7 @@ bool HGraphBuilder::BuildInvoke(const Instruction& instruction, DCHECK(!is_recursive || (target_method.dex_file == dex_compilation_unit_->GetDexFile())); invoke = new (arena_) HInvokeStaticOrDirect( arena_, number_of_arguments, return_type, dex_pc, target_method.dex_method_index, - is_recursive, optimized_invoke_type); + is_recursive, invoke_type, optimized_invoke_type); } size_t start_index = 0; diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 256e85b6ce..4b990f1ddd 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -50,7 +50,9 @@ void HInliner::Run() { HInstruction* next = instruction->GetNext(); HInvokeStaticOrDirect* call = instruction->AsInvokeStaticOrDirect(); if (call != nullptr) { - if (!TryInline(call, call->GetDexMethodIndex(), call->GetInvokeType())) { + // We use the original invoke type to ensure the resolution of the called method + // works properly. + if (!TryInline(call, call->GetDexMethodIndex(), call->GetOriginalInvokeType())) { if (kIsDebugBuild) { std::string callee_name = PrettyMethod(call->GetDexMethodIndex(), *outer_compilation_unit_.GetDexFile()); diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 08b16d99b6..9c751fb9c5 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -2131,8 +2131,10 @@ class HInvokeStaticOrDirect : public HInvoke { uint32_t dex_pc, uint32_t dex_method_index, bool is_recursive, + InvokeType original_invoke_type, InvokeType invoke_type) : HInvoke(arena, number_of_arguments, return_type, dex_pc, dex_method_index), + original_invoke_type_(original_invoke_type), invoke_type_(invoke_type), is_recursive_(is_recursive) {} @@ -2142,6 +2144,7 @@ class HInvokeStaticOrDirect : public HInvoke { return false; } + InvokeType GetOriginalInvokeType() const { return original_invoke_type_; } InvokeType GetInvokeType() const { return invoke_type_; } bool IsRecursive() const { return is_recursive_; } bool NeedsDexCache() const OVERRIDE { return !IsRecursive(); } @@ -2149,6 +2152,7 @@ class HInvokeStaticOrDirect : public HInvoke { DECLARE_INSTRUCTION(InvokeStaticOrDirect); private: + const InvokeType original_invoke_type_; const InvokeType invoke_type_; const bool is_recursive_; |