| 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.";
|
|
|