summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2016-11-29 18:15:29 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-11-29 18:15:29 +0000
commit8662aaaae4b63b02b2762673873b90b433b2eb2d (patch)
tree9f97a8acb0f7cd32cc6bc936cfdfa09edeba64a9 /compiler
parent52f52361c2ea37941fbda71e3c653bb8096bf516 (diff)
parent67986a15fa94d6740ba35f40a1ffdfef3245d2de (diff)
Merge "Use non vixl arm macro assembler"
Diffstat (limited to 'compiler')
-rw-r--r--compiler/utils/arm/jni_macro_assembler_arm.cc35
-rw-r--r--compiler/utils/arm/jni_macro_assembler_arm.h17
-rw-r--r--compiler/utils/jni_macro_assembler.cc4
3 files changed, 54 insertions, 2 deletions
diff --git a/compiler/utils/arm/jni_macro_assembler_arm.cc b/compiler/utils/arm/jni_macro_assembler_arm.cc
index cf7a4d1b72..3f425dfaf5 100644
--- a/compiler/utils/arm/jni_macro_assembler_arm.cc
+++ b/compiler/utils/arm/jni_macro_assembler_arm.cc
@@ -594,6 +594,41 @@ void ArmJNIMacroAssembler::ExceptionPoll(ManagedRegister mscratch, size_t stack_
__ b(slow->Entry(), NE);
}
+std::unique_ptr<JNIMacroLabel> ArmJNIMacroAssembler::CreateLabel() {
+ return std::unique_ptr<JNIMacroLabel>(new ArmJNIMacroLabel());
+}
+
+void ArmJNIMacroAssembler::Jump(JNIMacroLabel* label) {
+ CHECK(label != nullptr);
+ __ b(ArmJNIMacroLabel::Cast(label)->AsArm());
+}
+
+void ArmJNIMacroAssembler::Jump(JNIMacroLabel* label,
+ JNIMacroUnaryCondition condition,
+ ManagedRegister test) {
+ CHECK(label != nullptr);
+
+ arm::Condition arm_cond;
+ switch (condition) {
+ case JNIMacroUnaryCondition::kZero:
+ arm_cond = EQ;
+ break;
+ case JNIMacroUnaryCondition::kNotZero:
+ arm_cond = NE;
+ break;
+ default:
+ LOG(FATAL) << "Not implemented condition: " << static_cast<int>(condition);
+ UNREACHABLE();
+ }
+ __ cmp(test.AsArm().AsCoreRegister(), ShifterOperand(0));
+ __ b(ArmJNIMacroLabel::Cast(label)->AsArm(), arm_cond);
+}
+
+void ArmJNIMacroAssembler::Bind(JNIMacroLabel* label) {
+ CHECK(label != nullptr);
+ __ Bind(ArmJNIMacroLabel::Cast(label)->AsArm());
+}
+
#undef __
void ArmExceptionSlowPath::Emit(Assembler* sasm) {
diff --git a/compiler/utils/arm/jni_macro_assembler_arm.h b/compiler/utils/arm/jni_macro_assembler_arm.h
index 4471906c27..809ac8be94 100644
--- a/compiler/utils/arm/jni_macro_assembler_arm.h
+++ b/compiler/utils/arm/jni_macro_assembler_arm.h
@@ -25,6 +25,7 @@
#include "base/enums.h"
#include "base/macros.h"
#include "utils/jni_macro_assembler.h"
+#include "utils/label.h"
#include "offsets.h"
namespace art {
@@ -159,10 +160,26 @@ class ArmJNIMacroAssembler : public JNIMacroAssembler<PointerSize::k32> {
void MemoryBarrier(ManagedRegister scratch) OVERRIDE;
+ // Create a new label that can be used with Jump/Bind calls.
+ std::unique_ptr<JNIMacroLabel> CreateLabel() OVERRIDE;
+ // Emit an unconditional jump to the label.
+ void Jump(JNIMacroLabel* label) OVERRIDE;
+ // Emit a conditional jump to the label by applying a unary condition test to the register.
+ void Jump(JNIMacroLabel* label, JNIMacroUnaryCondition cond, ManagedRegister test) OVERRIDE;
+ // Code at this offset will serve as the target for the Jump call.
+ void Bind(JNIMacroLabel* label) OVERRIDE;
+
private:
std::unique_ptr<ArmAssembler> asm_;
};
+class ArmJNIMacroLabel FINAL : public JNIMacroLabelCommon<ArmJNIMacroLabel, art::Label, kArm> {
+ public:
+ art::Label* AsArm() {
+ return AsPlatformLabel();
+ }
+};
+
} // namespace arm
} // namespace art
diff --git a/compiler/utils/jni_macro_assembler.cc b/compiler/utils/jni_macro_assembler.cc
index 2f154fb862..1b743134ed 100644
--- a/compiler/utils/jni_macro_assembler.cc
+++ b/compiler/utils/jni_macro_assembler.cc
@@ -20,7 +20,7 @@
#include <vector>
#ifdef ART_ENABLE_CODEGEN_arm
-#include "arm/jni_macro_assembler_arm_vixl.h"
+#include "arm/jni_macro_assembler_arm.h"
#endif
#ifdef ART_ENABLE_CODEGEN_arm64
#include "arm64/jni_macro_assembler_arm64.h"
@@ -58,7 +58,7 @@ MacroAsm32UniquePtr JNIMacroAssembler<PointerSize::k32>::Create(
#ifdef ART_ENABLE_CODEGEN_arm
case kArm:
case kThumb2:
- return MacroAsm32UniquePtr(new (arena) arm::ArmVIXLJNIMacroAssembler(arena));
+ return MacroAsm32UniquePtr(new (arena) arm::ArmJNIMacroAssembler(arena, instruction_set));
#endif
#ifdef ART_ENABLE_CODEGEN_mips
case kMips: