From 3e3d73349a2de81d14e2279f60ffbd9ab3f3ac28 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Tue, 28 Apr 2015 11:00:54 +0100 Subject: Have HInvoke instructions know their number of actual arguments. Add an art::HInvoke::GetNumberOfArguments routine so that art::HInvoke and its subclasses can return the number of actual arguments of the called method. Use it in code generators and intrinsics handlers. Consequently, no longer remove a clinit check as last input of a static invoke if it is still present during baseline code generation, but ensure that static invokes have no such check as last input in optimized compilations. Change-Id: Iaf9e07d1057a3b15b83d9638538c02b70211e476 --- compiler/optimizing/builder.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'compiler/optimizing/builder.cc') diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index 96e08fd24c..69b46c49c3 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -691,7 +691,6 @@ bool HGraphBuilder::BuildInvoke(const Instruction& instruction, current_block_->AddInstruction(load_class); clinit_check = new (arena_) HClinitCheck(load_class, dex_pc); current_block_->AddInstruction(clinit_check); - ++number_of_arguments; } } } @@ -730,14 +729,14 @@ bool HGraphBuilder::BuildInvoke(const Instruction& instruction, i++; } } + DCHECK_EQ(argument_index, number_of_arguments); if (clinit_check_requirement == HInvokeStaticOrDirect::ClinitCheckRequirement::kExplicit) { // Add the class initialization check as last input of `invoke`. DCHECK(clinit_check != nullptr); - invoke->SetArgumentAt(argument_index++, clinit_check); + invoke->SetArgumentAt(argument_index, clinit_check); } - DCHECK_EQ(argument_index, number_of_arguments); current_block_->AddInstruction(invoke); latest_result_ = invoke; return true; -- cgit v1.2.3-59-g8ed1b