| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_GLOBALS_H_ | 5 #ifndef VM_GLOBALS_H_ |
| 6 #define VM_GLOBALS_H_ | 6 #define VM_GLOBALS_H_ |
| 7 | 7 |
| 8 // This file contains global definitions for the VM library only. Anything that | 8 // This file contains global definitions for the VM library only. Anything that |
| 9 // is more globally useful should be added to 'vm/globals.h'. | 9 // is more globally useful should be added to 'vm/globals.h'. |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const intptr_t kOffsetOfPtr = 32; | 48 const intptr_t kOffsetOfPtr = 32; |
| 49 | 49 |
| 50 #define OFFSET_OF(type, field) \ | 50 #define OFFSET_OF(type, field) \ |
| 51 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(kOffsetOfPtr)->field)) \ | 51 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(kOffsetOfPtr)->field)) \ |
| 52 - kOffsetOfPtr) | 52 - kOffsetOfPtr) |
| 53 | 53 |
| 54 #define OFFSET_OF_RETURNED_VALUE(type, accessor) \ | 54 #define OFFSET_OF_RETURNED_VALUE(type, accessor) \ |
| 55 (reinterpret_cast<intptr_t>( \ | 55 (reinterpret_cast<intptr_t>( \ |
| 56 (reinterpret_cast<type*>(kOffsetOfPtr)->accessor())) - kOffsetOfPtr) | 56 (reinterpret_cast<type*>(kOffsetOfPtr)->accessor())) - kOffsetOfPtr) |
| 57 | 57 |
| 58 #define OPEN_ARRAY_START(type, align) \ |
| 59 do { \ |
| 60 const uword result = reinterpret_cast<uword>(this) + sizeof(*this); \ |
| 61 ASSERT(Utils::IsAligned(result, sizeof(align))); \ |
| 62 return reinterpret_cast<type*>(result); \ |
| 63 } while (0) |
| 64 |
| 58 | 65 |
| 59 // A type large enough to contain the value of the C++ vtable. This is needed | 66 // A type large enough to contain the value of the C++ vtable. This is needed |
| 60 // to support the handle operations. | 67 // to support the handle operations. |
| 61 typedef uword cpp_vtable; | 68 typedef uword cpp_vtable; |
| 62 | 69 |
| 63 | 70 |
| 64 // When using GCC we can use GCC attributes to ensure that certain | 71 // When using GCC we can use GCC attributes to ensure that certain |
| 65 // contants are 16 byte aligned. | 72 // contants are 16 byte aligned. |
| 66 #if defined(TARGET_OS_WINDOWS) | 73 #if defined(TARGET_OS_WINDOWS) |
| 67 #define ALIGN16 __declspec(align(16)) | 74 #define ALIGN16 __declspec(align(16)) |
| 68 #else | 75 #else |
| 69 #define ALIGN16 __attribute__((aligned(16))) | 76 #define ALIGN16 __attribute__((aligned(16))) |
| 70 #endif | 77 #endif |
| 71 | 78 |
| 72 | 79 |
| 73 // Zap value used to indicate uninitialized handle area (debug purposes). | 80 // Zap value used to indicate uninitialized handle area (debug purposes). |
| 74 #if defined(ARCH_IS_32_BIT) | 81 #if defined(ARCH_IS_32_BIT) |
| 75 static const uword kZapUninitializedWord = 0xabababab; | 82 static const uword kZapUninitializedWord = 0xabababab; |
| 76 #else | 83 #else |
| 77 static const uword kZapUninitializedWord = 0xabababababababab; | 84 static const uword kZapUninitializedWord = 0xabababababababab; |
| 78 #endif | 85 #endif |
| 79 | 86 |
| 80 | 87 |
| 81 } // namespace dart | 88 } // namespace dart |
| 82 | 89 |
| 83 #endif // VM_GLOBALS_H_ | 90 #endif // VM_GLOBALS_H_ |
| OLD | NEW |