Changeset ef94ae7 for libcfa


Ignore:
Timestamp:
Jun 21, 2021, 3:41:22 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
5614552a
Parents:
4d865ca7
Message:

Changed ready-queue to use -1 for empty ts.

Location:
libcfa/src/concurrency
Files:
4 edited

Legend:

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

    r4d865ca7 ref94ae7  
    484484        self_mon_p = &self_mon;
    485485        link.next = 0p;
    486         link.ts   = 0;
     486        link.ts   = -1llu;
    487487        preferred = -1u;
    488488        last_proc = 0p;
  • libcfa/src/concurrency/ready_queue.cfa

    r4d865ca7 ref94ae7  
    679679                                        if(is_empty(sl)) {
    680680                                                assert( sl.anchor.next == 0p );
    681                                                 assert( sl.anchor.ts   == 0 );
     681                                                assert( sl.anchor.ts   == -1llu );
    682682                                                assert( mock_head(sl)  == sl.prev );
    683683                                        } else {
    684684                                                assert( sl.anchor.next != 0p );
    685                                                 assert( sl.anchor.ts   != 0 );
     685                                                assert( sl.anchor.ts   != -1llu );
    686686                                                assert( mock_head(sl)  != sl.prev );
    687687                                        }
     
    733733                lanes.tscs = alloc(lanes.count, lanes.tscs`realloc);
    734734                for(i; lanes.count) {
    735                         unsigned long long tsc = ts(lanes.data[i]);
    736                         lanes.tscs[i].tv = tsc != 0 ? tsc : rdtscl();
     735                        unsigned long long tsc1 = ts(lanes.data[i]);
     736                        unsigned long long tsc2 = rdtscl()
     737                        lanes.tscs[i].tv = min(tsc1, tsc2);
    737738                }
    738739        #endif
  • libcfa/src/concurrency/ready_subqueue.hfa

    r4d865ca7 ref94ae7  
    3232        this.prev = mock_head(this);
    3333        this.anchor.next = 0p;
    34         this.anchor.ts   = 0;
     34        this.anchor.ts   = -1llu;
    3535        #if !defined(__CFA_NO_STATISTICS__)
    3636                this.cnt  = 0;
     
    4444        /* paranoid */ verify( &mock_head(this)->link.ts   == &this.anchor.ts   );
    4545        /* paranoid */ verify( mock_head(this)->link.next == 0p );
    46         /* paranoid */ verify( mock_head(this)->link.ts   == 0  );
     46        /* paranoid */ verify( mock_head(this)->link.ts   == -1llu  );
    4747        /* paranoid */ verify( mock_head(this) == this.prev );
    4848        /* paranoid */ verify( __alignof__(__intrusive_lane_t) == 128 );
     
    5555        // Make sure the list is empty
    5656        /* paranoid */ verify( this.anchor.next == 0p );
    57         /* paranoid */ verify( this.anchor.ts   == 0 );
     57        /* paranoid */ verify( this.anchor.ts   == -1llu );
    5858        /* paranoid */ verify( mock_head(this)  == this.prev );
    5959}
     
    6464        /* paranoid */ verify( this.lock );
    6565        /* paranoid */ verify( node->link.next == 0p );
    66         /* paranoid */ verify( node->link.ts   == 0  );
     66        /* paranoid */ verify( node->link.ts   == -1llu  );
    6767        /* paranoid */ verify( this.prev->link.next == 0p );
    68         /* paranoid */ verify( this.prev->link.ts   == 0  );
     68        /* paranoid */ verify( this.prev->link.ts   == -1llu  );
    6969        if( this.anchor.next == 0p ) {
    7070                /* paranoid */ verify( this.anchor.next == 0p );
    71                 /* paranoid */ verify( this.anchor.ts   == 0  );
     71                /* paranoid */ verify( this.anchor.ts   == -1llu );
     72                /* paranoid */ verify( this.anchor.ts   != 0  );
    7273                /* paranoid */ verify( this.prev == mock_head( this ) );
    7374        } else {
    7475                /* paranoid */ verify( this.anchor.next != 0p );
     76                /* paranoid */ verify( this.anchor.ts   != -1llu );
    7577                /* paranoid */ verify( this.anchor.ts   != 0  );
    7678                /* paranoid */ verify( this.prev != mock_head( this ) );
     
    9294        /* paranoid */ verify( this.lock );
    9395        /* paranoid */ verify( this.anchor.next != 0p );
     96        /* paranoid */ verify( this.anchor.ts   != -1llu );
    9497        /* paranoid */ verify( this.anchor.ts   != 0  );
    9598
     
    99102        this.anchor.next = node->link.next;
    100103        this.anchor.ts   = node->link.ts;
    101         bool is_empty = this.anchor.ts == 0;
     104        bool is_empty = this.anchor.next == 0p;
    102105        node->link.next = 0p;
    103         node->link.ts   = 0;
     106        node->link.ts   = -1llu;
    104107        #if !defined(__CFA_NO_STATISTICS__)
    105108                this.cnt--;
     
    110113
    111114        /* paranoid */ verify( node->link.next == 0p );
    112         /* paranoid */ verify( node->link.ts   == 0  );
     115        /* paranoid */ verify( node->link.ts   == -1llu  );
     116        /* paranoid */ verify( node->link.ts   != 0  );
     117        /* paranoid */ verify( this.anchor.ts  != 0  );
    113118        return [node, ts];
    114119}
     
    116121// Check whether or not list is empty
    117122static inline bool is_empty(__intrusive_lane_t & this) {
    118         return this.anchor.ts == 0;
     123        return this.anchor.next == 0p;
    119124}
    120125
     
    122127static inline unsigned long long ts(__intrusive_lane_t & this) {
    123128        // Cannot verify here since it may not be locked
     129        /* paranoid */ verify(this.anchor.ts != 0);
    124130        return this.anchor.ts;
    125131}
  • libcfa/src/concurrency/thread.cfa

    r4d865ca7 ref94ae7  
    4040        curr_cluster = &cl;
    4141        link.next = 0p;
    42         link.ts   = 0;
     42        link.ts   = -1llu;
    4343        preferred = -1u;
    4444        last_proc = 0p;
Note: See TracChangeset for help on using the changeset viewer.