| 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 PLATFORM_GLOBALS_H_ | 5 #ifndef PLATFORM_GLOBALS_H_ |
| 6 #define PLATFORM_GLOBALS_H_ | 6 #define 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 #if !defined(UNICODE) | 44 #if !defined(UNICODE) |
| 45 #define _UNICODE | 45 #define _UNICODE |
| 46 #define UNICODE | 46 #define UNICODE |
| 47 #endif | 47 #endif |
| 48 | 48 |
| 49 #include <windows.h> | 49 #include <windows.h> |
| 50 #include <winsock2.h> | 50 #include <winsock2.h> |
| 51 #include <Rpc.h> | 51 #include <Rpc.h> |
| 52 #include <shellapi.h> | 52 #include <shellapi.h> |
| 53 #endif | 53 #endif // defined(_WIN32) |
| 54 | 54 |
| 55 #if !defined(_WIN32) | 55 #if !defined(_WIN32) |
| 56 #include <arpa/inet.h> | 56 #include <arpa/inet.h> |
| 57 #include <inttypes.h> | 57 #include <inttypes.h> |
| 58 #include <stdint.h> | 58 #include <stdint.h> |
| 59 #include <unistd.h> | 59 #include <unistd.h> |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 #include <float.h> | 62 #include <float.h> |
| 63 #include <limits.h> | 63 #include <limits.h> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 82 | 82 |
| 83 // Target OS detection. | 83 // Target OS detection. |
| 84 // for more information on predefined macros: | 84 // for more information on predefined macros: |
| 85 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 85 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
| 86 // - with gcc, run: "echo | gcc -E -dM -" | 86 // - with gcc, run: "echo | gcc -E -dM -" |
| 87 #if defined(__ANDROID__) | 87 #if defined(__ANDROID__) |
| 88 #define TARGET_OS_ANDROID 1 | 88 #define TARGET_OS_ANDROID 1 |
| 89 #elif defined(__linux__) || defined(__FreeBSD__) | 89 #elif defined(__linux__) || defined(__FreeBSD__) |
| 90 #define TARGET_OS_LINUX 1 | 90 #define TARGET_OS_LINUX 1 |
| 91 #elif defined(__APPLE__) | 91 #elif defined(__APPLE__) |
| 92 // Define the flavor of Mac OS we are running on. |
| 93 #include <TargetConditionals.h> |
| 94 // TODO(iposva): Rename TARGET_OS_MACOS to TARGET_OS_MAC to inherit |
| 95 // the value defined in TargetConditionals.h |
| 92 #define TARGET_OS_MACOS 1 | 96 #define TARGET_OS_MACOS 1 |
| 97 #if TARGET_OS_IPHONE |
| 98 #define TARGET_OS_IOS |
| 99 #endif |
| 100 |
| 93 #elif defined(_WIN32) | 101 #elif defined(_WIN32) |
| 94 #define TARGET_OS_WINDOWS 1 | 102 #define TARGET_OS_WINDOWS 1 |
| 95 #else | 103 #else |
| 96 #error Automatic target os detection failed. | 104 #error Automatic target os detection failed. |
| 97 #endif | 105 #endif |
| 98 | 106 |
| 99 namespace dart { | 107 namespace dart { |
| 100 | 108 |
| 101 struct simd128_value_t { | 109 struct simd128_value_t { |
| 102 union { | 110 union { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 #define kFpuRegisterSize 8 | 172 #define kFpuRegisterSize 8 |
| 165 typedef double fpu_register_t; | 173 typedef double fpu_register_t; |
| 166 #else | 174 #else |
| 167 #define kFpuRegisterSize 16 | 175 #define kFpuRegisterSize 16 |
| 168 typedef simd128_value_t fpu_register_t; | 176 typedef simd128_value_t fpu_register_t; |
| 169 #endif | 177 #endif |
| 170 #elif defined(__ARMEL__) | 178 #elif defined(__ARMEL__) |
| 171 #define HOST_ARCH_ARM 1 | 179 #define HOST_ARCH_ARM 1 |
| 172 #define ARCH_IS_32_BIT 1 | 180 #define ARCH_IS_32_BIT 1 |
| 173 #define kFpuRegisterSize 16 | 181 #define kFpuRegisterSize 16 |
| 182 // Mark the fact that we have defined simd_value_t. |
| 183 #define SIMD_VALUE_T_ |
| 174 typedef struct { | 184 typedef struct { |
| 175 union { | 185 union { |
| 176 uint32_t u; | 186 uint32_t u; |
| 177 float f; | 187 float f; |
| 178 } data_[4]; | 188 } data_[4]; |
| 179 } simd_value_t; | 189 } simd_value_t; |
| 180 typedef simd_value_t fpu_register_t; | 190 typedef simd_value_t fpu_register_t; |
| 181 #define simd_value_safe_load(addr) \ | 191 #define simd_value_safe_load(addr) \ |
| 182 (*reinterpret_cast<simd_value_t *>(addr)) | 192 (*reinterpret_cast<simd_value_t *>(addr)) |
| 183 #define simd_value_safe_store(addr, value) \ | 193 #define simd_value_safe_store(addr, value) \ |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 #error Mismatched Host/Target architectures. | 266 #error Mismatched Host/Target architectures. |
| 257 #endif | 267 #endif |
| 258 #elif defined(TARGET_ARCH_IA32) || \ | 268 #elif defined(TARGET_ARCH_IA32) || \ |
| 259 defined(TARGET_ARCH_ARM) || \ | 269 defined(TARGET_ARCH_ARM) || \ |
| 260 defined(TARGET_ARCH_MIPS) | 270 defined(TARGET_ARCH_MIPS) |
| 261 #if !defined(ARCH_IS_32_BIT) | 271 #if !defined(ARCH_IS_32_BIT) |
| 262 #error Mismatched Host/Target architectures. | 272 #error Mismatched Host/Target architectures. |
| 263 #endif | 273 #endif |
| 264 #endif | 274 #endif |
| 265 | 275 |
| 276 // Determine whether we will be using the simulator. |
| 277 #if defined(TARGET_ARCH_IA32) |
| 278 // No simulator used. |
| 279 #elif defined(TARGET_ARCH_X64) |
| 280 // No simulator used. |
| 281 #elif defined(TARGET_ARCH_ARM) |
| 282 #if !defined(HOST_ARCH_ARM) || defined(TARGET_OS_IOS) |
| 283 #define USING_SIMULATOR 1 |
| 284 #endif |
| 285 |
| 286 #elif defined(TARGET_ARCH_ARM64) |
| 287 #if !defined(HOST_ARCH_ARM64) || defined(TARGET_OS_IOS) |
| 288 #define USING_SIMULATOR 1 |
| 289 #endif |
| 290 |
| 291 #elif defined(TARGET_ARCH_MIPS) |
| 292 #if !defined(HOST_ARCH_MIPS) || defined(TARGET_OS_IOS) |
| 293 #define USING_SIMULATOR 1 |
| 294 #endif |
| 295 |
| 296 #else |
| 297 #error Unknown architecture. |
| 298 #endif |
| 299 |
| 266 | 300 |
| 267 // Short form printf format specifiers | 301 // Short form printf format specifiers |
| 268 #define Pd PRIdPTR | 302 #define Pd PRIdPTR |
| 269 #define Pu PRIuPTR | 303 #define Pu PRIuPTR |
| 270 #define Px PRIxPTR | 304 #define Px PRIxPTR |
| 271 #define Pd64 PRId64 | 305 #define Pd64 PRId64 |
| 272 #define Pu64 PRIu64 | 306 #define Pu64 PRIu64 |
| 273 #define Px64 PRIx64 | 307 #define Px64 PRIx64 |
| 274 | 308 |
| 275 | 309 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // should be counted from two, not one." | 578 // should be counted from two, not one." |
| 545 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ | 579 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ |
| 546 __attribute__((__format__(__printf__, string_index, first_to_check))) | 580 __attribute__((__format__(__printf__, string_index, first_to_check))) |
| 547 #else | 581 #else |
| 548 #define PRINTF_ATTRIBUTE(string_index, first_to_check) | 582 #define PRINTF_ATTRIBUTE(string_index, first_to_check) |
| 549 #endif | 583 #endif |
| 550 | 584 |
| 551 } // namespace dart | 585 } // namespace dart |
| 552 | 586 |
| 553 #endif // PLATFORM_GLOBALS_H_ | 587 #endif // PLATFORM_GLOBALS_H_ |
| OLD | NEW |