Add support for invoke-static in optimizing compiler.
Support is limited to calls without parameters and returning
void. For simplicity, we currently follow the Quick ABI.
Change-Id: I54805161141b7eac5959f1cae0dc138dd0b2e8a5
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index 39535e9..db77fee 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -16,10 +16,12 @@
*/
#include "dex_file.h"
+#include "dex_file-inl.h"
#include "dex_instruction.h"
#include "dex_instruction-inl.h"
#include "builder.h"
#include "nodes.h"
+#include "primitive.h"
namespace art {
@@ -192,6 +194,23 @@
break;
}
+ case Instruction::INVOKE_STATIC: {
+ uint32_t method_idx = instruction.VRegB_35c();
+ const DexFile::MethodId& method_id = dex_file_->GetMethodId(method_idx);
+ uint32_t return_type_idx = dex_file_->GetProtoId(method_id.proto_idx_).return_type_idx_;
+ const char* descriptor = dex_file_->StringByTypeIdx(return_type_idx);
+ const size_t number_of_arguments = instruction.VRegA_35c();
+ if (number_of_arguments != 0) {
+ return false;
+ }
+ if (Primitive::GetType(descriptor[0]) != Primitive::kPrimVoid) {
+ return false;
+ }
+ current_block_->AddInstruction(new (arena_) HInvokeStatic(
+ arena_, number_of_arguments, dex_offset, method_idx));
+ break;
+ }
+
case Instruction::NOP:
break;