OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_ATOMIC_H_ | 5 #ifndef RUNTIME_VM_ATOMIC_H_ |
6 #define RUNTIME_VM_ATOMIC_H_ | 6 #define RUNTIME_VM_ATOMIC_H_ |
7 | 7 |
8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
9 | 9 |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 uint32_t new_value); | 53 uint32_t new_value); |
54 | 54 |
55 // Performs a load of a word from 'ptr', but without any guarantees about | 55 // Performs a load of a word from 'ptr', but without any guarantees about |
56 // memory order (i.e., no load barriers/fences). | 56 // memory order (i.e., no load barriers/fences). |
57 template <typename T> | 57 template <typename T> |
58 static T LoadRelaxed(T* ptr) { | 58 static T LoadRelaxed(T* ptr) { |
59 return *static_cast<volatile T*>(ptr); | 59 return *static_cast<volatile T*>(ptr); |
60 } | 60 } |
61 }; | 61 }; |
62 | 62 |
63 | |
64 } // namespace dart | 63 } // namespace dart |
65 | 64 |
66 #if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC) | 65 #if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC) |
67 #define USING_SIMULATOR_ATOMICS | 66 #define USING_SIMULATOR_ATOMICS |
68 #endif | 67 #endif |
69 | 68 |
70 #if defined(USING_SIMULATOR_ATOMICS) | 69 #if defined(USING_SIMULATOR_ATOMICS) |
71 // We need to use the simulator to ensure that atomic operations are observed | 70 // We need to use the simulator to ensure that atomic operations are observed |
72 // both in C++ and in generated code if the simulator is active. | 71 // both in C++ and in generated code if the simulator is active. |
73 #include "vm/atomic_simulator.h" | 72 #include "vm/atomic_simulator.h" |
74 #endif | 73 #endif |
75 | 74 |
76 #if defined(HOST_OS_ANDROID) | 75 #if defined(HOST_OS_ANDROID) |
77 #include "vm/atomic_android.h" | 76 #include "vm/atomic_android.h" |
78 #elif defined(HOST_OS_FUCHSIA) | 77 #elif defined(HOST_OS_FUCHSIA) |
79 #include "vm/atomic_fuchsia.h" | 78 #include "vm/atomic_fuchsia.h" |
80 #elif defined(HOST_OS_LINUX) | 79 #elif defined(HOST_OS_LINUX) |
81 #include "vm/atomic_linux.h" | 80 #include "vm/atomic_linux.h" |
82 #elif defined(HOST_OS_MACOS) | 81 #elif defined(HOST_OS_MACOS) |
83 #include "vm/atomic_macos.h" | 82 #include "vm/atomic_macos.h" |
84 #elif defined(HOST_OS_WINDOWS) | 83 #elif defined(HOST_OS_WINDOWS) |
85 #include "vm/atomic_win.h" | 84 #include "vm/atomic_win.h" |
86 #else | 85 #else |
87 #error Unknown target os. | 86 #error Unknown target os. |
88 #endif | 87 #endif |
89 | 88 |
90 #endif // RUNTIME_VM_ATOMIC_H_ | 89 #endif // RUNTIME_VM_ATOMIC_H_ |
OLD | NEW |