summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/builder.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-03-19 10:34:11 +0000
committerNicolas Geoffray <ngeoffray@google.com>2014-03-31 09:44:40 +0100
commit8ccc3f5d06fd217cdaabd37e743adab2031d3720 (patch)
treeec8c904baafb4d9b9bfd582245e2d780bcdfaade /compiler/optimizing/builder.cc
parentad174d1b54bf2fa477bec71a0ca93595f54b8fe9 (diff)
downloadart-8ccc3f5d06fd217cdaabd37e743adab2031d3720.zip
art-8ccc3f5d06fd217cdaabd37e743adab2031d3720.tar.gz
art-8ccc3f5d06fd217cdaabd37e743adab2031d3720.tar.bz2
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
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r--compiler/optimizing/builder.cc19
1 files changed, 19 insertions, 0 deletions
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 @@ bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, int32_
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;