Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Unified Diff: runtime/vm/dart.cc

Issue 1883053002: Shuffle fields to make simarm and arm agree on the offset of Heap::new_space_.to_. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/atomic_linux.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart.cc
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 0041d9a6dbbfb64781e26efb7f6cb59bc8cfebb6..f50a22b9e8a7aec85589081d5c8f54ef20ebdd81 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -80,6 +80,40 @@ class ReadOnlyHandles {
};
+static void CheckOffsets() {
+#define CHECK_OFFSET(expr, offset) \
+ if ((expr) != (offset)) { \
+ FATAL2("%s == %" Pd, #expr, (expr)); \
+ } \
+
+#if defined(TARGET_ARCH_ARM)
+ // These offsets are embedded in precompiled instructions. We need simarm
+ // (compiler) and arm (runtime) to agree.
+ CHECK_OFFSET(Heap::TopOffset(Heap::kNew), 8);
+ CHECK_OFFSET(Isolate::heap_offset(), 8);
+ CHECK_OFFSET(Thread::stack_limit_offset(), 4);
+ CHECK_OFFSET(Thread::object_null_offset(), 36);
+#endif
+#if defined(TARGET_ARCH_MIPS)
+ // These offsets are embedded in precompiled instructions. We need simmips
+ // (compiler) and mips (runtime) to agree.
+ CHECK_OFFSET(Heap::TopOffset(Heap::kNew), 8);
+ CHECK_OFFSET(Isolate::heap_offset(), 8);
+ CHECK_OFFSET(Thread::stack_limit_offset(), 4);
+ CHECK_OFFSET(Thread::object_null_offset(), 36);
+#endif
+#if defined(TARGET_ARCH_ARM64)
+ // These offsets are embedded in precompiled instructions. We need simarm64
+ // (compiler) and arm64 (runtime) to agree.
+ CHECK_OFFSET(Heap::TopOffset(Heap::kNew), 8);
+ CHECK_OFFSET(Isolate::heap_offset(), 16);
+ CHECK_OFFSET(Thread::stack_limit_offset(), 8);
+ CHECK_OFFSET(Thread::object_null_offset(), 72);
+#endif
+#undef CHECK_OFFSET
+}
+
+
const char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
const uint8_t* instructions_snapshot,
const uint8_t* data_snapshot,
@@ -92,6 +126,7 @@ const char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
Dart_FileCloseCallback file_close,
Dart_EntropySource entropy_source,
Dart_GetVMServiceAssetsArchive get_service_assets) {
+ CheckOffsets();
// TODO(iposva): Fix race condition here.
if (vm_isolate_ != NULL || !Flags::Initialized()) {
return "VM already initialized or flags not initialized.";
« no previous file with comments | « runtime/vm/atomic_linux.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698