| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // See: http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx for an | 250 // See: http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx for an |
| 251 // explanation of some the cases when a function can never be inlined. | 251 // explanation of some the cases when a function can never be inlined. |
| 252 #ifdef _MSC_VER | 252 #ifdef _MSC_VER |
| 253 #define DART_FORCE_INLINE __forceinline | 253 #define DART_FORCE_INLINE __forceinline |
| 254 #elif __GNUC__ | 254 #elif __GNUC__ |
| 255 #define DART_FORCE_INLINE inline __attribute__((always_inline)) | 255 #define DART_FORCE_INLINE inline __attribute__((always_inline)) |
| 256 #else | 256 #else |
| 257 #error Automatic compiler detection failed. | 257 #error Automatic compiler detection failed. |
| 258 #endif | 258 #endif |
| 259 | 259 |
| 260 // DART_NOINLINE tells compiler to never inline a particular function. |
| 261 #ifdef _MSC_VER |
| 262 #define DART_NOINLINE __declspec(noinline) |
| 263 #elif __GNUC__ |
| 264 #define DART_NOINLINE __attribute__((noinline)) |
| 265 #else |
| 266 #error Automatic compiler detection failed. |
| 267 #endif |
| 268 |
| 260 // DART_UNUSED inidicates to the compiler that a variable/typedef is expected | 269 // DART_UNUSED inidicates to the compiler that a variable/typedef is expected |
| 261 // to be unused and disables the related warning. | 270 // to be unused and disables the related warning. |
| 262 #ifdef __GNUC__ | 271 #ifdef __GNUC__ |
| 263 #define DART_UNUSED __attribute__((unused)) | 272 #define DART_UNUSED __attribute__((unused)) |
| 264 #else | 273 #else |
| 265 #define DART_UNUSED | 274 #define DART_UNUSED |
| 266 #endif | 275 #endif |
| 267 | 276 |
| 268 // DART_NORETURN indicates to the compiler that a function doees not return. | 277 // DART_NORETURN indicates to the compiler that a function doees not return. |
| 269 // It should be used on functions that unconditionally call functions like | 278 // It should be used on functions that unconditionally call functions like |
| 270 // exit(), which end the program. We use it to avoid compiler warnings in | 279 // exit(), which end the program. We use it to avoid compiler warnings in |
| 271 // callers of DART_NORETURN functions. | 280 // callers of DART_NORETURN functions. |
| 272 #ifdef _MSC_VER | 281 #ifdef _MSC_VER |
| 273 #define DART_NORETURN __declspec(noreturn) | 282 #define DART_NORETURN __declspec(noreturn) |
| 274 #elif __GNUC__ | 283 #elif __GNUC__ |
| 275 #define DART_NORETURN __attribute__((noreturn)) | 284 #define DART_NORETURN __attribute__((noreturn)) |
| 276 #else | 285 #else |
| 277 #error Automatic compiler detection failed. | 286 #error Automatic compiler detection failed. |
| 278 #endif | 287 #endif |
| 279 | 288 |
| 280 #if !defined(TARGET_ARCH_MIPS) | 289 #if !defined(TARGET_ARCH_MIPS) |
| 281 #if !defined(TARGET_ARCH_ARM) | 290 #if !defined(TARGET_ARCH_ARM) |
| 282 #if !defined(TARGET_ARCH_X64) | 291 #if !defined(TARGET_ARCH_X64) |
| 283 #if !defined(TARGET_ARCH_IA32) | 292 #if !defined(TARGET_ARCH_IA32) |
| 284 #if !defined(TARGET_ARCH_ARM64) | 293 #if !defined(TARGET_ARCH_ARM64) |
| 294 #if !defined(TARGET_ARCH_DBC) |
| 285 // No target architecture specified pick the one matching the host architecture. | 295 // No target architecture specified pick the one matching the host architecture. |
| 286 #if defined(HOST_ARCH_MIPS) | 296 #if defined(HOST_ARCH_MIPS) |
| 287 #define TARGET_ARCH_MIPS 1 | 297 #define TARGET_ARCH_MIPS 1 |
| 288 #elif defined(HOST_ARCH_ARM) | 298 #elif defined(HOST_ARCH_ARM) |
| 289 #define TARGET_ARCH_ARM 1 | 299 #define TARGET_ARCH_ARM 1 |
| 290 #elif defined(HOST_ARCH_X64) | 300 #elif defined(HOST_ARCH_X64) |
| 291 #define TARGET_ARCH_X64 1 | 301 #define TARGET_ARCH_X64 1 |
| 292 #elif defined(HOST_ARCH_IA32) | 302 #elif defined(HOST_ARCH_IA32) |
| 293 #define TARGET_ARCH_IA32 1 | 303 #define TARGET_ARCH_IA32 1 |
| 294 #elif defined(HOST_ARCH_ARM64) | 304 #elif defined(HOST_ARCH_ARM64) |
| 295 #define TARGET_ARCH_ARM64 1 | 305 #define TARGET_ARCH_ARM64 1 |
| 296 #else | 306 #else |
| 297 #error Automatic target architecture detection failed. | 307 #error Automatic target architecture detection failed. |
| 298 #endif | 308 #endif |
| 299 #endif | 309 #endif |
| 300 #endif | 310 #endif |
| 301 #endif | 311 #endif |
| 302 #endif | 312 #endif |
| 303 #endif | 313 #endif |
| 314 #endif |
| 304 | 315 |
| 305 // Verify that host and target architectures match, we cannot | 316 // Verify that host and target architectures match, we cannot |
| 306 // have a 64 bit Dart VM generating 32 bit code or vice-versa. | 317 // have a 64 bit Dart VM generating 32 bit code or vice-versa. |
| 307 #if defined(TARGET_ARCH_X64) || \ | 318 #if defined(TARGET_ARCH_X64) || \ |
| 308 defined(TARGET_ARCH_ARM64) | 319 defined(TARGET_ARCH_ARM64) |
| 309 #if !defined(ARCH_IS_64_BIT) | 320 #if !defined(ARCH_IS_64_BIT) |
| 310 #error Mismatched Host/Target architectures. | 321 #error Mismatched Host/Target architectures. |
| 311 #endif | 322 #endif |
| 312 #elif defined(TARGET_ARCH_IA32) || \ | 323 #elif defined(TARGET_ARCH_IA32) || \ |
| 313 defined(TARGET_ARCH_ARM) || \ | 324 defined(TARGET_ARCH_ARM) || \ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 330 #elif defined(TARGET_ARCH_ARM64) | 341 #elif defined(TARGET_ARCH_ARM64) |
| 331 #if !defined(HOST_ARCH_ARM64) | 342 #if !defined(HOST_ARCH_ARM64) |
| 332 #define USING_SIMULATOR 1 | 343 #define USING_SIMULATOR 1 |
| 333 #endif | 344 #endif |
| 334 | 345 |
| 335 #elif defined(TARGET_ARCH_MIPS) | 346 #elif defined(TARGET_ARCH_MIPS) |
| 336 #if !defined(HOST_ARCH_MIPS) | 347 #if !defined(HOST_ARCH_MIPS) |
| 337 #define USING_SIMULATOR 1 | 348 #define USING_SIMULATOR 1 |
| 338 #endif | 349 #endif |
| 339 | 350 |
| 351 #elif defined(TARGET_ARCH_DBC) |
| 352 #define USING_SIMULATOR 1 |
| 353 |
| 340 #else | 354 #else |
| 341 #error Unknown architecture. | 355 #error Unknown architecture. |
| 342 #endif | 356 #endif |
| 343 | 357 |
| 344 | 358 |
| 345 // Short form printf format specifiers | 359 // Short form printf format specifiers |
| 346 #define Pd PRIdPTR | 360 #define Pd PRIdPTR |
| 347 #define Pu PRIuPTR | 361 #define Pu PRIuPTR |
| 348 #define Px PRIxPTR | 362 #define Px PRIxPTR |
| 349 #define Pd64 PRId64 | 363 #define Pd64 PRId64 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 // tag in the ICData and check it when recreating the flow graph in | 668 // tag in the ICData and check it when recreating the flow graph in |
| 655 // optimizing compiler. Enable it for other modes (product, release) if needed | 669 // optimizing compiler. Enable it for other modes (product, release) if needed |
| 656 // for debugging. | 670 // for debugging. |
| 657 #if defined(DEBUG) | 671 #if defined(DEBUG) |
| 658 #define TAG_IC_DATA | 672 #define TAG_IC_DATA |
| 659 #endif | 673 #endif |
| 660 | 674 |
| 661 } // namespace dart | 675 } // namespace dart |
| 662 | 676 |
| 663 #endif // PLATFORM_GLOBALS_H_ | 677 #endif // PLATFORM_GLOBALS_H_ |
| OLD | NEW |