Ignore:
Timestamp:
Nov 14, 2022, 11:52:44 AM (3 years ago)
Author:
caparson <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
7d9598d8
Parents:
b77f0e1 (diff), 19a8c40 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/invoke.h

    rb77f0e1 r63be3387  
    146146
    147147        // Link lists fields
    148         // instrusive link field for threads
     148        // instrusive link field for threads in the ready-queue
    149149        struct __thread_desc_link {
    150150                struct thread$ * next;
    151151                volatile unsigned long long ts;
    152152        };
     153
     154        // Link lists fields
     155        // instrusive link field for threads in the user_link/cltr_link
     156        struct __thread_user_link {
     157                #ifdef __cforall
     158                        inline dlink(thread$);
     159                #else
     160                        struct thread$ * next; struct thread$ * back;
     161                #endif
     162        };
     163        _Static_assert(sizeof(struct __thread_user_link) == 2 * sizeof(struct thread$ *), "__thread_user_link should be consistent in C and Cforall");
    153164
    154165        struct thread$ {
     
    159170                // Link lists fields
    160171                // instrusive link field for threads
    161                 struct __thread_desc_link link;
     172                struct __thread_desc_link rdy_link;
    162173
    163174                // current execution status for coroutine
     
    195206                struct __monitor_group_t monitors;
    196207
    197                 // used to put threads on dlist data structure
    198                 __cfa_dlink(thread$);
    199 
    200                 struct {
    201                         struct thread$ * next;
    202                         struct thread$ * prev;
    203                 } node;
     208                // intrusive link fields, used for locks, monitors and any user defined data structure
     209                // default link fields for dlist
     210                struct __thread_user_link user_link;
     211
     212                // secondary intrusive link fields, used for global cluster list
     213                // default link fields for dlist
     214                struct __thread_user_link cltr_link;
    204215
    205216                // used to store state between clh lock/unlock
     
    214225
    215226                #if defined( __CFA_WITH_VERIFY__ )
     227                        struct processor * volatile executing;
    216228                        void * canary;
    217229                #endif
    218230        };
    219         #ifdef __cforall
    220                 P9_EMBEDDED( thread$, dlink(thread$) )
    221         #endif
     231
    222232        // Wrapper for gdb
    223233        struct cfathread_thread_t { struct thread$ debug; };
     
    231241        #ifdef __cforall
    232242        extern "Cforall" {
     243                static inline thread$ * volatile & ?`next ( thread$ * this ) {
     244                        return this->user_link.next;
     245                }
    233246
    234247                static inline thread$ *& get_next( thread$ & this ) __attribute__((const)) {
    235                         return this.link.next;
    236                 }
    237 
    238                 static inline [thread$ *&, thread$ *& ] __get( thread$ & this ) __attribute__((const)) {
    239                         return this.node.[next, prev];
    240                 }
     248                        return this.user_link.next;
     249                }
     250
     251                static inline tytagref( dlink(thread$), dlink(thread$) ) ?`inner( thread$ & this ) {
     252                        dlink(thread$) & b = this.user_link;
     253                        tytagref( dlink(thread$), dlink(thread$) ) result = { b };
     254                        return result;
     255                }
     256
     257                static inline tytagref(struct __thread_user_link, dlink(thread$)) ?`inner( struct thread$ & this ) {
     258                        struct __thread_user_link & ib = this.cltr_link;
     259                        dlink(thread$) & b = ib`inner;
     260                        tytagref(struct __thread_user_link, dlink(thread$)) result = { b };
     261                        return result;
     262                }
     263
     264                P9_EMBEDDED(struct __thread_user_link, dlink(thread$))
    241265
    242266                static inline void ?{}(__monitor_group_t & this) {
Note: See TracChangeset for help on using the changeset viewer.