Changeset f4abc58 for src


Ignore:
Timestamp:
Mar 7, 2018, 5:09:18 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:
fb11446e
Parents:
b2e8841 (diff), 7b0dfa4 (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

Location:
src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • src/Common/SemanticError.h

    rb2e8841 rf4abc58  
    7272}
    7373
    74 
    75 
    76 
    7774// Local Variables: //
    7875// tab-width: 4 //
  • src/Parser/ExpressionNode.cc

    rb2e8841 rf4abc58  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 27 22:51:55 2017
    13 // Update Count     : 781
     12// Last Modified On : Sat Mar  3 18:22:33 2018
     13// Update Count     : 796
    1414//
    1515
     
    5858static inline bool checkD( char c ) { return c == 'd' || c == 'D'; }
    5959static inline bool checkI( char c ) { return c == 'i' || c == 'I'; }
     60static inline bool checkB( char c ) { return c == 'b' || c == 'B'; }
    6061static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }
    6162
     
    116117
    117118        unsigned long long int v;                                                       // converted integral value
    118         size_t last = str.length() - 1;                                         // last character of constant
     119        size_t last = str.length() - 1;                                         // last subscript of constant
    119120        Expression * ret;
    120121
     
    129130        } // if
    130131
    131         if ( str[0] == '0' ) {                                                          // octal/hex constant ?
     132        // Cannot be "0"
     133
     134        if ( str[0] == '0' ) {                                                          // radix character ?
    132135                dec = false;
    133                 if ( last != 0 && checkX( str[1] ) ) {                  // hex constant ?
     136                if ( checkX( str[1] ) ) {                                               // hex constant ?
    134137                        sscanf( (char *)str.c_str(), "%llx", &v );
     138                        //printf( "%llx %llu\n", v, v );
     139                } else if ( checkB( str[1] ) ) {                                // binary constant ?
     140                        v = 0;
     141                        for ( unsigned int i = 2;; i += 1 ) {           // compute value
     142                                if ( str[i] == '1' ) v |= 1;
     143                          if ( i == last ) break;
     144                                v <<= 1;
     145                        } // for
    135146                        //printf( "%llx %llu\n", v, v );
    136147                } else {                                                                                // octal constant
  • src/Parser/lex.ll

    rb2e8841 rf4abc58  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu Feb 22 18:11:27 2018
    13  * Update Count     : 637
     12 * Last Modified On : Sat Mar  3 18:38:16 2018
     13 * Update Count     : 640
    1414 */
    1515
     
    7777%}
    7878
     79binary [0-1]
    7980octal [0-7]
    8081nonzero [1-9]
     
    103104nonzero_digits ({nonzero})|({nonzero}({decimal}|"_")*{decimal})
    104105decimal_constant {nonzero_digits}{integer_suffix_opt}
     106
     107binary_digits ({binary})|({binary}({binary}|"_")*{binary})
     108binary_prefix "0"[bB]"_"?
     109binary_constant {binary_prefix}{binary_digits}{integer_suffix_opt}
    105110
    106111hex_digits ({hex})|({hex}({hex}|"_")*{hex})
     
    315320
    316321                                /* numeric constants */
     322{binary_constant} { NUMERIC_RETURN(INTEGERconstant); }
     323{octal_constant} { NUMERIC_RETURN(INTEGERconstant); }
    317324{decimal_constant} { NUMERIC_RETURN(INTEGERconstant); }
    318 {octal_constant} { NUMERIC_RETURN(INTEGERconstant); }
    319325{hex_constant}  { NUMERIC_RETURN(INTEGERconstant); }
    320326{floating_decimal}      { NUMERIC_RETURN(FLOATING_DECIMALconstant); } // must appear before floating_constant
  • src/libcfa/concurrency/kernel

    rb2e8841 rf4abc58  
    7979
    8080// Processor
     81coroutine processorCtx_t {
     82        struct processor * proc;
     83};
     84
    8185// Wrapper around kernel threads
    8286struct processor {
    8387        // Main state
    8488        // Coroutine ctx who does keeps the state of the processor
    85         struct processorCtx_t * runner;
     89        struct processorCtx_t runner;
    8690
    8791        // Cluster from which to get threads
  • src/libcfa/concurrency/kernel.c

    rb2e8841 rf4abc58  
    124124//-----------------------------------------------------------------------------
    125125// Processor coroutine
     126void ?{}(processorCtx_t & this) {}
    126127
    127128// Construct the processor context of the main processor
     
    130131        this.__cor.starter = NULL;
    131132        this.proc = proc;
    132         proc->runner = &this;
    133133}
    134134
     
    137137        (this.__cor){ info };
    138138        this.proc = proc;
    139         proc->runner = &this;
    140139}
    141140
     
    150149        preemption_alarm = NULL;
    151150        pending_preemption = false;
     151        runner.proc = &this;
    152152
    153153        start( &this );
     
    161161        pending_preemption = false;
    162162        kernel_thread = pthread_self();
    163 
    164         this.runner = &runner;
     163        runner.proc = &this;
     164
    165165        __cfaabi_dbg_print_safe("Kernel : constructing main processor context %p\n", &runner);
    166166        runner{ &this };
     
    196196void main(processorCtx_t & runner) {
    197197        processor * this = runner.proc;
     198        verify(this);
    198199
    199200        __cfaabi_dbg_print_safe("Kernel : core %p starting\n", this);
     
    241242void runThread(processor * this, thread_desc * dst) {
    242243        assert(dst->curr_cor);
    243         coroutine_desc * proc_cor = get_coroutine(*this->runner);
     244        coroutine_desc * proc_cor = get_coroutine(this->runner);
    244245        coroutine_desc * thrd_cor = dst->curr_cor;
    245246
     
    256257
    257258void returnToKernel() {
    258         coroutine_desc * proc_cor = get_coroutine(*this_processor->runner);
     259        coroutine_desc * proc_cor = get_coroutine(this_processor->runner);
    259260        coroutine_desc * thrd_cor = this_thread->curr_cor = this_coroutine;
    260261        ThreadCtxSwitch(thrd_cor, proc_cor);
     
    317318        machine_context_t ctx;
    318319        info.context = &ctx;
    319         processorCtx_t proc_cor_storage = { proc, &info };
    320 
    321         __cfaabi_dbg_print_safe("Coroutine : created stack %p\n", proc_cor_storage.__cor.stack.base);
     320        (proc->runner){ proc, &info };
     321
     322        __cfaabi_dbg_print_safe("Coroutine : created stack %p\n", get_coroutine(proc->runner)->stack.base);
    322323
    323324        //Set global state
    324         this_coroutine = &proc->runner->__cor;
     325        this_coroutine = get_coroutine(proc->runner);
    325326        this_thread = NULL;
    326327
    327328        //We now have a proper context from which to schedule threads
    328         __cfaabi_dbg_print_safe("Kernel : core %p created (%p, %p)\n", proc, proc->runner, &ctx);
     329        __cfaabi_dbg_print_safe("Kernel : core %p created (%p, %p)\n", proc, &proc->runner, &ctx);
    329330
    330331        // SKULLDUGGERY: Since the coroutine doesn't have its own stack, we can't
     
    332333        // back to here. Instead directly call the main since we already are on the
    333334        // appropriate stack.
    334         proc_cor_storage.__cor.state = Active;
    335         main( proc_cor_storage );
    336         proc_cor_storage.__cor.state = Halted;
     335        get_coroutine(proc->runner)->state = Active;
     336        main( proc->runner );
     337        get_coroutine(proc->runner)->state = Halted;
    337338
    338339        // Main routine of the core returned, the core is now fully terminated
    339         __cfaabi_dbg_print_safe("Kernel : core %p main ended (%p)\n", proc, proc->runner);
     340        __cfaabi_dbg_print_safe("Kernel : core %p main ended (%p)\n", proc, &proc->runner);
    340341
    341342        return NULL;
     
    352353void kernel_first_resume(processor * this) {
    353354        coroutine_desc * src = this_coroutine;
    354         coroutine_desc * dst = get_coroutine(*this->runner);
     355        coroutine_desc * dst = get_coroutine(this->runner);
    355356
    356357        verify( !preemption_state.enabled );
    357358
    358359        create_stack(&dst->stack, dst->stack.size);
    359         CtxStart(this->runner, CtxInvokeCoroutine);
     360        CtxStart(&this->runner, CtxInvokeCoroutine);
    360361
    361362        verify( !preemption_state.enabled );
     
    411412        verify( !preemption_state.enabled );
    412413        lock( ready_queue_lock __cfaabi_dbg_ctx2 );
    413         //TEMP hack to find a bug
    414         if(this_processor != mainProcessor) {
    415                 if(ready_queue.head == mainThread) {
    416                         unlock( ready_queue_lock );
    417                         return NULL;
    418                 }
    419         }
    420 
    421414        thread_desc * head = pop_head( ready_queue );
    422415        unlock( ready_queue_lock );
     
    584577        // Destroy the main processor and its context in reverse order of construction
    585578        // These were manually constructed so we need manually destroy them
    586         ^(*mainProcessor->runner){};
     579        ^(mainProcessor->runner){};
    587580        ^(mainProcessor){};
    588581
  • src/libcfa/concurrency/kernel_private.h

    rb2e8841 rf4abc58  
    5252//-----------------------------------------------------------------------------
    5353// Processor
    54 coroutine processorCtx_t {
    55         processor * proc;
    56 };
    57 
    5854void main(processorCtx_t *);
    5955void start(processor * this);
  • src/tests/.expect/literals.x64.txt

    rb2e8841 rf4abc58  
    522522signed int __main__Fi___1(){
    523523    __attribute__ ((unused)) signed int ___retval_main__i_1;
     524    ((void)0b01101011);
     525    ((void)0b01101011u);
     526    ((void)0b01101011l);
     527    ((void)0b01101011ll);
     528    ((void)0b01101011ul);
     529    ((void)0b01101011lu);
     530    ((void)0b01101011ull);
     531    ((void)0b01101011llu);
     532    ((void)(+0b01101011));
     533    ((void)(+0b01101011u));
     534    ((void)(+0b01101011l));
     535    ((void)(+0b01101011ll));
     536    ((void)(+0b01101011ul));
     537    ((void)(+0b01101011lu));
     538    ((void)(+0b01101011ull));
     539    ((void)(+0b01101011llu));
     540    ((void)(-0b01101011));
     541    ((void)(-0b01101011u));
     542    ((void)(-0b01101011l));
     543    ((void)(-0b01101011ll));
     544    ((void)(-0b01101011ul));
     545    ((void)(-0b01101011lu));
     546    ((void)(-0b01101011ull));
     547    ((void)(-0b01101011llu));
    524548    ((void)01234567);
    525549    ((void)01234567u);
     
    10171041    ((void)(-0X0123456789.0123456789P-09F));
    10181042    ((void)(-0X0123456789.0123456789P-09L));
     1043    ((void)((signed char )0b01101011));
     1044    ((void)((signed short int )0b01101011));
     1045    ((void)((signed int )0b01101011));
     1046    ((void)((signed long int )0b01101011));
     1047    ((void)((__int128 )0b01101011));
     1048    ((void)((unsigned char )0b01101011u));
     1049    ((void)((signed short int )0b01101011u));
     1050    ((void)((unsigned int )0b01101011u));
     1051    ((void)((signed long int )0b01101011u));
     1052    ((void)((__int128 )0b01101011u));
     1053    ((void)(+((signed int )((signed char )0b01101011))));
     1054    ((void)(+((signed int )((signed short int )0b01101011))));
     1055    ((void)(+((signed int )0b01101011)));
     1056    ((void)(+((signed long int )0b01101011)));
     1057    ((void)(+((float )((__int128 )0b01101011))));
     1058    ((void)(+((signed int )((unsigned char )0b01101011u))));
     1059    ((void)(+((signed int )((signed short int )0b01101011u))));
     1060    ((void)(+((unsigned int )0b01101011u)));
     1061    ((void)(+((signed long int )0b01101011u)));
     1062    ((void)(+((float )((__int128 )0b01101011u))));
     1063    ((void)(-((signed int )((signed char )0b01101011))));
     1064    ((void)(-((signed int )((signed short int )0b01101011))));
     1065    ((void)(-((signed int )0b01101011)));
     1066    ((void)(-((signed long int )0b01101011)));
     1067    ((void)(-((float )((__int128 )0b01101011))));
     1068    ((void)(-((signed int )((unsigned char )0b01101011u))));
     1069    ((void)(-((signed int )((signed short int )0b01101011u))));
     1070    ((void)(-((unsigned int )0b01101011u)));
     1071    ((void)(-((signed long int )0b01101011u)));
     1072    ((void)(-((float )((__int128 )0b01101011u))));
    10191073    ((void)((signed char )01234567));
    10201074    ((void)((signed short int )01234567));
  • src/tests/.expect/literals.x86.txt

    rb2e8841 rf4abc58  
    522522signed int __main__Fi___1(){
    523523    __attribute__ ((unused)) signed int ___retval_main__i_1;
     524    ((void)0b01101011);
     525    ((void)0b01101011u);
     526    ((void)0b01101011l);
     527    ((void)0b01101011ll);
     528    ((void)0b01101011ul);
     529    ((void)0b01101011lu);
     530    ((void)0b01101011ull);
     531    ((void)0b01101011llu);
     532    ((void)(+0b01101011));
     533    ((void)(+0b01101011u));
     534    ((void)(+0b01101011l));
     535    ((void)(+0b01101011ll));
     536    ((void)(+0b01101011ul));
     537    ((void)(+0b01101011lu));
     538    ((void)(+0b01101011ull));
     539    ((void)(+0b01101011llu));
     540    ((void)(-0b01101011));
     541    ((void)(-0b01101011u));
     542    ((void)(-0b01101011l));
     543    ((void)(-0b01101011ll));
     544    ((void)(-0b01101011ul));
     545    ((void)(-0b01101011lu));
     546    ((void)(-0b01101011ull));
     547    ((void)(-0b01101011llu));
    524548    ((void)01234567);
    525549    ((void)01234567u);
     
    10171041    ((void)(-0X0123456789.0123456789P-09F));
    10181042    ((void)(-0X0123456789.0123456789P-09L));
     1043    ((void)((signed char )0b01101011));
     1044    ((void)((signed short int )0b01101011));
     1045    ((void)((signed int )0b01101011));
     1046    ((void)((signed long long int )0b01101011));
     1047    ((void)((__int128 )0b01101011));
     1048    ((void)((unsigned char )0b01101011u));
     1049    ((void)((signed short int )0b01101011u));
     1050    ((void)((unsigned int )0b01101011u));
     1051    ((void)((signed long long int )0b01101011u));
     1052    ((void)((__int128 )0b01101011u));
     1053    ((void)(+((signed int )((signed char )0b01101011))));
     1054    ((void)(+((signed int )((signed short int )0b01101011))));
     1055    ((void)(+((signed int )0b01101011)));
     1056    ((void)(+((signed long long int )0b01101011)));
     1057    ((void)(+((float )((__int128 )0b01101011))));
     1058    ((void)(+((signed int )((unsigned char )0b01101011u))));
     1059    ((void)(+((signed int )((signed short int )0b01101011u))));
     1060    ((void)(+((unsigned int )0b01101011u)));
     1061    ((void)(+((signed long long int )0b01101011u)));
     1062    ((void)(+((float )((__int128 )0b01101011u))));
     1063    ((void)(-((signed int )((signed char )0b01101011))));
     1064    ((void)(-((signed int )((signed short int )0b01101011))));
     1065    ((void)(-((signed int )0b01101011)));
     1066    ((void)(-((signed long long int )0b01101011)));
     1067    ((void)(-((float )((__int128 )0b01101011))));
     1068    ((void)(-((signed int )((unsigned char )0b01101011u))));
     1069    ((void)(-((signed int )((signed short int )0b01101011u))));
     1070    ((void)(-((unsigned int )0b01101011u)));
     1071    ((void)(-((signed long long int )0b01101011u)));
     1072    ((void)(-((float )((__int128 )0b01101011u))));
    10191073    ((void)((signed char )01234567));
    10201074    ((void)((signed short int )01234567));
  • src/tests/.expect/user_literals.txt

    rb2e8841 rf4abc58  
    1111.0714285714286
    2 11.07225
     215
    3311.0714285714286
     424.8
     511.248
    4611.0714285714286
    5 11.0714285714286
    6 22.0457142857143
     728.0657142857143
    78secs 1
    89secs 23
  • src/tests/Makefile.am

    rb2e8841 rf4abc58  
    123123        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    124124
     125# Warnings
    125126warnings/self-assignment: warnings/self-assignment.c @CFA_BINDIR@/@CFA_NAME@
    126         ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} -o ${@}
    127         echo > ${@}
     127        ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} 2> ${@} -fsyntax-only
  • src/tests/Makefile.in

    rb2e8841 rf4abc58  
    800800        ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@}
    801801
     802# Warnings
    802803warnings/self-assignment: warnings/self-assignment.c @CFA_BINDIR@/@CFA_NAME@
    803         ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} -o ${@}
    804         echo > ${@}
     804        ${CC} ${AM_CFLAGS} ${CFLAGS} ${<} 2> ${@} -fsyntax-only
    805805
    806806# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • src/tests/literals.c

    rb2e8841 rf4abc58  
    1010// Created On       : Sat Sep  9 16:34:38 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 25 20:26:00 2017
    13 // Update Count     : 132
     12// Last Modified On : Sun Mar  4 10:41:31 2018
     13// Update Count     : 134
    1414//
    1515
     
    3131// integer literals
    3232
     33        // binary
     34         0b01101011;   0b01101011u;   0b01101011l;   0b01101011ll;   0b01101011ul;   0b01101011lu;   0b01101011ull;   0b01101011llu;
     35        +0b01101011;  +0b01101011u;  +0b01101011l;  +0b01101011ll;  +0b01101011ul;  +0b01101011lu;  +0b01101011ull;  +0b01101011llu;
     36        -0b01101011;  -0b01101011u;  -0b01101011l;  -0b01101011ll;  -0b01101011ul;  -0b01101011lu;  -0b01101011ull;  -0b01101011llu;
     37
    3338        // octal
    3439         01234567;   01234567u;   01234567l;   01234567ll;   01234567ul;   01234567lu;   01234567ull;   01234567llu;
     
    148153#ifdef __CFA__
    149154// fixed-size length
     155
     156        // binary
     157         0b01101011_l8;   0b01101011_l16;   0b01101011_l32;   0b01101011_l64;   0b01101011_l128;   0b01101011_l8u;   0b01101011_ul16;   0b01101011_l32u;   0b01101011_ul64;   0b01101011_ul128;
     158        +0b01101011_l8;  +0b01101011_l16;  +0b01101011_l32;  +0b01101011_l64;  +0b01101011_l128;  +0b01101011_l8u;  +0b01101011_ul16;  +0b01101011_l32u;  +0b01101011_ul64;  +0b01101011_ul128;
     159        -0b01101011_l8;  -0b01101011_l16;  -0b01101011_l32;  -0b01101011_l64;  -0b01101011_l128;  -0b01101011_l8u;  -0b01101011_ul16;  -0b01101011_l32u;  -0b01101011_ul64;  -0b01101011_ul128;
    150160
    151161        // octal
  • src/tests/user_literals.c

    rb2e8841 rf4abc58  
    1010// Created On       : Wed Sep  6 21:40:50 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Dec  7 09:12:36 2017
    13 // Update Count     : 50
     12// Last Modified On : Sun Mar  4 11:14:02 2018
     13// Update Count     : 52
    1414//
    1515
     
    3131
    3232
    33 struct Weight {
    34         double stones;
    35 };
    36 void ?{}( Weight & w ) { w.stones = 0; }                                // operations
     33struct Weight { double stones; };
     34void ?{}( Weight & w ) { w.stones = 0; }
    3735void ?{}( Weight & w, double w ) { w.stones = w; }
    38 Weight ?+?( Weight l, Weight r ) { return (Weight){ l.stones + r.stones }; }
     36Weight ?+?( Weight l, Weight r ) {
     37        return (Weight){ l.stones + r.stones };
     38}
    3939ofstream & ?|?( ofstream & os, Weight w ) { return os | w.stones; }
    4040
    4141Weight ?`st( double w ) { return (Weight){ w }; }               // backquote for user literals
    4242Weight ?`lb( double w ) { return (Weight){ w / 14.0 }; }
    43 Weight ?`kg( double w ) { return (Weight) { w * 0.1575}; }
    44 
     43Weight ?`kg( double w ) { return (Weight) { w * 0.16 }; }
    4544
    4645int main() {
    47         Weight w, hw = { 14 };                                                          // 14 stone
    48         w = 11`st + 1`lb;
     46        Weight w, heavy = { 20 };                                                       // 20 stone
     47        w = 155`lb;
     48        sout | w | endl;
     49        w = 0b_1111`st;
     50        sout | w | endl;
     51        w = 0_233`lb;                                                                           // octal weight (155)
     52        sout | w | endl;
     53        w = 0x_9b_u`kg;
    4954        sout | w | endl;
    5055        w = 70.3`kg;
    5156        sout | w | endl;
    52         w = 155`lb;
     57        w = 11`st + 1`lb;
    5358        sout | w | endl;
    54         w = 0x_9b_u`lb;                                                                         // hexadecimal unsigned weight (155)
    55         sout | w | endl;
    56         w = 0_233`lb;                                                                           // octal weight (155)
    57         sout | w | endl;
    58         w = 5`st + 8`kg + 25`lb + hw;
     59        w = 5`st + 8`kg + 25`lb + heavy;
    5960        sout | w | endl;
    6061
  • src/tests/warnings/.expect/self-assignment.txt

    rb2e8841 rf4abc58  
     1warnings/self-assignment.c:29:1 warning: self assignment of expression: Cast of:
     2  Variable Expression: j: signed int
     3... to:
     4  reference to signed int
     5warnings/self-assignment.c:30:1 warning: self assignment of expression: Cast of:
     6  Variable Expression: s: instance of struct S with body 1
     7... to:
     8  reference to instance of struct S with body 1
     9warnings/self-assignment.c:31:1 warning: self assignment of expression: Cast of:
     10  Member Expression, with field:
     11    i: signed int
     12  ... from aggregate:
     13    Variable Expression: s: instance of struct S with body 1
     14... to:
     15  reference to signed int
     16warnings/self-assignment.c:32:1 warning: self assignment of expression: Cast of:
     17  Member Expression, with field:
     18    i: signed int
     19  ... from aggregate:
     20    Member Expression, with field:
     21      s: instance of struct S with body 1
     22    ... from aggregate:
     23      Variable Expression: t: instance of struct T with body 1
     24... to:
     25  reference to signed int
Note: See TracChangeset for help on using the changeset viewer.