- Timestamp:
- Feb 24, 2020, 2:21:03 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 959f6ad
- Parents:
- 0f2c555
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/Concurrency/Keywords.cc ¶
r0f2c555 rac2b598 88 88 // int data; int data; 89 89 // a_struct_t more_data; a_struct_t more_data; 90 // => thread_desc__thrd_d;90 // => $thread __thrd_d; 91 91 // }; }; 92 // static inline thread_desc* get_thread( MyThread * this ) { return &this->__thrd_d; }92 // static inline $thread * get_thread( MyThread * this ) { return &this->__thrd_d; } 93 93 // 94 94 class ThreadKeyword final : public ConcurrentSueKeyword { … … 96 96 97 97 ThreadKeyword() : ConcurrentSueKeyword( 98 " thread_desc",98 "$thread", 99 99 "__thrd", 100 100 "get_thread", … … 120 120 // int data; int data; 121 121 // a_struct_t more_data; a_struct_t more_data; 122 // => coroutine_desc__cor_d;122 // => $coroutine __cor_d; 123 123 // }; }; 124 // static inline coroutine_desc* get_coroutine( MyCoroutine * this ) { return &this->__cor_d; }124 // static inline $coroutine * get_coroutine( MyCoroutine * this ) { return &this->__cor_d; } 125 125 // 126 126 class CoroutineKeyword final : public ConcurrentSueKeyword { … … 128 128 129 129 CoroutineKeyword() : ConcurrentSueKeyword( 130 " coroutine_desc",130 "$coroutine", 131 131 "__cor", 132 132 "get_coroutine", … … 152 152 // int data; int data; 153 153 // a_struct_t more_data; a_struct_t more_data; 154 // => monitor_desc__mon_d;154 // => $monitor __mon_d; 155 155 // }; }; 156 // static inline monitor_desc* get_coroutine( MyMonitor * this ) { return &this->__cor_d; }156 // static inline $monitor * get_coroutine( MyMonitor * this ) { return &this->__cor_d; } 157 157 // 158 158 class MonitorKeyword final : public ConcurrentSueKeyword { … … 160 160 161 161 MonitorKeyword() : ConcurrentSueKeyword( 162 " monitor_desc",162 "$monitor", 163 163 "__mon", 164 164 "get_monitor", … … 182 182 //Handles mutex routines definitions : 183 183 // void foo( A * mutex a, B * mutex b, int i ) { void foo( A * a, B * b, int i ) { 184 // monitor_desc* __monitors[] = { get_monitor(a), get_monitor(b) };184 // $monitor * __monitors[] = { get_monitor(a), get_monitor(b) }; 185 185 // monitor_guard_t __guard = { __monitors, 2 }; 186 186 // /*Some code*/ => /*Some code*/ … … 221 221 //Handles mutex routines definitions : 222 222 // void foo( A * mutex a, B * mutex b, int i ) { void foo( A * a, B * b, int i ) { 223 // monitor_desc* __monitors[] = { get_monitor(a), get_monitor(b) };223 // $monitor * __monitors[] = { get_monitor(a), get_monitor(b) }; 224 224 // monitor_guard_t __guard = { __monitors, 2 }; 225 225 // /*Some code*/ => /*Some code*/ … … 306 306 Expression * ConcurrentSueKeyword::postmutate( KeywordCastExpr * cast ) { 307 307 if ( cast_target == cast->target ) { 308 // convert (thread &)t to ( thread_desc&)*get_thread(t), etc.308 // convert (thread &)t to ($thread &)*get_thread(t), etc. 309 309 if( !type_decl ) SemanticError( cast, context_error ); 310 310 if( !dtor_decl ) SemanticError( cast, context_error ); … … 516 516 void MutexKeyword::postvisit(StructDecl* decl) { 517 517 518 if( decl->name == " monitor_desc" && decl->body ) {518 if( decl->name == "$monitor" && decl->body ) { 519 519 assert( !monitor_decl ); 520 520 monitor_decl = decl; … … 612 612 ); 613 613 614 // monitor_desc* __monitors[] = { get_monitor(a), get_monitor(b) };614 //$monitor * __monitors[] = { get_monitor(a), get_monitor(b) }; 615 615 body->push_front( new DeclStmt( monitors) ); 616 616 } … … 673 673 ); 674 674 675 // monitor_desc* __monitors[] = { get_monitor(a), get_monitor(b) };675 //$monitor * __monitors[] = { get_monitor(a), get_monitor(b) }; 676 676 body->push_front( new DeclStmt( monitors) ); 677 677 } … … 681 681 //============================================================================================= 682 682 void ThreadStarter::previsit( StructDecl * decl ) { 683 if( decl->name == " thread_desc" && decl->body ) {683 if( decl->name == "$thread" && decl->body ) { 684 684 assert( !thread_decl ); 685 685 thread_decl = decl; -
TabularUnified src/Concurrency/Waitfor.cc ¶
r0f2c555 rac2b598 244 244 decl_mask = decl; 245 245 } 246 else if( decl->name == " monitor_desc" ) {246 else if( decl->name == "$monitor" ) { 247 247 assert( !decl_monitor ); 248 248 decl_monitor = decl; -
TabularUnified src/ResolvExpr/AlternativeFinder.cc ¶
r0f2c555 rac2b598 1292 1292 1293 1293 try { 1294 // Attempt 1 : turn (thread&)X into ( thread_desc&)X.__thrd1294 // Attempt 1 : turn (thread&)X into ($thread&)X.__thrd 1295 1295 // Clone is purely for memory management 1296 1296 std::unique_ptr<Expression> tech1 { new UntypedMemberExpr(new NameExpr(castExpr->concrete_target.field), castExpr->arg->clone()) }; … … 1303 1303 } catch(SemanticErrorException & ) {} 1304 1304 1305 // Fallback : turn (thread&)X into ( thread_desc&)get_thread(X)1305 // Fallback : turn (thread&)X into ($thread&)get_thread(X) 1306 1306 std::unique_ptr<Expression> fallback { UntypedExpr::createDeref( new UntypedExpr(new NameExpr(castExpr->concrete_target.getter), { castExpr->arg->clone() })) }; 1307 1307 // don't prune here, since it's guaranteed all alternatives will have the same type
Note: See TracChangeset
for help on using the changeset viewer.