Changes in / [1afda5a2:8e64cb4]
- Files:
-
- 2 deleted
- 7 edited
-
src/AST/Pass.hpp (modified) (1 diff)
-
src/AST/Pass.impl.hpp (modified) (1 diff)
-
src/GenPoly/Box.cc (modified) (6 diffs)
-
src/Parser/RunParser.cpp (deleted)
-
src/Parser/RunParser.hpp (deleted)
-
src/Parser/module.mk (modified) (1 diff)
-
src/main.cc (modified) (5 diffs)
-
tests/concurrent/pthread/.expect/bounded_buffer.txt (modified) (1 diff)
-
tests/concurrent/pthread/bounded_buffer.cfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.hpp
r1afda5a2 r8e64cb4 66 66 // 67 67 // Other Special Members: 68 // | beginScope - A method with no parameters or return value, called each time the69 // visitor enters a block.70 // | endScope - A method with no parameters or return value, called each time the71 // visitor leaves a block.72 68 // | result - Either a method that takes no parameters or a field. If a method (or 73 69 // callable field) get_result calls it, otherwise the value is returned. -
src/AST/Pass.impl.hpp
r1afda5a2 r8e64cb4 836 836 if ( enterScope ) { 837 837 __pass::symtab::enter(core, 0); 838 __pass::scope::enter(core, 0); 838 839 } 839 840 }, [this, leaveScope = !this->atFunctionTop]() { 840 841 if ( leaveScope ) { 841 842 __pass::symtab::leave(core, 0); 843 __pass::scope::leave(core, 0); 842 844 } 843 845 }); -
src/GenPoly/Box.cc
r1afda5a2 r8e64cb4 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Dec 19 16:36:00 202213 // Update Count : 34 811 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 23:40:34 2019 13 // Update Count : 347 14 14 // 15 15 … … 214 214 /// sizeof expressions of polymorphic types with the proper variable, 215 215 /// and strips fields from generic struct declarations. 216 struct Pass3 final { 216 struct Pass3 final : public BoxPass, public WithGuards { 217 template< typename DeclClass > 218 void handleDecl( DeclClass * decl, Type * type ); 219 217 220 void premutate( ObjectDecl * objectDecl ); 218 221 void premutate( FunctionDecl * functionDecl ); … … 220 223 void premutate( StructDecl * structDecl ); 221 224 void premutate( UnionDecl * unionDecl ); 225 void premutate( TypeDecl * typeDecl ); 226 void premutate( PointerType * pointerType ); 227 void premutate( FunctionType * funcType ); 222 228 }; 223 229 } // anonymous namespace … … 1880 1886 ////////////////////////////////////////// Pass3 //////////////////////////////////////////////////// 1881 1887 1888 template< typename DeclClass > 1889 void Pass3::handleDecl( DeclClass * decl, Type * type ) { 1890 GuardScope( scopeTyVars ); 1891 makeTyVarMap( type, scopeTyVars ); 1892 ScrubTyVars::scrubAll( decl ); 1893 } 1894 1882 1895 void Pass3::premutate( ObjectDecl * objectDecl ) { 1883 ScrubTyVars::scrubAll( objectDecl);1896 handleDecl( objectDecl, objectDecl->type ); 1884 1897 } 1885 1898 1886 1899 void Pass3::premutate( FunctionDecl * functionDecl ) { 1887 ScrubTyVars::scrubAll( functionDecl);1900 handleDecl( functionDecl, functionDecl->type ); 1888 1901 } 1889 1902 1890 1903 void Pass3::premutate( TypedefDecl * typedefDecl ) { 1891 ScrubTyVars::scrubAll( typedefDecl);1904 handleDecl( typedefDecl, typedefDecl->base ); 1892 1905 } 1893 1906 1894 1907 /// Strips the members from a generic aggregate 1895 static void stripGenericMembers( AggregateDecl * decl) {1908 void stripGenericMembers(AggregateDecl * decl) { 1896 1909 if ( ! decl->parameters.empty() ) decl->members.clear(); 1897 1910 } … … 1903 1916 void Pass3::premutate( UnionDecl * unionDecl ) { 1904 1917 stripGenericMembers( unionDecl ); 1918 } 1919 1920 void Pass3::premutate( TypeDecl * typeDecl ) { 1921 addToTyVarMap( typeDecl, scopeTyVars ); 1922 } 1923 1924 void Pass3::premutate( PointerType * pointerType ) { 1925 GuardScope( scopeTyVars ); 1926 makeTyVarMap( pointerType, scopeTyVars ); 1927 } 1928 1929 void Pass3::premutate( FunctionType * functionType ) { 1930 GuardScope( scopeTyVars ); 1931 makeTyVarMap( functionType, scopeTyVars ); 1905 1932 } 1906 1933 } // anonymous namespace … … 1912 1939 // compile-command: "make install" // 1913 1940 // End: // 1941 -
src/Parser/module.mk
r1afda5a2 r8e64cb4 30 30 Parser/parserutility.cc \ 31 31 Parser/parserutility.h \ 32 Parser/RunParser.cpp \33 Parser/RunParser.hpp \34 32 Parser/StatementNode.cc \ 35 33 Parser/TypeData.cc \ -
src/main.cc
r1afda5a2 r8e64cb4 59 59 #include "InitTweak/GenInit.h" // for genInit 60 60 #include "MakeLibCfa.h" // for makeLibCfa 61 #include "Parser/RunParser.hpp" // for buildList, dumpParseTree,... 61 #include "Parser/ParseNode.h" // for DeclarationNode, buildList 62 #include "Parser/TypedefTable.h" // for TypedefTable 62 63 #include "ResolvExpr/CandidatePrinter.hpp" // for printCandidates 63 64 #include "ResolvExpr/Resolver.h" // for resolve … … 108 109 Stats::Time::StopBlock(); 109 110 111 LinkageSpec::Spec linkage = LinkageSpec::Cforall; 112 TypedefTable typedefTable; 113 DeclarationNode * parseTree = nullptr; // program parse tree 114 110 115 static bool waiting_for_gdb = false; // flag to set cfa-cpp to wait for gdb on start 111 116 … … 113 118 114 119 static void parse_cmdline( int argc, char * argv[] ); 120 static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false ); 115 121 static void dump( list< Declaration * > & translationUnit, ostream & out = cout ); 116 122 static void dump( ast::TranslationUnit && transUnit, ostream & out = cout ); … … 295 301 296 302 if ( parsep ) { 297 dumpParseTree( cout ); 298 return EXIT_SUCCESS; 299 } // if 300 301 translationUnit = buildUnit(); 303 parseTree->printList( cout ); 304 delete parseTree; 305 return EXIT_SUCCESS; 306 } // if 307 308 buildList( parseTree, translationUnit ); 309 delete parseTree; 310 parseTree = nullptr; 302 311 303 312 if ( astp ) { … … 739 748 } // parse_cmdline 740 749 750 static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit ) { 751 extern int yyparse( void ); 752 extern FILE * yyin; 753 extern int yylineno; 754 755 ::linkage = linkage; // set globals 756 yyin = input; 757 yylineno = 1; 758 int parseStatus = yyparse(); 759 760 fclose( input ); 761 if ( shouldExit || parseStatus != 0 ) { 762 exit( parseStatus ); 763 } // if 764 } // parse 765 741 766 static bool notPrelude( Declaration * decl ) { 742 767 return ! LinkageSpec::isBuiltin( decl->get_linkage() ); -
tests/concurrent/pthread/.expect/bounded_buffer.txt
r1afda5a2 r8e64cb4 1 producer total value is 2 41502 consumer total value is 2 41501 producer total value is 23426 2 consumer total value is 23426 -
tests/concurrent/pthread/bounded_buffer.cfa
r1afda5a2 r8e64cb4 63 63 64 64 void *producer( void *arg ) { 65 Buffer(int) &buf = *(Buffer(int)*)arg;66 const int NoOfItems = prng(*active_thread(), 40);65 Buffer(int) &buf = *(Buffer(int)*)arg; 66 const int NoOfItems = rand() % 40; 67 67 int item; 68 68 for ( int i = 1; i <= NoOfItems; i += 1 ) { // produce a bunch of items 69 item = prng(*active_thread(), 1, 101);// produce a random number69 item = rand() % 100 + 1; // produce a random number 70 70 //sout | "Producer:" | pthread_self() | " value:" | item; 71 71 insert( buf,item ); // insert element into queue … … 101 101 pthread_mutex_init(&consumer_cnt_lock, NULL); 102 102 // parallelism 103 s et_seed( 1003 );103 srandom( 1003 ); 104 104 105 105 processor p[5];
Note:
See TracChangeset
for help on using the changeset viewer.