Ignore:
Timestamp:
Oct 28, 2022, 5:30:57 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, master
Children:
f1f481a
Parents:
be5f0a5
Message:

Renamed ready-queue link fields to rdy_link

Location:
libcfa/src/concurrency
Files:
6 edited

Legend:

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

    rbe5f0a5 r15c93d8  
    159159                // Link lists fields
    160160                // instrusive link field for threads
    161                 struct __thread_desc_link link;
     161                struct __thread_desc_link rdy_link;
    162162
    163163                // current execution status for coroutine
  • libcfa/src/concurrency/kernel.cfa

    rbe5f0a5 r15c93d8  
    291291        /* paranoid */ verify( ! __preemption_enabled() );
    292292        /* paranoid */ verifyf( thrd_dst->state == Ready || thrd_dst->preempted != __NO_PREEMPTION, "state : %d, preempted %d\n", thrd_dst->state, thrd_dst->preempted);
    293         /* paranoid */ verifyf( thrd_dst->link.next == 0p, "Expected null got %p", thrd_dst->link.next );
     293        /* paranoid */ verifyf( thrd_dst->rdy_link.next == 0p, "Expected null got %p", thrd_dst->rdy_link.next );
    294294        __builtin_prefetch( thrd_dst->context.SP );
    295295
     
    454454                                        "Error preempted thread marked as not currently running, state %d, preemption %d\n", thrd->state, thrd->preempted );
    455455        /* paranoid */ #endif
    456         /* paranoid */ verifyf( thrd->link.next == 0p, "Expected null got %p", thrd->link.next );
     456        /* paranoid */ verifyf( thrd->rdy_link.next == 0p, "Expected null got %p", thrd->rdy_link.next );
    457457        /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd->canary );
    458458
     
    628628                // If that is the case, abandon the preemption.
    629629                bool preempted = false;
    630                 if(thrd->link.next == 0p) {
     630                if(thrd->rdy_link.next == 0p) {
    631631                        preempted = true;
    632632                        thrd->preempted = reason;
  • libcfa/src/concurrency/kernel/cluster.cfa

    rbe5f0a5 r15c93d8  
    483483
    484484        // We add a boat-load of assertions here because the anchor code is very fragile
    485         /* paranoid */ _Static_assert( offsetof( thread$, link ) == nested_offsetof(__intrusive_lane_t, l.anchor) );
    486         /* paranoid */ verify( offsetof( thread$, link ) == nested_offsetof(__intrusive_lane_t, l.anchor) );
    487         /* paranoid */ verify( ((uintptr_t)( mock_head(this) ) + offsetof( thread$, link )) == (uintptr_t)(&this.l.anchor) );
    488         /* paranoid */ verify( &mock_head(this)->link.next == &this.l.anchor.next );
    489         /* paranoid */ verify( &mock_head(this)->link.ts   == &this.l.anchor.ts   );
    490         /* paranoid */ verify( mock_head(this)->link.next == 0p );
    491         /* paranoid */ verify( mock_head(this)->link.ts   == MAX );
     485        /* paranoid */ _Static_assert( offsetof( thread$, rdy_link ) == nested_offsetof(__intrusive_lane_t, l.anchor) );
     486        /* paranoid */ verify( offsetof( thread$, rdy_link ) == nested_offsetof(__intrusive_lane_t, l.anchor) );
     487        /* paranoid */ verify( ((uintptr_t)( mock_head(this) ) + offsetof( thread$, rdy_link )) == (uintptr_t)(&this.l.anchor) );
     488        /* paranoid */ verify( &mock_head(this)->rdy_link.next == &this.l.anchor.next );
     489        /* paranoid */ verify( &mock_head(this)->rdy_link.ts   == &this.l.anchor.ts   );
     490        /* paranoid */ verify( mock_head(this)->rdy_link.next == 0p );
     491        /* paranoid */ verify( mock_head(this)->rdy_link.ts   == MAX );
    492492        /* paranoid */ verify( mock_head(this) == this.l.prev );
    493493        /* paranoid */ verify( __alignof__(__intrusive_lane_t) == 64 );
  • libcfa/src/concurrency/kernel/startup.cfa

    rbe5f0a5 r15c93d8  
    525525        self_mon.recursion = 1;
    526526        self_mon_p = &self_mon;
    527         link.next = 0p;
    528         link.ts   = MAX;
     527        rdy_link.next = 0p;
     528        rdy_link.ts   = MAX;
    529529        preferred = ready_queue_new_preferred();
    530530        last_proc = 0p;
  • libcfa/src/concurrency/ready_subqueue.hfa

    rbe5f0a5 r15c93d8  
    2525static inline thread$ * mock_head(const __intrusive_lane_t & this) {
    2626        thread$ * rhead = (thread$ *)(
    27                 (uintptr_t)( &this.l.anchor ) - __builtin_offsetof( thread$, link )
     27                (uintptr_t)( &this.l.anchor ) - __builtin_offsetof( thread$, rdy_link )
    2828        );
    2929        return rhead;
     
    3434static inline void push( __intrusive_lane_t & this, thread$ * node ) {
    3535        /* paranoid */ verify( this.l.lock );
    36         /* paranoid */ verify( node->link.next == 0p );
    37         /* paranoid */ verify( __atomic_load_n(&node->link.ts, __ATOMIC_RELAXED) == MAX  );
    38         /* paranoid */ verify( this.l.prev->link.next == 0p );
    39         /* paranoid */ verify( __atomic_load_n(&this.l.prev->link.ts, __ATOMIC_RELAXED)   == MAX  );
     36        /* paranoid */ verify( node->rdy_link.next == 0p );
     37        /* paranoid */ verify( __atomic_load_n(&node->rdy_link.ts, __ATOMIC_RELAXED) == MAX  );
     38        /* paranoid */ verify( this.l.prev->rdy_link.next == 0p );
     39        /* paranoid */ verify( __atomic_load_n(&this.l.prev->rdy_link.ts, __ATOMIC_RELAXED)   == MAX  );
    4040        if( this.l.anchor.next == 0p ) {
    4141                /* paranoid */ verify( this.l.anchor.next == 0p );
     
    5151
    5252        // Get the relevant nodes locally
    53         this.l.prev->link.next = node;
    54         __atomic_store_n(&this.l.prev->link.ts, rdtscl(), __ATOMIC_RELAXED);
     53        this.l.prev->rdy_link.next = node;
     54        __atomic_store_n(&this.l.prev->rdy_link.ts, rdtscl(), __ATOMIC_RELAXED);
    5555        this.l.prev = node;
    5656        #if !defined(__CFA_NO_STATISTICS__)
     
    7070        // Get the relevant nodes locally
    7171        thread$ * node = this.l.anchor.next;
    72         this.l.anchor.next = node->link.next;
    73         __atomic_store_n(&this.l.anchor.ts, __atomic_load_n(&node->link.ts, __ATOMIC_RELAXED), __ATOMIC_RELAXED);
     72        this.l.anchor.next = node->rdy_link.next;
     73        __atomic_store_n(&this.l.anchor.ts, __atomic_load_n(&node->rdy_link.ts, __ATOMIC_RELAXED), __ATOMIC_RELAXED);
    7474        bool is_empty = this.l.anchor.next == 0p;
    75         node->link.next = 0p;
    76         __atomic_store_n(&node->link.ts, ULLONG_MAX, __ATOMIC_RELAXED);
     75        node->rdy_link.next = 0p;
     76        __atomic_store_n(&node->rdy_link.ts, ULLONG_MAX, __ATOMIC_RELAXED);
    7777        #if !defined(__CFA_NO_STATISTICS__)
    7878                this.l.cnt--;
     
    8383
    8484        unsigned long long ats = __atomic_load_n(&this.l.anchor.ts, __ATOMIC_RELAXED);
    85         /* paranoid */ verify( node->link.next == 0p );
    86         /* paranoid */ verify( __atomic_load_n(&node->link.ts , __ATOMIC_RELAXED) == MAX );
    87         /* paranoid */ verify( __atomic_load_n(&node->link.ts , __ATOMIC_RELAXED) != 0   );
     85        /* paranoid */ verify( node->rdy_link.next == 0p );
     86        /* paranoid */ verify( __atomic_load_n(&node->rdy_link.ts , __ATOMIC_RELAXED) == MAX );
     87        /* paranoid */ verify( __atomic_load_n(&node->rdy_link.ts , __ATOMIC_RELAXED) != 0   );
    8888        /* paranoid */ verify( ats != 0 );
    8989        /* paranoid */ verify( (ats == MAX) == is_empty );
  • libcfa/src/concurrency/thread.cfa

    rbe5f0a5 r15c93d8  
    4444        self_mon_p = &self_mon;
    4545        curr_cluster = &cl;
    46         link.next = 0p;
    47         link.ts   = MAX;
     46        rdy_link.next = 0p;
     47        rdy_link.ts   = MAX;
    4848        preferred = ready_queue_new_preferred();
    4949        last_proc = 0p;
Note: See TracChangeset for help on using the changeset viewer.