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 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_OS_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
7 | 7 |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 void OS::AlignedFree(void* ptr) { | 190 void OS::AlignedFree(void* ptr) { |
191 free(ptr); | 191 free(ptr); |
192 } | 192 } |
193 | 193 |
194 | 194 |
195 // TODO(5411554): May need to hoist these architecture dependent code | 195 // TODO(5411554): May need to hoist these architecture dependent code |
196 // into a architecture specific file e.g: os_ia32_linux.cc | 196 // into a architecture specific file e.g: os_ia32_linux.cc |
197 intptr_t OS::ActivationFrameAlignment() { | 197 intptr_t OS::ActivationFrameAlignment() { |
198 #if defined(TARGET_ARCH_IA32) || \ | 198 #if defined(TARGET_ARCH_IA32) || \ |
199 defined(TARGET_ARCH_X64) || \ | 199 defined(TARGET_ARCH_X64) || \ |
200 defined(TARGET_ARCH_ARM64) | 200 defined(TARGET_ARCH_ARM64) || \ |
| 201 defined(TARGET_ARCH_DBC) |
201 const int kMinimumAlignment = 16; | 202 const int kMinimumAlignment = 16; |
202 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) | 203 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
203 const int kMinimumAlignment = 8; | 204 const int kMinimumAlignment = 8; |
204 #else | 205 #else |
205 #error Unsupported architecture. | 206 #error Unsupported architecture. |
206 #endif | 207 #endif |
207 intptr_t alignment = kMinimumAlignment; | 208 intptr_t alignment = kMinimumAlignment; |
208 // TODO(5411554): Allow overriding default stack alignment for | 209 // TODO(5411554): Allow overriding default stack alignment for |
209 // testing purposes. | 210 // testing purposes. |
210 // Flags::DebugIsInt("stackalign", &alignment); | 211 // Flags::DebugIsInt("stackalign", &alignment); |
211 ASSERT(Utils::IsPowerOfTwo(alignment)); | 212 ASSERT(Utils::IsPowerOfTwo(alignment)); |
212 ASSERT(alignment >= kMinimumAlignment); | 213 ASSERT(alignment >= kMinimumAlignment); |
213 return alignment; | 214 return alignment; |
214 } | 215 } |
215 | 216 |
216 | 217 |
217 intptr_t OS::PreferredCodeAlignment() { | 218 intptr_t OS::PreferredCodeAlignment() { |
218 #if defined(TARGET_ARCH_IA32) || \ | 219 #if defined(TARGET_ARCH_IA32) || \ |
219 defined(TARGET_ARCH_X64) || \ | 220 defined(TARGET_ARCH_X64) || \ |
220 defined(TARGET_ARCH_ARM64) | 221 defined(TARGET_ARCH_ARM64) || \ |
| 222 defined(TARGET_ARCH_DBC) |
221 const int kMinimumAlignment = 32; | 223 const int kMinimumAlignment = 32; |
222 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) | 224 #elif defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) |
223 const int kMinimumAlignment = 16; | 225 const int kMinimumAlignment = 16; |
224 #else | 226 #else |
225 #error Unsupported architecture. | 227 #error Unsupported architecture. |
226 #endif | 228 #endif |
227 intptr_t alignment = kMinimumAlignment; | 229 intptr_t alignment = kMinimumAlignment; |
228 // TODO(5411554): Allow overriding default code alignment for | 230 // TODO(5411554): Allow overriding default code alignment for |
229 // testing purposes. | 231 // testing purposes. |
230 // Flags::DebugIsInt("codealign", &alignment); | 232 // Flags::DebugIsInt("codealign", &alignment); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 407 } |
406 | 408 |
407 | 409 |
408 void OS::Exit(int code) { | 410 void OS::Exit(int code) { |
409 exit(code); | 411 exit(code); |
410 } | 412 } |
411 | 413 |
412 } // namespace dart | 414 } // namespace dart |
413 | 415 |
414 #endif // defined(TARGET_OS_LINUX) | 416 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |