Changes in / [d28524a:4e83bb7]


Ignore:
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • libcfa/configure.ac

    rd28524a r4e83bb7  
    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.])
    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.])
    184183AH_TEMPLATE([CFA_HAVE_PREADV2],[Defined if preadv2 support is present when compiling libcfathread.])
    185184AH_TEMPLATE([CFA_HAVE_PWRITEV2],[Defined if pwritev2 support is present when compiling libcfathread.])
     
    190189
    191190define(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])
    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])
     191define(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])
    193192
    194193define(ioring_from_decls, [
  • libcfa/src/concurrency/ready_subqueue.hfa

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

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

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

    rd28524a r4e83bb7  
    6464                }
    6565
    66                 __attribute__((unused))
     66                __attribute__((ununsed))
    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

    rd28524a r4e83bb7  
    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

    rd28524a r4e83bb7  
    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"
    8784%}
    8885
  • src/Parser/parser.yy

    rd28524a r4e83bb7  
    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"
    6158
    6259extern DeclarationNode * parseTree;
     
    12431240                {
    12441241                        $$ = new StatementNode( build_while( new CondCtl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) );
    1245                         SemanticWarning( yylloc, Warning::SuperfluousElse, "" );
     1242                        SemanticWarning( yylloc, Warning::SuperfluousElse );
    12461243                }
    12471244        | WHILE '(' conditional_declaration ')' statement       %prec THEN
     
    12541251                {
    12551252                        $$ = new StatementNode( build_do_while( new ExpressionNode( build_constantInteger( *new string( "1" ) ) ), maybe_build_compound( $2 ) ) );
    1256                         SemanticWarning( yylloc, Warning::SuperfluousElse, "" );
     1253                        SemanticWarning( yylloc, Warning::SuperfluousElse );
    12571254                }
    12581255        | DO statement WHILE '(' comma_expression ')' ';'
     
    12651262                {
    12661263                        $$ = new StatementNode( build_for( new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr ), maybe_build_compound( $4 ) ) );
    1267                         SemanticWarning( yylloc, Warning::SuperfluousElse, "" );
     1264                        SemanticWarning( yylloc, Warning::SuperfluousElse );
    12681265                }
    12691266        | FOR '(' for_control_expression_list ')' statement     %prec THEN
     
    23972394        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}'
    23982395                {
    2399                         if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 )
     2396                        if ( $3->storageClasses.val != 0 || $3->type->qualifiers.val != 0 ) 
    24002397                        { SemanticError( yylloc, "storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); }
    24012398
     
    28442841                        linkage = LinkageSpec::update( yylloc, linkage, $2 );
    28452842                }
    2846           up external_definition down
     2843          up external_definition down 
    28472844                {
    28482845                        linkage = linkageStack.top();
  • src/ResolvExpr/CurrentObject.cc

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

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

    rd28524a r4e83bb7  
    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 ) {
    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                         }
     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
    236229                }
    237230        }
    238        
    239231        if ( enumDecl->body ) {
    240232                ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->name );
  • src/SynTree/Type.h

    rd28524a r4e83bb7  
    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 enum inst; it is merely a pointer to elsewhere in the tree,
    519         // where the enum used in this type is actually defined
     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
    520520        EnumDecl *baseEnum = nullptr;
    521521
  • tests/pybin/tools.py

    rd28524a r4e83bb7  
    4646
    4747                        print(cmd)
    48                         return 0, None, None
     48                        return 0, None
    4949
    5050                with contextlib.ExitStack() as onexit:
     
    291291################################################################################
    292292def jobserver_version():
    293         make_ret, out, err = sh('make', '.test_makeflags', '-j2', ignore_dry_run = True, output_file=subprocess.PIPE, error=subprocess.PIPE)
     293        make_ret, out, err = sh('make', '.test_makeflags', '-j2', 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

    rd28524a r4e83bb7  
    8989        return argv
    9090
    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 
     91def get_cluster_root():
     92        """
     93        Return: gdb.Value of globalClusters.root (is an address)
     94        """
    12495        cluster_root = gdb.parse_and_eval('_X11mainClusterPS7cluster_1')
    12596        if cluster_root.address == 0x0:
    12697                print('No clusters, program terminated')
    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         """
     98        return cluster_root
     99
     100def 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
     109def 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
     128
     129def all_processors():
     130        if not is_cforall():
     131                return None
     132
    174133        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))
    179 
    180 def all_processors():
    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
     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'])
    192149
    193150def tls_for_pthread(pthrd):
     
    203160
    204161def tls_for_proc(proc):
    205         return proc['_X10local_dataPS16KernelThreadData_1']
     162        return tls_for_pthread(proc['_X13kernel_threadm_1'])
    206163
    207164def thread_for_pthread(pthrd):
     
    223180def lookup_cluster(name = None):
    224181        """
    225         Look up one or more cluster given a name
     182        Look up a cluster given its ID
    226183        @name: str
    227184        Return: gdb.Value
     
    230187                return None
    231188
    232         clusters = all_clusters()
    233         if not clusters:
     189        root = get_cluster_root()
     190        if root.address == 0x0:
    234191                return None
    235192
    236193        if not name:
    237                 return clusters.root
     194                return root
    238195
    239196        # lookup for the task associated with the id
    240         found = [c for c in clusters if c['_X4namePKc_1'].string() == name]
    241 
    242         if not found:
     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:
    243208                print("Cannot find a cluster with the name: {}.".format(name))
    244209                return None
    245210
    246         return found
    247 
     211        return cluster
    248212
    249213def lookup_threads_by_cluster(cluster):
     
    330294                super(Processors, self).__init__('info processors', gdb.COMMAND_USER)
    331295
    332         def print_processor(self, processor, in_stats):
     296        def print_processor(self, processor):
    333297                should_stop = processor['_X12do_terminateVb_1']
    334298                if not should_stop:
    335                         status = in_stats
     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'
    336303                else:
    337304                        stop_count  = processor['_X10terminatedS9semaphore_1']['_X5counti_1']
     
    369336                        return
    370337
     338                procs = all_processors()
     339
    371340                print('{:>20}  {:>11}  {:<7}  {}'.format('Processor', '', 'Pending', 'Object'))
    372341                print('{:>20}  {:>11}  {:<7}  {}'.format('Name', 'Status', 'Yield', 'Address'))
    373                 for c in clusters:
    374                         print('Cluster {}'.format(c['_X4namePKc_1'].string()))
    375 
    376                         active, idle = proc_list(c)
     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
    377351                        # print the processor information
    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()
     352                        self.print_processor(p)
    385353
    386354                print()
     
    465433                        cluster = lookup_cluster(arg)
    466434                        if not cluster:
    467                                 print("No matching cluster")
     435                                print("Could not find cluster '{}'".format(arg))
    468436                                return
    469437
Note: See TracChangeset for help on using the changeset viewer.