Changeset cef7430


Ignore:
Timestamp:
Jan 28, 2022, 2:50:51 PM (23 months ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
3e5db5b4
Parents:
6b2d444 (diff), e21f253 (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:
4 added
14 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/io.cfa

    r6b2d444 rcef7430  
    306306                ctx->proc->io.pending = true;
    307307                ctx->proc->io.dirty   = true;
    308                 if(sq.to_submit > 30 || !lazy) {
     308                if(sq.to_submit > 30) {
     309                        __tls_stats()->io.flush.full++;
     310                        __cfa_io_flush( ctx->proc, 0 );
     311                }
     312                if(!lazy) {
     313                        __tls_stats()->io.flush.eager++;
    309314                        __cfa_io_flush( ctx->proc, 0 );
    310315                }
  • libcfa/src/concurrency/kernel.cfa

    r6b2d444 rcef7430  
    196196
    197197                        if( !readyThread ) {
     198                                __tls_stats()->io.flush.idle++;
    198199                                __cfa_io_flush( this, 0 );
    199200
     
    244245
    245246                        if(this->io.pending && !this->io.dirty) {
     247                                __tls_stats()->io.flush.dirty++;
    246248                                __cfa_io_flush( this, 0 );
    247249                        }
  • libcfa/src/concurrency/stats.cfa

    r6b2d444 rcef7430  
    4545                        stats->io.submit.slow       = 0;
    4646                        stats->io.flush.external    = 0;
     47                        stats->io.flush.dirty       = 0;
     48                        stats->io.flush.full        = 0;
     49                        stats->io.flush.idle        = 0;
     50                        stats->io.flush.eager       = 0;
    4751                        stats->io.calls.flush       = 0;
    4852                        stats->io.calls.submitted   = 0;
     
    107111                        tally_one( &cltr->io.submit.slow      , &proc->io.submit.slow       );
    108112                        tally_one( &cltr->io.flush.external   , &proc->io.flush.external    );
     113                        tally_one( &cltr->io.flush.dirty      , &proc->io.flush.dirty       );
     114                        tally_one( &cltr->io.flush.full       , &proc->io.flush.full        );
     115                        tally_one( &cltr->io.flush.idle       , &proc->io.flush.idle        );
     116                        tally_one( &cltr->io.flush.eager      , &proc->io.flush.eager       );
    109117                        tally_one( &cltr->io.calls.flush      , &proc->io.calls.flush       );
    110118                        tally_one( &cltr->io.calls.submitted  , &proc->io.calls.submitted   );
     
    184192                                if(io.alloc.fail || io.alloc.revoke || io.alloc.block)
    185193                                        sstr | "-     failures      : " | eng3(io.alloc.fail) | "oom, " | eng3(io.alloc.revoke) | "rvk, " | eng3(io.alloc.block) | "blk";
    186                                 if(io.flush.external)
    187                                         sstr | "- flush external    : " | eng3(io.flush.external);
     194                                // if(io.flush.external)
     195                                //      sstr | "- flush external    : " | eng3(io.flush.external);
    188196
    189197                                double avgsubs = ((double)io.calls.submitted) / io.calls.flush;
    190198                                double avgcomp = ((double)io.calls.completed) / io.calls.drain;
    191199                                sstr | "- syscll : "
    192                                      |   " sub " | eng3(io.calls.flush) | "/" | eng3(io.calls.submitted) | "(" | ws(3, 3, avgsubs) | "/flush)"
    193                                      | " - cmp " | eng3(io.calls.drain) | "/" | eng3(io.calls.completed) | "(" | ws(3, 3, avgcomp) | "/drain)"
     200                                     |   " sub " | eng3(io.calls.submitted) | "/" | eng3(io.calls.flush) | "(" | ws(3, 3, avgsubs) | "/flush)"
     201                                     | " - cmp " | eng3(io.calls.completed) | "/" | eng3(io.calls.drain) | "(" | ws(3, 3, avgcomp) | "/drain)"
    194202                                     | " - " | eng3(io.calls.errors.busy) | " EBUSY";
     203                                sstr | " - sub: " | eng3(io.flush.full) | "full, " | eng3(io.flush.dirty) | "drty, " | eng3(io.flush.idle) | "idle, " | eng3(io.flush.eager) | "eagr, " | eng3(io.flush.external) | "ext";
    195204                                sstr | "- ops blk: "
    196205                                     |   " sk rd: " | eng3(io.ops.sockread)  | "epll: " | eng3(io.ops.epllread)
  • libcfa/src/concurrency/stats.hfa

    r6b2d444 rcef7430  
    9191                        struct {
    9292                                volatile uint64_t external;
     93                                volatile uint64_t dirty;
     94                                volatile uint64_t full;
     95                                volatile uint64_t idle;
     96                                volatile uint64_t eager;
    9397                        } flush;
    9498                        struct {
  • src/AST/Copy.hpp

    r6b2d444 rcef7430  
    1010// Created On       : Wed Jul 10 16:13:00 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Nov 11  9:22:00 2021
    13 // Update Count     : 2
     12// Last Modified On : Wed Dec 15 11:07:00 2021
     13// Update Count     : 3
    1414//
    1515
     
    5252Node * deepCopy<Node>( const Node * localRoot );
    5353
     54template<typename node_t, enum Node::ref_type ref_t>
     55node_t * shallowCopy( const ptr_base<node_t, ref_t> & localRoot ) {
     56        return shallowCopy( localRoot.get() );
     57}
     58
     59template<typename node_t, enum Node::ref_type ref_t>
     60node_t * deepCopy( const ptr_base<node_t, ref_t> & localRoot ) {
     61        return deepCopy( localRoot.get() );
     62}
     63
    5464}
    5565
  • src/AST/Node.hpp

    r6b2d444 rcef7430  
    188188        }
    189189
     190        ptr_base & operator=( const node_t * node ) {
     191                assign( node );
     192                return *this;
     193        }
     194
    190195        template<typename o_node_t>
    191196        ptr_base & operator=( const o_node_t * node ) {
  • src/AST/Pass.impl.hpp

    r6b2d444 rcef7430  
    3333        /* call the implementation of the previsit of this pass */ \
    3434        __pass::previsit( core, node, 0 );
    35 
    36 #define VISIT( code... ) \
    37         /* if this node should visit its children */ \
    38         if ( __visit_children() ) { \
    39                 /* visit the children */ \
    40                 code \
    41         }
    4235
    4336#define VISIT_END( type, node ) \
     
    452445        VISIT_START( node );
    453446
    454         VISIT(
     447        if ( __visit_children() ) {
    455448                {
    456449                        guard_symtab guard { *this };
     
    460453                maybe_accept( node, &ObjectDecl::bitfieldWidth );
    461454                maybe_accept( node, &ObjectDecl::attributes    );
    462         )
     455        }
    463456
    464457        __pass::symtab::addId( core, 0, node );
     
    475468        __pass::symtab::addId( core, 0, node );
    476469
    477         VISIT(maybe_accept( node, &FunctionDecl::withExprs );)
     470        if ( __visit_children() ) {
     471                maybe_accept( node, &FunctionDecl::withExprs );
     472        }
    478473        {
    479474                // with clause introduces a level of scope (for the with expression members).
     
    493488                        } };
    494489                        __pass::symtab::addId( core, 0, func );
    495                         VISIT(
     490                        if ( __visit_children() ) {
    496491                                // parameter declarations
    497492                                maybe_accept( node, &FunctionDecl::params );
     
    509504                                maybe_accept( node, &FunctionDecl::stmts );
    510505                                maybe_accept( node, &FunctionDecl::attributes );
    511                         )
     506                        }
    512507                }
    513508        }
     
    526521        __pass::symtab::addStructFwd( core, 0, node );
    527522
    528         VISIT({
     523        if ( __visit_children() ) {
    529524                guard_symtab guard { * this };
    530525                maybe_accept( node, &StructDecl::params     );
    531526                maybe_accept( node, &StructDecl::members    );
    532527                maybe_accept( node, &StructDecl::attributes );
    533         })
     528        }
    534529
    535530        // this addition replaces the forward declaration
     
    548543        __pass::symtab::addUnionFwd( core, 0, node );
    549544
    550         VISIT({
     545        if ( __visit_children() ) {
    551546                guard_symtab guard { * this };
    552547                maybe_accept( node, &UnionDecl::params     );
    553548                maybe_accept( node, &UnionDecl::members    );
    554549                maybe_accept( node, &UnionDecl::attributes );
    555         })
     550        }
    556551
    557552        __pass::symtab::addUnion( core, 0, node );
     
    568563        __pass::symtab::addEnum( core, 0, node );
    569564
    570         VISIT(
     565        if ( __visit_children() ) {
    571566                // unlike structs, traits, and unions, enums inject their members into the global scope
    572567                maybe_accept( node, &EnumDecl::params     );
    573568                maybe_accept( node, &EnumDecl::members    );
    574569                maybe_accept( node, &EnumDecl::attributes );
    575         )
     570        }
    576571
    577572        VISIT_END( Decl, node );
     
    584579        VISIT_START( node );
    585580
    586         VISIT({
     581        if ( __visit_children() ) {
    587582                guard_symtab guard { *this };
    588583                maybe_accept( node, &TraitDecl::params     );
    589584                maybe_accept( node, &TraitDecl::members    );
    590585                maybe_accept( node, &TraitDecl::attributes );
    591         })
     586        }
    592587
    593588        __pass::symtab::addTrait( core, 0, node );
     
    602597        VISIT_START( node );
    603598
    604         VISIT({
     599        if ( __visit_children() ) {
    605600                guard_symtab guard { *this };
    606601                maybe_accept( node, &TypeDecl::base   );
    607         })
     602        }
    608603
    609604        // see A NOTE ON THE ORDER OF TRAVERSAL, above
     
    612607        __pass::symtab::addType( core, 0, node );
    613608
    614         VISIT(
     609        if ( __visit_children() ) {
    615610                maybe_accept( node, &TypeDecl::assertions );
    616611
     
    619614                        maybe_accept( node, &TypeDecl::init );
    620615                }
    621         )
     616        }
    622617
    623618        VISIT_END( Decl, node );
     
    630625        VISIT_START( node );
    631626
    632         VISIT({
     627        if ( __visit_children() ) {
    633628                guard_symtab guard { *this };
    634629                maybe_accept( node, &TypedefDecl::base   );
    635         })
     630        }
    636631
    637632        __pass::symtab::addType( core, 0, node );
    638633
    639         VISIT( maybe_accept( node, &TypedefDecl::assertions ); )
     634        if ( __visit_children() ) {
     635                maybe_accept( node, &TypedefDecl::assertions );
     636        }
    640637
    641638        VISIT_END( Decl, node );
     
    648645        VISIT_START( node );
    649646
    650         VISIT(
     647        if ( __visit_children() ) {
    651648                maybe_accept( node, &AsmDecl::stmt );
    652         )
     649        }
    653650
    654651        VISIT_END( AsmDecl, node );
     
    661658        VISIT_START( node );
    662659
    663         VISIT(
     660        if ( __visit_children() ) {
    664661                maybe_accept( node, &DirectiveDecl::stmt );
    665         )
     662        }
    666663
    667664        VISIT_END( DirectiveDecl, node );
     
    674671        VISIT_START( node );
    675672
    676         VISIT(
     673        if ( __visit_children() ) {
    677674                maybe_accept( node, &StaticAssertDecl::cond );
    678675                maybe_accept( node, &StaticAssertDecl::msg  );
    679         )
     676        }
    680677
    681678        VISIT_END( StaticAssertDecl, node );
     
    687684const ast::CompoundStmt * ast::Pass< core_t >::visit( const ast::CompoundStmt * node ) {
    688685        VISIT_START( node );
    689         VISIT(
     686
     687        if ( __visit_children() ) {
    690688                // Do not enter (or leave) a new scope if atFunctionTop. Remember to save the result.
    691689                auto guard1 = makeFuncGuard( [this, enterScope = !this->atFunctionTop]() {
     
    704702                guard_scope guard3 { *this };
    705703                maybe_accept( node, &CompoundStmt::kids );
    706         )
     704        }
     705
    707706        VISIT_END( CompoundStmt, node );
    708707}
     
    714713        VISIT_START( node );
    715714
    716         VISIT(
     715        if ( __visit_children() ) {
    717716                maybe_accept( node, &ExprStmt::expr );
    718         )
     717        }
    719718
    720719        VISIT_END( Stmt, node );
     
    727726        VISIT_START( node )
    728727
    729         VISIT(
     728        if ( __visit_children() ) {
    730729                maybe_accept( node, &AsmStmt::instruction );
    731730                maybe_accept( node, &AsmStmt::output      );
    732731                maybe_accept( node, &AsmStmt::input       );
    733732                maybe_accept( node, &AsmStmt::clobber     );
    734         )
     733        }
    735734
    736735        VISIT_END( Stmt, node );
     
    752751        VISIT_START( node );
    753752
    754         VISIT({
     753        if ( __visit_children() ) {
    755754                // if statements introduce a level of scope (for the initialization)
    756755                guard_symtab guard { *this };
     
    759758                maybe_accept_as_compound( node, &IfStmt::thenPart );
    760759                maybe_accept_as_compound( node, &IfStmt::elsePart );
    761         })
     760        }
    762761
    763762        VISIT_END( Stmt, node );
     
    770769        VISIT_START( node );
    771770
    772         VISIT({
     771        if ( __visit_children() ) {
    773772                // while statements introduce a level of scope (for the initialization)
    774773                guard_symtab guard { *this };
     
    776775                maybe_accept( node, &WhileStmt::cond  );
    777776                maybe_accept_as_compound( node, &WhileStmt::body  );
    778         })
     777        }
    779778
    780779        VISIT_END( Stmt, node );
     
    787786        VISIT_START( node );
    788787
    789         VISIT({
     788        if ( __visit_children() ) {
    790789                // for statements introduce a level of scope (for the initialization)
    791790                guard_symtab guard { *this };
     
    795794                maybe_accept( node, &ForStmt::inc   );
    796795                maybe_accept_as_compound( node, &ForStmt::body  );
    797         })
     796        }
    798797
    799798        VISIT_END( Stmt, node );
     
    806805        VISIT_START( node );
    807806
    808         VISIT(
     807        if ( __visit_children() ) {
    809808                maybe_accept( node, &SwitchStmt::cond  );
    810809                maybe_accept( node, &SwitchStmt::stmts );
    811         )
     810        }
    812811
    813812        VISIT_END( Stmt, node );
     
    820819        VISIT_START( node );
    821820
    822         VISIT(
     821        if ( __visit_children() ) {
    823822                maybe_accept( node, &CaseStmt::cond  );
    824823                maybe_accept( node, &CaseStmt::stmts );
    825         )
     824        }
    826825
    827826        VISIT_END( Stmt, node );
     
    842841        VISIT_START( node );
    843842
    844         VISIT(
     843        if ( __visit_children() ) {
    845844                maybe_accept( node, &ReturnStmt::expr );
    846         )
     845        }
    847846
    848847        VISIT_END( Stmt, node );
     
    855854        VISIT_START( node );
    856855
    857         VISIT(
     856        if ( __visit_children() ) {
    858857                maybe_accept( node, &ThrowStmt::expr   );
    859858                maybe_accept( node, &ThrowStmt::target );
    860         )
     859        }
    861860
    862861        VISIT_END( Stmt, node );
     
    869868        VISIT_START( node );
    870869
    871         VISIT(
     870        if ( __visit_children() ) {
    872871                maybe_accept( node, &TryStmt::body     );
    873872                maybe_accept( node, &TryStmt::handlers );
    874873                maybe_accept( node, &TryStmt::finally  );
    875         )
     874        }
    876875
    877876        VISIT_END( Stmt, node );
     
    884883        VISIT_START( node );
    885884
    886         VISIT({
     885        if ( __visit_children() ) {
    887886                // catch statements introduce a level of scope (for the caught exception)
    888887                guard_symtab guard { *this };
     
    890889                maybe_accept( node, &CatchStmt::cond );
    891890                maybe_accept_as_compound( node, &CatchStmt::body );
    892         })
     891        }
    893892
    894893        VISIT_END( Stmt, node );
     
    901900        VISIT_START( node );
    902901
    903         VISIT(
     902        if ( __visit_children() ) {
    904903                maybe_accept( node, &FinallyStmt::body );
    905         )
     904        }
    906905
    907906        VISIT_END( Stmt, node );
     
    914913        VISIT_START( node );
    915914
    916         VISIT(
     915        if ( __visit_children() ) {
    917916                maybe_accept( node, &SuspendStmt::then   );
    918         )
     917        }
    919918
    920919        VISIT_END( Stmt, node );
     
    934933                // }
    935934
    936         VISIT({
     935        if ( __visit_children() ) {
    937936                std::vector<WaitForStmt::Clause> new_clauses;
    938937                new_clauses.reserve( node->clauses.size() );
     
    965964                        node = n;
    966965                }
    967         })
     966        }
    968967
    969968        #define maybe_accept(field) \
     
    977976                }
    978977
    979         VISIT(
     978        if ( __visit_children() ) {
    980979                maybe_accept( timeout.time );
    981980                maybe_accept( timeout.stmt );
     
    983982                maybe_accept( orElse.stmt  );
    984983                maybe_accept( orElse.cond  );
    985         )
     984        }
    986985
    987986        #undef maybe_accept
     
    996995        VISIT_START( node );
    997996
    998         VISIT(
     997        if ( __visit_children() ) {
    999998                maybe_accept( node, &WithStmt::exprs );
    1000999                {
     
    10041003                        maybe_accept( node, &WithStmt::stmt );
    10051004                }
    1006         )
     1005        }
     1006
    10071007        VISIT_END( Stmt, node );
    10081008}
     
    10221022        VISIT_START( node );
    10231023
    1024         VISIT(
     1024        if ( __visit_children() ) {
    10251025                maybe_accept( node, &DeclStmt::decl );
    1026         )
     1026        }
    10271027
    10281028        VISIT_END( Stmt, node );
     
    10371037        // For now this isn't visited, it is unclear if this causes problem
    10381038        // if all tests are known to pass, remove this code
    1039         VISIT(
     1039        if ( __visit_children() ) {
    10401040                maybe_accept( node, &ImplicitCtorDtorStmt::callStmt );
    1041         )
     1041        }
    10421042
    10431043        VISIT_END( Stmt, node );
     
    10501050        VISIT_START( node );
    10511051
     1052<<<<<<< HEAD
    10521053        VISIT(
    10531054                maybe_accept( node, &MutexStmt::mutexObjs );
     
    10591060                }
    10601061        )
     1062=======
     1063        if ( __visit_children() ) {
     1064                // mutex statements introduce a level of scope (for the initialization)
     1065                guard_symtab guard { *this };
     1066                maybe_accept( node, &MutexStmt::stmt );
     1067                maybe_accept( node, &MutexStmt::mutexObjs );
     1068        }
     1069>>>>>>> e21f2536b7495654ded040259b42b7e2325b8360
    10611070
    10621071        VISIT_END( Stmt, node );
     
    10691078        VISIT_START( node );
    10701079
    1071         VISIT(
     1080        if ( __visit_children() ) {
    10721081                {
    10731082                        guard_symtab guard { *this };
     
    10761085                maybe_accept( node, &ApplicationExpr::func );
    10771086                maybe_accept( node, &ApplicationExpr::args );
    1078         )
     1087        }
    10791088
    10801089        VISIT_END( Expr, node );
     
    10871096        VISIT_START( node );
    10881097
    1089         VISIT(
     1098        if ( __visit_children() ) {
    10901099                {
    10911100                        guard_symtab guard { *this };
     
    10941103
    10951104                maybe_accept( node, &UntypedExpr::args );
    1096         )
     1105        }
    10971106
    10981107        VISIT_END( Expr, node );
     
    11051114        VISIT_START( node );
    11061115
    1107         VISIT({
     1116        if ( __visit_children() ) {
    11081117                guard_symtab guard { *this };
    11091118                maybe_accept( node, &NameExpr::result );
    1110         })
     1119        }
    11111120
    11121121        VISIT_END( Expr, node );
     
    11191128        VISIT_START( node );
    11201129
    1121         VISIT({
     1130        if ( __visit_children() ) {
     1131                {
    11221132                        guard_symtab guard { *this };
    11231133                        maybe_accept( node, &CastExpr::result );
    11241134                }
    11251135                maybe_accept( node, &CastExpr::arg );
    1126         )
     1136        }
    11271137
    11281138        VISIT_END( Expr, node );
     
    11351145        VISIT_START( node );
    11361146
    1137         VISIT({
     1147        if ( __visit_children() ) {
     1148                {
    11381149                        guard_symtab guard { *this };
    11391150                        maybe_accept( node, &KeywordCastExpr::result );
    11401151                }
    11411152                maybe_accept( node, &KeywordCastExpr::arg );
    1142         )
     1153        }
    11431154
    11441155        VISIT_END( Expr, node );
     
    11511162        VISIT_START( node );
    11521163
    1153         VISIT({
     1164        if ( __visit_children() ) {
     1165                {
    11541166                        guard_symtab guard { *this };
    11551167                        maybe_accept( node, &VirtualCastExpr::result );
    11561168                }
    11571169                maybe_accept( node, &VirtualCastExpr::arg );
    1158         )
     1170        }
    11591171
    11601172        VISIT_END( Expr, node );
     
    11671179        VISIT_START( node );
    11681180
    1169         VISIT({
     1181        if ( __visit_children() ) {
     1182                {
    11701183                        guard_symtab guard { *this };
    11711184                        maybe_accept( node, &AddressExpr::result );
    11721185                }
    11731186                maybe_accept( node, &AddressExpr::arg );
    1174         )
     1187        }
    11751188
    11761189        VISIT_END( Expr, node );
     
    11831196        VISIT_START( node );
    11841197
    1185         VISIT({
     1198        if ( __visit_children() ) {
    11861199                guard_symtab guard { *this };
    11871200                maybe_accept( node, &LabelAddressExpr::result );
    1188         })
     1201        }
    11891202
    11901203        VISIT_END( Expr, node );
     
    11971210        VISIT_START( node );
    11981211
    1199         VISIT({
     1212        if ( __visit_children() ) {
     1213                {
    12001214                        guard_symtab guard { *this };
    12011215                        maybe_accept( node, &UntypedMemberExpr::result );
     
    12031217                maybe_accept( node, &UntypedMemberExpr::aggregate );
    12041218                maybe_accept( node, &UntypedMemberExpr::member    );
    1205         )
     1219        }
    12061220
    12071221        VISIT_END( Expr, node );
     
    12141228        VISIT_START( node );
    12151229
    1216         VISIT({
     1230        if ( __visit_children() ) {
     1231                {
    12171232                        guard_symtab guard { *this };
    12181233                        maybe_accept( node, &MemberExpr::result );
    12191234                }
    12201235                maybe_accept( node, &MemberExpr::aggregate );
    1221         )
     1236        }
    12221237
    12231238        VISIT_END( Expr, node );
     
    12301245        VISIT_START( node );
    12311246
    1232         VISIT({
     1247        if ( __visit_children() ) {
    12331248                guard_symtab guard { *this };
    12341249                maybe_accept( node, &VariableExpr::result );
    1235         })
     1250        }
    12361251
    12371252        VISIT_END( Expr, node );
     
    12441259        VISIT_START( node );
    12451260
    1246         VISIT({
     1261        if ( __visit_children() ) {
    12471262                guard_symtab guard { *this };
    12481263                maybe_accept( node, &ConstantExpr::result );
    1249         })
     1264        }
    12501265
    12511266        VISIT_END( Expr, node );
     
    12581273        VISIT_START( node );
    12591274
    1260         VISIT({
     1275        if ( __visit_children() ) {
     1276                {
    12611277                        guard_symtab guard { *this };
    12621278                        maybe_accept( node, &SizeofExpr::result );
     
    12671283                        maybe_accept( node, &SizeofExpr::expr );
    12681284                }
    1269         )
     1285        }
    12701286
    12711287        VISIT_END( Expr, node );
     
    12781294        VISIT_START( node );
    12791295
    1280         VISIT({
     1296        if ( __visit_children() ) {
     1297                {
    12811298                        guard_symtab guard { *this };
    12821299                        maybe_accept( node, &AlignofExpr::result );
     
    12871304                        maybe_accept( node, &AlignofExpr::expr );
    12881305                }
    1289         )
     1306        }
    12901307
    12911308        VISIT_END( Expr, node );
     
    12981315        VISIT_START( node );
    12991316
    1300         VISIT({
     1317        if ( __visit_children() ) {
     1318                {
    13011319                        guard_symtab guard { *this };
    13021320                        maybe_accept( node, &UntypedOffsetofExpr::result );
    13031321                }
    13041322                maybe_accept( node, &UntypedOffsetofExpr::type   );
    1305         )
     1323        }
    13061324
    13071325        VISIT_END( Expr, node );
     
    13141332        VISIT_START( node );
    13151333
    1316         VISIT({
     1334        if ( __visit_children() ) {
     1335                {
    13171336                        guard_symtab guard { *this };
    13181337                        maybe_accept( node, &OffsetofExpr::result );
    13191338                }
    13201339                maybe_accept( node, &OffsetofExpr::type   );
    1321         )
     1340        }
    13221341
    13231342        VISIT_END( Expr, node );
     
    13301349        VISIT_START( node );
    13311350
    1332         VISIT({
     1351        if ( __visit_children() ) {
     1352                {
    13331353                        guard_symtab guard { *this };
    13341354                        maybe_accept( node, &OffsetPackExpr::result );
    13351355                }
    13361356                maybe_accept( node, &OffsetPackExpr::type   );
    1337         )
     1357        }
    13381358
    13391359        VISIT_END( Expr, node );
     
    13461366        VISIT_START( node );
    13471367
    1348         VISIT({
     1368        if ( __visit_children() ) {
     1369                {
    13491370                        guard_symtab guard { *this };
    13501371                        maybe_accept( node, &LogicalExpr::result );
     
    13521373                maybe_accept( node, &LogicalExpr::arg1 );
    13531374                maybe_accept( node, &LogicalExpr::arg2 );
    1354         )
     1375        }
    13551376
    13561377        VISIT_END( Expr, node );
     
    13631384        VISIT_START( node );
    13641385
    1365         VISIT({
     1386        if ( __visit_children() ) {
     1387                {
    13661388                        guard_symtab guard { *this };
    13671389                        maybe_accept( node, &ConditionalExpr::result );
     
    13701392                maybe_accept( node, &ConditionalExpr::arg2 );
    13711393                maybe_accept( node, &ConditionalExpr::arg3 );
    1372         )
     1394        }
    13731395
    13741396        VISIT_END( Expr, node );
     
    13811403        VISIT_START( node );
    13821404
    1383         VISIT({
     1405        if ( __visit_children() ) {
     1406                {
    13841407                        guard_symtab guard { *this };
    13851408                        maybe_accept( node, &CommaExpr::result );
     
    13871410                maybe_accept( node, &CommaExpr::arg1 );
    13881411                maybe_accept( node, &CommaExpr::arg2 );
    1389         )
     1412        }
    13901413
    13911414        VISIT_END( Expr, node );
     
    13981421        VISIT_START( node );
    13991422
    1400         VISIT({
     1423        if ( __visit_children() ) {
     1424                {
    14011425                        guard_symtab guard { *this };
    14021426                        maybe_accept( node, &TypeExpr::result );
    14031427                }
    14041428                maybe_accept( node, &TypeExpr::type );
    1405         )
     1429        }
    14061430
    14071431        VISIT_END( Expr, node );
     
    14141438        VISIT_START( node );
    14151439
    1416         VISIT({
     1440        if ( __visit_children() ) {
     1441                {
    14171442                        guard_symtab guard { *this };
    14181443                        maybe_accept( node, &AsmExpr::result );
     
    14201445                maybe_accept( node, &AsmExpr::constraint );
    14211446                maybe_accept( node, &AsmExpr::operand    );
    1422         )
     1447        }
    14231448
    14241449        VISIT_END( Expr, node );
     
    14311456        VISIT_START( node );
    14321457
    1433         VISIT({
     1458        if ( __visit_children() ) {
     1459                {
    14341460                        guard_symtab guard { *this };
    14351461                        maybe_accept( node, &ImplicitCopyCtorExpr::result );
    14361462                }
    14371463                maybe_accept( node, &ImplicitCopyCtorExpr::callExpr    );
    1438         )
     1464        }
    14391465
    14401466        VISIT_END( Expr, node );
     
    14471473        VISIT_START( node );
    14481474
    1449         VISIT({
     1475        if ( __visit_children() ) {
     1476                {
    14501477                        guard_symtab guard { *this };
    14511478                        maybe_accept( node, &ConstructorExpr::result );
    14521479                }
    14531480                maybe_accept( node, &ConstructorExpr::callExpr );
    1454         )
     1481        }
    14551482
    14561483        VISIT_END( Expr, node );
     
    14631490        VISIT_START( node );
    14641491
    1465         VISIT({
     1492        if ( __visit_children() ) {
     1493                {
    14661494                        guard_symtab guard { *this };
    14671495                        maybe_accept( node, &CompoundLiteralExpr::result );
    14681496                }
    14691497                maybe_accept( node, &CompoundLiteralExpr::init );
    1470         )
     1498        }
    14711499
    14721500        VISIT_END( Expr, node );
     
    14791507        VISIT_START( node );
    14801508
    1481         VISIT({
     1509        if ( __visit_children() ) {
     1510                {
    14821511                        guard_symtab guard { *this };
    14831512                        maybe_accept( node, &RangeExpr::result );
     
    14851514                maybe_accept( node, &RangeExpr::low    );
    14861515                maybe_accept( node, &RangeExpr::high   );
    1487         )
     1516        }
    14881517
    14891518        VISIT_END( Expr, node );
     
    14961525        VISIT_START( node );
    14971526
    1498         VISIT({
     1527        if ( __visit_children() ) {
     1528                {
    14991529                        guard_symtab guard { *this };
    15001530                        maybe_accept( node, &UntypedTupleExpr::result );
    15011531                }
    15021532                maybe_accept( node, &UntypedTupleExpr::exprs  );
    1503         )
     1533        }
    15041534
    15051535        VISIT_END( Expr, node );
     
    15121542        VISIT_START( node );
    15131543
    1514         VISIT({
     1544        if ( __visit_children() ) {
     1545                {
    15151546                        guard_symtab guard { *this };
    15161547                        maybe_accept( node, &TupleExpr::result );
    15171548                }
    15181549                maybe_accept( node, &TupleExpr::exprs  );
    1519         )
     1550        }
    15201551
    15211552        VISIT_END( Expr, node );
     
    15281559        VISIT_START( node );
    15291560
    1530         VISIT({
     1561        if ( __visit_children() ) {
     1562                {
    15311563                        guard_symtab guard { *this };
    15321564                        maybe_accept( node, &TupleIndexExpr::result );
    15331565                }
    15341566                maybe_accept( node, &TupleIndexExpr::tuple  );
    1535         )
     1567        }
    15361568
    15371569        VISIT_END( Expr, node );
     
    15441576        VISIT_START( node );
    15451577
    1546         VISIT({
     1578        if ( __visit_children() ) {
     1579                {
    15471580                        guard_symtab guard { *this };
    15481581                        maybe_accept( node, &TupleAssignExpr::result );
    15491582                }
    15501583                maybe_accept( node, &TupleAssignExpr::stmtExpr );
    1551         )
     1584        }
    15521585
    15531586        VISIT_END( Expr, node );
     
    15601593        VISIT_START( node );
    15611594
    1562         VISIT(// don't want statements from outer CompoundStmts to be added to this StmtExpr
     1595        if ( __visit_children() ) {
     1596                // don't want statements from outer CompoundStmts to be added to this StmtExpr
    15631597                // get the stmts that will need to be spliced in
    15641598                auto stmts_before = __pass::stmtsToAddBefore( core, 0);
     
    15771611                maybe_accept( node, &StmtExpr::returnDecls );
    15781612                maybe_accept( node, &StmtExpr::dtors       );
    1579         )
     1613        }
    15801614
    15811615        VISIT_END( Expr, node );
     
    15881622        VISIT_START( node );
    15891623
    1590         VISIT({
     1624        if ( __visit_children() ) {
     1625                {
    15911626                        guard_symtab guard { *this };
    15921627                        maybe_accept( node, &UniqueExpr::result );
    15931628                }
    15941629                maybe_accept( node, &UniqueExpr::expr   );
    1595         )
     1630        }
    15961631
    15971632        VISIT_END( Expr, node );
     
    16041639        VISIT_START( node );
    16051640
    1606         VISIT({
     1641        if ( __visit_children() ) {
     1642                {
    16071643                        guard_symtab guard { *this };
    16081644                        maybe_accept( node, &UntypedInitExpr::result );
     
    16101646                maybe_accept( node, &UntypedInitExpr::expr   );
    16111647                // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver.
    1612         )
     1648        }
    16131649
    16141650        VISIT_END( Expr, node );
     
    16211657        VISIT_START( node );
    16221658
    1623         VISIT({
     1659        if ( __visit_children() ) {
     1660                {
    16241661                        guard_symtab guard { *this };
    16251662                        maybe_accept( node, &InitExpr::result );
     
    16271664                maybe_accept( node, &InitExpr::expr   );
    16281665                maybe_accept( node, &InitExpr::designation );
    1629         )
     1666        }
    16301667
    16311668        VISIT_END( Expr, node );
     
    16381675        VISIT_START( node );
    16391676
    1640         VISIT({
     1677        if ( __visit_children() ) {
     1678                {
    16411679                        guard_symtab guard { *this };
    16421680                        maybe_accept( node, &DeletedExpr::result );
     
    16441682                maybe_accept( node, &DeletedExpr::expr );
    16451683                // don't visit deleteStmt, because it is a pointer to somewhere else in the tree.
    1646         )
     1684        }
    16471685
    16481686        VISIT_END( Expr, node );
     
    16551693        VISIT_START( node );
    16561694
    1657         VISIT({
     1695        if ( __visit_children() ) {
     1696                {
    16581697                        guard_symtab guard { *this };
    16591698                        maybe_accept( node, &DefaultArgExpr::result );
    16601699                }
    16611700                maybe_accept( node, &DefaultArgExpr::expr );
    1662         )
     1701        }
    16631702
    16641703        VISIT_END( Expr, node );
     
    16711710        VISIT_START( node );
    16721711
    1673         VISIT({
     1712        if ( __visit_children() ) {
     1713                {
    16741714                        guard_symtab guard { *this };
    16751715                        maybe_accept( node, &GenericExpr::result );
     
    17001740                        node = n;
    17011741                }
    1702         )
     1742        }
    17031743
    17041744        VISIT_END( Expr, node );
     
    17291769        VISIT_START( node );
    17301770
    1731         VISIT(
     1771        if ( __visit_children() ) {
    17321772                // xxx - should PointerType visit/mutate dimension?
    17331773                maybe_accept( node, &PointerType::base );
    1734         )
     1774        }
    17351775
    17361776        VISIT_END( Type, node );
     
    17431783        VISIT_START( node );
    17441784
    1745         VISIT(
     1785        if ( __visit_children() ) {
    17461786                maybe_accept( node, &ArrayType::dimension );
    17471787                maybe_accept( node, &ArrayType::base );
    1748         )
     1788        }
    17491789
    17501790        VISIT_END( Type, node );
     
    17571797        VISIT_START( node );
    17581798
    1759         VISIT(
     1799        if ( __visit_children() ) {
    17601800                maybe_accept( node, &ReferenceType::base );
    1761         )
     1801        }
    17621802
    17631803        VISIT_END( Type, node );
     
    17701810        VISIT_START( node );
    17711811
    1772         VISIT(
     1812        if ( __visit_children() ) {
    17731813                maybe_accept( node, &QualifiedType::parent );
    17741814                maybe_accept( node, &QualifiedType::child );
    1775         )
     1815        }
    17761816
    17771817        VISIT_END( Type, node );
     
    17841824        VISIT_START( node );
    17851825
    1786         VISIT({
     1826        if ( __visit_children() ) {
    17871827                // guard_forall_subs forall_guard { *this, node };
    17881828                // mutate_forall( node );
     
    17901830                maybe_accept( node, &FunctionType::returns );
    17911831                maybe_accept( node, &FunctionType::params  );
    1792         })
     1832        }
    17931833
    17941834        VISIT_END( Type, node );
     
    18031843        __pass::symtab::addStruct( core, 0, node->name );
    18041844
    1805         VISIT({
     1845        if ( __visit_children() ) {
    18061846                guard_symtab guard { *this };
    18071847                maybe_accept( node, &StructInstType::params );
    1808         })
     1848        }
    18091849
    18101850        VISIT_END( Type, node );
     
    18191859        __pass::symtab::addUnion( core, 0, node->name );
    18201860
    1821         VISIT({
     1861        if ( __visit_children() ) {
    18221862                guard_symtab guard { *this };
    18231863                maybe_accept( node, &UnionInstType::params );
    1824         })
     1864        }
    18251865
    18261866        VISIT_END( Type, node );
     
    18331873        VISIT_START( node );
    18341874
    1835         VISIT({
     1875        if ( __visit_children() ) {
    18361876                maybe_accept( node, &EnumInstType::params );
    1837         })
     1877        }
    18381878
    18391879        VISIT_END( Type, node );
     
    18461886        VISIT_START( node );
    18471887
    1848         VISIT({
     1888        if ( __visit_children() ) {
    18491889                maybe_accept( node, &TraitInstType::params );
    1850         })
     1890        }
    18511891
    18521892        VISIT_END( Type, node );
     
    18591899        VISIT_START( node );
    18601900
    1861         VISIT(
     1901        if ( __visit_children() ) {
    18621902                {
    18631903                        maybe_accept( node, &TypeInstType::params );
     
    18651905                // ensure that base re-bound if doing substitution
    18661906                __pass::forall::replace( core, 0, node );
    1867         )
     1907        }
    18681908
    18691909        VISIT_END( Type, node );
     
    18761916        VISIT_START( node );
    18771917
    1878         VISIT(
     1918        if ( __visit_children() ) {
    18791919                maybe_accept( node, &TupleType::types );
    18801920                maybe_accept( node, &TupleType::members );
    1881         )
     1921        }
    18821922
    18831923        VISIT_END( Type, node );
     
    18901930        VISIT_START( node );
    18911931
    1892         VISIT(
     1932        if ( __visit_children() ) {
    18931933                maybe_accept( node, &TypeofType::expr );
    1894         )
     1934        }
    18951935
    18961936        VISIT_END( Type, node );
     
    19031943        VISIT_START( node );
    19041944
    1905         VISIT(
     1945        if ( __visit_children() ) {
    19061946                maybe_accept( node, &VTableType::base );
    1907         )
     1947        }
    19081948
    19091949        VISIT_END( Type, node );
     
    19531993        VISIT_START( node );
    19541994
    1955         VISIT( maybe_accept( node, &Designation::designators ); )
     1995        if ( __visit_children() ) {
     1996                maybe_accept( node, &Designation::designators );
     1997        }
    19561998
    19571999        VISIT_END( Designation, node );
     
    19642006        VISIT_START( node );
    19652007
    1966         VISIT(
     2008        if ( __visit_children() ) {
    19672009                maybe_accept( node, &SingleInit::value );
    1968         )
     2010        }
    19692011
    19702012        VISIT_END( Init, node );
     
    19772019        VISIT_START( node );
    19782020
    1979         VISIT(
     2021        if ( __visit_children() ) {
    19802022                maybe_accept( node, &ListInit::designations );
    19812023                maybe_accept( node, &ListInit::initializers );
    1982         )
     2024        }
    19832025
    19842026        VISIT_END( Init, node );
     
    19912033        VISIT_START( node );
    19922034
    1993         VISIT(
     2035        if ( __visit_children() ) {
    19942036                maybe_accept( node, &ConstructorInit::ctor );
    19952037                maybe_accept( node, &ConstructorInit::dtor );
    19962038                maybe_accept( node, &ConstructorInit::init );
    1997         )
     2039        }
    19982040
    19992041        VISIT_END( Init, node );
     
    20062048        VISIT_START( node );
    20072049
    2008         VISIT(
     2050        if ( __visit_children() ) {
    20092051                maybe_accept( node, &Attribute::params );
    2010         )
     2052        }
    20112053
    20122054        VISIT_END( Attribute, node );
     
    20192061        VISIT_START( node );
    20202062
    2021         VISIT(
     2063        if ( __visit_children() ) {
    20222064                {
    20232065                        bool mutated = false;
     
    20352077                        }
    20362078                }
    2037         )
     2079        }
    20382080
    20392081        VISIT_END( TypeSubstitution, node );
     
    20412083
    20422084#undef VISIT_START
    2043 #undef VISIT
    20442085#undef VISIT_END
  • src/ControlStruct/module.mk

    r6b2d444 rcef7430  
    2222        ControlStruct/ForExprMutator.cc \
    2323        ControlStruct/ForExprMutator.h \
     24        ControlStruct/HoistControlDecls.cpp \
     25        ControlStruct/HoistControlDecls.hpp \
    2426        ControlStruct/LabelFixer.cc \
    2527        ControlStruct/LabelFixer.h \
  • src/InitTweak/InitTweak.cc

    r6b2d444 rcef7430  
    1010// Created On       : Fri May 13 11:26:36 2016
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Nov 19 19:22:00 2021
    13 // Update Count     : 19
     12// Last Modified On : Mon Dec  6 13:21:00 2021
     13// Update Count     : 20
    1414//
    1515
     
    11911191        }
    11921192
    1193         bool isCopyFunction( const ast::FunctionDecl * decl ) {
    1194                 const ast::FunctionType * ftype = decl->type;
    1195                 if ( ftype->params.size() != 2 ) return false;
    1196 
    1197                 const ast::Type * t1 = getPointerBase( ftype->params.front() );
    1198                 if ( ! t1 ) return false;
    1199                 const ast::Type * t2 = ftype->params.back();
    1200 
    1201                 return ResolvExpr::typesCompatibleIgnoreQualifiers( t1, t2, ast::SymbolTable{} );
    1202         }
     1193bool isAssignment( const ast::FunctionDecl * decl ) {
     1194        return isAssignment( decl->name ) && isCopyFunction( decl );
     1195}
     1196
     1197bool isDestructor( const ast::FunctionDecl * decl ) {
     1198        return isDestructor( decl->name );
     1199}
     1200
     1201bool isDefaultConstructor( const ast::FunctionDecl * decl ) {
     1202        return isConstructor( decl->name ) && 1 == decl->params.size();
     1203}
     1204
     1205bool isCopyConstructor( const ast::FunctionDecl * decl ) {
     1206        return isConstructor( decl->name ) && 2 == decl->params.size();
     1207}
     1208
     1209bool isCopyFunction( const ast::FunctionDecl * decl ) {
     1210        const ast::FunctionType * ftype = decl->type;
     1211        if ( ftype->params.size() != 2 ) return false;
     1212
     1213        const ast::Type * t1 = getPointerBase( ftype->params.front() );
     1214        if ( ! t1 ) return false;
     1215        const ast::Type * t2 = ftype->params.back();
     1216
     1217        return ResolvExpr::typesCompatibleIgnoreQualifiers( t1, t2, ast::SymbolTable{} );
     1218}
    12031219
    12041220        const FunctionDecl * isAssignment( const Declaration * decl ) {
  • src/InitTweak/InitTweak.h

    r6b2d444 rcef7430  
    1010// Created On       : Fri May 13 11:26:36 2016
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Nov 19 14:18:00 2021
    13 // Update Count     : 7
     12// Last Modified On : Mon Dec  6 13:20:00 2021
     13// Update Count     : 8
    1414//
    1515
     
    3131        const FunctionDecl * isCopyConstructor( const Declaration * decl );
    3232        const FunctionDecl * isCopyFunction( const Declaration * decl, const std::string & fname );
     33        bool isAssignment( const ast::FunctionDecl * decl );
     34        bool isDestructor( const ast::FunctionDecl * decl );
     35        bool isDefaultConstructor( const ast::FunctionDecl * decl );
     36        bool isCopyConstructor( const ast::FunctionDecl * decl );
    3337        bool isCopyFunction( const ast::FunctionDecl * decl );
    3438
  • src/SymTab/Validate.cc

    r6b2d444 rcef7430  
    453453        }
    454454
     455        void decayForallPointers( std::list< Declaration * > & translationUnit ) {
     456                PassVisitor<ForallPointerDecay_old> fpd;
     457                acceptAll( translationUnit, fpd );
     458        }
     459
    455460        void validate( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug ) {
    456461                validate_A( translationUnit );
     
    470475                type->accept( fpd );
    471476        }
    472 
    473477
    474478        void HoistTypeDecls::handleType( Type * type ) {
  • src/SymTab/Validate.h

    r6b2d444 rcef7430  
    4242        void validate_E( std::list< Declaration * > &translationUnit );
    4343        void validate_F( std::list< Declaration * > &translationUnit );
     44        void decayForallPointers( std::list< Declaration * > & translationUnit );
    4445
    4546        const ast::Type * validateType(
  • src/Validate/module.mk

    r6b2d444 rcef7430  
    1616
    1717SRC_VALIDATE = \
     18        Validate/Autogen.cpp \
     19        Validate/Autogen.hpp \
    1820        Validate/CompoundLiteral.cpp \
    1921        Validate/CompoundLiteral.hpp \
  • src/main.cc

    r6b2d444 rcef7430  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Tue Nov 30 10:25:00 2021
    13 // Update Count     : 659
     12// Last Modified On : Wed Jan 26 14:09:00 2022
     13// Update Count     : 670
    1414//
    1515
     
    5555#include "ControlStruct/ExceptTranslate.h"  // for translateEHM
    5656#include "ControlStruct/FixLabels.hpp"      // for fixLabels
     57#include "ControlStruct/HoistControlDecls.hpp" //  hoistControlDecls
    5758#include "ControlStruct/Mutate.h"           // for mutate
    5859#include "GenPoly/Box.h"                    // for box
     
    7374#include "SynTree/Visitor.h"                // for acceptAll
    7475#include "Tuples/Tuples.h"                  // for expandMemberTuples, expan...
     76#include "Validate/Autogen.hpp"             // for autogenerateRoutines
    7577#include "Validate/FindSpecialDecls.h"      // for findGlobalDecls
    7678#include "Validate/CompoundLiteral.hpp"     // for handleCompoundLiterals
     
    7880#include "Validate/LabelAddressFixer.hpp"   // for fixLabelAddresses
    7981#include "Virtual/ExpandCasts.h"            // for expandCasts
    80 
    8182
    8283static void NewPass( const char * const name ) {
     
    326327                PASS( "Validate-B", SymTab::validate_B( translationUnit ) );
    327328                PASS( "Validate-C", SymTab::validate_C( translationUnit ) );
    328                 PASS( "Validate-D", SymTab::validate_D( translationUnit ) );
    329329
    330330                CodeTools::fillLocations( translationUnit );
    331331
    332332                if( useNewAST ) {
     333                        PASS( "Apply Concurrent Keywords", Concurrency::applyKeywords( translationUnit ) );
     334                        PASS( "Forall Pointer Decay", SymTab::decayForallPointers( translationUnit ) );
     335                        CodeTools::fillLocations( translationUnit );
     336
    333337                        if (Stats::Counters::enabled) {
    334338                                ast::pass_visitor_stats.avg = Stats::Counters::build<Stats::Counters::AverageCounter<double>>("Average Depth - New");
     
    338342
    339343                        forceFillCodeLocations( transUnit );
     344
     345                        // Must happen before autogen routines are added.
     346                        PASS( "Hoist Control Declarations", ControlStruct::hoistControlDecls( transUnit ) );
     347
     348                        // Must be after enum and pointer decay.
     349                        // Must be before compound literals.
     350                        PASS( "Generate Autogen Routines", Validate::autogenerateRoutines( transUnit ) );
    340351
    341352                        PASS( "Implement Mutex", Concurrency::implementMutex( transUnit ) );
     
    406417                        translationUnit = convert( move( transUnit ) );
    407418                } else {
     419                        PASS( "Validate-D", SymTab::validate_D( translationUnit ) );
    408420                        PASS( "Validate-E", SymTab::validate_E( translationUnit ) );
    409421                        PASS( "Validate-F", SymTab::validate_F( translationUnit ) );
Note: See TracChangeset for help on using the changeset viewer.