Changeset 9042795


Ignore:
Timestamp:
May 2, 2017, 7:18:52 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
6db9dab
Parents:
ed8a0d2 (diff), b510ac2 (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:/u/cforall/software/cfa/cfa-cc

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    red8a0d2 r9042795  
    371371"""
    372372
    373         def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
     373        def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com, ajbeach@edu.uwaterloo.ca"
    374374
    375375        //send email notification
  • src/benchmark/CorCtxSwitch.c

    red8a0d2 r9042795  
    2323} // Time
    2424
    25 struct GreatSuspender {
    26         coroutine_desc __cor;
    27 };
    28 
    29 DECL_COROUTINE(GreatSuspender);
     25coroutine GreatSuspender {};
    3026
    3127void ?{}( GreatSuspender * this ) {
  • src/benchmark/bench.c

    red8a0d2 r9042795  
    8686//=======================================
    8787
    88 struct CoroutineDummy { coroutine_desc __cor; };
    89 DECL_COROUTINE(CoroutineDummy);
     88coroutine CoroutineDummy {};
    9089void main(CoroutineDummy * this) {}
    9190
     
    117116}
    118117
    119 struct CoroutineResume {
     118coroutine CoroutineResume {
    120119    int N;
    121     coroutine_desc __cor;
    122120};
    123 
    124 DECL_COROUTINE(CoroutineResume);
    125121
    126122void ?{}(CoroutineResume* this, int N) {
     
    150146//=======================================
    151147
    152 struct ThreadDummy { thread_desc __thrd; };
    153 DECL_THREAD(ThreadDummy);
     148thread ThreadDummy {};
    154149void main(ThreadDummy * this) {}
    155150
     
    177172}
    178173
    179 struct ContextSwitch {
     174thread ContextSwitch {
    180175    int N;
    181176    long long result;
    182     thread_desc __thrd;
    183177};
    184 
    185 DECL_THREAD(ContextSwitch);
    186178
    187179void main(ContextSwitch * this) {   
     
    241233        DynamicTaskCreateDelete( NoOfTimes );
    242234        {
    243                 scoped(ContextSwitch) dummy = { (int)NoOfTimes };               // context switch
     235                ContextSwitch dummy = { (int)NoOfTimes };               // context switch
    244236        }
    245237        sout | "\t" | endl;
  • src/benchmark/csv-data.c

    red8a0d2 r9042795  
    2525} // Time
    2626
    27 struct GreatSuspender {
    28         coroutine_desc __cor;
    29 };
    30 
    31 DECL_COROUTINE(GreatSuspender);
     27coroutine GreatSuspender {};
    3228
    3329void ?{}( GreatSuspender * this ) {
  • src/libcfa/concurrency/monitor.c

    red8a0d2 r9042795  
    1717#include "monitor"
    1818
     19#include <stdlib>
     20
    1921#include "kernel_private.h"
    2022#include "libhdr.h"
     
    130132        this_thread()->current_monitors      = this->prev_mntrs;
    131133        this_thread()->current_monitor_count = this->prev_count;
     134}
     135
     136void debug_break() __attribute__(( noinline ))
     137{
     138       
    132139}
    133140
     
    171178
    172179        //Find the next thread(s) to run
    173         unsigned short thread_count = count;
     180        unsigned short thread_count = 0;
    174181        thread_desc * threads[ count ];
     182        for(int i = 0; i < count; i++) {
     183                threads[i] = 0;
     184        }
     185
     186        debug_break();
    175187
    176188        for( int i = 0; i < count; i++) {
    177189                thread_desc * new_owner = next_thread( this->monitors[i] );
    178                 thread_count = insert_unique( threads, i, new_owner );
    179         }
     190                thread_count = insert_unique( threads, thread_count, new_owner );
     191        }
     192
     193        debug_break();
    180194
    181195        LIB_DEBUG_PRINT_SAFE("Will unblock: ");
     
    339353                LIB_DEBUG_PRINT_SAFE("Branding\n");
    340354                assertf( thrd->current_monitors != NULL, "No current monitor to brand condition", thrd->current_monitors );
    341                 this->monitors = thrd->current_monitors;
    342355                this->monitor_count = thrd->current_monitor_count;
     356
     357                this->monitors = malloc( this->monitor_count * sizeof( *this->monitors ) );
     358                for( int i = 0; i < this->monitor_count; i++ ) {
     359                        this->monitors[i] = thrd->current_monitors[i];
     360                }
    343361        }
    344362}
    345363
    346364static inline unsigned short insert_unique( thread_desc ** thrds, unsigned short end, thread_desc * val ) {
    347         for(int i = 0; i < end; i++) {
     365        if( !val ) return end;
     366
     367        for(int i = 0; i <= end; i++) {
    348368                if( thrds[i] == val ) return end;
    349369        }
  • src/tests/.expect/concurrent/sched-int-multi.txt

    red8a0d2 r9042795  
    1 Waiting All
    2 Entering A
    3 Entering A & B
    4 Signal
    5 Leaving  A & B
    6 Leaving  A
    7 Done waiting
     11000
     22000
     33000
     44000
     55000
     66000
     77000
     88000
     99000
     1010000
     1111000
     1212000
     1313000
     1414000
     1515000
     1616000
     1717000
     1818000
     1919000
     2020000
     2121000
     2222000
     2323000
     2424000
     2525000
     2626000
     2727000
     2828000
     2929000
     3030000
     3131000
     3232000
     3333000
     3434000
     3535000
     3636000
     3737000
     3838000
     3939000
     4040000
     4141000
     4242000
     4343000
     4444000
     4545000
     4646000
     4747000
     4848000
     4949000
     5050000
     5151000
     5252000
     5353000
     5454000
     5555000
     5656000
     5757000
     5858000
     5959000
     6060000
     6161000
     6262000
     6363000
     6464000
     6565000
     6666000
     6767000
     6868000
     6969000
     7070000
     7171000
     7272000
     7373000
     7474000
     7575000
     7676000
     7777000
     7878000
     7979000
     8080000
     8181000
     8282000
     8383000
     8484000
     8585000
     8686000
     8787000
     8888000
     8989000
     9090000
     9191000
     9292000
     9393000
     9494000
     9595000
     9696000
     9797000
     9898000
     9999000
     100100000
  • src/tests/sched-int-multi.c

    red8a0d2 r9042795  
    44#include <thread>
    55
     6enum state_t { WAIT, SIGNAL, BARGE };
     7
    68monitor global_t {};
    79
     10monitor global_data_t {
     11        bool done;
     12        int counter;
     13        state_t state;
     14};
     15
     16void ?{} ( global_data_t * this ) {
     17        this->done = false;
     18        this->counter = 0;
     19        this->state = BARGE;
     20}
     21
     22void ^?{} ( global_data_t * this ) {}
     23
     24global_t globalA;
    825global_t globalB;
    9 global_t globalA;
     26global_data_t globalC;
    1027
    1128condition cond;
    1229
    13 thread Signalee {};
    14 thread Signaler {};
     30thread Threads {};
    1531
    16 void signalee_action( global_t * mutex a, global_t * mutex b ) {
    17         sout | "Waiting All" | endl;
    18         wait( &cond );
    19         sout | "Done waiting" | endl;
     32bool logicC( global_t * mutex a, global_t * mutex b, global_data_t * mutex c ) {
     33        c->counter++;
     34
     35        int action = c->counter % 10;
     36
     37        if( action == 1 || action == 3 ) {
     38                if(c->state != BARGE) {
     39                        sout | "ERROR Mutual exclusion is inconsistent for wait" | endl;
     40                        abort();
     41                }
     42
     43                c->state = WAIT;
     44                wait( &cond );
     45
     46                if(c->state != SIGNAL) {
     47                        sout | "ERROR Barging detected" | endl;
     48                        abort();
     49                }
     50        }
     51        else if( action == 6 ) {
     52                if(c->state != BARGE) {
     53                        sout | "ERROR Mutual exclusion is inconsistent for signal" | endl;
     54                        abort();
     55                }
     56
     57                c->state = SIGNAL;
     58
     59                signal( &cond );
     60                signal( &cond );
     61        }
     62        else {
     63                c->state = BARGE;
     64        }
     65
     66        if( (c->counter % 1000) == 0 ) sout | c->counter | endl;
     67        if( c->counter == 100_000 ) c->done = true;
     68        return !c->done;
    2069}
    2170
    22 void main( Signalee* this ) {
    23         signalee_action( &globalA, &globalB );
     71bool logicB( global_t * mutex a, global_t * mutex b ) {
     72        return logicC(a, b, &globalC);
    2473}
    2574
    26 void signaler_action_inner( global_t * mutex a, global_t * mutex b ) {
    27         sout | "Entering A & B" | endl;
    28         sout | "Signal" | endl;
    29         signal( &cond );
    30         sout | "Leaving  A & B" | endl;
     75bool logicA( global_t * mutex a ) {
     76        return logicB(a, &globalB);
    3177}
    3278
    33 void signaler_action( global_t * mutex a, global_t * b ) {
    34         sout | "Entering A" | endl;
    35         signaler_action_inner( a, b );
    36         sout | "Leaving  A" | endl;
    37 }
    38 
    39 void main( Signaler* this ) {
    40         for(int i = 0; i < 10_000; i++) {
    41                 asm volatile ("" : : : "memory");
    42         }
    43 
    44         signaler_action( &globalA, &globalB );
     79void main( Threads* this ) {
     80        while( logicA(&globalA) ) { yield(); };
    4581}
    4682
    4783int main(int argc, char* argv[]) {
    48         processor p;
     84        processor p[3];
    4985        {
    50                 Signalee a;
    51                 Signaler b;
     86                Threads t[20];
    5287        }
    5388}
Note: See TracChangeset for help on using the changeset viewer.