Changeset d28524a


Ignore:
Timestamp:
Jun 23, 2022, 1:41:39 PM (3 months ago)
Author:
caparsons <caparson@…>
Branches:
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
14 edited

Legend:

Unmodified
Added
Removed
  • libcfa/configure.ac

    r4e83bb7 rd28524a  
    181181AH_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.])
    182182AH_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.])
     183AH_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.])
    183184AH_TEMPLATE([CFA_HAVE_PREADV2],[Defined if preadv2 support is present when compiling libcfathread.])
    184185AH_TEMPLATE([CFA_HAVE_PWRITEV2],[Defined if pwritev2 support is present when compiling libcfathread.])
     
    189190
    190191define(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])
     192define(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])
    192193
    193194define(ioring_from_decls, [
  • libcfa/src/concurrency/ready_subqueue.hfa

    r4e83bb7 rd28524a  
    4949        // Get the relevant nodes locally
    5050        this.prev->link.next = node;
    51         this.prev->link.ts   = rdtscl();
     51        __atomic_store_n(&this.prev->link.ts, rdtscl(), __ATOMIC_RELAXED);
    5252        this.prev = node;
    5353        #if !defined(__CFA_NO_STATISTICS__)
  • src/AST/Pass.impl.hpp

    r4e83bb7 rd28524a  
    648648        if ( __visit_children() ) {
    649649                // unlike structs, traits, and unions, enums inject their members into the global scope
     650                maybe_accept( node, &EnumDecl::base );
    650651                maybe_accept( node, &EnumDecl::params     );
    651652                maybe_accept( node, &EnumDecl::members    );
  • src/Common/ResolvProtoDump.cpp

    r4e83bb7 rd28524a  
    227227        }
    228228
    229         void previsit( const ast::EnumInstType * enumInst) {
     229        void previsit( const ast::EnumInstType * ) {
    230230                // TODO: Add the meaningful text representation of typed enum
    231231                ss << (int)ast::BasicType::SignedInt;
  • src/GenPoly/GenPoly.cc

    r4e83bb7 rd28524a  
    6464                }
    6565
    66                 __attribute__((ununsed))
     66                __attribute__((unused))
    6767                bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const TyVarMap & tyVars, const ast::TypeSubstitution * env) {
    6868                        for (auto &param : params) {
  • src/InitTweak/GenInit.cc

    r4e83bb7 rd28524a  
    642642
    643643ast::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
    645645        // constructable object
    646646        InitExpander_new srcParam{ objDecl->init }, nullParam{ (const ast::Init *)nullptr };
    647647        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(
    650650                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,
    653653                SymTab::LoopBackward );
    654        
     654
    655655        // check that either both ctor and dtor are present, or neither
    656656        assert( (bool)ctor == (bool)dtor );
    657657
    658658        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
    660660                // use ctor expression instead of init.
    661                 ctor.strict_as< ast::ImplicitCtorDtorStmt >(); 
     661                ctor.strict_as< ast::ImplicitCtorDtorStmt >();
    662662                dtor.strict_as< ast::ImplicitCtorDtorStmt >();
    663663
  • src/Parser/lex.ll

    r4e83bb7 rd28524a  
    8282// Stop warning due to incorrectly generated flex code.
    8383#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"
    8487%}
    8588
  • src/Parser/parser.yy

    r4e83bb7 rd28524a  
    5656
    5757#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"
    5861
    5962extern DeclarationNode * parseTree;
     
    12401243                {
    12411244                        $$ = 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, "" );
    12431246                }
    12441247        | WHILE '(' conditional_declaration ')' statement       %prec THEN
     
    12511254                {
    12521255                        $$ = 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, "" );
    12541257                }
    12551258        | DO statement WHILE '(' comma_expression ')' ';'
     
    12621265                {
    12631266                        $$ = 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, "" );
    12651268                }
    12661269        | FOR '(' for_control_expression_list ')' statement     %prec THEN
     
    23942397        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}'
    23952398                {
    2396                         if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) 
     2399                        if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 )
    23972400                        { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); }
    23982401
     
    28412844                        linkage = LinkageSpec::update( yylloc, linkage, $2 );
    28422845                }
    2843           up external_definition down 
     2846          up external_definition down
    28442847                {
    28452848                        linkage = linkageStack.top();
  • src/ResolvExpr/CurrentObject.cc

    r4e83bb7 rd28524a  
    7373                virtual void setPosition( std::list< Expression * > & designators ) = 0;
    7474
    75                 /// retrieve the list of possible Type/Designaton pairs for the current position in the currect object
     75                /// retrieve the list of possible Type/Designation pairs for the current position in the currect object
    7676                virtual std::list<InitAlternative> operator*() const = 0;
    7777
  • src/SymTab/Mangler.cc

    r4e83bb7 rd28524a  
    537537                }
    538538
     539                __attribute__((unused))
    539540                inline std::vector< ast::ptr< ast::Type > > getTypes( const std::vector< ast::ptr< ast::DeclWithType > > & decls ) {
    540541                        std::vector< ast::ptr< ast::Type > > ret;
  • src/SymTab/ValidateType.cc

    r4e83bb7 rd28524a  
    222222        // visit enum members first so that the types of self-referencing members are updated properly
    223223        // 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                        }
    229236                }
    230237        }
     238       
    231239        if ( enumDecl->body ) {
    232240                ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->name );
  • src/SynTree/Type.h

    r4e83bb7 rd28524a  
    274274class PointerType : public Type {
    275275  public:
    276         Type *base;
     276        Type * base;
    277277
    278278        // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] )
     
    516516        typedef ReferenceToType Parent;
    517517  public:
    518         // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,
    519         // where the union used in this type is actually defined
     518        // 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
    520520        EnumDecl *baseEnum = nullptr;
    521521
  • tests/pybin/tools.py

    r4e83bb7 rd28524a  
    4646
    4747                        print(cmd)
    48                         return 0, None
     48                        return 0, None, None
    4949
    5050                with contextlib.ExitStack() as onexit:
     
    291291################################################################################
    292292def 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)
    294294        if make_ret != 0:
    295295                print("ERROR: cannot find Makefile jobserver version", file=sys.stderr)
  • tools/gdb/utils-gdb.py

    r4e83bb7 rd28524a  
    8989        return argv
    9090
    91 def get_cluster_root():
    92         """
    93         Return: gdb.Value of globalClusters.root (is an address)
    94         """
     91class 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
     116def 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
    95124        cluster_root = gdb.parse_and_eval('_X11mainClusterPS7cluster_1')
    96125        if cluster_root.address == 0x0:
    97126                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
     131class 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
     170def 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))
    128179
    129180def 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
    149192
    150193def tls_for_pthread(pthrd):
     
    160203
    161204def tls_for_proc(proc):
    162         return tls_for_pthread(proc['_X13kernel_threadm_1'])
     205        return proc['_X10local_dataPS16KernelThreadData_1']
    163206
    164207def thread_for_pthread(pthrd):
     
    180223def lookup_cluster(name = None):
    181224        """
    182         Look up a cluster given its ID
     225        Look up one or more cluster given a name
    183226        @name: str
    184227        Return: gdb.Value
     
    187230                return None
    188231
    189         root = get_cluster_root()
    190         if root.address == 0x0:
     232        clusters = all_clusters()
     233        if not clusters:
    191234                return None
    192235
    193236        if not name:
    194                 return root
     237                return clusters.root
    195238
    196239        # 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:
    208243                print("Cannot find a cluster with the name: {}.".format(name))
    209244                return None
    210245
    211         return cluster
     246        return found
     247
    212248
    213249def lookup_threads_by_cluster(cluster):
     
    294330                super(Processors, self).__init__('info processors', gdb.COMMAND_USER)
    295331
    296         def print_processor(self, processor):
     332        def print_processor(self, processor, in_stats):
    297333                should_stop = processor['_X12do_terminateVb_1']
    298334                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
    303336                else:
    304337                        stop_count  = processor['_X10terminatedS9semaphore_1']['_X5counti_1']
     
    336369                        return
    337370
    338                 procs = all_processors()
    339 
    340371                print('{:>20}  {:>11}  {:<7}  {}'.format('Processor', '', 'Pending', 'Object'))
    341372                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)
    351377                        # 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()
    353385
    354386                print()
     
    433465                        cluster = lookup_cluster(arg)
    434466                        if not cluster:
    435                                 print("Could not find cluster '{}'".format(arg))
     467                                print("No matching cluster")
    436468                                return
    437469
Note: See TracChangeset for help on using the changeset viewer.