64bit: make runtime offsets more deterministic.
STL implementations vary causing offsets not to be consistent. Place member
variables we care about the offsets of at the start of Runtime.
Change-Id: I3ad7fe606cb99bcdd884a8fdbdd06bd7e047cd84
diff --git a/runtime/arch/arm64/asm_support_arm64.h b/runtime/arch/arm64/asm_support_arm64.h
index 44c3e60..263a764 100644
--- a/runtime/arch/arm64/asm_support_arm64.h
+++ b/runtime/arch/arm64/asm_support_arm64.h
@@ -22,11 +22,11 @@
// TODO Thread offsets need to be checked when on Aarch64.
// Offset of field Runtime::callee_save_methods_[kSaveAll]
-#define RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET 320
+#define RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET 0
// Offset of field Runtime::callee_save_methods_[kRefsOnly]
-#define RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET 328
+#define RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET 8
// Offset of field Runtime::callee_save_methods_[kRefsAndArgs]
-#define RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET 336
+#define RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET 16
// Register holding Thread::Current().
#define xSELF x18
diff --git a/runtime/arch/x86_64/asm_support_x86_64.h b/runtime/arch/x86_64/asm_support_x86_64.h
index 5a4e63e..03d9e24 100644
--- a/runtime/arch/x86_64/asm_support_x86_64.h
+++ b/runtime/arch/x86_64/asm_support_x86_64.h
@@ -20,11 +20,11 @@
#include "asm_support.h"
// Offset of field Runtime::callee_save_methods_[kSaveAll]
-#define RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET 200
+#define RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET 0
// Offset of field Runtime::callee_save_methods_[kRefsOnly]
-#define RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET 208
+#define RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET 8
// Offset of field Runtime::callee_save_methods_[kRefsAndArgs]
-#define RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET 216
+#define RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET 16
// Offset of field Thread::self_ verified in InitCpu
#define THREAD_SELF_OFFSET 72
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index eaa27de..21d79c3 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -80,7 +80,11 @@
Runtime* Runtime::instance_ = NULL;
Runtime::Runtime()
- : compiler_callbacks_(nullptr),
+ : pre_allocated_OutOfMemoryError_(nullptr),
+ resolution_method_(nullptr),
+ imt_conflict_method_(nullptr),
+ default_imt_(nullptr),
+ compiler_callbacks_(nullptr),
is_zygote_(false),
is_concurrent_gc_enabled_(true),
is_explicit_gc_disabled_(false),
@@ -94,10 +98,6 @@
class_linker_(nullptr),
signal_catcher_(nullptr),
java_vm_(nullptr),
- pre_allocated_OutOfMemoryError_(nullptr),
- resolution_method_(nullptr),
- imt_conflict_method_(nullptr),
- default_imt_(nullptr),
fault_message_lock_("Fault message lock"),
fault_message_(""),
method_verifier_lock_("Method verifiers lock"),
diff --git a/runtime/runtime.h b/runtime/runtime.h
index eeaaa2b..50c88d3 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -442,6 +442,12 @@
// A pointer to the active runtime or NULL.
static Runtime* instance_;
+ mirror::ArtMethod* callee_save_methods_[kLastCalleeSaveType];
+ mirror::Throwable* pre_allocated_OutOfMemoryError_;
+ mirror::ArtMethod* resolution_method_;
+ mirror::ArtMethod* imt_conflict_method_;
+ mirror::ObjectArray<mirror::ArtMethod>* default_imt_;
+
CompilerCallbacks* compiler_callbacks_;
bool is_zygote_;
bool is_concurrent_gc_enabled_;
@@ -475,16 +481,6 @@
JavaVMExt* java_vm_;
- mirror::Throwable* pre_allocated_OutOfMemoryError_;
-
- mirror::ArtMethod* callee_save_methods_[kLastCalleeSaveType];
-
- mirror::ArtMethod* resolution_method_;
-
- mirror::ArtMethod* imt_conflict_method_;
-
- mirror::ObjectArray<mirror::ArtMethod>* default_imt_;
-
// Fault message, printed when we get a SIGSEGV.
Mutex fault_message_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
std::string fault_message_ GUARDED_BY(fault_message_lock_);