summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/builder.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-11-10 10:36:59 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-11-10 10:37:00 +0000
commit9806199033fc2fb61bfd2260f0156d1b38d56beb (patch)
tree14a5cd067fb01ace19fb5e0f7d494bd9e8744845 /compiler/optimizing/builder.cc
parent255507d9c695aa9c774b882308faa8278382006b (diff)
parent52839d17c06175e19ca4a093fb878450d1c4310d (diff)
downloadart-9806199033fc2fb61bfd2260f0156d1b38d56beb.tar.gz
art-9806199033fc2fb61bfd2260f0156d1b38d56beb.tar.bz2
art-9806199033fc2fb61bfd2260f0156d1b38d56beb.zip
Merge "Support invoke-interface in optimizing."
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r--compiler/optimizing/builder.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index 3d492cde0..8418ab0a7 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -374,20 +374,28 @@ bool HGraphBuilder::BuildInvoke(const Instruction& instruction,
const size_t number_of_arguments = strlen(descriptor) - (is_instance_call ? 0 : 1);
HInvoke* invoke = nullptr;
- if (invoke_type == kVirtual) {
+ if (invoke_type == kVirtual || invoke_type == kInterface) {
MethodReference target_method(dex_file_, method_idx);
uintptr_t direct_code;
uintptr_t direct_method;
- int vtable_index;
+ int table_index;
+ InvokeType optimized_invoke_type = invoke_type;
// TODO: Add devirtualization support.
compiler_driver_->ComputeInvokeInfo(dex_compilation_unit_, dex_offset, true, true,
- &invoke_type, &target_method, &vtable_index,
+ &optimized_invoke_type, &target_method, &table_index,
&direct_code, &direct_method);
- if (vtable_index == -1) {
+ if (table_index == -1) {
return false;
}
- invoke = new (arena_) HInvokeVirtual(
- arena_, number_of_arguments, return_type, dex_offset, vtable_index);
+
+ if (invoke_type == kVirtual) {
+ invoke = new (arena_) HInvokeVirtual(
+ arena_, number_of_arguments, return_type, dex_offset, table_index);
+ } else {
+ DCHECK_EQ(invoke_type, kInterface);
+ invoke = new (arena_) HInvokeInterface(
+ arena_, number_of_arguments, return_type, dex_offset, method_idx, table_index);
+ }
} else {
// Treat invoke-direct like static calls for now.
invoke = new (arena_) HInvokeStatic(
@@ -852,7 +860,8 @@ bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, uint32
case Instruction::INVOKE_STATIC:
case Instruction::INVOKE_DIRECT:
- case Instruction::INVOKE_VIRTUAL: {
+ case Instruction::INVOKE_VIRTUAL:
+ case Instruction::INVOKE_INTERFACE: {
uint32_t method_idx = instruction.VRegB_35c();
uint32_t number_of_vreg_arguments = instruction.VRegA_35c();
uint32_t args[5];
@@ -866,7 +875,8 @@ bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, uint32
case Instruction::INVOKE_STATIC_RANGE:
case Instruction::INVOKE_DIRECT_RANGE:
- case Instruction::INVOKE_VIRTUAL_RANGE: {
+ case Instruction::INVOKE_VIRTUAL_RANGE:
+ case Instruction::INVOKE_INTERFACE_RANGE: {
uint32_t method_idx = instruction.VRegB_3rc();
uint32_t number_of_vreg_arguments = instruction.VRegA_3rc();
uint32_t register_index = instruction.VRegC();