Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: runtime/vm/atomic.h

Issue 1277473004: Safe and efficient stack-limit based interrupt checking in C++. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comments. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/atomic_linux.h » ('j') | runtime/vm/atomic_win.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 VM_ATOMIC_H_ 5 #ifndef VM_ATOMIC_H_
6 #define VM_ATOMIC_H_ 6 #define 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"
11 #include "vm/simulator.h" 11 #include "vm/simulator.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 class AtomicOperations : public AllStatic { 15 class AtomicOperations : public AllStatic {
16 public: 16 public:
17 // Atomically fetch the value at p and increment the value at p. 17 // Atomically fetch the value at p and increment the value at p.
18 // Returns the original value at p. 18 // Returns the original value at p.
19 // 19 //
20 // NOTE: Not to be used for any atomic operations involving memory locations 20 // NOTE: Not to be used for any atomic operations involving memory locations
21 // that are accessed by generated code 21 // that are accessed by generated code
22 static uintptr_t FetchAndIncrement(uintptr_t* p); 22 static uintptr_t FetchAndIncrement(uintptr_t* p);
23 23
24 static intptr_t FetchAndAdd(intptr_t* p, intptr_t delta);
25
24 static uword CompareAndSwapWord(uword* ptr, uword old_value, uword new_value); 26 static uword CompareAndSwapWord(uword* ptr, uword old_value, uword new_value);
27
28 static uword LoadRelaxed(uword* ptr);
25 }; 29 };
26 30
27 31
28 } // namespace dart 32 } // namespace dart
29 33
30 // We need to use the simulator to ensure that atomic operations are observed 34 // We need to use the simulator to ensure that atomic operations are observed
31 // both in C++ and in generated code if the simulator is active. 35 // both in C++ and in generated code if the simulator is active.
32 #include "vm/atomic_simulator.h" 36 #include "vm/atomic_simulator.h"
33 37
34 #if defined(TARGET_OS_ANDROID) 38 #if defined(TARGET_OS_ANDROID)
35 #include "vm/atomic_android.h" 39 #include "vm/atomic_android.h"
36 #elif defined(TARGET_OS_LINUX) 40 #elif defined(TARGET_OS_LINUX)
37 #include "vm/atomic_linux.h" 41 #include "vm/atomic_linux.h"
38 #elif defined(TARGET_OS_MACOS) 42 #elif defined(TARGET_OS_MACOS)
39 #include "vm/atomic_macos.h" 43 #include "vm/atomic_macos.h"
40 #elif defined(TARGET_OS_WINDOWS) 44 #elif defined(TARGET_OS_WINDOWS)
41 #include "vm/atomic_win.h" 45 #include "vm/atomic_win.h"
42 #else 46 #else
43 #error Unknown target os. 47 #error Unknown target os.
44 #endif 48 #endif
45 49
46 #endif // VM_ATOMIC_H_ 50 #endif // VM_ATOMIC_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/atomic_linux.h » ('j') | runtime/vm/atomic_win.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698