Ignore:
Timestamp:
Jun 2, 2022, 3:11:21 PM (4 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
ced5e2a
Parents:
015925a (diff), fc134a48 (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

Location:
libcfa/src/concurrency/kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel/cluster.cfa

    r015925a re5d9274  
    4949
    5050// returns the maximum number of processors the RWLock support
    51 __attribute__((weak)) unsigned __max_processors() {
     51__attribute__((weak)) unsigned __max_processors() libcfa_public {
    5252        const char * max_cores_s = getenv("CFA_MAX_PROCESSORS");
    5353        if(!max_cores_s) {
     
    233233                                        if(is_empty(sl)) {
    234234                                                assert( sl.anchor.next == 0p );
    235                                                 assert( sl.anchor.ts   == -1llu );
     235                                                assert( sl.anchor.ts   == MAX );
    236236                                                assert( mock_head(sl)  == sl.prev );
    237237                                        } else {
    238238                                                assert( sl.anchor.next != 0p );
    239                                                 assert( sl.anchor.ts   != -1llu );
     239                                                assert( sl.anchor.ts   != MAX );
    240240                                                assert( mock_head(sl)  != sl.prev );
    241241                                        }
     
    259259                /* paranoid */ verifyf( it, "Unexpected null iterator, at index %u of %u\n", i, count);
    260260                it->rdq.id = valrq;
    261                 it->rdq.target = MAX;
     261                it->rdq.target = UINT_MAX;
    262262                valrq += __shard_factor.readyq;
    263263                #if defined(CFA_HAVE_LINUX_IO_URING_H)
    264264                        it->io.ctx->cq.id = valio;
    265                         it->io.target = MAX;
     265                        it->io.target = UINT_MAX;
    266266                        valio += __shard_factor.io;
    267267                #endif
     
    472472        this.prev = mock_head(this);
    473473        this.anchor.next = 0p;
    474         this.anchor.ts   = -1llu;
     474        this.anchor.ts   = MAX;
    475475        #if !defined(__CFA_NO_STATISTICS__)
    476476                this.cnt  = 0;
     
    484484        /* paranoid */ verify( &mock_head(this)->link.ts   == &this.anchor.ts   );
    485485        /* paranoid */ verify( mock_head(this)->link.next == 0p );
    486         /* paranoid */ verify( mock_head(this)->link.ts   == -1llu );
     486        /* paranoid */ verify( mock_head(this)->link.ts   == MAX );
    487487        /* paranoid */ verify( mock_head(this) == this.prev );
    488488        /* paranoid */ verify( __alignof__(__intrusive_lane_t) == 128 );
     
    495495        // Make sure the list is empty
    496496        /* paranoid */ verify( this.anchor.next == 0p );
    497         /* paranoid */ verify( this.anchor.ts   == -1llu );
     497        /* paranoid */ verify( this.anchor.ts   == MAX );
    498498        /* paranoid */ verify( mock_head(this)  == this.prev );
    499499}
  • libcfa/src/concurrency/kernel/cluster.hfa

    r015925a re5d9274  
    1919#include "kernel/private.hfa"
    2020
    21 #include "limits.hfa"
     21#include <limits.h>
    2222
    2323//-----------------------------------------------------------------------
     
    3737
    3838static inline void touch_tsc(__timestamp_t * tscs, size_t idx, unsigned long long ts_prev, unsigned long long ts_next) {
    39         if (ts_next == MAX) return;
     39        if (ts_next == ULLONG_MAX) return;
    4040        unsigned long long now = rdtscl();
    4141        unsigned long long pma = __atomic_load_n(&tscs[ idx ].ma, __ATOMIC_RELAXED);
     
    5959        for(i; shard_factor) {
    6060                unsigned long long ptsc = ts(data[start + i]);
    61                 if(ptsc != -1ull) {
     61                if(ptsc != ULLONG_MAX) {
    6262                        /* paranoid */ verify( start + i < count );
    6363                        unsigned long long tsc = moving_average(ctsc, ptsc, tscs[start + i].ma);
  • libcfa/src/concurrency/kernel/private.hfa

    r015925a re5d9274  
    109109//-----------------------------------------------------------------------------
    110110// Processor
    111 void main(processorCtx_t *);
     111void main(processorCtx_t &);
     112static inline coroutine$* get_coroutine(processorCtx_t & this) { return &this.self; }
    112113
    113114void * __create_pthread( pthread_t *, void * (*)(void *), void * );
  • libcfa/src/concurrency/kernel/startup.cfa

    r015925a re5d9274  
    120120#endif
    121121
    122 cluster              * mainCluster;
     122cluster              * mainCluster libcfa_public;
    123123processor            * mainProcessor;
    124124thread$              * mainThread;
     
    169169};
    170170
    171 void ?{}( current_stack_info_t & this ) {
     171static void ?{}( current_stack_info_t & this ) {
    172172        __stack_context_t ctx;
    173173        CtxGet( ctx );
     
    209209        // Construct the processor context of the main processor
    210210        void ?{}(processorCtx_t & this, processor * proc) {
    211                 (this.__cor){ "Processor" };
    212                 this.__cor.starter = 0p;
     211                (this.self){ "Processor" };
     212                this.self.starter = 0p;
    213213                this.proc = proc;
    214214        }
     
    507507        self_mon_p = &self_mon;
    508508        link.next = 0p;
    509         link.ts   = -1llu;
     509        link.ts   = MAX;
    510510        preferred = ready_queue_new_preferred();
    511511        last_proc = 0p;
     
    526526// Construct the processor context of non-main processors
    527527static void ?{}(processorCtx_t & this, processor * proc, current_stack_info_t * info) {
    528         (this.__cor){ info };
     528        (this.self){ info };
    529529        this.proc = proc;
    530530}
     
    578578}
    579579
    580 void ?{}(processor & this, const char name[], cluster & _cltr, thread$ * initT) {
     580void ?{}(processor & this, const char name[], cluster & _cltr, thread$ * initT) libcfa_public {
    581581        ( this.terminated ){};
    582582        ( this.runner ){};
     
    591591}
    592592
    593 void ?{}(processor & this, const char name[], cluster & _cltr) {
     593void ?{}(processor & this, const char name[], cluster & _cltr) libcfa_public {
    594594        (this){name, _cltr, 0p};
    595595}
    596596
    597597extern size_t __page_size;
    598 void ^?{}(processor & this) with( this ){
     598void ^?{}(processor & this) libcfa_public with( this ) {
    599599        /* paranoid */ verify( !__atomic_load_n(&do_terminate, __ATOMIC_ACQUIRE) );
    600600        __cfadbg_print_safe(runtime_core, "Kernel : core %p signaling termination\n", &this);
     
    623623}
    624624
    625 void ?{}(cluster & this, const char name[], Duration preemption_rate, unsigned num_io, const io_context_params & io_params) with( this ) {
     625void ?{}(cluster & this, const char name[], Duration preemption_rate, unsigned num_io, const io_context_params & io_params) libcfa_public with( this ) {
    626626        this.name = name;
    627627        this.preemption_rate = preemption_rate;
     
    658658}
    659659
    660 void ^?{}(cluster & this) {
     660void ^?{}(cluster & this) libcfa_public {
    661661        destroy(this.io.arbiter);
    662662
Note: See TracChangeset for help on using the changeset viewer.