Changeset cef7430
- Timestamp:
- Jan 28, 2022, 2:50:51 PM (23 months ago)
- 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. - Files:
-
- 4 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r6b2d444 rcef7430 306 306 ctx->proc->io.pending = true; 307 307 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++; 309 314 __cfa_io_flush( ctx->proc, 0 ); 310 315 } -
libcfa/src/concurrency/kernel.cfa
r6b2d444 rcef7430 196 196 197 197 if( !readyThread ) { 198 __tls_stats()->io.flush.idle++; 198 199 __cfa_io_flush( this, 0 ); 199 200 … … 244 245 245 246 if(this->io.pending && !this->io.dirty) { 247 __tls_stats()->io.flush.dirty++; 246 248 __cfa_io_flush( this, 0 ); 247 249 } -
libcfa/src/concurrency/stats.cfa
r6b2d444 rcef7430 45 45 stats->io.submit.slow = 0; 46 46 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; 47 51 stats->io.calls.flush = 0; 48 52 stats->io.calls.submitted = 0; … … 107 111 tally_one( &cltr->io.submit.slow , &proc->io.submit.slow ); 108 112 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 ); 109 117 tally_one( &cltr->io.calls.flush , &proc->io.calls.flush ); 110 118 tally_one( &cltr->io.calls.submitted , &proc->io.calls.submitted ); … … 184 192 if(io.alloc.fail || io.alloc.revoke || io.alloc.block) 185 193 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); 188 196 189 197 double avgsubs = ((double)io.calls.submitted) / io.calls.flush; 190 198 double avgcomp = ((double)io.calls.completed) / io.calls.drain; 191 199 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)" 194 202 | " - " | 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"; 195 204 sstr | "- ops blk: " 196 205 | " sk rd: " | eng3(io.ops.sockread) | "epll: " | eng3(io.ops.epllread) -
libcfa/src/concurrency/stats.hfa
r6b2d444 rcef7430 91 91 struct { 92 92 volatile uint64_t external; 93 volatile uint64_t dirty; 94 volatile uint64_t full; 95 volatile uint64_t idle; 96 volatile uint64_t eager; 93 97 } flush; 94 98 struct { -
src/AST/Copy.hpp
r6b2d444 rcef7430 10 10 // Created On : Wed Jul 10 16:13:00 2019 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Nov 11 9:22:00 202113 // Update Count : 212 // Last Modified On : Wed Dec 15 11:07:00 2021 13 // Update Count : 3 14 14 // 15 15 … … 52 52 Node * deepCopy<Node>( const Node * localRoot ); 53 53 54 template<typename node_t, enum Node::ref_type ref_t> 55 node_t * shallowCopy( const ptr_base<node_t, ref_t> & localRoot ) { 56 return shallowCopy( localRoot.get() ); 57 } 58 59 template<typename node_t, enum Node::ref_type ref_t> 60 node_t * deepCopy( const ptr_base<node_t, ref_t> & localRoot ) { 61 return deepCopy( localRoot.get() ); 62 } 63 54 64 } 55 65 -
src/AST/Node.hpp
r6b2d444 rcef7430 188 188 } 189 189 190 ptr_base & operator=( const node_t * node ) { 191 assign( node ); 192 return *this; 193 } 194 190 195 template<typename o_node_t> 191 196 ptr_base & operator=( const o_node_t * node ) { -
src/AST/Pass.impl.hpp
r6b2d444 rcef7430 33 33 /* call the implementation of the previsit of this pass */ \ 34 34 __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 }42 35 43 36 #define VISIT_END( type, node ) \ … … 452 445 VISIT_START( node ); 453 446 454 VISIT(447 if ( __visit_children() ) { 455 448 { 456 449 guard_symtab guard { *this }; … … 460 453 maybe_accept( node, &ObjectDecl::bitfieldWidth ); 461 454 maybe_accept( node, &ObjectDecl::attributes ); 462 )455 } 463 456 464 457 __pass::symtab::addId( core, 0, node ); … … 475 468 __pass::symtab::addId( core, 0, node ); 476 469 477 VISIT(maybe_accept( node, &FunctionDecl::withExprs );) 470 if ( __visit_children() ) { 471 maybe_accept( node, &FunctionDecl::withExprs ); 472 } 478 473 { 479 474 // with clause introduces a level of scope (for the with expression members). … … 493 488 } }; 494 489 __pass::symtab::addId( core, 0, func ); 495 VISIT(490 if ( __visit_children() ) { 496 491 // parameter declarations 497 492 maybe_accept( node, &FunctionDecl::params ); … … 509 504 maybe_accept( node, &FunctionDecl::stmts ); 510 505 maybe_accept( node, &FunctionDecl::attributes ); 511 )506 } 512 507 } 513 508 } … … 526 521 __pass::symtab::addStructFwd( core, 0, node ); 527 522 528 VISIT({523 if ( __visit_children() ) { 529 524 guard_symtab guard { * this }; 530 525 maybe_accept( node, &StructDecl::params ); 531 526 maybe_accept( node, &StructDecl::members ); 532 527 maybe_accept( node, &StructDecl::attributes ); 533 } )528 } 534 529 535 530 // this addition replaces the forward declaration … … 548 543 __pass::symtab::addUnionFwd( core, 0, node ); 549 544 550 VISIT({545 if ( __visit_children() ) { 551 546 guard_symtab guard { * this }; 552 547 maybe_accept( node, &UnionDecl::params ); 553 548 maybe_accept( node, &UnionDecl::members ); 554 549 maybe_accept( node, &UnionDecl::attributes ); 555 } )550 } 556 551 557 552 __pass::symtab::addUnion( core, 0, node ); … … 568 563 __pass::symtab::addEnum( core, 0, node ); 569 564 570 VISIT(565 if ( __visit_children() ) { 571 566 // unlike structs, traits, and unions, enums inject their members into the global scope 572 567 maybe_accept( node, &EnumDecl::params ); 573 568 maybe_accept( node, &EnumDecl::members ); 574 569 maybe_accept( node, &EnumDecl::attributes ); 575 )570 } 576 571 577 572 VISIT_END( Decl, node ); … … 584 579 VISIT_START( node ); 585 580 586 VISIT({581 if ( __visit_children() ) { 587 582 guard_symtab guard { *this }; 588 583 maybe_accept( node, &TraitDecl::params ); 589 584 maybe_accept( node, &TraitDecl::members ); 590 585 maybe_accept( node, &TraitDecl::attributes ); 591 } )586 } 592 587 593 588 __pass::symtab::addTrait( core, 0, node ); … … 602 597 VISIT_START( node ); 603 598 604 VISIT({599 if ( __visit_children() ) { 605 600 guard_symtab guard { *this }; 606 601 maybe_accept( node, &TypeDecl::base ); 607 } )602 } 608 603 609 604 // see A NOTE ON THE ORDER OF TRAVERSAL, above … … 612 607 __pass::symtab::addType( core, 0, node ); 613 608 614 VISIT(609 if ( __visit_children() ) { 615 610 maybe_accept( node, &TypeDecl::assertions ); 616 611 … … 619 614 maybe_accept( node, &TypeDecl::init ); 620 615 } 621 )616 } 622 617 623 618 VISIT_END( Decl, node ); … … 630 625 VISIT_START( node ); 631 626 632 VISIT({627 if ( __visit_children() ) { 633 628 guard_symtab guard { *this }; 634 629 maybe_accept( node, &TypedefDecl::base ); 635 } )630 } 636 631 637 632 __pass::symtab::addType( core, 0, node ); 638 633 639 VISIT( maybe_accept( node, &TypedefDecl::assertions ); ) 634 if ( __visit_children() ) { 635 maybe_accept( node, &TypedefDecl::assertions ); 636 } 640 637 641 638 VISIT_END( Decl, node ); … … 648 645 VISIT_START( node ); 649 646 650 VISIT(647 if ( __visit_children() ) { 651 648 maybe_accept( node, &AsmDecl::stmt ); 652 )649 } 653 650 654 651 VISIT_END( AsmDecl, node ); … … 661 658 VISIT_START( node ); 662 659 663 VISIT(660 if ( __visit_children() ) { 664 661 maybe_accept( node, &DirectiveDecl::stmt ); 665 )662 } 666 663 667 664 VISIT_END( DirectiveDecl, node ); … … 674 671 VISIT_START( node ); 675 672 676 VISIT(673 if ( __visit_children() ) { 677 674 maybe_accept( node, &StaticAssertDecl::cond ); 678 675 maybe_accept( node, &StaticAssertDecl::msg ); 679 )676 } 680 677 681 678 VISIT_END( StaticAssertDecl, node ); … … 687 684 const ast::CompoundStmt * ast::Pass< core_t >::visit( const ast::CompoundStmt * node ) { 688 685 VISIT_START( node ); 689 VISIT( 686 687 if ( __visit_children() ) { 690 688 // Do not enter (or leave) a new scope if atFunctionTop. Remember to save the result. 691 689 auto guard1 = makeFuncGuard( [this, enterScope = !this->atFunctionTop]() { … … 704 702 guard_scope guard3 { *this }; 705 703 maybe_accept( node, &CompoundStmt::kids ); 706 ) 704 } 705 707 706 VISIT_END( CompoundStmt, node ); 708 707 } … … 714 713 VISIT_START( node ); 715 714 716 VISIT(715 if ( __visit_children() ) { 717 716 maybe_accept( node, &ExprStmt::expr ); 718 )717 } 719 718 720 719 VISIT_END( Stmt, node ); … … 727 726 VISIT_START( node ) 728 727 729 VISIT(728 if ( __visit_children() ) { 730 729 maybe_accept( node, &AsmStmt::instruction ); 731 730 maybe_accept( node, &AsmStmt::output ); 732 731 maybe_accept( node, &AsmStmt::input ); 733 732 maybe_accept( node, &AsmStmt::clobber ); 734 )733 } 735 734 736 735 VISIT_END( Stmt, node ); … … 752 751 VISIT_START( node ); 753 752 754 VISIT({753 if ( __visit_children() ) { 755 754 // if statements introduce a level of scope (for the initialization) 756 755 guard_symtab guard { *this }; … … 759 758 maybe_accept_as_compound( node, &IfStmt::thenPart ); 760 759 maybe_accept_as_compound( node, &IfStmt::elsePart ); 761 } )760 } 762 761 763 762 VISIT_END( Stmt, node ); … … 770 769 VISIT_START( node ); 771 770 772 VISIT({771 if ( __visit_children() ) { 773 772 // while statements introduce a level of scope (for the initialization) 774 773 guard_symtab guard { *this }; … … 776 775 maybe_accept( node, &WhileStmt::cond ); 777 776 maybe_accept_as_compound( node, &WhileStmt::body ); 778 } )777 } 779 778 780 779 VISIT_END( Stmt, node ); … … 787 786 VISIT_START( node ); 788 787 789 VISIT({788 if ( __visit_children() ) { 790 789 // for statements introduce a level of scope (for the initialization) 791 790 guard_symtab guard { *this }; … … 795 794 maybe_accept( node, &ForStmt::inc ); 796 795 maybe_accept_as_compound( node, &ForStmt::body ); 797 } )796 } 798 797 799 798 VISIT_END( Stmt, node ); … … 806 805 VISIT_START( node ); 807 806 808 VISIT(807 if ( __visit_children() ) { 809 808 maybe_accept( node, &SwitchStmt::cond ); 810 809 maybe_accept( node, &SwitchStmt::stmts ); 811 )810 } 812 811 813 812 VISIT_END( Stmt, node ); … … 820 819 VISIT_START( node ); 821 820 822 VISIT(821 if ( __visit_children() ) { 823 822 maybe_accept( node, &CaseStmt::cond ); 824 823 maybe_accept( node, &CaseStmt::stmts ); 825 )824 } 826 825 827 826 VISIT_END( Stmt, node ); … … 842 841 VISIT_START( node ); 843 842 844 VISIT(843 if ( __visit_children() ) { 845 844 maybe_accept( node, &ReturnStmt::expr ); 846 )845 } 847 846 848 847 VISIT_END( Stmt, node ); … … 855 854 VISIT_START( node ); 856 855 857 VISIT(856 if ( __visit_children() ) { 858 857 maybe_accept( node, &ThrowStmt::expr ); 859 858 maybe_accept( node, &ThrowStmt::target ); 860 )859 } 861 860 862 861 VISIT_END( Stmt, node ); … … 869 868 VISIT_START( node ); 870 869 871 VISIT(870 if ( __visit_children() ) { 872 871 maybe_accept( node, &TryStmt::body ); 873 872 maybe_accept( node, &TryStmt::handlers ); 874 873 maybe_accept( node, &TryStmt::finally ); 875 )874 } 876 875 877 876 VISIT_END( Stmt, node ); … … 884 883 VISIT_START( node ); 885 884 886 VISIT({885 if ( __visit_children() ) { 887 886 // catch statements introduce a level of scope (for the caught exception) 888 887 guard_symtab guard { *this }; … … 890 889 maybe_accept( node, &CatchStmt::cond ); 891 890 maybe_accept_as_compound( node, &CatchStmt::body ); 892 } )891 } 893 892 894 893 VISIT_END( Stmt, node ); … … 901 900 VISIT_START( node ); 902 901 903 VISIT(902 if ( __visit_children() ) { 904 903 maybe_accept( node, &FinallyStmt::body ); 905 )904 } 906 905 907 906 VISIT_END( Stmt, node ); … … 914 913 VISIT_START( node ); 915 914 916 VISIT(915 if ( __visit_children() ) { 917 916 maybe_accept( node, &SuspendStmt::then ); 918 )917 } 919 918 920 919 VISIT_END( Stmt, node ); … … 934 933 // } 935 934 936 VISIT({935 if ( __visit_children() ) { 937 936 std::vector<WaitForStmt::Clause> new_clauses; 938 937 new_clauses.reserve( node->clauses.size() ); … … 965 964 node = n; 966 965 } 967 } )966 } 968 967 969 968 #define maybe_accept(field) \ … … 977 976 } 978 977 979 VISIT(978 if ( __visit_children() ) { 980 979 maybe_accept( timeout.time ); 981 980 maybe_accept( timeout.stmt ); … … 983 982 maybe_accept( orElse.stmt ); 984 983 maybe_accept( orElse.cond ); 985 )984 } 986 985 987 986 #undef maybe_accept … … 996 995 VISIT_START( node ); 997 996 998 VISIT(997 if ( __visit_children() ) { 999 998 maybe_accept( node, &WithStmt::exprs ); 1000 999 { … … 1004 1003 maybe_accept( node, &WithStmt::stmt ); 1005 1004 } 1006 ) 1005 } 1006 1007 1007 VISIT_END( Stmt, node ); 1008 1008 } … … 1022 1022 VISIT_START( node ); 1023 1023 1024 VISIT(1024 if ( __visit_children() ) { 1025 1025 maybe_accept( node, &DeclStmt::decl ); 1026 )1026 } 1027 1027 1028 1028 VISIT_END( Stmt, node ); … … 1037 1037 // For now this isn't visited, it is unclear if this causes problem 1038 1038 // if all tests are known to pass, remove this code 1039 VISIT(1039 if ( __visit_children() ) { 1040 1040 maybe_accept( node, &ImplicitCtorDtorStmt::callStmt ); 1041 )1041 } 1042 1042 1043 1043 VISIT_END( Stmt, node ); … … 1050 1050 VISIT_START( node ); 1051 1051 1052 <<<<<<< HEAD 1052 1053 VISIT( 1053 1054 maybe_accept( node, &MutexStmt::mutexObjs ); … … 1059 1060 } 1060 1061 ) 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 1061 1070 1062 1071 VISIT_END( Stmt, node ); … … 1069 1078 VISIT_START( node ); 1070 1079 1071 VISIT(1080 if ( __visit_children() ) { 1072 1081 { 1073 1082 guard_symtab guard { *this }; … … 1076 1085 maybe_accept( node, &ApplicationExpr::func ); 1077 1086 maybe_accept( node, &ApplicationExpr::args ); 1078 )1087 } 1079 1088 1080 1089 VISIT_END( Expr, node ); … … 1087 1096 VISIT_START( node ); 1088 1097 1089 VISIT(1098 if ( __visit_children() ) { 1090 1099 { 1091 1100 guard_symtab guard { *this }; … … 1094 1103 1095 1104 maybe_accept( node, &UntypedExpr::args ); 1096 )1105 } 1097 1106 1098 1107 VISIT_END( Expr, node ); … … 1105 1114 VISIT_START( node ); 1106 1115 1107 VISIT({1116 if ( __visit_children() ) { 1108 1117 guard_symtab guard { *this }; 1109 1118 maybe_accept( node, &NameExpr::result ); 1110 } )1119 } 1111 1120 1112 1121 VISIT_END( Expr, node ); … … 1119 1128 VISIT_START( node ); 1120 1129 1121 VISIT({ 1130 if ( __visit_children() ) { 1131 { 1122 1132 guard_symtab guard { *this }; 1123 1133 maybe_accept( node, &CastExpr::result ); 1124 1134 } 1125 1135 maybe_accept( node, &CastExpr::arg ); 1126 )1136 } 1127 1137 1128 1138 VISIT_END( Expr, node ); … … 1135 1145 VISIT_START( node ); 1136 1146 1137 VISIT({ 1147 if ( __visit_children() ) { 1148 { 1138 1149 guard_symtab guard { *this }; 1139 1150 maybe_accept( node, &KeywordCastExpr::result ); 1140 1151 } 1141 1152 maybe_accept( node, &KeywordCastExpr::arg ); 1142 )1153 } 1143 1154 1144 1155 VISIT_END( Expr, node ); … … 1151 1162 VISIT_START( node ); 1152 1163 1153 VISIT({ 1164 if ( __visit_children() ) { 1165 { 1154 1166 guard_symtab guard { *this }; 1155 1167 maybe_accept( node, &VirtualCastExpr::result ); 1156 1168 } 1157 1169 maybe_accept( node, &VirtualCastExpr::arg ); 1158 )1170 } 1159 1171 1160 1172 VISIT_END( Expr, node ); … … 1167 1179 VISIT_START( node ); 1168 1180 1169 VISIT({ 1181 if ( __visit_children() ) { 1182 { 1170 1183 guard_symtab guard { *this }; 1171 1184 maybe_accept( node, &AddressExpr::result ); 1172 1185 } 1173 1186 maybe_accept( node, &AddressExpr::arg ); 1174 )1187 } 1175 1188 1176 1189 VISIT_END( Expr, node ); … … 1183 1196 VISIT_START( node ); 1184 1197 1185 VISIT({1198 if ( __visit_children() ) { 1186 1199 guard_symtab guard { *this }; 1187 1200 maybe_accept( node, &LabelAddressExpr::result ); 1188 } )1201 } 1189 1202 1190 1203 VISIT_END( Expr, node ); … … 1197 1210 VISIT_START( node ); 1198 1211 1199 VISIT({ 1212 if ( __visit_children() ) { 1213 { 1200 1214 guard_symtab guard { *this }; 1201 1215 maybe_accept( node, &UntypedMemberExpr::result ); … … 1203 1217 maybe_accept( node, &UntypedMemberExpr::aggregate ); 1204 1218 maybe_accept( node, &UntypedMemberExpr::member ); 1205 )1219 } 1206 1220 1207 1221 VISIT_END( Expr, node ); … … 1214 1228 VISIT_START( node ); 1215 1229 1216 VISIT({ 1230 if ( __visit_children() ) { 1231 { 1217 1232 guard_symtab guard { *this }; 1218 1233 maybe_accept( node, &MemberExpr::result ); 1219 1234 } 1220 1235 maybe_accept( node, &MemberExpr::aggregate ); 1221 )1236 } 1222 1237 1223 1238 VISIT_END( Expr, node ); … … 1230 1245 VISIT_START( node ); 1231 1246 1232 VISIT({1247 if ( __visit_children() ) { 1233 1248 guard_symtab guard { *this }; 1234 1249 maybe_accept( node, &VariableExpr::result ); 1235 } )1250 } 1236 1251 1237 1252 VISIT_END( Expr, node ); … … 1244 1259 VISIT_START( node ); 1245 1260 1246 VISIT({1261 if ( __visit_children() ) { 1247 1262 guard_symtab guard { *this }; 1248 1263 maybe_accept( node, &ConstantExpr::result ); 1249 } )1264 } 1250 1265 1251 1266 VISIT_END( Expr, node ); … … 1258 1273 VISIT_START( node ); 1259 1274 1260 VISIT({ 1275 if ( __visit_children() ) { 1276 { 1261 1277 guard_symtab guard { *this }; 1262 1278 maybe_accept( node, &SizeofExpr::result ); … … 1267 1283 maybe_accept( node, &SizeofExpr::expr ); 1268 1284 } 1269 )1285 } 1270 1286 1271 1287 VISIT_END( Expr, node ); … … 1278 1294 VISIT_START( node ); 1279 1295 1280 VISIT({ 1296 if ( __visit_children() ) { 1297 { 1281 1298 guard_symtab guard { *this }; 1282 1299 maybe_accept( node, &AlignofExpr::result ); … … 1287 1304 maybe_accept( node, &AlignofExpr::expr ); 1288 1305 } 1289 )1306 } 1290 1307 1291 1308 VISIT_END( Expr, node ); … … 1298 1315 VISIT_START( node ); 1299 1316 1300 VISIT({ 1317 if ( __visit_children() ) { 1318 { 1301 1319 guard_symtab guard { *this }; 1302 1320 maybe_accept( node, &UntypedOffsetofExpr::result ); 1303 1321 } 1304 1322 maybe_accept( node, &UntypedOffsetofExpr::type ); 1305 )1323 } 1306 1324 1307 1325 VISIT_END( Expr, node ); … … 1314 1332 VISIT_START( node ); 1315 1333 1316 VISIT({ 1334 if ( __visit_children() ) { 1335 { 1317 1336 guard_symtab guard { *this }; 1318 1337 maybe_accept( node, &OffsetofExpr::result ); 1319 1338 } 1320 1339 maybe_accept( node, &OffsetofExpr::type ); 1321 )1340 } 1322 1341 1323 1342 VISIT_END( Expr, node ); … … 1330 1349 VISIT_START( node ); 1331 1350 1332 VISIT({ 1351 if ( __visit_children() ) { 1352 { 1333 1353 guard_symtab guard { *this }; 1334 1354 maybe_accept( node, &OffsetPackExpr::result ); 1335 1355 } 1336 1356 maybe_accept( node, &OffsetPackExpr::type ); 1337 )1357 } 1338 1358 1339 1359 VISIT_END( Expr, node ); … … 1346 1366 VISIT_START( node ); 1347 1367 1348 VISIT({ 1368 if ( __visit_children() ) { 1369 { 1349 1370 guard_symtab guard { *this }; 1350 1371 maybe_accept( node, &LogicalExpr::result ); … … 1352 1373 maybe_accept( node, &LogicalExpr::arg1 ); 1353 1374 maybe_accept( node, &LogicalExpr::arg2 ); 1354 )1375 } 1355 1376 1356 1377 VISIT_END( Expr, node ); … … 1363 1384 VISIT_START( node ); 1364 1385 1365 VISIT({ 1386 if ( __visit_children() ) { 1387 { 1366 1388 guard_symtab guard { *this }; 1367 1389 maybe_accept( node, &ConditionalExpr::result ); … … 1370 1392 maybe_accept( node, &ConditionalExpr::arg2 ); 1371 1393 maybe_accept( node, &ConditionalExpr::arg3 ); 1372 )1394 } 1373 1395 1374 1396 VISIT_END( Expr, node ); … … 1381 1403 VISIT_START( node ); 1382 1404 1383 VISIT({ 1405 if ( __visit_children() ) { 1406 { 1384 1407 guard_symtab guard { *this }; 1385 1408 maybe_accept( node, &CommaExpr::result ); … … 1387 1410 maybe_accept( node, &CommaExpr::arg1 ); 1388 1411 maybe_accept( node, &CommaExpr::arg2 ); 1389 )1412 } 1390 1413 1391 1414 VISIT_END( Expr, node ); … … 1398 1421 VISIT_START( node ); 1399 1422 1400 VISIT({ 1423 if ( __visit_children() ) { 1424 { 1401 1425 guard_symtab guard { *this }; 1402 1426 maybe_accept( node, &TypeExpr::result ); 1403 1427 } 1404 1428 maybe_accept( node, &TypeExpr::type ); 1405 )1429 } 1406 1430 1407 1431 VISIT_END( Expr, node ); … … 1414 1438 VISIT_START( node ); 1415 1439 1416 VISIT({ 1440 if ( __visit_children() ) { 1441 { 1417 1442 guard_symtab guard { *this }; 1418 1443 maybe_accept( node, &AsmExpr::result ); … … 1420 1445 maybe_accept( node, &AsmExpr::constraint ); 1421 1446 maybe_accept( node, &AsmExpr::operand ); 1422 )1447 } 1423 1448 1424 1449 VISIT_END( Expr, node ); … … 1431 1456 VISIT_START( node ); 1432 1457 1433 VISIT({ 1458 if ( __visit_children() ) { 1459 { 1434 1460 guard_symtab guard { *this }; 1435 1461 maybe_accept( node, &ImplicitCopyCtorExpr::result ); 1436 1462 } 1437 1463 maybe_accept( node, &ImplicitCopyCtorExpr::callExpr ); 1438 )1464 } 1439 1465 1440 1466 VISIT_END( Expr, node ); … … 1447 1473 VISIT_START( node ); 1448 1474 1449 VISIT({ 1475 if ( __visit_children() ) { 1476 { 1450 1477 guard_symtab guard { *this }; 1451 1478 maybe_accept( node, &ConstructorExpr::result ); 1452 1479 } 1453 1480 maybe_accept( node, &ConstructorExpr::callExpr ); 1454 )1481 } 1455 1482 1456 1483 VISIT_END( Expr, node ); … … 1463 1490 VISIT_START( node ); 1464 1491 1465 VISIT({ 1492 if ( __visit_children() ) { 1493 { 1466 1494 guard_symtab guard { *this }; 1467 1495 maybe_accept( node, &CompoundLiteralExpr::result ); 1468 1496 } 1469 1497 maybe_accept( node, &CompoundLiteralExpr::init ); 1470 )1498 } 1471 1499 1472 1500 VISIT_END( Expr, node ); … … 1479 1507 VISIT_START( node ); 1480 1508 1481 VISIT({ 1509 if ( __visit_children() ) { 1510 { 1482 1511 guard_symtab guard { *this }; 1483 1512 maybe_accept( node, &RangeExpr::result ); … … 1485 1514 maybe_accept( node, &RangeExpr::low ); 1486 1515 maybe_accept( node, &RangeExpr::high ); 1487 )1516 } 1488 1517 1489 1518 VISIT_END( Expr, node ); … … 1496 1525 VISIT_START( node ); 1497 1526 1498 VISIT({ 1527 if ( __visit_children() ) { 1528 { 1499 1529 guard_symtab guard { *this }; 1500 1530 maybe_accept( node, &UntypedTupleExpr::result ); 1501 1531 } 1502 1532 maybe_accept( node, &UntypedTupleExpr::exprs ); 1503 )1533 } 1504 1534 1505 1535 VISIT_END( Expr, node ); … … 1512 1542 VISIT_START( node ); 1513 1543 1514 VISIT({ 1544 if ( __visit_children() ) { 1545 { 1515 1546 guard_symtab guard { *this }; 1516 1547 maybe_accept( node, &TupleExpr::result ); 1517 1548 } 1518 1549 maybe_accept( node, &TupleExpr::exprs ); 1519 )1550 } 1520 1551 1521 1552 VISIT_END( Expr, node ); … … 1528 1559 VISIT_START( node ); 1529 1560 1530 VISIT({ 1561 if ( __visit_children() ) { 1562 { 1531 1563 guard_symtab guard { *this }; 1532 1564 maybe_accept( node, &TupleIndexExpr::result ); 1533 1565 } 1534 1566 maybe_accept( node, &TupleIndexExpr::tuple ); 1535 )1567 } 1536 1568 1537 1569 VISIT_END( Expr, node ); … … 1544 1576 VISIT_START( node ); 1545 1577 1546 VISIT({ 1578 if ( __visit_children() ) { 1579 { 1547 1580 guard_symtab guard { *this }; 1548 1581 maybe_accept( node, &TupleAssignExpr::result ); 1549 1582 } 1550 1583 maybe_accept( node, &TupleAssignExpr::stmtExpr ); 1551 )1584 } 1552 1585 1553 1586 VISIT_END( Expr, node ); … … 1560 1593 VISIT_START( node ); 1561 1594 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 1563 1597 // get the stmts that will need to be spliced in 1564 1598 auto stmts_before = __pass::stmtsToAddBefore( core, 0); … … 1577 1611 maybe_accept( node, &StmtExpr::returnDecls ); 1578 1612 maybe_accept( node, &StmtExpr::dtors ); 1579 )1613 } 1580 1614 1581 1615 VISIT_END( Expr, node ); … … 1588 1622 VISIT_START( node ); 1589 1623 1590 VISIT({ 1624 if ( __visit_children() ) { 1625 { 1591 1626 guard_symtab guard { *this }; 1592 1627 maybe_accept( node, &UniqueExpr::result ); 1593 1628 } 1594 1629 maybe_accept( node, &UniqueExpr::expr ); 1595 )1630 } 1596 1631 1597 1632 VISIT_END( Expr, node ); … … 1604 1639 VISIT_START( node ); 1605 1640 1606 VISIT({ 1641 if ( __visit_children() ) { 1642 { 1607 1643 guard_symtab guard { *this }; 1608 1644 maybe_accept( node, &UntypedInitExpr::result ); … … 1610 1646 maybe_accept( node, &UntypedInitExpr::expr ); 1611 1647 // not currently visiting initAlts, but this doesn't matter since this node is only used in the resolver. 1612 )1648 } 1613 1649 1614 1650 VISIT_END( Expr, node ); … … 1621 1657 VISIT_START( node ); 1622 1658 1623 VISIT({ 1659 if ( __visit_children() ) { 1660 { 1624 1661 guard_symtab guard { *this }; 1625 1662 maybe_accept( node, &InitExpr::result ); … … 1627 1664 maybe_accept( node, &InitExpr::expr ); 1628 1665 maybe_accept( node, &InitExpr::designation ); 1629 )1666 } 1630 1667 1631 1668 VISIT_END( Expr, node ); … … 1638 1675 VISIT_START( node ); 1639 1676 1640 VISIT({ 1677 if ( __visit_children() ) { 1678 { 1641 1679 guard_symtab guard { *this }; 1642 1680 maybe_accept( node, &DeletedExpr::result ); … … 1644 1682 maybe_accept( node, &DeletedExpr::expr ); 1645 1683 // don't visit deleteStmt, because it is a pointer to somewhere else in the tree. 1646 )1684 } 1647 1685 1648 1686 VISIT_END( Expr, node ); … … 1655 1693 VISIT_START( node ); 1656 1694 1657 VISIT({ 1695 if ( __visit_children() ) { 1696 { 1658 1697 guard_symtab guard { *this }; 1659 1698 maybe_accept( node, &DefaultArgExpr::result ); 1660 1699 } 1661 1700 maybe_accept( node, &DefaultArgExpr::expr ); 1662 )1701 } 1663 1702 1664 1703 VISIT_END( Expr, node ); … … 1671 1710 VISIT_START( node ); 1672 1711 1673 VISIT({ 1712 if ( __visit_children() ) { 1713 { 1674 1714 guard_symtab guard { *this }; 1675 1715 maybe_accept( node, &GenericExpr::result ); … … 1700 1740 node = n; 1701 1741 } 1702 )1742 } 1703 1743 1704 1744 VISIT_END( Expr, node ); … … 1729 1769 VISIT_START( node ); 1730 1770 1731 VISIT(1771 if ( __visit_children() ) { 1732 1772 // xxx - should PointerType visit/mutate dimension? 1733 1773 maybe_accept( node, &PointerType::base ); 1734 )1774 } 1735 1775 1736 1776 VISIT_END( Type, node ); … … 1743 1783 VISIT_START( node ); 1744 1784 1745 VISIT(1785 if ( __visit_children() ) { 1746 1786 maybe_accept( node, &ArrayType::dimension ); 1747 1787 maybe_accept( node, &ArrayType::base ); 1748 )1788 } 1749 1789 1750 1790 VISIT_END( Type, node ); … … 1757 1797 VISIT_START( node ); 1758 1798 1759 VISIT(1799 if ( __visit_children() ) { 1760 1800 maybe_accept( node, &ReferenceType::base ); 1761 )1801 } 1762 1802 1763 1803 VISIT_END( Type, node ); … … 1770 1810 VISIT_START( node ); 1771 1811 1772 VISIT(1812 if ( __visit_children() ) { 1773 1813 maybe_accept( node, &QualifiedType::parent ); 1774 1814 maybe_accept( node, &QualifiedType::child ); 1775 )1815 } 1776 1816 1777 1817 VISIT_END( Type, node ); … … 1784 1824 VISIT_START( node ); 1785 1825 1786 VISIT({1826 if ( __visit_children() ) { 1787 1827 // guard_forall_subs forall_guard { *this, node }; 1788 1828 // mutate_forall( node ); … … 1790 1830 maybe_accept( node, &FunctionType::returns ); 1791 1831 maybe_accept( node, &FunctionType::params ); 1792 } )1832 } 1793 1833 1794 1834 VISIT_END( Type, node ); … … 1803 1843 __pass::symtab::addStruct( core, 0, node->name ); 1804 1844 1805 VISIT({1845 if ( __visit_children() ) { 1806 1846 guard_symtab guard { *this }; 1807 1847 maybe_accept( node, &StructInstType::params ); 1808 } )1848 } 1809 1849 1810 1850 VISIT_END( Type, node ); … … 1819 1859 __pass::symtab::addUnion( core, 0, node->name ); 1820 1860 1821 VISIT({1861 if ( __visit_children() ) { 1822 1862 guard_symtab guard { *this }; 1823 1863 maybe_accept( node, &UnionInstType::params ); 1824 } )1864 } 1825 1865 1826 1866 VISIT_END( Type, node ); … … 1833 1873 VISIT_START( node ); 1834 1874 1835 VISIT({1875 if ( __visit_children() ) { 1836 1876 maybe_accept( node, &EnumInstType::params ); 1837 } )1877 } 1838 1878 1839 1879 VISIT_END( Type, node ); … … 1846 1886 VISIT_START( node ); 1847 1887 1848 VISIT({1888 if ( __visit_children() ) { 1849 1889 maybe_accept( node, &TraitInstType::params ); 1850 } )1890 } 1851 1891 1852 1892 VISIT_END( Type, node ); … … 1859 1899 VISIT_START( node ); 1860 1900 1861 VISIT(1901 if ( __visit_children() ) { 1862 1902 { 1863 1903 maybe_accept( node, &TypeInstType::params ); … … 1865 1905 // ensure that base re-bound if doing substitution 1866 1906 __pass::forall::replace( core, 0, node ); 1867 )1907 } 1868 1908 1869 1909 VISIT_END( Type, node ); … … 1876 1916 VISIT_START( node ); 1877 1917 1878 VISIT(1918 if ( __visit_children() ) { 1879 1919 maybe_accept( node, &TupleType::types ); 1880 1920 maybe_accept( node, &TupleType::members ); 1881 )1921 } 1882 1922 1883 1923 VISIT_END( Type, node ); … … 1890 1930 VISIT_START( node ); 1891 1931 1892 VISIT(1932 if ( __visit_children() ) { 1893 1933 maybe_accept( node, &TypeofType::expr ); 1894 )1934 } 1895 1935 1896 1936 VISIT_END( Type, node ); … … 1903 1943 VISIT_START( node ); 1904 1944 1905 VISIT(1945 if ( __visit_children() ) { 1906 1946 maybe_accept( node, &VTableType::base ); 1907 )1947 } 1908 1948 1909 1949 VISIT_END( Type, node ); … … 1953 1993 VISIT_START( node ); 1954 1994 1955 VISIT( maybe_accept( node, &Designation::designators ); ) 1995 if ( __visit_children() ) { 1996 maybe_accept( node, &Designation::designators ); 1997 } 1956 1998 1957 1999 VISIT_END( Designation, node ); … … 1964 2006 VISIT_START( node ); 1965 2007 1966 VISIT(2008 if ( __visit_children() ) { 1967 2009 maybe_accept( node, &SingleInit::value ); 1968 )2010 } 1969 2011 1970 2012 VISIT_END( Init, node ); … … 1977 2019 VISIT_START( node ); 1978 2020 1979 VISIT(2021 if ( __visit_children() ) { 1980 2022 maybe_accept( node, &ListInit::designations ); 1981 2023 maybe_accept( node, &ListInit::initializers ); 1982 )2024 } 1983 2025 1984 2026 VISIT_END( Init, node ); … … 1991 2033 VISIT_START( node ); 1992 2034 1993 VISIT(2035 if ( __visit_children() ) { 1994 2036 maybe_accept( node, &ConstructorInit::ctor ); 1995 2037 maybe_accept( node, &ConstructorInit::dtor ); 1996 2038 maybe_accept( node, &ConstructorInit::init ); 1997 )2039 } 1998 2040 1999 2041 VISIT_END( Init, node ); … … 2006 2048 VISIT_START( node ); 2007 2049 2008 VISIT(2050 if ( __visit_children() ) { 2009 2051 maybe_accept( node, &Attribute::params ); 2010 )2052 } 2011 2053 2012 2054 VISIT_END( Attribute, node ); … … 2019 2061 VISIT_START( node ); 2020 2062 2021 VISIT(2063 if ( __visit_children() ) { 2022 2064 { 2023 2065 bool mutated = false; … … 2035 2077 } 2036 2078 } 2037 )2079 } 2038 2080 2039 2081 VISIT_END( TypeSubstitution, node ); … … 2041 2083 2042 2084 #undef VISIT_START 2043 #undef VISIT2044 2085 #undef VISIT_END -
src/ControlStruct/module.mk
r6b2d444 rcef7430 22 22 ControlStruct/ForExprMutator.cc \ 23 23 ControlStruct/ForExprMutator.h \ 24 ControlStruct/HoistControlDecls.cpp \ 25 ControlStruct/HoistControlDecls.hpp \ 24 26 ControlStruct/LabelFixer.cc \ 25 27 ControlStruct/LabelFixer.h \ -
src/InitTweak/InitTweak.cc
r6b2d444 rcef7430 10 10 // Created On : Fri May 13 11:26:36 2016 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Nov 19 19:22:00 202113 // Update Count : 1912 // Last Modified On : Mon Dec 6 13:21:00 2021 13 // Update Count : 20 14 14 // 15 15 … … 1191 1191 } 1192 1192 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 } 1193 bool isAssignment( const ast::FunctionDecl * decl ) { 1194 return isAssignment( decl->name ) && isCopyFunction( decl ); 1195 } 1196 1197 bool isDestructor( const ast::FunctionDecl * decl ) { 1198 return isDestructor( decl->name ); 1199 } 1200 1201 bool isDefaultConstructor( const ast::FunctionDecl * decl ) { 1202 return isConstructor( decl->name ) && 1 == decl->params.size(); 1203 } 1204 1205 bool isCopyConstructor( const ast::FunctionDecl * decl ) { 1206 return isConstructor( decl->name ) && 2 == decl->params.size(); 1207 } 1208 1209 bool 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 } 1203 1219 1204 1220 const FunctionDecl * isAssignment( const Declaration * decl ) { -
src/InitTweak/InitTweak.h
r6b2d444 rcef7430 10 10 // Created On : Fri May 13 11:26:36 2016 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Nov 19 14:18:00 202113 // Update Count : 712 // Last Modified On : Mon Dec 6 13:20:00 2021 13 // Update Count : 8 14 14 // 15 15 … … 31 31 const FunctionDecl * isCopyConstructor( const Declaration * decl ); 32 32 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 ); 33 37 bool isCopyFunction( const ast::FunctionDecl * decl ); 34 38 -
src/SymTab/Validate.cc
r6b2d444 rcef7430 453 453 } 454 454 455 void decayForallPointers( std::list< Declaration * > & translationUnit ) { 456 PassVisitor<ForallPointerDecay_old> fpd; 457 acceptAll( translationUnit, fpd ); 458 } 459 455 460 void validate( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug ) { 456 461 validate_A( translationUnit ); … … 470 475 type->accept( fpd ); 471 476 } 472 473 477 474 478 void HoistTypeDecls::handleType( Type * type ) { -
src/SymTab/Validate.h
r6b2d444 rcef7430 42 42 void validate_E( std::list< Declaration * > &translationUnit ); 43 43 void validate_F( std::list< Declaration * > &translationUnit ); 44 void decayForallPointers( std::list< Declaration * > & translationUnit ); 44 45 45 46 const ast::Type * validateType( -
src/Validate/module.mk
r6b2d444 rcef7430 16 16 17 17 SRC_VALIDATE = \ 18 Validate/Autogen.cpp \ 19 Validate/Autogen.hpp \ 18 20 Validate/CompoundLiteral.cpp \ 19 21 Validate/CompoundLiteral.hpp \ -
src/main.cc
r6b2d444 rcef7430 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Nov 30 10:25:00 202113 // Update Count : 6 5912 // Last Modified On : Wed Jan 26 14:09:00 2022 13 // Update Count : 670 14 14 // 15 15 … … 55 55 #include "ControlStruct/ExceptTranslate.h" // for translateEHM 56 56 #include "ControlStruct/FixLabels.hpp" // for fixLabels 57 #include "ControlStruct/HoistControlDecls.hpp" // hoistControlDecls 57 58 #include "ControlStruct/Mutate.h" // for mutate 58 59 #include "GenPoly/Box.h" // for box … … 73 74 #include "SynTree/Visitor.h" // for acceptAll 74 75 #include "Tuples/Tuples.h" // for expandMemberTuples, expan... 76 #include "Validate/Autogen.hpp" // for autogenerateRoutines 75 77 #include "Validate/FindSpecialDecls.h" // for findGlobalDecls 76 78 #include "Validate/CompoundLiteral.hpp" // for handleCompoundLiterals … … 78 80 #include "Validate/LabelAddressFixer.hpp" // for fixLabelAddresses 79 81 #include "Virtual/ExpandCasts.h" // for expandCasts 80 81 82 82 83 static void NewPass( const char * const name ) { … … 326 327 PASS( "Validate-B", SymTab::validate_B( translationUnit ) ); 327 328 PASS( "Validate-C", SymTab::validate_C( translationUnit ) ); 328 PASS( "Validate-D", SymTab::validate_D( translationUnit ) );329 329 330 330 CodeTools::fillLocations( translationUnit ); 331 331 332 332 if( useNewAST ) { 333 PASS( "Apply Concurrent Keywords", Concurrency::applyKeywords( translationUnit ) ); 334 PASS( "Forall Pointer Decay", SymTab::decayForallPointers( translationUnit ) ); 335 CodeTools::fillLocations( translationUnit ); 336 333 337 if (Stats::Counters::enabled) { 334 338 ast::pass_visitor_stats.avg = Stats::Counters::build<Stats::Counters::AverageCounter<double>>("Average Depth - New"); … … 338 342 339 343 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 ) ); 340 351 341 352 PASS( "Implement Mutex", Concurrency::implementMutex( transUnit ) ); … … 406 417 translationUnit = convert( move( transUnit ) ); 407 418 } else { 419 PASS( "Validate-D", SymTab::validate_D( translationUnit ) ); 408 420 PASS( "Validate-E", SymTab::validate_E( translationUnit ) ); 409 421 PASS( "Validate-F", SymTab::validate_F( translationUnit ) );
Note: See TracChangeset
for help on using the changeset viewer.