Changeset e235429


Ignore:
Timestamp:
Oct 1, 2020, 1:52:53 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
b4b63e8
Parents:
038110a
Message:

Removed last parker/unparker information is it was not particularly useful

Files:
20 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/main.cfa

    r038110a re235429  
    125125                                                workers[i].flags   = 0;
    126126                                        }
    127                                         unpark( workers[i] __cfaabi_dbg_ctx2 );
     127                                        unpark( workers[i] );
    128128                                }
    129129                                printf("%d workers started on %d processors\n", options.clopts.nworkers, options.clopts.nprocs);
  • benchmark/io/http/worker.cfa

    r038110a re235429  
    2222
    2323void main( Worker & this ) {
    24         park( __cfaabi_dbg_ctx );
     24        park();
    2525        /* paranoid */ assert( this.pipe[0] != -1 );
    2626        /* paranoid */ assert( this.pipe[1] != -1 );
  • benchmark/io/readv.cfa

    r038110a re235429  
    5454
    5555void main( Reader & ) {
    56         park( __cfaabi_dbg_ctx );
     56        park();
    5757        /* paranoid */ assert( true == __atomic_load_n(&run, __ATOMIC_RELAXED) );
    5858
     
    151151
    152152                                for(i; nthreads) {
    153                                         unpark( threads[i] __cfaabi_dbg_ctx2 );
     153                                        unpark( threads[i] );
    154154                                }
    155155                                wait(duration, start, end, is_tty);
  • benchmark/readyQ/yield.cfa

    r038110a re235429  
    3232
    3333void main( Yielder & this ) {
    34         park( __cfaabi_dbg_ctx );
     34        park();
    3535        /* paranoid */ assert( true == __atomic_load_n(&run, __ATOMIC_RELAXED) );
    3636
     
    7070
    7171                                for(i; nthreads) {
    72                                         unpark( threads[i] __cfaabi_dbg_ctx2 );
     72                                        unpark( threads[i] );
    7373                                }
    7474                                wait(duration, start, end, is_tty);
  • libcfa/src/bits/locks.hfa

    r038110a re235429  
    164164
    165165        struct $thread;
    166         extern void park( __cfaabi_dbg_ctx_param );
    167         extern void unpark( struct $thread * this __cfaabi_dbg_ctx_param2 );
     166        extern void park( void );
     167        extern void unpark( struct $thread * this );
    168168        static inline struct $thread * active_thread ();
    169169
     
    191191                                        /* paranoid */ verify( expected == 0p );
    192192                                        if(__atomic_compare_exchange_n(&this.ptr, &expected, active_thread(), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    193                                                 park( __cfaabi_dbg_ctx );
     193                                                park();
    194194                                                return true;
    195195                                        }
     
    210210                                else {
    211211                                        if(__atomic_compare_exchange_n(&this.ptr, &expected, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    212                                                 unpark( expected __cfaabi_dbg_ctx2 );
     212                                                unpark( expected );
    213213                                                return true;
    214214                                        }
     
    244244                                /* paranoid */ verify( expected == 0p );
    245245                                if(__atomic_compare_exchange_n(&this.ptr, &expected, active_thread(), false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    246                                         park( __cfaabi_dbg_ctx );
     246                                        park();
    247247                                        /* paranoid */ verify( this.ptr == 1p );
    248248                                        return true;
     
    256256                        struct $thread * got = __atomic_exchange_n( &this.ptr, 1p, __ATOMIC_SEQ_CST);
    257257                        if( got == 0p ) return false;
    258                         unpark( got __cfaabi_dbg_ctx2 );
     258                        unpark( got );
    259259                        return true;
    260260                }
  • libcfa/src/concurrency/alarm.cfa

    r038110a re235429  
    130130
    131131        register_self( &node );
    132         park( __cfaabi_dbg_ctx );
     132        park();
    133133
    134134        /* paranoid */ verify( !node.set );
  • libcfa/src/concurrency/clib/cfathread.cfa

    r038110a re235429  
    4444
    4545        void cfathread_park( void ) {
    46                 park( __cfaabi_dbg_ctx );
     46                park();
    4747        }
    4848
    4949        void cfathread_unpark( CRunner * thrd ) {
    50                 unpark( *thrd __cfaabi_dbg_ctx2 );
     50                unpark( *thrd );
    5151        }
    5252
  • libcfa/src/concurrency/invoke.h

    r038110a re235429  
    9494        };
    9595        // Wrapper for gdb
    96         struct cfathread_coroutine_t { $coroutine debug; };
     96        struct cfathread_coroutine_t { struct $coroutine debug; };
    9797
    9898        static inline struct __stack_t * __get_stack( struct $coroutine * cor ) {
     
    132132        };
    133133        // Wrapper for gdb
    134         struct cfathread_monitor_t { $monitor debug; };
     134        struct cfathread_monitor_t { struct $monitor debug; };
    135135
    136136        struct __monitor_group_t {
     
    191191
    192192                #ifdef __CFA_DEBUG__
    193                         // previous function to park/unpark the thread
    194                         const char * park_caller;
    195                         int park_result;
    196                         enum __Coroutine_State park_state;
    197                         bool park_stale;
    198                         const char * unpark_caller;
    199                         int unpark_result;
    200                         enum __Coroutine_State unpark_state;
    201                         bool unpark_stale;
     193                        unsigned long long canary;
    202194                #endif
    203195        };
    204196        // Wrapper for gdb
    205         struct cfathread_thread_t { $thread debug; };
     197        struct cfathread_thread_t { struct $thread debug; };
    206198
    207199        #ifdef __CFA_DEBUG__
  • libcfa/src/concurrency/io.cfa

    r038110a re235429  
    6969                if( block ) {
    7070                        enable_interrupts( __cfaabi_dbg_ctx );
    71                         park( __cfaabi_dbg_ctx );
     71                        park();
    7272                        disable_interrupts();
    7373                }
  • libcfa/src/concurrency/io/setup.cfa

    r038110a re235429  
    247247                                        thrd.link.next = 0p;
    248248                                        thrd.link.prev = 0p;
    249                                         __cfaabi_dbg_debug_do( thrd.unpark_stale = true );
    250249
    251250                                        // Fixup the thread state
  • libcfa/src/concurrency/kernel.cfa

    r038110a re235429  
    246246                thrd_dst->state = Active;
    247247
    248                 __cfaabi_dbg_debug_do(
    249                         thrd_dst->park_stale   = true;
    250                         thrd_dst->unpark_stale = true;
    251                 )
    252248                // Update global state
    253249                kernelTLS.this_thread = thrd_dst;
     
    288284                        // The thread has halted, it should never be scheduled/run again
    289285                        // We may need to wake someone up here since
    290                         unpark( this->destroyer __cfaabi_dbg_ctx2 );
     286                        unpark( this->destroyer );
    291287                        this->destroyer = 0p;
    292288                        break RUNNING;
     
    298294                // set state of processor coroutine to active and the thread to inactive
    299295                int old_ticket = __atomic_fetch_sub(&thrd_dst->ticket, 1, __ATOMIC_SEQ_CST);
    300                 __cfaabi_dbg_debug_do( thrd_dst->park_result = old_ticket; )
    301296                switch(old_ticket) {
    302297                        case 1:
     
    404399
    405400// KERNEL ONLY unpark with out disabling interrupts
    406 void __unpark(  struct __processor_id_t * id, $thread * thrd __cfaabi_dbg_ctx_param2 ) {
    407         // record activity
    408         __cfaabi_dbg_record_thrd( *thrd, false, caller );
    409 
     401void __unpark(  struct __processor_id_t * id, $thread * thrd ) {
    410402        int old_ticket = __atomic_fetch_add(&thrd->ticket, 1, __ATOMIC_SEQ_CST);
    411         __cfaabi_dbg_debug_do( thrd->unpark_result = old_ticket; thrd->unpark_state = thrd->state; )
    412403        switch(old_ticket) {
    413404                case 1:
     
    427418}
    428419
    429 void unpark( $thread * thrd __cfaabi_dbg_ctx_param2 ) {
     420void unpark( $thread * thrd ) {
    430421        if( !thrd ) return;
    431422
    432423        disable_interrupts();
    433         __unpark( (__processor_id_t*)kernelTLS.this_processor, thrd __cfaabi_dbg_ctx_fwd2 );
     424        __unpark( (__processor_id_t*)kernelTLS.this_processor, thrd );
    434425        enable_interrupts( __cfaabi_dbg_ctx );
    435426}
    436427
    437 void park( __cfaabi_dbg_ctx_param ) {
     428void park( void ) {
    438429        /* paranoid */ verify( kernelTLS.preemption_state.enabled );
    439430        disable_interrupts();
    440431        /* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
    441432        /* paranoid */ verify( kernelTLS.this_thread->preempted == __NO_PREEMPTION );
    442 
    443         // record activity
    444         __cfaabi_dbg_record_thrd( *kernelTLS.this_thread, true, caller );
    445433
    446434        returnToKernel();
     
    650638                // atomically release spin lock and block
    651639                unlock( lock );
    652                 park( __cfaabi_dbg_ctx );
     640                park();
    653641                return true;
    654642        }
     
    671659
    672660        // make new owner
    673         unpark( thrd __cfaabi_dbg_ctx2 );
     661        unpark( thrd );
    674662
    675663        return thrd != 0p;
     
    682670        count += diff;
    683671        for(release) {
    684                 unpark( pop_head( waiting ) __cfaabi_dbg_ctx2 );
     672                unpark( pop_head( waiting ) );
    685673        }
    686674
     
    698686                        this.prev_thrd = kernelTLS.this_thread;
    699687                }
    700 
    701                 void __cfaabi_dbg_record_thrd($thread & this, bool park, const char prev_name[]) {
    702                         if(park) {
    703                                 this.park_caller   = prev_name;
    704                                 this.park_stale    = false;
    705                         }
    706                         else {
    707                                 this.unpark_caller = prev_name;
    708                                 this.unpark_stale  = false;
    709                         }
    710                 }
    711688        }
    712689)
  • libcfa/src/concurrency/kernel/fwd.hfa

    r038110a re235429  
    118118
    119119        extern "Cforall" {
    120                 extern void park( __cfaabi_dbg_ctx_param );
    121                 extern void unpark( struct $thread * this __cfaabi_dbg_ctx_param2 );
     120                extern void park( void );
     121                extern void unpark( struct $thread * this );
    122122                static inline struct $thread * active_thread () { return TL_GET( this_thread ); }
    123123
  • libcfa/src/concurrency/kernel_private.hfa

    r038110a re235429  
    6464
    6565// KERNEL ONLY unpark with out disabling interrupts
    66 void __unpark( struct __processor_id_t *, $thread * thrd __cfaabi_dbg_ctx_param2 );
     66void __unpark( struct __processor_id_t *, $thread * thrd );
    6767
    6868static inline bool __post(single_sem & this, struct __processor_id_t * id) {
     
    7777                else {
    7878                        if(__atomic_compare_exchange_n(&this.ptr, &expected, 0p, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) {
    79                                 __unpark( id, expected __cfaabi_dbg_ctx2 );
     79                                __unpark( id, expected );
    8080                                return true;
    8181                        }
  • libcfa/src/concurrency/monitor.cfa

    r038110a re235429  
    122122
    123123                unlock( this->lock );
    124                 park( __cfaabi_dbg_ctx );
     124                park();
    125125
    126126                __cfaabi_dbg_print_safe( "Kernel : %10p Entered  mon %p\n", thrd, this);
     
    201201                // Release the next thread
    202202                /* paranoid */ verifyf( urgent->owner->waiting_thread == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", kernelTLS.this_thread, this->owner, this->recursion, this );
    203                 unpark( urgent->owner->waiting_thread __cfaabi_dbg_ctx2 );
     203                unpark( urgent->owner->waiting_thread );
    204204
    205205                // Park current thread waiting
    206                 park( __cfaabi_dbg_ctx );
     206                park();
    207207
    208208                // Some one was waiting for us, enter
     
    222222
    223223                // Park current thread waiting
    224                 park( __cfaabi_dbg_ctx );
     224                park();
    225225
    226226                /* paranoid */ verifyf( kernelTLS.this_thread == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", kernelTLS.this_thread, this->owner, this->recursion, this );
     
    264264        //We need to wake-up the thread
    265265        /* paranoid */ verifyf( !new_owner || new_owner == this->owner, "Expected owner to be %p, got %p (m: %p)", new_owner, this->owner, this );
    266         unpark( new_owner __cfaabi_dbg_ctx2 );
     266        unpark( new_owner );
    267267}
    268268
     
    493493        // Wake the threads
    494494        for(int i = 0; i < thread_count; i++) {
    495                 unpark( threads[i] __cfaabi_dbg_ctx2 );
     495                unpark( threads[i] );
    496496        }
    497497
    498498        // Everything is ready to go to sleep
    499         park( __cfaabi_dbg_ctx );
     499        park();
    500500
    501501        // We are back, restore the owners and recursions
     
    575575
    576576        // unpark the thread we signalled
    577         unpark( signallee __cfaabi_dbg_ctx2 );
     577        unpark( signallee );
    578578
    579579        //Everything is ready to go to sleep
    580         park( __cfaabi_dbg_ctx );
     580        park();
    581581
    582582
     
    679679
    680680                                // unpark the thread we signalled
    681                                 unpark( next __cfaabi_dbg_ctx2 );
     681                                unpark( next );
    682682
    683683                                //Everything is ready to go to sleep
    684                                 park( __cfaabi_dbg_ctx );
     684                                park();
    685685
    686686                                // We are back, restore the owners and recursions
     
    724724
    725725        //Everything is ready to go to sleep
    726         park( __cfaabi_dbg_ctx );
     726        park();
    727727
    728728
  • libcfa/src/concurrency/mutex.cfa

    r038110a re235429  
    4242                append( blocked_threads, kernelTLS.this_thread );
    4343                unlock( lock );
    44                 park( __cfaabi_dbg_ctx );
     44                park();
    4545        }
    4646        else {
     
    6565        this.is_locked = (this.blocked_threads != 0);
    6666        unpark(
    67                 pop_head( this.blocked_threads ) __cfaabi_dbg_ctx2
     67                pop_head( this.blocked_threads )
    6868        );
    6969        unlock( this.lock );
     
    9797                append( blocked_threads, kernelTLS.this_thread );
    9898                unlock( lock );
    99                 park( __cfaabi_dbg_ctx );
     99                park();
    100100        }
    101101}
     
    124124                owner = thrd;
    125125                recursion_count = (thrd ? 1 : 0);
    126                 unpark( thrd __cfaabi_dbg_ctx2 );
     126                unpark( thrd );
    127127        }
    128128        unlock( lock );
     
    142142        lock( lock __cfaabi_dbg_ctx2 );
    143143        unpark(
    144                 pop_head( this.blocked_threads ) __cfaabi_dbg_ctx2
     144                pop_head( this.blocked_threads )
    145145        );
    146146        unlock( lock );
     
    151151        while(this.blocked_threads) {
    152152                unpark(
    153                         pop_head( this.blocked_threads ) __cfaabi_dbg_ctx2
     153                        pop_head( this.blocked_threads )
    154154                );
    155155        }
     
    161161        append( this.blocked_threads, kernelTLS.this_thread );
    162162        unlock( this.lock );
    163         park( __cfaabi_dbg_ctx );
     163        park();
    164164}
    165165
     
    170170        unlock(l);
    171171        unlock(this.lock);
    172         park( __cfaabi_dbg_ctx );
     172        park();
    173173        lock(l);
    174174}
  • libcfa/src/concurrency/preemption.cfa

    r038110a re235429  
    274274                kernelTLS.this_stats = this->curr_cluster->stats;
    275275        #endif
    276         __unpark( id, this __cfaabi_dbg_ctx2 );
     276        __unpark( id, this );
    277277}
    278278
  • libcfa/src/concurrency/thread.hfa

    r038110a re235429  
    8888//----------
    8989// Park thread: block until corresponding call to unpark, won't block if unpark is already called
    90 void park( __cfaabi_dbg_ctx_param );
     90void park( void );
    9191
    9292//----------
    9393// Unpark a thread, if the thread is already blocked, schedule it
    9494//                  if the thread is not yet block, signal that it should rerun immediately
    95 void unpark( $thread * this __cfaabi_dbg_ctx_param2 );
     95void unpark( $thread * this );
    9696
    9797forall( dtype T | is_thread(T) )
    98 static inline void unpark( T & this __cfaabi_dbg_ctx_param2 ) { if(!&this) return; unpark( get_thread( this ) __cfaabi_dbg_ctx_fwd2 );}
     98static inline void unpark( T & this ) { if(!&this) return; unpark( get_thread( this ) );}
    9999
    100100//----------
  • tests/concurrent/park/contention.cfa

    r038110a re235429  
    2121                if(blocked[idx]) {
    2222                        Thread * thrd = __atomic_exchange_n(&blocked[idx], 0p, __ATOMIC_SEQ_CST);
    23                         unpark( *thrd __cfaabi_dbg_ctx2 );
     23                        unpark( *thrd );
    2424                } else {
    2525                        Thread * thrd = __atomic_exchange_n(&blocked[idx], &this, __ATOMIC_SEQ_CST);
    26                         unpark( *thrd __cfaabi_dbg_ctx2 );
    27                         park( __cfaabi_dbg_ctx );
     26                        unpark( *thrd );
     27                        park();
    2828                }
    2929        }
     
    4141                        int idx = myrand() % blocked_size;
    4242                        Thread * thrd = __atomic_exchange_n(&blocked[idx], 0p, __ATOMIC_SEQ_CST);
    43                         unpark( *thrd __cfaabi_dbg_ctx2 );
     43                        unpark( *thrd );
    4444                        yield( myrand() % 20 );
    4545                }
  • tests/concurrent/park/force_preempt.cfa

    r038110a re235429  
    3030
    3131                // Unpark this thread, don't force a yield
    32                 unpark( this __cfaabi_dbg_ctx2 );
     32                unpark( this );
    3333                assert(mask == 0xCAFEBABA);
    3434
     
    4343                // Park this thread,
    4444                assert(mask == (id_hash ^ 0xCAFEBABA));
    45                 park( __cfaabi_dbg_ctx );
     45                park();
    4646                assert(mask == (id_hash ^ 0xCAFEBABA));
    4747
  • tests/concurrent/park/start_parked.cfa

    r038110a re235429  
    33thread Parker {};
    44void main( Parker & ) {
    5         park( __cfaabi_dbg_ctx );
     5        park();
    66}
    77
     
    99        for(1000) {
    1010                Parker parker;
    11                 unpark( parker __cfaabi_dbg_ctx2 );
     11                unpark( parker );
    1212        }
    1313        printf( "done\n" );                                                                     // non-empty .expect file
Note: See TracChangeset for help on using the changeset viewer.