OSDN Git Service

64bit: make runtime offsets more deterministic.
authorIan Rogers <irogers@google.com>
Thu, 20 Mar 2014 15:10:17 +0000 (08:10 -0700)
committerIan Rogers <irogers@google.com>
Thu, 20 Mar 2014 21:34:21 +0000 (14:34 -0700)
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

runtime/arch/arm64/asm_support_arm64.h
runtime/arch/x86_64/asm_support_x86_64.h
runtime/runtime.cc
runtime/runtime.h

index 44c3e60..263a764 100644 (file)
 // 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
index 5a4e63e..03d9e24 100644 (file)
 #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
index eaa27de..21d79c3 100644 (file)
@@ -80,7 +80,11 @@ namespace art {
 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 @@ Runtime::Runtime()
       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"),
index eeaaa2b..50c88d3 100644 (file)
@@ -442,6 +442,12 @@ class Runtime {
   // 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 @@ class Runtime {
 
   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_);