Changeset d28524a
- Timestamp:
- Jun 23, 2022, 1:41:39 PM (18 months ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 3322180, a6cfb4d, fd365da
- Parents:
- 4e83bb7 (diff), 9dad5b3 (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. - Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/configure.ac
r4e83bb7 rd28524a 181 181 AH_TEMPLATE([CFA_HAVE_SPLICE_F_FD_IN_FIXED],[Defined if io_uring support is present when compiling libcfathread and supports the flag SPLICE_F_FD_IN_FIXED.]) 182 182 AH_TEMPLATE([CFA_HAVE_IORING_SETUP_ATTACH_WQ],[Defined if io_uring support is present when compiling libcfathread and supports the flag IORING_SETUP_ATTACH_WQ.]) 183 AH_TEMPLATE([CFA_HAVE_IORING_REGISTER_IOWQ_MAX_WORKERS],[Defined if io_uring support is present when compiling libcfathread and supports the flag IORING_REGISTER_IOWQ_MAX_WORKERS.]) 183 184 AH_TEMPLATE([CFA_HAVE_PREADV2],[Defined if preadv2 support is present when compiling libcfathread.]) 184 185 AH_TEMPLATE([CFA_HAVE_PWRITEV2],[Defined if pwritev2 support is present when compiling libcfathread.]) … … 189 190 190 191 define(ioring_ops, [IORING_OP_NOP,IORING_OP_READV,IORING_OP_WRITEV,IORING_OP_FSYNC,IORING_OP_READ_FIXED,IORING_OP_WRITE_FIXED,IORING_OP_POLL_ADD,IORING_OP_POLL_REMOVE,IORING_OP_SYNC_FILE_RANGE,IORING_OP_SENDMSG,IORING_OP_RECVMSG,IORING_OP_TIMEOUT,IORING_OP_TIMEOUT_REMOVE,IORING_OP_ACCEPT,IORING_OP_ASYNC_CANCEL,IORING_OP_LINK_TIMEOUT,IORING_OP_CONNECT,IORING_OP_FALLOCATE,IORING_OP_OPENAT,IORING_OP_CLOSE,IORING_OP_FILES_UPDATE,IORING_OP_STATX,IORING_OP_READ,IORING_OP_WRITE,IORING_OP_FADVISE,IORING_OP_MADVISE,IORING_OP_SEND,IORING_OP_RECV,IORING_OP_OPENAT2,IORING_OP_EPOLL_CTL,IORING_OP_SPLICE,IORING_OP_PROVIDE_BUFFERS,IORING_OP_REMOVE_BUFFER,IORING_OP_TEE]) 191 define(ioring_flags, [IOSQE_FIXED_FILE,IOSQE_IO_DRAIN,IOSQE_IO_LINK,IOSQE_IO_HARDLINK,IOSQE_ASYNC,IOSQE_BUFFER_SELECT,SPLICE_F_FD_IN_FIXED,IORING_SETUP_ATTACH_WQ ])192 define(ioring_flags, [IOSQE_FIXED_FILE,IOSQE_IO_DRAIN,IOSQE_IO_LINK,IOSQE_IO_HARDLINK,IOSQE_ASYNC,IOSQE_BUFFER_SELECT,SPLICE_F_FD_IN_FIXED,IORING_SETUP_ATTACH_WQ,IORING_REGISTER_IOWQ_MAX_WORKERS]) 192 193 193 194 define(ioring_from_decls, [ -
libcfa/src/concurrency/ready_subqueue.hfa
r4e83bb7 rd28524a 49 49 // Get the relevant nodes locally 50 50 this.prev->link.next = node; 51 this.prev->link.ts = rdtscl();51 __atomic_store_n(&this.prev->link.ts, rdtscl(), __ATOMIC_RELAXED); 52 52 this.prev = node; 53 53 #if !defined(__CFA_NO_STATISTICS__) -
src/AST/Pass.impl.hpp
r4e83bb7 rd28524a 648 648 if ( __visit_children() ) { 649 649 // unlike structs, traits, and unions, enums inject their members into the global scope 650 maybe_accept( node, &EnumDecl::base ); 650 651 maybe_accept( node, &EnumDecl::params ); 651 652 maybe_accept( node, &EnumDecl::members ); -
src/Common/ResolvProtoDump.cpp
r4e83bb7 rd28524a 227 227 } 228 228 229 void previsit( const ast::EnumInstType * enumInst) {229 void previsit( const ast::EnumInstType * ) { 230 230 // TODO: Add the meaningful text representation of typed enum 231 231 ss << (int)ast::BasicType::SignedInt; -
src/GenPoly/GenPoly.cc
r4e83bb7 rd28524a 64 64 } 65 65 66 __attribute__((unu nsed))66 __attribute__((unused)) 67 67 bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const TyVarMap & tyVars, const ast::TypeSubstitution * env) { 68 68 for (auto ¶m : params) { -
src/InitTweak/GenInit.cc
r4e83bb7 rd28524a 642 642 643 643 ast::ConstructorInit * genCtorInit( const CodeLocation & loc, const ast::ObjectDecl * objDecl ) { 644 // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor for each 644 // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor for each 645 645 // constructable object 646 646 InitExpander_new srcParam{ objDecl->init }, nullParam{ (const ast::Init *)nullptr }; 647 647 ast::ptr< ast::Expr > dstParam = new ast::VariableExpr(loc, objDecl); 648 649 ast::ptr< ast::Stmt > ctor = SymTab::genImplicitCall( 648 649 ast::ptr< ast::Stmt > ctor = SymTab::genImplicitCall( 650 650 srcParam, dstParam, loc, "?{}", objDecl ); 651 ast::ptr< ast::Stmt > dtor = SymTab::genImplicitCall( 652 nullParam, dstParam, loc, "^?{}", objDecl, 651 ast::ptr< ast::Stmt > dtor = SymTab::genImplicitCall( 652 nullParam, dstParam, loc, "^?{}", objDecl, 653 653 SymTab::LoopBackward ); 654 654 655 655 // check that either both ctor and dtor are present, or neither 656 656 assert( (bool)ctor == (bool)dtor ); 657 657 658 658 if ( ctor ) { 659 // need to remember init expression, in case no ctors exist. If ctor does exist, want to 659 // need to remember init expression, in case no ctors exist. If ctor does exist, want to 660 660 // use ctor expression instead of init. 661 ctor.strict_as< ast::ImplicitCtorDtorStmt >(); 661 ctor.strict_as< ast::ImplicitCtorDtorStmt >(); 662 662 dtor.strict_as< ast::ImplicitCtorDtorStmt >(); 663 663 -
src/Parser/lex.ll
r4e83bb7 rd28524a 82 82 // Stop warning due to incorrectly generated flex code. 83 83 #pragma GCC diagnostic ignored "-Wsign-compare" 84 85 // lex uses __null in a boolean context, it's fine. 86 #pragma GCC diagnostic ignored "-Wnull-conversion" 84 87 %} 85 88 -
src/Parser/parser.yy
r4e83bb7 rd28524a 56 56 57 57 #include "SynTree/Attribute.h" // for Attribute 58 59 // lex uses __null in a boolean context, it's fine. 60 #pragma GCC diagnostic ignored "-Wparentheses-equality" 58 61 59 62 extern DeclarationNode * parseTree; … … 1240 1243 { 1241 1244 $$ = new StatementNode( build_while( new CondCtl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); 1242 SemanticWarning( yylloc, Warning::SuperfluousElse );1245 SemanticWarning( yylloc, Warning::SuperfluousElse, "" ); 1243 1246 } 1244 1247 | WHILE '(' conditional_declaration ')' statement %prec THEN … … 1251 1254 { 1252 1255 $$ = new StatementNode( build_do_while( new ExpressionNode( build_constantInteger( *new string( "1" ) ) ), maybe_build_compound( $2 ) ) ); 1253 SemanticWarning( yylloc, Warning::SuperfluousElse );1256 SemanticWarning( yylloc, Warning::SuperfluousElse, "" ); 1254 1257 } 1255 1258 | DO statement WHILE '(' comma_expression ')' ';' … … 1262 1265 { 1263 1266 $$ = new StatementNode( build_for( new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr ), maybe_build_compound( $4 ) ) ); 1264 SemanticWarning( yylloc, Warning::SuperfluousElse );1267 SemanticWarning( yylloc, Warning::SuperfluousElse, "" ); 1265 1268 } 1266 1269 | FOR '(' for_control_expression_list ')' statement %prec THEN … … 2394 2397 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}' 2395 2398 { 2396 if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) 2399 if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) 2397 2400 { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); } 2398 2401 … … 2841 2844 linkage = LinkageSpec::update( yylloc, linkage, $2 ); 2842 2845 } 2843 up external_definition down 2846 up external_definition down 2844 2847 { 2845 2848 linkage = linkageStack.top(); -
src/ResolvExpr/CurrentObject.cc
r4e83bb7 rd28524a 73 73 virtual void setPosition( std::list< Expression * > & designators ) = 0; 74 74 75 /// retrieve the list of possible Type/Designat on pairs for the current position in the currect object75 /// retrieve the list of possible Type/Designation pairs for the current position in the currect object 76 76 virtual std::list<InitAlternative> operator*() const = 0; 77 77 -
src/SymTab/Mangler.cc
r4e83bb7 rd28524a 537 537 } 538 538 539 __attribute__((unused)) 539 540 inline std::vector< ast::ptr< ast::Type > > getTypes( const std::vector< ast::ptr< ast::DeclWithType > > & decls ) { 540 541 std::vector< ast::ptr< ast::Type > > ret; -
src/SymTab/ValidateType.cc
r4e83bb7 rd28524a 222 222 // visit enum members first so that the types of self-referencing members are updated properly 223 223 // Replace the enum base; right now it works only for StructEnum 224 if ( enumDecl->base && dynamic_cast<TypeInstType*>(enumDecl->base) ) { 225 std::string baseName = static_cast<TypeInstType*>(enumDecl->base)->name; 226 const StructDecl * st = local_indexer->lookupStruct( baseName ); 227 if ( st ) { 228 enumDecl->base = new StructInstType(Type::Qualifiers(),const_cast<StructDecl *>(st)); // Just linking in the node 224 if ( enumDecl->base ) { 225 if ( const TypeInstType * base = dynamic_cast< TypeInstType * >(enumDecl->base) ) { 226 if ( const StructDecl * decl = local_indexer->lookupStruct( base->name ) ) { 227 enumDecl->base = new StructInstType( Type::Qualifiers(), const_cast< StructDecl * >( decl ) ); // Just linking in the node 228 } 229 } else if ( const PointerType * ptr = dynamic_cast< PointerType * >(enumDecl->base) ) { 230 if ( const TypeInstType * ptrBase = dynamic_cast< TypeInstType * >( ptr->base ) ) { 231 if ( const StructDecl * decl = local_indexer->lookupStruct( ptrBase->name ) ) { 232 enumDecl->base = new PointerType( Type::Qualifiers(), 233 new StructInstType( Type::Qualifiers(), const_cast< StructDecl * >( decl ) ) ); 234 } 235 } 229 236 } 230 237 } 238 231 239 if ( enumDecl->body ) { 232 240 ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->name ); -
src/SynTree/Type.h
r4e83bb7 rd28524a 274 274 class PointerType : public Type { 275 275 public: 276 Type * base;276 Type * base; 277 277 278 278 // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] ) … … 516 516 typedef ReferenceToType Parent; 517 517 public: 518 // this decl is not "owned" by the unioninst; it is merely a pointer to elsewhere in the tree,519 // where the unionused in this type is actually defined518 // this decl is not "owned" by the enum inst; it is merely a pointer to elsewhere in the tree, 519 // where the enum used in this type is actually defined 520 520 EnumDecl *baseEnum = nullptr; 521 521 -
tests/pybin/tools.py
r4e83bb7 rd28524a 46 46 47 47 print(cmd) 48 return 0, None 48 return 0, None, None 49 49 50 50 with contextlib.ExitStack() as onexit: … … 291 291 ################################################################################ 292 292 def jobserver_version(): 293 make_ret, out, err = sh('make', '.test_makeflags', '-j2', output_file=subprocess.PIPE, error=subprocess.PIPE)293 make_ret, out, err = sh('make', '.test_makeflags', '-j2', ignore_dry_run = True, output_file=subprocess.PIPE, error=subprocess.PIPE) 294 294 if make_ret != 0: 295 295 print("ERROR: cannot find Makefile jobserver version", file=sys.stderr) -
tools/gdb/utils-gdb.py
r4e83bb7 rd28524a 89 89 return argv 90 90 91 def get_cluster_root(): 92 """ 93 Return: gdb.Value of globalClusters.root (is an address) 94 """ 91 class ClusterIter: 92 def __init__(self, root): 93 self.curr = None 94 self.root = root 95 96 def __iter__(self): 97 return self 98 99 def __next__(self): 100 # Clusters form a cycle 101 # If we haven't seen the root yet, then the root is the first 102 if not self.curr: 103 self.curr = self.root 104 return self.curr 105 106 # if we already saw the root, then go forward 107 self.curr = self.curr['_X4nodeS26__cluster____dbg_node_cltr_1']['_X4nextPS7cluster_1'] 108 109 # if we reached the root again, then we are done 110 if self.curr == self.root: 111 raise StopIteration 112 113 # otherwise return the next 114 return self.curr 115 116 def all_clusters(): 117 """ 118 Return: a list of all the clusters as an iterator. 119 obtained from gdb.Value of globalClusters.root (is an address) 120 """ 121 if not is_cforall(): 122 return [] 123 95 124 cluster_root = gdb.parse_and_eval('_X11mainClusterPS7cluster_1') 96 125 if cluster_root.address == 0x0: 97 126 print('No clusters, program terminated') 98 return cluster_root 99 100 def get_sched_lock(): 101 """ 102 Return: gdb.Value of __scheduler_lock 103 """ 104 lock = gdb.parse_and_eval('_X16__scheduler_lockPS20__scheduler_RWLock_t_1') 105 if lock.address == 0x0: 106 print('No scheduler lock, program terminated') 107 return lock 108 109 def all_clusters(): 110 if not is_cforall(): 111 return None 112 113 cluster_root = get_cluster_root() 114 if cluster_root.address == 0x0: 115 return 116 117 curr = cluster_root 118 ret = [curr] 119 120 while True: 121 curr = curr['_X4nodeS26__cluster____dbg_node_cltr_1']['_X4nextPS7cluster_1'] 122 if curr == cluster_root: 123 break 124 125 ret.append(curr) 126 127 return ret 127 return [] 128 129 return ClusterIter(cluster_root) 130 131 class ProcIter: 132 def __init__(self, root): 133 self.curr = None 134 self.root = root 135 136 def __iter__(self): 137 return self 138 139 def check(self): 140 # check if this is the last value 141 addr = int(self.curr) 142 mask = 1 << ((8 * int(gdb.parse_and_eval('sizeof(void*)'))) - 1) 143 if 0 != (mask & addr): 144 raise StopIteration 145 146 def __next__(self): 147 cfa_t = get_cfa_types() 148 149 # Processors form a cycle 150 # If we haven't seen the root yet, then the root is the first 151 if not self.curr: 152 my_next = self.root 153 self.curr = my_next.cast(cfa_t.processor_ptr) 154 155 #check if this is an empty list 156 self.check() 157 158 return self.curr 159 160 # if we already saw the root, then go forward 161 my_next = self.curr['__anonymous_object2225']['_X4nextPY13__tE_generic__1'] 162 self.curr = my_next.cast(cfa_t.processor_ptr) 163 164 #check if we reached the end 165 self.check() 166 167 # otherwise return the next 168 return self.curr 169 170 def proc_list(cluster): 171 """ 172 Return: for a given processor, return the active and idle processors, as 2 iterators 173 """ 174 cfa_t = get_cfa_types() 175 proclist = cluster['_X5procsS19__cluster_proc_list_1'] 176 idle = proclist['_X5idlesS5dlist_S9processorS5dlink_S9processor___1']['__anonymous_object2167']['_X4nextPY13__tE_generic__1'] 177 active = proclist['_X7activesS5dlist_S9processorS5dlink_S9processor___1']['__anonymous_object2167']['_X4nextPY13__tE_generic__1'] 178 return ProcIter(active.cast(cfa_t.processor_ptr)), ProcIter(idle.cast(cfa_t.processor_ptr)) 128 179 129 180 def all_processors(): 130 if not is_cforall(): 131 return None 132 133 cfa_t = get_cfa_types() 134 135 # get processors from registration to the RWlock 136 lock = get_sched_lock() 137 138 #get number of elements 139 count = lock['_X5readyVj_1'] 140 141 #find all the procs 142 raw_procs = [lock['_X4dataPS21__scheduler_lock_id_t_1'][i]['_X6handleVPS16__processor_id_t_1'] for i in range(count)] 143 144 # pre cast full procs 145 procs = [p.cast(cfa_t.processor_ptr) for p in raw_procs if p['_X9full_procb_1']] 146 147 # sort procs by clusters 148 return sorted(procs, key=lambda p: p['_X4cltrPS7cluster_1']) 181 procs = [] 182 for c in all_clusters(): 183 active, idle = proc_list(c) 184 for p in active: 185 procs.append(p) 186 187 for p in idle: 188 procs.append(p) 189 190 print(procs) 191 return procs 149 192 150 193 def tls_for_pthread(pthrd): … … 160 203 161 204 def tls_for_proc(proc): 162 return tls_for_pthread(proc['_X13kernel_threadm_1'])205 return proc['_X10local_dataPS16KernelThreadData_1'] 163 206 164 207 def thread_for_pthread(pthrd): … … 180 223 def lookup_cluster(name = None): 181 224 """ 182 Look up a cluster given its ID225 Look up one or more cluster given a name 183 226 @name: str 184 227 Return: gdb.Value … … 187 230 return None 188 231 189 root = get_cluster_root()190 if root.address == 0x0:232 clusters = all_clusters() 233 if not clusters: 191 234 return None 192 235 193 236 if not name: 194 return root237 return clusters.root 195 238 196 239 # lookup for the task associated with the id 197 cluster = None 198 curr = root 199 while True: 200 if curr['_X4namePKc_1'].string() == name: 201 cluster = curr.address 202 break 203 curr = curr['_X4nodeS26__cluster____dbg_node_cltr_1']['_X4nextPS7cluster_1'] 204 if curr == root or curr == 0x0: 205 break 206 207 if not cluster: 240 found = [c for c in clusters if c['_X4namePKc_1'].string() == name] 241 242 if not found: 208 243 print("Cannot find a cluster with the name: {}.".format(name)) 209 244 return None 210 245 211 return cluster 246 return found 247 212 248 213 249 def lookup_threads_by_cluster(cluster): … … 294 330 super(Processors, self).__init__('info processors', gdb.COMMAND_USER) 295 331 296 def print_processor(self, processor ):332 def print_processor(self, processor, in_stats): 297 333 should_stop = processor['_X12do_terminateVb_1'] 298 334 if not should_stop: 299 midle = processor['_X6$linksS7$dlinks_S9processor__1']['_X4nextS9$mgd_link_Y13__tE_generic___1']['_X4elemPY13__tE_generic__1'] != 0x0 300 end = processor['_X6$linksS7$dlinks_S9processor__1']['_X4nextS9$mgd_link_Y13__tE_generic___1']['_X10terminatorPv_1'] != 0x0 301 302 status = 'Idle' if midle or end else 'Active' 335 status = in_stats 303 336 else: 304 337 stop_count = processor['_X10terminatedS9semaphore_1']['_X5counti_1'] … … 336 369 return 337 370 338 procs = all_processors()339 340 371 print('{:>20} {:>11} {:<7} {}'.format('Processor', '', 'Pending', 'Object')) 341 372 print('{:>20} {:>11} {:<7} {}'.format('Name', 'Status', 'Yield', 'Address')) 342 cl = None 343 for p in procs: 344 # if this is a different cluster print it 345 if cl != p['_X4cltrPS7cluster_1']: 346 if cl: 347 print() 348 cl = p['_X4cltrPS7cluster_1'] 349 print('Cluster {}'.format(cl['_X4namePKc_1'].string())) 350 373 for c in clusters: 374 print('Cluster {}'.format(c['_X4namePKc_1'].string())) 375 376 active, idle = proc_list(c) 351 377 # print the processor information 352 self.print_processor(p) 378 for p in active: 379 self.print_processor(p, 'Active') 380 381 for p in idle: 382 self.print_processor(p, 'Idle') 383 384 print() 353 385 354 386 print() … … 433 465 cluster = lookup_cluster(arg) 434 466 if not cluster: 435 print(" Could not find cluster '{}'".format(arg))467 print("No matching cluster") 436 468 return 437 469
Note: See TracChangeset
for help on using the changeset viewer.