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

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

Issue 1658983004: Change signature of atomic increment/decrement functions to return void. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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_android.h » ('j') | no next file with comments »
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 static uintptr_t FetchAndIncrementBy(intptr_t* p, intptr_t value); 23
24 // Atomically increment the value at p by 'value'.
25 //
26 // NOTE: Not to be used for any atomic operations involving memory locations
27 // that are accessed by generated code.
28 static void IncrementBy(intptr_t* p, intptr_t value);
24 29
25 // Atomically fetch the value at p and decrement the value at p. 30 // Atomically fetch the value at p and decrement the value at p.
26 // Returns the original value at p. 31 // Returns the original value at p.
27 // 32 //
28 // NOTE: Not to be used for any atomic operations involving memory locations 33 // NOTE: Not to be used for any atomic operations involving memory locations
29 // that are accessed by generated code. 34 // that are accessed by generated code.
30 static uintptr_t FetchAndDecrement(uintptr_t* p); 35 static uintptr_t FetchAndDecrement(uintptr_t* p);
31 static uintptr_t FetchAndDecrementBy(intptr_t* p, intptr_t value); 36
37 // Atomically decrement the value at p by 'value'.
38 //
39 // NOTE: Not to be used for any atomic operations involving memory locations
40 // that are accessed by generated code.
41 static void DecrementBy(intptr_t* p, intptr_t value);
32 42
33 // Atomically compare *ptr to old_value, and if equal, store new_value. 43 // Atomically compare *ptr to old_value, and if equal, store new_value.
34 // Returns the original value at ptr. 44 // Returns the original value at ptr.
35 // 45 //
36 // NOTE: OK to use with memory locations that are accessed by generated code 46 // NOTE: OK to use with memory locations that are accessed by generated code
37 static uword CompareAndSwapWord(uword* ptr, uword old_value, uword new_value); 47 static uword CompareAndSwapWord(uword* ptr, uword old_value, uword new_value);
38 static uint32_t CompareAndSwapUint32( 48 static uint32_t CompareAndSwapUint32(
39 uint32_t* ptr, uint32_t old_value, uint32_t new_value); 49 uint32_t* ptr, uint32_t old_value, uint32_t new_value);
40 50
41 // Performs a load of a word from 'ptr', but without any guarantees about 51 // Performs a load of a word from 'ptr', but without any guarantees about
(...skipping 16 matching lines...) Expand all
58 #include "vm/atomic_linux.h" 68 #include "vm/atomic_linux.h"
59 #elif defined(TARGET_OS_MACOS) 69 #elif defined(TARGET_OS_MACOS)
60 #include "vm/atomic_macos.h" 70 #include "vm/atomic_macos.h"
61 #elif defined(TARGET_OS_WINDOWS) 71 #elif defined(TARGET_OS_WINDOWS)
62 #include "vm/atomic_win.h" 72 #include "vm/atomic_win.h"
63 #else 73 #else
64 #error Unknown target os. 74 #error Unknown target os.
65 #endif 75 #endif
66 76
67 #endif // VM_ATOMIC_H_ 77 #endif // VM_ATOMIC_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/atomic_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698