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 RUNTIME_VM_GLOBALS_H_ | 5 #ifndef RUNTIME_VM_GLOBALS_H_ |
6 #define RUNTIME_VM_GLOBALS_H_ | 6 #define RUNTIME_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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } while (0) | 73 } while (0) |
74 | 74 |
75 | 75 |
76 // A type large enough to contain the value of the C++ vtable. This is needed | 76 // A type large enough to contain the value of the C++ vtable. This is needed |
77 // to support the handle operations. | 77 // to support the handle operations. |
78 typedef uword cpp_vtable; | 78 typedef uword cpp_vtable; |
79 | 79 |
80 | 80 |
81 // When using GCC we can use GCC attributes to ensure that certain | 81 // When using GCC we can use GCC attributes to ensure that certain |
82 // contants are 8 or 16 byte aligned. | 82 // contants are 8 or 16 byte aligned. |
83 #if defined(TARGET_OS_WINDOWS) | 83 #if defined(HOST_OS_WINDOWS) |
84 #define ALIGN8 __declspec(align(8)) | 84 #define ALIGN8 __declspec(align(8)) |
85 #define ALIGN16 __declspec(align(16)) | 85 #define ALIGN16 __declspec(align(16)) |
86 #else | 86 #else |
87 #define ALIGN8 __attribute__((aligned(8))) | 87 #define ALIGN8 __attribute__((aligned(8))) |
88 #define ALIGN16 __attribute__((aligned(16))) | 88 #define ALIGN16 __attribute__((aligned(16))) |
89 #endif | 89 #endif |
90 | 90 |
91 | 91 |
92 // Zap value used to indicate uninitialized handle area (debug purposes). | 92 // Zap value used to indicate uninitialized handle area (debug purposes). |
93 #if defined(ARCH_IS_32_BIT) | 93 #if defined(ARCH_IS_32_BIT) |
94 static const uword kZapUninitializedWord = 0xabababab; | 94 static const uword kZapUninitializedWord = 0xabababab; |
95 #else | 95 #else |
96 static const uword kZapUninitializedWord = 0xabababababababab; | 96 static const uword kZapUninitializedWord = 0xabababababababab; |
97 #endif | 97 #endif |
98 | 98 |
99 | 99 |
100 // Macros to get the contents of the fp register. | 100 // Macros to get the contents of the fp register. |
101 #if defined(TARGET_OS_WINDOWS) | 101 #if defined(HOST_OS_WINDOWS) |
102 | 102 |
103 // clang-format off | 103 // clang-format off |
104 #if defined(HOST_ARCH_IA32) | 104 #if defined(HOST_ARCH_IA32) |
105 #define COPY_FP_REGISTER(fp) \ | 105 #define COPY_FP_REGISTER(fp) \ |
106 __asm { mov fp, ebp} \ | 106 __asm { mov fp, ebp} \ |
107 ; // NOLINT | 107 ; // NOLINT |
108 // clang-format on | 108 // clang-format on |
109 #elif defined(HOST_ARCH_X64) | 109 #elif defined(HOST_ARCH_X64) |
110 // We don't have the asm equivalent to get at the frame pointer on | 110 // We don't have the asm equivalent to get at the frame pointer on |
111 // windows x64, return the stack pointer instead. | 111 // windows x64, return the stack pointer instead. |
112 #define COPY_FP_REGISTER(fp) fp = Thread::GetCurrentStackPointer(); | 112 #define COPY_FP_REGISTER(fp) fp = Thread::GetCurrentStackPointer(); |
113 #else | 113 #else |
114 #error Unknown host architecture. | 114 #error Unknown host architecture. |
115 #endif | 115 #endif |
116 | 116 |
117 #else // !defined(TARGET_OS_WINDOWS)) | 117 #else // !defined(HOST_OS_WINDOWS)) |
118 | 118 |
119 // Assume GCC-like inline syntax is valid. | 119 // Assume GCC-like inline syntax is valid. |
120 #if defined(HOST_ARCH_IA32) | 120 #if defined(HOST_ARCH_IA32) |
121 #define COPY_FP_REGISTER(fp) asm volatile("movl %%ebp, %0" : "=r"(fp)); | 121 #define COPY_FP_REGISTER(fp) asm volatile("movl %%ebp, %0" : "=r"(fp)); |
122 #elif defined(HOST_ARCH_X64) | 122 #elif defined(HOST_ARCH_X64) |
123 #define COPY_FP_REGISTER(fp) asm volatile("movq %%rbp, %0" : "=r"(fp)); | 123 #define COPY_FP_REGISTER(fp) asm volatile("movq %%rbp, %0" : "=r"(fp)); |
124 #elif defined(HOST_ARCH_ARM) | 124 #elif defined(HOST_ARCH_ARM) |
125 #if defined(TARGET_OS_MAC) | 125 #if defined(HOST_OS_MAC) |
126 #define COPY_FP_REGISTER(fp) asm volatile("mov %0, r7" : "=r"(fp)); | 126 #define COPY_FP_REGISTER(fp) asm volatile("mov %0, r7" : "=r"(fp)); |
127 #else | 127 #else |
128 #define COPY_FP_REGISTER(fp) asm volatile("mov %0, r11" : "=r"(fp)); | 128 #define COPY_FP_REGISTER(fp) asm volatile("mov %0, r11" : "=r"(fp)); |
129 #endif | 129 #endif |
130 #elif defined(HOST_ARCH_ARM64) | 130 #elif defined(HOST_ARCH_ARM64) |
131 #define COPY_FP_REGISTER(fp) asm volatile("mov %0, x29" : "=r"(fp)); | 131 #define COPY_FP_REGISTER(fp) asm volatile("mov %0, x29" : "=r"(fp)); |
132 #elif defined(HOST_ARCH_MIPS) | 132 #elif defined(HOST_ARCH_MIPS) |
133 #define COPY_FP_REGISTER(fp) asm volatile("move %0, $fp" : "=r"(fp)); | 133 #define COPY_FP_REGISTER(fp) asm volatile("move %0, $fp" : "=r"(fp)); |
134 #else | 134 #else |
135 #error Unknown host architecture. | 135 #error Unknown host architecture. |
136 #endif | 136 #endif |
137 | 137 |
138 #endif // !defined(TARGET_OS_WINDOWS)) | 138 #endif // !defined(HOST_OS_WINDOWS)) |
139 | 139 |
140 } // namespace dart | 140 } // namespace dart |
141 | 141 |
142 #endif // RUNTIME_VM_GLOBALS_H_ | 142 #endif // RUNTIME_VM_GLOBALS_H_ |
OLD | NEW |