From 0eedd7e0c923f3ef0b7103f58ca0b975613af144 Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Thu, 20 Aug 2015 14:48:00 +0100 Subject: Fix BuildInvoke The invoke should be added to the graph before PotentiallySimplifyFakeString. Change-Id: I2afc1d16e6dae60957e7d1386fd028e4f3a5b27a --- compiler/optimizing/builder.cc | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'compiler/optimizing/builder.cc') diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index d2149763ba..1483403ae2 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -885,20 +885,13 @@ bool HGraphBuilder::BuildInvoke(const Instruction& instruction, table_index); } - if (!SetupArgumentsForInvoke(invoke, - number_of_vreg_arguments, - args, - register_index, - is_range, - descriptor, - clinit_check)) { - return false; - } - - current_block_->AddInstruction(invoke); - latest_result_ = invoke; - - return true; + return SetupArgumentsAndAddInvoke(invoke, + number_of_vreg_arguments, + args, + register_index, + is_range, + descriptor, + clinit_check)); } HClinitCheck* HGraphBuilder::ProcessClinitCheckForInvoke( @@ -1047,13 +1040,13 @@ HInvokeStaticOrDirect::DispatchInfo HGraphBuilder::ComputeDispatchInfo( method_load_kind, code_ptr_location, method_load_data, direct_code_ptr }; } -bool HGraphBuilder::SetupArgumentsForInvoke(HInvoke* invoke, - uint32_t number_of_vreg_arguments, - uint32_t* args, - uint32_t register_index, - bool is_range, - const char* descriptor, - HClinitCheck* clinit_check) { +bool HGraphBuilder::SetupArgumentsAndAddInvoke(HInvoke* invoke, + uint32_t number_of_vreg_arguments, + uint32_t* args, + uint32_t register_index, + bool is_range, + const char* descriptor, + HClinitCheck* clinit_check) { size_t start_index = 0; size_t argument_index = 0; uint32_t descriptor_index = 1; // Skip the return type. @@ -1131,8 +1124,14 @@ bool HGraphBuilder::SetupArgumentsForInvoke(HInvoke* invoke, uint32_t orig_this_reg = is_range ? register_index : args[0]; HInstruction* fake_string = LoadLocal(orig_this_reg, Primitive::kPrimNot); invoke->SetArgumentAt(argument_index, fake_string); + current_block_->AddInstruction(invoke); PotentiallySimplifyFakeString(orig_this_reg, invoke->GetDexPc(), invoke); + } else { + current_block_->AddInstruction(invoke); } + + latest_result_ = invoke; + return true; } -- cgit v1.2.3-59-g8ed1b