summaryrefslogtreecommitdiff
path: root/compiler/optimizing/builder.cc
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2015-08-20 14:48:00 +0100
committer Calin Juravle <calin@google.com> 2015-08-20 14:51:27 +0100
commit0eedd7e0c923f3ef0b7103f58ca0b975613af144 (patch)
treec77db90ea2e42f0cd3b0e3b185a2c3ecde0ca515 /compiler/optimizing/builder.cc
parent68ad649d3918f2eed3a37209c01a7f0a0faf09f0 (diff)
Fix BuildInvoke
The invoke should be added to the graph before PotentiallySimplifyFakeString. Change-Id: I2afc1d16e6dae60957e7d1386fd028e4f3a5b27a
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r--compiler/optimizing/builder.cc41
1 files changed, 20 insertions, 21 deletions
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;
}