Changeset 0f89d4f
- Timestamp:
- Jun 19, 2020, 5:30:16 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b232745
- Parents:
- 68f36f4
- Location:
- libcfa/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.hfa
r68f36f4 r0f89d4f 118 118 static inline void ?{}(processor & this, const char name[]) { this{name, *mainCluster }; } 119 119 120 static inline Link(processor) * getNext( processor * this ) { return &this->link; }120 static inline Link(processor) * ?`next( processor * this ) { return &this->link; } 121 121 122 122 //----------------------------------------------------------------------------- -
libcfa/src/containers/stackLockFree.hfa
r68f36f4 r0f89d4f 31 31 }; // Link 32 32 33 forall( otype T | { Link(T) * getNext( T * ); } ) {33 forall( otype T | { Link(T) * ?`next( T * ); } ) { 34 34 struct StackLF { 35 35 Link(T) stack; … … 43 43 void push( StackLF(T) & this, T & n ) with(this) { 44 44 for () { // busy wait 45 * getNext( &n )= stack; // atomic assignment unnecessary, or use CAA46 if ( __atomic_compare_exchange_n( &stack.atom, & getNext( &n )->atom, (Link(T))@{ {&n, getNext( &n )->count + 1} }.atom, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ) ) break; // attempt to update top node45 *( &n )`next = stack; // atomic assignment unnecessary, or use CAA 46 if ( __atomic_compare_exchange_n( &stack.atom, &( &n )`next->atom, (Link(T))@{ {&n, ( &n )`next->count + 1} }.atom, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ) ) break; // attempt to update top node 47 47 } // for 48 48 } // push … … 53 53 t = stack; // atomic assignment unnecessary, or use CAA 54 54 if ( t.top == 0p ) return 0p; // empty stack ? 55 if ( __atomic_compare_exchange_n( &stack.atom, &t.atom, (Link(T))@{ { getNext( t.top )->top, t.count} }.atom, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ) ) return t.top; // attempt to update top node55 if ( __atomic_compare_exchange_n( &stack.atom, &t.atom, (Link(T))@{ {( t.top )`next->top, t.count} }.atom, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ) ) return t.top; // attempt to update top node 56 56 } // for 57 57 } // pop … … 62 62 T * next = link->top; 63 63 if( next == node ) { 64 link->top = getNext( node )->top;64 link->top = ( node )`next->top; 65 65 return true; 66 66 } 67 67 if( next == 0p ) return false; 68 link = getNext(next);68 link = (next)`next; 69 69 } 70 70 } -
libcfa/src/heap.cfa
r68f36f4 r0f89d4f 208 208 209 209 #if BUCKETLOCK == LOCKFREE 210 static inline Link(HeapManager.Storage) * getNext( HeapManager.Storage * this ) { return &this->header.kind.real.next; }210 static inline Link(HeapManager.Storage) * ?`next( HeapManager.Storage * this ) { return &this->header.kind.real.next; } 211 211 static inline void ?{}( HeapManager.FreeHeader & ) {} 212 212 static inline void ^?{}( HeapManager.FreeHeader & ) {} … … 665 665 #else 666 666 for ( HeapManager.Storage * p = top( freeLists[i].freeList ); p != 0p; /* p = getNext( p )->top */) { 667 typeof(p) temp = getNext( p )->top; // FIX ME: direct assignent fails, initialization works667 typeof(p) temp = ( p )`next->top; // FIX ME: direct assignent fails, initialization works 668 668 p = temp; 669 669 #endif // BUCKETLOCK … … 901 901 return oaddr; 902 902 } // if 903 903 904 904 // change size, DO NOT preserve STICKY PROPERTIES. 905 905 free( oaddr );
Note: See TracChangeset
for help on using the changeset viewer.