Changeset 34d194c for libcfa/src/heap.cfa
- Timestamp:
- Jul 5, 2026, 11:13:26 PM (4 days ago)
- Branches:
- master
- Children:
- 97c75bf
- Parents:
- 3859adb
- git-author:
- Peter A. Buhr <pabuhr@…> (07/05/26 23:05:57)
- git-committer:
- Peter A. Buhr <pabuhr@…> (07/05/26 23:13:26)
- File:
-
- 1 edited
-
libcfa/src/heap.cfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/heap.cfa
r3859adb r34d194c 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu May 15 16:47:35 202513 // Update Count : 16 4712 // Last Modified On : Sat Jul 4 16:17:06 2026 13 // Update Count : 1658 14 14 // 15 15 … … 25 25 26 26 #include "heap.hfa" 27 #include "bits/align.hfa" // libAlign 28 #include "bits/defs.hfa" // likely, unlikely 27 #include "bits/align.hfa" // libAlign, Pause, likely, unlikely 29 28 #include "concurrency/kernel/fwd.hfa" // disable_interrupts, enable_interrupts 30 29 #include "startup.hfa" // STARTUP_PRIORITY_MEMORY … … 129 128 } // Bsearchl 130 129 131 132 // pause to prevent excess processor bus usage133 #if defined( __i386 ) || defined( __x86_64 )134 #define Pause() __asm__ __volatile__ ( "pause" : : : )135 #elif defined(__ARM_ARCH)136 #define Pause() __asm__ __volatile__ ( "YIELD" : : : )137 #else138 #error unsupported architecture139 #endif140 141 130 typedef volatile uintptr_t SpinLock_t; 142 131 … … 146 135 147 136 for ( unsigned int i = 1;; i += 1 ) { 148 if ( slock == 0 && __atomic_test_and_set( &slock, __ATOMIC_ACQUIRE) == 0 ) break; // Fence137 if ( slock == 0 && AtomicTas( slock ) == 0 ) break; // Fence 149 138 for ( volatile unsigned int s = 0; s < spin; s += 1 ) Pause(); // exponential spin 150 139 spin += spin; // powers of 2 … … 155 144 156 145 static inline __attribute__((always_inline)) void unlock( volatile SpinLock_t & slock ) { 157 __atomic_clear( &slock, __ATOMIC_RELEASE );// Fence146 AtomicClr( slock ); // Fence 158 147 } // spin_unlock 159 148 … … 1003 992 unlock( freeHead->returnLock ); 1004 993 #else 1005 block = __atomic_exchange_n( &freeHead->returnList, 0p, __ATOMIC_SEQ_CST);994 block = AtomicFas( freeHead->returnList, 0p ); 1006 995 #endif // RETURNSPIN 1007 996 … … 1168 1157 header->kind.real.next = freeHead->returnList; // link new node to top node 1169 1158 // CAS resets header->kind.real.next = freeHead->returnList on failure 1170 while ( ! __atomic_compare_exchange_n( &freeHead->returnList, &header->kind.real.next, (Heap.Storage *)header, 1171 false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ) ); 1159 while ( ! AtomicCasv( freeHead->returnList, header->kind.real.next, (Heap.Storage *)header ); 1172 1160 1173 1161 #ifdef __STATISTICS__
Note:
See TracChangeset
for help on using the changeset viewer.