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

Side by Side Diff: runtime/vm/atomic_win.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 | « runtime/vm/atomic_test.cc ('k') | runtime/vm/pages.cc » ('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_WIN_H_ 5 #ifndef VM_ATOMIC_WIN_H_
6 #define VM_ATOMIC_WIN_H_ 6 #define VM_ATOMIC_WIN_H_
7 7
8 #if !defined VM_ATOMIC_H_ 8 #if !defined VM_ATOMIC_H_
9 #error Do not include atomic_win.h directly. Use atomic.h instead. 9 #error Do not include atomic_win.h directly. Use atomic.h instead.
10 #endif 10 #endif
(...skipping 10 matching lines...) Expand all
21 InterlockedIncrement64(reinterpret_cast<LONGLONG*>(p))) - 1; 21 InterlockedIncrement64(reinterpret_cast<LONGLONG*>(p))) - 1;
22 #elif defined(HOST_ARCH_IA32) 22 #elif defined(HOST_ARCH_IA32)
23 return static_cast<uintptr_t>( 23 return static_cast<uintptr_t>(
24 InterlockedIncrement(reinterpret_cast<LONG*>(p))) - 1; 24 InterlockedIncrement(reinterpret_cast<LONG*>(p))) - 1;
25 #else 25 #else
26 #error Unsupported host architecture. 26 #error Unsupported host architecture.
27 #endif 27 #endif
28 } 28 }
29 29
30 30
31 inline uintptr_t AtomicOperations::FetchAndIncrementBy(intptr_t* p, 31 inline void AtomicOperations::IncrementBy(intptr_t* p, intptr_t value) {
32 intptr_t value) {
33 #if defined(HOST_ARCH_X64) 32 #if defined(HOST_ARCH_X64)
34 return static_cast<uintptr_t>( 33 InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p),
35 InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p), 34 static_cast<LONGLONG>(value));
36 static_cast<LONGLONG>(value)));
37 #elif defined(HOST_ARCH_IA32) 35 #elif defined(HOST_ARCH_IA32)
38 return static_cast<uintptr_t>( 36 InterlockedExchangeAdd(reinterpret_cast<LONG*>(p),
39 InterlockedExchangeAdd(reinterpret_cast<LONG*>(p), 37 static_cast<LONG>(value));
40 static_cast<LONG>(value)));
41 #else 38 #else
42 #error Unsupported host architecture. 39 #error Unsupported host architecture.
43 #endif 40 #endif
44 } 41 }
45 42
46 43
47 inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) { 44 inline uintptr_t AtomicOperations::FetchAndDecrement(uintptr_t* p) {
48 #if defined(HOST_ARCH_X64) 45 #if defined(HOST_ARCH_X64)
49 return static_cast<uintptr_t>( 46 return static_cast<uintptr_t>(
50 InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) + 1; 47 InterlockedDecrement64(reinterpret_cast<LONGLONG*>(p))) + 1;
51 #elif defined(HOST_ARCH_IA32) 48 #elif defined(HOST_ARCH_IA32)
52 return static_cast<uintptr_t>( 49 return static_cast<uintptr_t>(
53 InterlockedDecrement(reinterpret_cast<LONG*>(p))) + 1; 50 InterlockedDecrement(reinterpret_cast<LONG*>(p))) + 1;
54 #else 51 #else
55 #error Unsupported host architecture. 52 #error Unsupported host architecture.
56 #endif 53 #endif
57 } 54 }
58 55
59 56
60 inline uintptr_t AtomicOperations::FetchAndDecrementBy(intptr_t* p, 57 inline void AtomicOperations::DecrementBy(intptr_t* p, intptr_t value) {
61 intptr_t value) {
62 #if defined(HOST_ARCH_X64) 58 #if defined(HOST_ARCH_X64)
63 return static_cast<uintptr_t>( 59 InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p),
64 InterlockedExchangeAdd64(reinterpret_cast<LONGLONG*>(p), 60 static_cast<LONGLONG>(-value));
65 static_cast<LONGLONG>(-value)));
66 #elif defined(HOST_ARCH_IA32) 61 #elif defined(HOST_ARCH_IA32)
67 return static_cast<uintptr_t>( 62 InterlockedExchangeAdd(reinterpret_cast<LONG*>(p),
68 InterlockedExchangeAdd(reinterpret_cast<LONG*>(p), 63 static_cast<LONG>(-value));
69 static_cast<LONG>(-value)));
70 #else 64 #else
71 #error Unsupported host architecture. 65 #error Unsupported host architecture.
72 #endif 66 #endif
73 } 67 }
74 68
75 69
76 #if !defined(USING_SIMULATOR) 70 #if !defined(USING_SIMULATOR)
77 inline uword AtomicOperations::CompareAndSwapWord(uword* ptr, 71 inline uword AtomicOperations::CompareAndSwapWord(uword* ptr,
78 uword old_value, 72 uword old_value,
79 uword new_value) { 73 uword new_value) {
(...skipping 21 matching lines...) Expand all
101 static_cast<LONG>(old_value))); 95 static_cast<LONG>(old_value)));
102 #else 96 #else
103 #error Unsupported host architecture. 97 #error Unsupported host architecture.
104 #endif 98 #endif
105 } 99 }
106 #endif // !defined(USING_SIMULATOR) 100 #endif // !defined(USING_SIMULATOR)
107 101
108 } // namespace dart 102 } // namespace dart
109 103
110 #endif // VM_ATOMIC_WIN_H_ 104 #endif // VM_ATOMIC_WIN_H_
OLDNEW
« no previous file with comments | « runtime/vm/atomic_test.cc ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698