- Timestamp:
- Mar 7, 2018, 5:09:18 PM (8 years ago)
- 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. - Location:
- src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/SemanticError.h
rb2e8841 rf4abc58 72 72 } 73 73 74 75 76 77 74 // Local Variables: // 78 75 // tab-width: 4 // -
src/Parser/ExpressionNode.cc
rb2e8841 rf4abc58 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 27 22:51:55 201713 // Update Count : 7 8112 // Last Modified On : Sat Mar 3 18:22:33 2018 13 // Update Count : 796 14 14 // 15 15 … … 58 58 static inline bool checkD( char c ) { return c == 'd' || c == 'D'; } 59 59 static inline bool checkI( char c ) { return c == 'i' || c == 'I'; } 60 static inline bool checkB( char c ) { return c == 'b' || c == 'B'; } 60 61 static inline bool checkX( char c ) { return c == 'x' || c == 'X'; } 61 62 … … 116 117 117 118 unsigned long long int v; // converted integral value 118 size_t last = str.length() - 1; // last characterof constant119 size_t last = str.length() - 1; // last subscript of constant 119 120 Expression * ret; 120 121 … … 129 130 } // if 130 131 131 if ( str[0] == '0' ) { // octal/hex constant ? 132 // Cannot be "0" 133 134 if ( str[0] == '0' ) { // radix character ? 132 135 dec = false; 133 if ( last != 0 && checkX( str[1] ) ) {// hex constant ?136 if ( checkX( str[1] ) ) { // hex constant ? 134 137 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 135 146 //printf( "%llx %llu\n", v, v ); 136 147 } else { // octal constant -
src/Parser/lex.ll
rb2e8841 rf4abc58 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Thu Feb 22 18:11:27201813 * Update Count : 6 3712 * Last Modified On : Sat Mar 3 18:38:16 2018 13 * Update Count : 640 14 14 */ 15 15 … … 77 77 %} 78 78 79 binary [0-1] 79 80 octal [0-7] 80 81 nonzero [1-9] … … 103 104 nonzero_digits ({nonzero})|({nonzero}({decimal}|"_")*{decimal}) 104 105 decimal_constant {nonzero_digits}{integer_suffix_opt} 106 107 binary_digits ({binary})|({binary}({binary}|"_")*{binary}) 108 binary_prefix "0"[bB]"_"? 109 binary_constant {binary_prefix}{binary_digits}{integer_suffix_opt} 105 110 106 111 hex_digits ({hex})|({hex}({hex}|"_")*{hex}) … … 315 320 316 321 /* numeric constants */ 322 {binary_constant} { NUMERIC_RETURN(INTEGERconstant); } 323 {octal_constant} { NUMERIC_RETURN(INTEGERconstant); } 317 324 {decimal_constant} { NUMERIC_RETURN(INTEGERconstant); } 318 {octal_constant} { NUMERIC_RETURN(INTEGERconstant); }319 325 {hex_constant} { NUMERIC_RETURN(INTEGERconstant); } 320 326 {floating_decimal} { NUMERIC_RETURN(FLOATING_DECIMALconstant); } // must appear before floating_constant -
src/libcfa/concurrency/kernel
rb2e8841 rf4abc58 79 79 80 80 // Processor 81 coroutine processorCtx_t { 82 struct processor * proc; 83 }; 84 81 85 // Wrapper around kernel threads 82 86 struct processor { 83 87 // Main state 84 88 // Coroutine ctx who does keeps the state of the processor 85 struct processorCtx_t *runner;89 struct processorCtx_t runner; 86 90 87 91 // Cluster from which to get threads -
src/libcfa/concurrency/kernel.c
rb2e8841 rf4abc58 124 124 //----------------------------------------------------------------------------- 125 125 // Processor coroutine 126 void ?{}(processorCtx_t & this) {} 126 127 127 128 // Construct the processor context of the main processor … … 130 131 this.__cor.starter = NULL; 131 132 this.proc = proc; 132 proc->runner = &this;133 133 } 134 134 … … 137 137 (this.__cor){ info }; 138 138 this.proc = proc; 139 proc->runner = &this;140 139 } 141 140 … … 150 149 preemption_alarm = NULL; 151 150 pending_preemption = false; 151 runner.proc = &this; 152 152 153 153 start( &this ); … … 161 161 pending_preemption = false; 162 162 kernel_thread = pthread_self(); 163 164 this.runner = &runner; 163 runner.proc = &this; 164 165 165 __cfaabi_dbg_print_safe("Kernel : constructing main processor context %p\n", &runner); 166 166 runner{ &this }; … … 196 196 void main(processorCtx_t & runner) { 197 197 processor * this = runner.proc; 198 verify(this); 198 199 199 200 __cfaabi_dbg_print_safe("Kernel : core %p starting\n", this); … … 241 242 void runThread(processor * this, thread_desc * dst) { 242 243 assert(dst->curr_cor); 243 coroutine_desc * proc_cor = get_coroutine( *this->runner);244 coroutine_desc * proc_cor = get_coroutine(this->runner); 244 245 coroutine_desc * thrd_cor = dst->curr_cor; 245 246 … … 256 257 257 258 void returnToKernel() { 258 coroutine_desc * proc_cor = get_coroutine( *this_processor->runner);259 coroutine_desc * proc_cor = get_coroutine(this_processor->runner); 259 260 coroutine_desc * thrd_cor = this_thread->curr_cor = this_coroutine; 260 261 ThreadCtxSwitch(thrd_cor, proc_cor); … … 317 318 machine_context_t ctx; 318 319 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); 322 323 323 324 //Set global state 324 this_coroutine = &proc->runner->__cor;325 this_coroutine = get_coroutine(proc->runner); 325 326 this_thread = NULL; 326 327 327 328 //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); 329 330 330 331 // SKULLDUGGERY: Since the coroutine doesn't have its own stack, we can't … … 332 333 // back to here. Instead directly call the main since we already are on the 333 334 // 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; 337 338 338 339 // 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); 340 341 341 342 return NULL; … … 352 353 void kernel_first_resume(processor * this) { 353 354 coroutine_desc * src = this_coroutine; 354 coroutine_desc * dst = get_coroutine( *this->runner);355 coroutine_desc * dst = get_coroutine(this->runner); 355 356 356 357 verify( !preemption_state.enabled ); 357 358 358 359 create_stack(&dst->stack, dst->stack.size); 359 CtxStart( this->runner, CtxInvokeCoroutine);360 CtxStart(&this->runner, CtxInvokeCoroutine); 360 361 361 362 verify( !preemption_state.enabled ); … … 411 412 verify( !preemption_state.enabled ); 412 413 lock( ready_queue_lock __cfaabi_dbg_ctx2 ); 413 //TEMP hack to find a bug414 if(this_processor != mainProcessor) {415 if(ready_queue.head == mainThread) {416 unlock( ready_queue_lock );417 return NULL;418 }419 }420 421 414 thread_desc * head = pop_head( ready_queue ); 422 415 unlock( ready_queue_lock ); … … 584 577 // Destroy the main processor and its context in reverse order of construction 585 578 // These were manually constructed so we need manually destroy them 586 ^( *mainProcessor->runner){};579 ^(mainProcessor->runner){}; 587 580 ^(mainProcessor){}; 588 581 -
src/libcfa/concurrency/kernel_private.h
rb2e8841 rf4abc58 52 52 //----------------------------------------------------------------------------- 53 53 // Processor 54 coroutine processorCtx_t {55 processor * proc;56 };57 58 54 void main(processorCtx_t *); 59 55 void start(processor * this); -
src/tests/.expect/literals.x64.txt
rb2e8841 rf4abc58 522 522 signed int __main__Fi___1(){ 523 523 __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)); 524 548 ((void)01234567); 525 549 ((void)01234567u); … … 1017 1041 ((void)(-0X0123456789.0123456789P-09F)); 1018 1042 ((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)))); 1019 1073 ((void)((signed char )01234567)); 1020 1074 ((void)((signed short int )01234567)); -
src/tests/.expect/literals.x86.txt
rb2e8841 rf4abc58 522 522 signed int __main__Fi___1(){ 523 523 __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)); 524 548 ((void)01234567); 525 549 ((void)01234567u); … … 1017 1041 ((void)(-0X0123456789.0123456789P-09F)); 1018 1042 ((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)))); 1019 1073 ((void)((signed char )01234567)); 1020 1074 ((void)((signed short int )01234567)); -
src/tests/.expect/user_literals.txt
rb2e8841 rf4abc58 1 1 11.0714285714286 2 1 1.072252 15 3 3 11.0714285714286 4 24.8 5 11.248 4 6 11.0714285714286 5 11.0714285714286 6 22.0457142857143 7 28.0657142857143 7 8 secs 1 8 9 secs 23 -
src/tests/Makefile.am
rb2e8841 rf4abc58 123 123 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@} 124 124 125 # Warnings 125 126 warnings/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 800 800 ${CC} ${AM_CFLAGS} ${CFLAGS} -DERR1 ${<} -o ${@} 801 801 802 # Warnings 802 803 warnings/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 805 805 806 806 # Tell versions [3.59,3.63) of GNU make to not export all variables. -
src/tests/literals.c
rb2e8841 rf4abc58 10 10 // Created On : Sat Sep 9 16:34:38 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 25 20:26:00 201713 // Update Count : 13 212 // Last Modified On : Sun Mar 4 10:41:31 2018 13 // Update Count : 134 14 14 // 15 15 … … 31 31 // integer literals 32 32 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 33 38 // octal 34 39 01234567; 01234567u; 01234567l; 01234567ll; 01234567ul; 01234567lu; 01234567ull; 01234567llu; … … 148 153 #ifdef __CFA__ 149 154 // 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; 150 160 151 161 // octal -
src/tests/user_literals.c
rb2e8841 rf4abc58 10 10 // Created On : Wed Sep 6 21:40:50 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 7 09:12:36 201713 // Update Count : 5 012 // Last Modified On : Sun Mar 4 11:14:02 2018 13 // Update Count : 52 14 14 // 15 15 … … 31 31 32 32 33 struct Weight { 34 double stones; 35 }; 36 void ?{}( Weight & w ) { w.stones = 0; } // operations 33 struct Weight { double stones; }; 34 void ?{}( Weight & w ) { w.stones = 0; } 37 35 void ?{}( Weight & w, double w ) { w.stones = w; } 38 Weight ?+?( Weight l, Weight r ) { return (Weight){ l.stones + r.stones }; } 36 Weight ?+?( Weight l, Weight r ) { 37 return (Weight){ l.stones + r.stones }; 38 } 39 39 ofstream & ?|?( ofstream & os, Weight w ) { return os | w.stones; } 40 40 41 41 Weight ?`st( double w ) { return (Weight){ w }; } // backquote for user literals 42 42 Weight ?`lb( double w ) { return (Weight){ w / 14.0 }; } 43 Weight ?`kg( double w ) { return (Weight) { w * 0.1575}; } 44 43 Weight ?`kg( double w ) { return (Weight) { w * 0.16 }; } 45 44 46 45 int 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; 49 54 sout | w | endl; 50 55 w = 70.3`kg; 51 56 sout | w | endl; 52 w = 1 55`lb;57 w = 11`st + 1`lb; 53 58 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; 59 60 sout | w | endl; 60 61 -
src/tests/warnings/.expect/self-assignment.txt
rb2e8841 rf4abc58 1 warnings/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 5 warnings/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 9 warnings/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 16 warnings/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.