- Timestamp:
- Jul 7, 2021, 6:24:42 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- d83b266
- Parents:
- 1f45c7d (diff), b1a2c4a (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:
-
- 4 edited
-
Concurrency/Keywords.cc (modified) (14 diffs)
-
Concurrency/Waitfor.cc (modified) (1 diff)
-
ResolvExpr/AlternativeFinder.cc (modified) (2 diffs)
-
ResolvExpr/CandidateFinder.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
r1f45c7d rc86ee4c 122 122 // int data; int data; 123 123 // a_struct_t more_data; a_struct_t more_data; 124 // => $thread__thrd_d;124 // => thread$ __thrd_d; 125 125 // }; }; 126 // static inline $thread* get_thread( MyThread * this ) { return &this->__thrd_d; }126 // static inline thread$ * get_thread( MyThread * this ) { return &this->__thrd_d; } 127 127 // 128 128 class ThreadKeyword final : public ConcurrentSueKeyword { … … 130 130 131 131 ThreadKeyword() : ConcurrentSueKeyword( 132 " $thread",132 "thread$", 133 133 "__thrd", 134 134 "get_thread", … … 155 155 // int data; int data; 156 156 // a_struct_t more_data; a_struct_t more_data; 157 // => $coroutine__cor_d;157 // => coroutine$ __cor_d; 158 158 // }; }; 159 // static inline $coroutine* get_coroutine( MyCoroutine * this ) { return &this->__cor_d; }159 // static inline coroutine$ * get_coroutine( MyCoroutine * this ) { return &this->__cor_d; } 160 160 // 161 161 class CoroutineKeyword final : public ConcurrentSueKeyword { … … 163 163 164 164 CoroutineKeyword() : ConcurrentSueKeyword( 165 " $coroutine",165 "coroutine$", 166 166 "__cor", 167 167 "get_coroutine", … … 190 190 // int data; int data; 191 191 // a_struct_t more_data; a_struct_t more_data; 192 // => $monitor__mon_d;192 // => monitor$ __mon_d; 193 193 // }; }; 194 // static inline $monitor* get_coroutine( MyMonitor * this ) { return &this->__cor_d; }194 // static inline monitor$ * get_coroutine( MyMonitor * this ) { return &this->__cor_d; } 195 195 // 196 196 class MonitorKeyword final : public ConcurrentSueKeyword { … … 198 198 199 199 MonitorKeyword() : ConcurrentSueKeyword( 200 " $monitor",200 "monitor$", 201 201 "__mon", 202 202 "get_monitor", … … 230 230 231 231 GeneratorKeyword() : ConcurrentSueKeyword( 232 " $generator",232 "generator$", 233 233 "__generator_state", 234 234 "get_generator", 235 "Unable to find builtin type $generator\n",235 "Unable to find builtin type generator$\n", 236 236 "", 237 237 true, … … 292 292 //Handles mutex routines definitions : 293 293 // void foo( A * mutex a, B * mutex b, int i ) { void foo( A * a, B * b, int i ) { 294 // $monitor* __monitors[] = { get_monitor(a), get_monitor(b) };294 // monitor$ * __monitors[] = { get_monitor(a), get_monitor(b) }; 295 295 // monitor_guard_t __guard = { __monitors, 2 }; 296 296 // /*Some code*/ => /*Some code*/ … … 333 333 //Handles mutex routines definitions : 334 334 // void foo( A * mutex a, B * mutex b, int i ) { void foo( A * a, B * b, int i ) { 335 // $monitor* __monitors[] = { get_monitor(a), get_monitor(b) };335 // monitor$ * __monitors[] = { get_monitor(a), get_monitor(b) }; 336 336 // monitor_guard_t __guard = { __monitors, 2 }; 337 337 // /*Some code*/ => /*Some code*/ … … 449 449 Expression * ConcurrentSueKeyword::postmutate( KeywordCastExpr * cast ) { 450 450 if ( cast_target == cast->target ) { 451 // convert (thread &)t to ( $thread&)*get_thread(t), etc.451 // convert (thread &)t to (thread$ &)*get_thread(t), etc. 452 452 if( !type_decl ) SemanticError( cast, context_error ); 453 453 if( !dtor_decl ) SemanticError( cast, context_error ); … … 919 919 void MutexKeyword::postvisit(StructDecl* decl) { 920 920 921 if( decl->name == " $monitor" && decl->body ) {921 if( decl->name == "monitor$" && decl->body ) { 922 922 assert( !monitor_decl ); 923 923 monitor_decl = decl; … … 1020 1020 ); 1021 1021 1022 // $monitor* __monitors[] = { get_monitor(a), get_monitor(b) };1022 //monitor$ * __monitors[] = { get_monitor(a), get_monitor(b) }; 1023 1023 body->push_front( new DeclStmt( monitors ) ); 1024 1024 } … … 1117 1117 ); 1118 1118 1119 // $monitor* __monitors[] = { get_monitor(a), get_monitor(b) };1119 //monitor$ * __monitors[] = { get_monitor(a), get_monitor(b) }; 1120 1120 body->push_front( new DeclStmt( monitors) ); 1121 1121 } … … 1125 1125 //============================================================================================= 1126 1126 void ThreadStarter::previsit( StructDecl * decl ) { 1127 if( decl->name == " $thread" && decl->body ) {1127 if( decl->name == "thread$" && decl->body ) { 1128 1128 assert( !thread_decl ); 1129 1129 thread_decl = decl; -
src/Concurrency/Waitfor.cc
r1f45c7d rc86ee4c 244 244 decl_mask = decl; 245 245 } 246 else if( decl->name == " $monitor" ) {246 else if( decl->name == "monitor$" ) { 247 247 assert( !decl_monitor ); 248 248 decl_monitor = decl; -
src/ResolvExpr/AlternativeFinder.cc
r1f45c7d rc86ee4c 1302 1302 1303 1303 try { 1304 // Attempt 1 : turn (thread&)X into ( $thread&)X.__thrd1304 // Attempt 1 : turn (thread&)X into (thread$&)X.__thrd 1305 1305 // Clone is purely for memory management 1306 1306 std::unique_ptr<Expression> tech1 { new UntypedMemberExpr(new NameExpr(castExpr->concrete_target.field), castExpr->arg->clone()) }; … … 1313 1313 } catch(SemanticErrorException & ) {} 1314 1314 1315 // Fallback : turn (thread&)X into ( $thread&)get_thread(X)1315 // Fallback : turn (thread&)X into (thread$&)get_thread(X) 1316 1316 std::unique_ptr<Expression> fallback { UntypedExpr::createDeref( new UntypedExpr(new NameExpr(castExpr->concrete_target.getter), { castExpr->arg->clone() })) }; 1317 1317 // don't prune here, since it's guaranteed all alternatives will have the same type -
src/ResolvExpr/CandidateFinder.cpp
r1f45c7d rc86ee4c 1180 1180 1181 1181 try { 1182 // Attempt 1 : turn (thread&)X into ( $thread&)X.__thrd1182 // Attempt 1 : turn (thread&)X into (thread$&)X.__thrd 1183 1183 // Clone is purely for memory management 1184 1184 std::unique_ptr<const ast::Expr> tech1 { new ast::UntypedMemberExpr(loc, new ast::NameExpr(loc, castExpr->concrete_target.field), castExpr->arg) }; … … 1191 1191 } catch(SemanticErrorException & ) {} 1192 1192 1193 // Fallback : turn (thread&)X into ( $thread&)get_thread(X)1193 // Fallback : turn (thread&)X into (thread$&)get_thread(X) 1194 1194 std::unique_ptr<const ast::Expr> fallback { ast::UntypedExpr::createDeref(loc, new ast::UntypedExpr(loc, new ast::NameExpr(loc, castExpr->concrete_target.getter), { castExpr->arg })) }; 1195 1195 // 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.