ARM: VIXL32: Implement HClassTableGet Visitor.
Test: ART_USE_VIXL_ARM_BACKEND=true m test-art-host
Test: ART_USE_VIXL_ARM_BACKEND=true m test-art-target
Change-Id: Ia334bff827a78966274dc2a80a2be8688240cadf
diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc
index b8d9a91..d962b44 100644
--- a/compiler/optimizing/code_generator_arm_vixl.cc
+++ b/compiler/optimizing/code_generator_arm_vixl.cc
@@ -6155,17 +6155,35 @@
}
}
-void LocationsBuilderARMVIXL::VisitClassTableGet(
- HClassTableGet* instruction ATTRIBUTE_UNUSED) {
- TODO_VIXL32(FATAL);
+void LocationsBuilderARMVIXL::VisitClassTableGet(HClassTableGet* instruction) {
+ LocationSummary* locations =
+ new (GetGraph()->GetArena()) LocationSummary(instruction, LocationSummary::kNoCall);
+ locations->SetInAt(0, Location::RequiresRegister());
+ locations->SetOut(Location::RequiresRegister());
}
-void InstructionCodeGeneratorARMVIXL::VisitClassTableGet(
- HClassTableGet* instruction ATTRIBUTE_UNUSED) {
- TODO_VIXL32(FATAL);
+void InstructionCodeGeneratorARMVIXL::VisitClassTableGet(HClassTableGet* instruction) {
+ if (instruction->GetTableKind() == HClassTableGet::TableKind::kVTable) {
+ uint32_t method_offset = mirror::Class::EmbeddedVTableEntryOffset(
+ instruction->GetIndex(), kArmPointerSize).SizeValue();
+ GetAssembler()->LoadFromOffset(kLoadWord,
+ OutputRegister(instruction),
+ InputRegisterAt(instruction, 0),
+ method_offset);
+ } else {
+ uint32_t method_offset = static_cast<uint32_t>(ImTable::OffsetOfElement(
+ instruction->GetIndex(), kArmPointerSize));
+ GetAssembler()->LoadFromOffset(kLoadWord,
+ OutputRegister(instruction),
+ InputRegisterAt(instruction, 0),
+ mirror::Class::ImtPtrOffset(kArmPointerSize).Uint32Value());
+ GetAssembler()->LoadFromOffset(kLoadWord,
+ OutputRegister(instruction),
+ OutputRegister(instruction),
+ method_offset);
+ }
}
-
#undef __
#undef QUICK_ENTRY_POINT
#undef TODO_VIXL32