nterp: Address old x86-64 comments.
Follow-up to
https://android-review.googlesource.com/1185416 ,
https://android-review.googlesource.com/1180627 .
Test: testrunner.py --host --interpreter
Change-Id: I4ee8825593cf11d673fcaf8e1172d00405cc7abc
diff --git a/runtime/oat_quick_method_header.cc b/runtime/oat_quick_method_header.cc
index ebb868b..bbc3bfa 100644
--- a/runtime/oat_quick_method_header.cc
+++ b/runtime/oat_quick_method_header.cc
@@ -16,6 +16,7 @@
#include "oat_quick_method_header.h"
+#include "arch/instruction_set.h"
#include "art_method.h"
#include "dex/dex_file_types.h"
#include "interpreter/interpreter_mterp_impl.h"
@@ -88,12 +89,19 @@
return UINTPTR_MAX;
}
-OatQuickMethodHeader* OatQuickMethodHeader::NterpMethodHeader =
- (interpreter::IsNterpSupported()
- ? reinterpret_cast<OatQuickMethodHeader*>(
- reinterpret_cast<uintptr_t>(interpreter::GetNterpEntryPoint()) -
- sizeof(OatQuickMethodHeader))
- : nullptr);
+static inline OatQuickMethodHeader* GetNterpMethodHeader() {
+ if (!interpreter::IsNterpSupported()) {
+ return nullptr;
+ }
+ uintptr_t nterp_entrypoint = reinterpret_cast<uintptr_t>(interpreter::GetNterpEntryPoint());
+ uintptr_t nterp_code_pointer = (kRuntimeISA == InstructionSet::kArm)
+ // Remove the Thumb mode bit if present on ARM.
+ ? nterp_entrypoint & ~static_cast<uintptr_t>(1)
+ : nterp_entrypoint;
+ return reinterpret_cast<OatQuickMethodHeader*>(nterp_code_pointer - sizeof(OatQuickMethodHeader));
+}
+
+OatQuickMethodHeader* OatQuickMethodHeader::NterpMethodHeader = GetNterpMethodHeader();
bool OatQuickMethodHeader::IsNterpMethodHeader() const {
return interpreter::IsNterpSupported() ? (this == NterpMethodHeader) : false;