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_PLATFORM_GLOBALS_H_ | 5 #ifndef RUNTIME_PLATFORM_GLOBALS_H_ |
6 #define RUNTIME_PLATFORM_GLOBALS_H_ | 6 #define RUNTIME_PLATFORM_GLOBALS_H_ |
7 | 7 |
8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to | 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to |
9 // enable platform independent printf format specifiers. | 9 // enable platform independent printf format specifiers. |
10 #ifndef __STDC_FORMAT_MACROS | 10 #ifndef __STDC_FORMAT_MACROS |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // http://www.agner.org/optimize/calling_conventions.pdf | 205 // http://www.agner.org/optimize/calling_conventions.pdf |
206 // or with gcc, run: "echo | gcc -E -dM -" | 206 // or with gcc, run: "echo | gcc -E -dM -" |
207 #if defined(_M_X64) || defined(__x86_64__) | 207 #if defined(_M_X64) || defined(__x86_64__) |
208 #define HOST_ARCH_X64 1 | 208 #define HOST_ARCH_X64 1 |
209 #define ARCH_IS_64_BIT 1 | 209 #define ARCH_IS_64_BIT 1 |
210 #define kFpuRegisterSize 16 | 210 #define kFpuRegisterSize 16 |
211 typedef simd128_value_t fpu_register_t; | 211 typedef simd128_value_t fpu_register_t; |
212 #elif defined(_M_IX86) || defined(__i386__) | 212 #elif defined(_M_IX86) || defined(__i386__) |
213 #define HOST_ARCH_IA32 1 | 213 #define HOST_ARCH_IA32 1 |
214 #define ARCH_IS_32_BIT 1 | 214 #define ARCH_IS_32_BIT 1 |
215 #if defined(TARGET_ARCH_MIPS) | |
216 #define kFpuRegisterSize 8 | |
217 typedef double fpu_register_t; | |
218 #else | |
219 #define kFpuRegisterSize 16 | 215 #define kFpuRegisterSize 16 |
220 typedef simd128_value_t fpu_register_t; | 216 typedef simd128_value_t fpu_register_t; |
221 #endif | |
222 #elif defined(__ARMEL__) | 217 #elif defined(__ARMEL__) |
223 #define HOST_ARCH_ARM 1 | 218 #define HOST_ARCH_ARM 1 |
224 #define ARCH_IS_32_BIT 1 | 219 #define ARCH_IS_32_BIT 1 |
225 #define kFpuRegisterSize 16 | 220 #define kFpuRegisterSize 16 |
226 // Mark the fact that we have defined simd_value_t. | 221 // Mark the fact that we have defined simd_value_t. |
227 #define SIMD_VALUE_T_ | 222 #define SIMD_VALUE_T_ |
228 typedef struct { | 223 typedef struct { |
229 union { | 224 union { |
230 uint32_t u; | 225 uint32_t u; |
231 float f; | 226 float f; |
232 } data_[4]; | 227 } data_[4]; |
233 } simd_value_t; | 228 } simd_value_t; |
234 typedef simd_value_t fpu_register_t; | 229 typedef simd_value_t fpu_register_t; |
235 #define simd_value_safe_load(addr) (*reinterpret_cast<simd_value_t*>(addr)) | 230 #define simd_value_safe_load(addr) (*reinterpret_cast<simd_value_t*>(addr)) |
236 #define simd_value_safe_store(addr, value) \ | 231 #define simd_value_safe_store(addr, value) \ |
237 do { \ | 232 do { \ |
238 reinterpret_cast<simd_value_t*>(addr)->data_[0] = value.data_[0]; \ | 233 reinterpret_cast<simd_value_t*>(addr)->data_[0] = value.data_[0]; \ |
239 reinterpret_cast<simd_value_t*>(addr)->data_[1] = value.data_[1]; \ | 234 reinterpret_cast<simd_value_t*>(addr)->data_[1] = value.data_[1]; \ |
240 reinterpret_cast<simd_value_t*>(addr)->data_[2] = value.data_[2]; \ | 235 reinterpret_cast<simd_value_t*>(addr)->data_[2] = value.data_[2]; \ |
241 reinterpret_cast<simd_value_t*>(addr)->data_[3] = value.data_[3]; \ | 236 reinterpret_cast<simd_value_t*>(addr)->data_[3] = value.data_[3]; \ |
242 } while (0) | 237 } while (0) |
243 | 238 |
244 #elif defined(__MIPSEL__) | |
245 #define HOST_ARCH_MIPS 1 | |
246 #define ARCH_IS_32_BIT 1 | |
247 #define kFpuRegisterSize 8 | |
248 typedef double fpu_register_t; | |
249 #elif defined(__MIPSEB__) | |
250 #error Big-endian MIPS is not supported by Dart. Try passing -EL to your \ | |
251 compiler. | |
252 #elif defined(__aarch64__) | 239 #elif defined(__aarch64__) |
253 #define HOST_ARCH_ARM64 1 | 240 #define HOST_ARCH_ARM64 1 |
254 #define ARCH_IS_64_BIT 1 | 241 #define ARCH_IS_64_BIT 1 |
255 #define kFpuRegisterSize 16 | 242 #define kFpuRegisterSize 16 |
256 typedef simd128_value_t fpu_register_t; | 243 typedef simd128_value_t fpu_register_t; |
257 #else | 244 #else |
258 #error Architecture was not detected as supported by Dart. | 245 #error Architecture was not detected as supported by Dart. |
259 #endif | 246 #endif |
260 | 247 |
261 // DART_FORCE_INLINE strongly hints to the compiler that a function should | 248 // DART_FORCE_INLINE strongly hints to the compiler that a function should |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 #endif | 288 #endif |
302 | 289 |
303 #ifdef _MSC_VER | 290 #ifdef _MSC_VER |
304 #define DART_PRETTY_FUNCTION __FUNCSIG__ | 291 #define DART_PRETTY_FUNCTION __FUNCSIG__ |
305 #elif __GNUC__ | 292 #elif __GNUC__ |
306 #define DART_PRETTY_FUNCTION __PRETTY_FUNCTION__ | 293 #define DART_PRETTY_FUNCTION __PRETTY_FUNCTION__ |
307 #else | 294 #else |
308 #error Automatic compiler detection failed. | 295 #error Automatic compiler detection failed. |
309 #endif | 296 #endif |
310 | 297 |
311 #if !defined(TARGET_ARCH_MIPS) && !defined(TARGET_ARCH_ARM) && \ | 298 #if !defined(TARGET_ARCH_ARM) && !defined(TARGET_ARCH_X64) && \ |
312 !defined(TARGET_ARCH_X64) && !defined(TARGET_ARCH_IA32) && \ | 299 !defined(TARGET_ARCH_IA32) && !defined(TARGET_ARCH_ARM64) && \ |
313 !defined(TARGET_ARCH_ARM64) && !defined(TARGET_ARCH_DBC) | 300 !defined(TARGET_ARCH_DBC) |
314 // No target architecture specified pick the one matching the host architecture. | 301 // No target architecture specified pick the one matching the host architecture. |
315 #if defined(HOST_ARCH_MIPS) | 302 #if defined(HOST_ARCH_ARM) |
316 #define TARGET_ARCH_MIPS 1 | |
317 #elif defined(HOST_ARCH_ARM) | |
318 #define TARGET_ARCH_ARM 1 | 303 #define TARGET_ARCH_ARM 1 |
319 #elif defined(HOST_ARCH_X64) | 304 #elif defined(HOST_ARCH_X64) |
320 #define TARGET_ARCH_X64 1 | 305 #define TARGET_ARCH_X64 1 |
321 #elif defined(HOST_ARCH_IA32) | 306 #elif defined(HOST_ARCH_IA32) |
322 #define TARGET_ARCH_IA32 1 | 307 #define TARGET_ARCH_IA32 1 |
323 #elif defined(HOST_ARCH_ARM64) | 308 #elif defined(HOST_ARCH_ARM64) |
324 #define TARGET_ARCH_ARM64 1 | 309 #define TARGET_ARCH_ARM64 1 |
325 #else | 310 #else |
326 #error Automatic target architecture detection failed. | 311 #error Automatic target architecture detection failed. |
327 #endif | 312 #endif |
328 #endif | 313 #endif |
329 | 314 |
330 // Verify that host and target architectures match, we cannot | 315 // Verify that host and target architectures match, we cannot |
331 // have a 64 bit Dart VM generating 32 bit code or vice-versa. | 316 // have a 64 bit Dart VM generating 32 bit code or vice-versa. |
332 #if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64) | 317 #if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_ARM64) |
333 #if !defined(ARCH_IS_64_BIT) | 318 #if !defined(ARCH_IS_64_BIT) |
334 #error Mismatched Host/Target architectures. | 319 #error Mismatched Host/Target architectures. |
335 #endif | 320 #endif |
336 #elif defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_ARM) || \ | 321 #elif defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_ARM) |
337 defined(TARGET_ARCH_MIPS) | |
338 #if !defined(ARCH_IS_32_BIT) | 322 #if !defined(ARCH_IS_32_BIT) |
339 #error Mismatched Host/Target architectures. | 323 #error Mismatched Host/Target architectures. |
340 #endif | 324 #endif |
341 #endif | 325 #endif |
342 | 326 |
343 // Determine whether we will be using the simulator. | 327 // Determine whether we will be using the simulator. |
344 #if defined(TARGET_ARCH_IA32) | 328 #if defined(TARGET_ARCH_IA32) |
345 // No simulator used. | 329 // No simulator used. |
346 #elif defined(TARGET_ARCH_X64) | 330 #elif defined(TARGET_ARCH_X64) |
347 // No simulator used. | 331 // No simulator used. |
348 #elif defined(TARGET_ARCH_ARM) | 332 #elif defined(TARGET_ARCH_ARM) |
349 #if !defined(HOST_ARCH_ARM) | 333 #if !defined(HOST_ARCH_ARM) |
350 #define USING_SIMULATOR 1 | 334 #define USING_SIMULATOR 1 |
351 #endif | 335 #endif |
352 | 336 |
353 #elif defined(TARGET_ARCH_ARM64) | 337 #elif defined(TARGET_ARCH_ARM64) |
354 #if !defined(HOST_ARCH_ARM64) | 338 #if !defined(HOST_ARCH_ARM64) |
355 #define USING_SIMULATOR 1 | 339 #define USING_SIMULATOR 1 |
356 #endif | 340 #endif |
357 | 341 |
358 #elif defined(TARGET_ARCH_MIPS) | |
359 #if !defined(HOST_ARCH_MIPS) | |
360 #define USING_SIMULATOR 1 | |
361 #endif | |
362 | |
363 #elif defined(TARGET_ARCH_DBC) | 342 #elif defined(TARGET_ARCH_DBC) |
364 #define USING_SIMULATOR 1 | 343 #define USING_SIMULATOR 1 |
365 | 344 |
366 #else | 345 #else |
367 #error Unknown architecture. | 346 #error Unknown architecture. |
368 #endif | 347 #endif |
369 | 348 |
370 // Disable background threads by default on armv5te. The relevant | 349 // Disable background threads by default on armv5te. The relevant |
371 // implementations are uniprocessors. | 350 // implementations are uniprocessors. |
372 #if !defined(TARGET_ARCH_ARM_5TE) | 351 #if !defined(TARGET_ARCH_ARM_5TE) |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 // tag in the ICData and check it when recreating the flow graph in | 683 // tag in the ICData and check it when recreating the flow graph in |
705 // optimizing compiler. Enable it for other modes (product, release) if needed | 684 // optimizing compiler. Enable it for other modes (product, release) if needed |
706 // for debugging. | 685 // for debugging. |
707 #if defined(DEBUG) | 686 #if defined(DEBUG) |
708 #define TAG_IC_DATA | 687 #define TAG_IC_DATA |
709 #endif | 688 #endif |
710 | 689 |
711 } // namespace dart | 690 } // namespace dart |
712 | 691 |
713 #endif // RUNTIME_PLATFORM_GLOBALS_H_ | 692 #endif // RUNTIME_PLATFORM_GLOBALS_H_ |
OLD | NEW |