Changeset 41b8ea4 for doc/theses
- Timestamp:
- Oct 7, 2020, 5:10:45 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 490fb92e, 69c5c00
- Parents:
- 2fb35df (diff), 848439f (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. - Location:
- doc/theses
- Files:
-
- 6 added
- 1 deleted
- 3 edited
- 1 moved
-
fangren_yu_COOP_S20/Makefile (modified) (1 diff)
-
fangren_yu_COOP_S20/Report.tex (modified) (8 diffs)
-
thierry_delisle_PhD/code/readQ_example/Makefile (added)
-
thierry_delisle_PhD/code/readQ_example/proto-gui/main.cpp (modified) (12 diffs)
-
thierry_delisle_PhD/code/readQ_example/thrdlib/Makefile (added)
-
thierry_delisle_PhD/code/readQ_example/thrdlib/cforall.cpp (added)
-
thierry_delisle_PhD/code/readQ_example/thrdlib/fibre.cpp (added)
-
thierry_delisle_PhD/code/readQ_example/thrdlib/pthread.cpp (moved) (moved from doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/thread_pthread.h ) (3 diffs)
-
thierry_delisle_PhD/code/readQ_example/thrdlib/thread.cpp (added)
-
thierry_delisle_PhD/code/readQ_example/thrdlib/thread.h (deleted)
-
thierry_delisle_PhD/code/readQ_example/thrdlib/thread.hpp (added)
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/fangren_yu_COOP_S20/Makefile
r2fb35df r41b8ea4 46 46 # File Dependencies # 47 47 48 49 48 ${DOCUMENT} : ${BASE}.ps 50 49 ps2pdf $< -
doc/theses/fangren_yu_COOP_S20/Report.tex
r2fb35df r41b8ea4 1 \documentclass[twoside,1 2pt]{article}1 \documentclass[twoside,11pt]{article} 2 2 3 3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 11 11 \usepackage[labelformat=simple,aboveskip=0pt,farskip=0pt]{subfig} 12 12 \renewcommand{\thesubfigure}{\alph{subfigure})} 13 \usepackage[flushmargin]{footmisc} % support label/reference in footnote 13 14 \usepackage{latexsym} % \Box glyph 14 15 \usepackage{mathptmx} % better math font with "times" 15 \usepackage {appendix}16 \usepackage[toc]{appendix} % article does not have appendix 16 17 \usepackage[usenames]{color} 17 18 \input{common} % common CFA document macros … … 39 40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 40 41 41 \CFA Defaults42 \CFAStyle % CFA code-style for all languages 42 43 \lstset{ 43 language=C++, % make C++ the default language44 language=C++,moredelim=**[is][\color{red}]{@}{@} % make C++ the default language 44 45 }% lstset 45 46 \lstnewenvironment{C++}[1][] % use C++ style 46 {\lstset{language=C++,moredelim=**[is][\color{red}]{@}{@} ,#1}}{}47 {\lstset{language=C++,moredelim=**[is][\color{red}]{@}{@}}\lstset{#1}}{} 47 48 48 49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% … … 87 88 \section{Overview} 88 89 89 cfa-ccis the reference compiler for the \CFA programming language, which is a non-object-oriented extension to C.90 @cfa-cc@ is the reference compiler for the \CFA programming language, which is a non-object-oriented extension to C. 90 91 \CFA attempts to introduce productive modern programming language features to C while maintaining as much backward-compatibility as possible, so that most existing C programs can seamlessly work with \CFA. 91 92 … … 381 382 \subsubsection{Source: \lstinline{AST/SymbolTable.hpp}} 382 383 383 384 \subsubsection{Source: \lstinline{SymTab/Indexer.h}}385 386 384 Function 387 385 \begin{C++} … … 612 610 613 611 614 \ begin{appendices}[toc,titletoc]612 \appendix 615 613 \section{Appendix} 616 617 614 618 615 \subsection{Kinds of Type Parameters} 619 616 \label{s:KindsTypeParameters} 620 617 621 A type parameter in a @forall@ clause has three possiblekinds:618 A type parameter in a @forall@ clause has 3 kinds: 622 619 \begin{enumerate}[listparindent=0pt] 623 620 \item 624 @dtype@: any data type (built-in or user defined). 625 626 There is also a difference between opaque types (incomplete types, \ie those with only a forward declaration) and concrete types. 627 Only concrete types can be directly used as a variable type. 628 629 \CFA provides the @otype@ shorthand to require a type parameter be concrete, which also implicitly asserts the existence of its default and copy constructors, assignment, and destructor\footnote{\CFA implements the same automatic resource management (RAII) semantics as \CC.}. 630 \item 631 @ftype@: any function type. 632 633 @ftype@ provides two purposes: 634 \begin{itemize} 635 \item 636 Differentiate function pointer from data pointer because (in theory) some systems have different sizes for these pointers. 637 \item 638 Disallow a function pointer to match an overloaded data pointer, since variables and functions can have the same names. 639 \end{itemize} 621 @dtype@: any data type (built-in or user defined) that is not a concrete type. 622 623 A non-concrete type is an incomplete type such as an opaque type or pointer/reference with an implicit (pointer) size and implicitly generated reference and dereference operations. 624 \item 625 @otype@: any data type (built-in or user defined) that is concrete type. 626 627 A concrete type is a complete type, \ie types that can be used to create a variable, which also implicitly asserts the existence of default and copy constructors, assignment, and destructor\footnote{\CFA implements the same automatic resource management (RAII) semantics as \CC.}. 628 % \item 629 % @ftype@: any function type. 630 % 631 % @ftype@ provides two purposes: 632 % \begin{itemize} 633 % \item 634 % Differentiate function pointer from data pointer because (in theory) some systems have different sizes for these pointers. 635 % \item 636 % Disallow a function pointer to match an overloaded data pointer, since variables and functions can have the same names. 637 % \end{itemize} 640 638 641 639 \item 642 640 @ttype@: tuple (variadic) type. 643 641 644 @ttype@ parameter may only appear as type of the last parameter in a function, andit provides a type-safe way to implement variadic functions.642 Restricted to the type for the last parameter in a function, it provides a type-safe way to implement variadic functions. 645 643 Note however, that it has certain restrictions, as described in the implementation section below. 646 644 \end{enumerate} … … 673 671 \begin{enumerate} 674 672 \item 675 All types are function declarations are candidates of implicit parameters.673 All types, variables, and functions are candidates of implicit parameters 676 674 \item 677 675 The parameter (assertion) name must match the actual declarations. 678 \item679 Currently, assertions are all functions.680 Note that since \CFA has variable overloading, implicit value parameters might also be supported in the future.681 676 \end{enumerate} 682 677 … … 732 727 In particular, polymorphic variadic recursion must be structural (\ie the number of arguments decreases in any possible recursive calls), otherwise code generation gets into an infinite loop. 733 728 The \CFA compiler sets a limit on assertion depth and reports an error if assertion resolution does not terminate within the limit (as for \lstinline[language=C++]@templates@ in \CC). 734 \end{appendices}735 729 736 730 \bibliographystyle{plain} -
doc/theses/thierry_delisle_PhD/code/readQ_example/proto-gui/main.cpp
r2fb35df r41b8ea4 1 #include "thrdlib/thread.h "1 #include "thrdlib/thread.hpp" 2 2 3 3 #include <cassert> … … 5 5 #include <algorithm> 6 6 #include <atomic> 7 #include <iostream> 7 8 #include <memory> 8 9 #include <vector> 9 10 10 11 #include <getopt.h> 12 using thrdlib::thread_t; 13 14 15 extern __attribute__((aligned(128))) thread_local struct { 16 void * volatile this_thread; 17 void * volatile this_processor; 18 void * volatile this_stats; 19 20 struct { 21 volatile unsigned short disable_count; 22 volatile bool enabled; 23 volatile bool in_progress; 24 } preemption_state; 25 26 #if defined(__SIZEOF_INT128__) 27 __uint128_t rand_seed; 28 #else 29 uint64_t rand_seed; 30 #endif 31 struct { 32 uint64_t fwd_seed; 33 uint64_t bck_seed; 34 } ready_rng; 35 } kernelTLS __attribute__ ((tls_model ( "initial-exec" ))); 11 36 12 37 //-------------------- … … 36 61 assert( expected == reset ); 37 62 if( std::atomic_compare_exchange_strong( &state, &expected, self) ) { 38 thrdlib _park( self );63 thrdlib::park( self ); 39 64 ret = true; 40 65 goto END; … … 54 79 if( got == reset ) return false; 55 80 56 thrdlib _unpark( got );81 thrdlib::unpark( got ); 57 82 return true; 58 83 } … … 109 134 the_stats_thread = self; 110 135 fence(); 111 thrdlib _park( self );136 thrdlib::park( self ); 112 137 113 138 std::vector<bool> seen; … … 115 140 116 141 while(last_produced < nproduce) { 117 thrdlib _yield();142 thrdlib::yield(); 118 143 thrd_stats.stats.ran++; 119 144 if( last_produced > 0 ) seen.at(last_produced - 1) = true; … … 147 172 148 173 void Renderer( thread_t self ) { 149 thrdlib _unpark( the_stats_thread );174 thrdlib::unpark( the_stats_thread ); 150 175 for(unsigned i = 0; i < nproduce; i++) { 151 176 auto & frame = frames[i % nframes]; … … 178 203 fsize = 1000; 179 204 nproduce = 60; 205 206 const char * framework; 180 207 181 208 for(;;) { … … 196 223 case -1: 197 224 /* paranoid */ assert(optind <= argc); 225 if( optind == argc ) { 226 std::cerr << "Must specify a framework" << std::endl; 227 goto usage; 228 229 } 230 framework = argv[optind]; 198 231 goto run; 199 232 case 'b': … … 228 261 std::cerr << opt << std::endl; 229 262 usage: 230 std::cerr << "Usage: " << argv[0] << " [options] " << std::endl;263 std::cerr << "Usage: " << argv[0] << " [options] framework" << std::endl; 231 264 std::cerr << std::endl; 232 265 std::cerr << " -b, --buff=COUNT Number of frames to buffer" << std::endl; … … 237 270 } 238 271 run: 272 assert( framework ); 239 273 240 274 frames.reset(new Frame[nframes]); … … 246 280 std::cout << "(Buffering " << nframes << ")" << std::endl; 247 281 248 thrdlib _setproccnt(2 );249 250 thread_t stats = thrdlib _create( Stats);282 thrdlib::init( framework, 2 ); 283 284 thread_t stats = thrdlib::create( Stats ); 251 285 std::cout << "Created Stats Thread" << std::endl; 252 while( the_stats_thread == nullptr ) thrdlib_yield(); 286 while( the_stats_thread == nullptr ) thrdlib::yield(); 287 253 288 std::cout << "Creating Main Threads" << std::endl; 254 thread_t renderer = thrdlib_create( Renderer ); 255 // while(true); 256 thread_t simulator = thrdlib_create( Simulator ); 289 thread_t renderer = thrdlib::create( Renderer ); 290 thread_t simulator = thrdlib::create( Simulator ); 257 291 258 292 std::cout << "Running" << std::endl; 259 293 260 thrdlib_join( simulator ); 261 thrdlib_join( renderer ); 262 thrdlib_join( stats ); 294 thrdlib::join( simulator ); 295 thrdlib::join( renderer ); 296 thrdlib::join( stats ); 297 298 thrdlib::clean(); 263 299 264 300 std::cout << "----------" << std::endl; -
doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/pthread.cpp
r2fb35df r41b8ea4 1 #pragma once2 3 1 #include <pthread.h> 4 2 #include <errno.h> … … 56 54 #undef CHECKED 57 55 58 #if defined(__cforall) || defined(__cpluplus) 56 //-------------------- 57 // Basic types 58 struct pthread_runner_t { 59 pthread_t handle; 60 __bin_sem_t sem; 61 }; 62 typedef pthread_runner_t * thread_t; 63 64 static_assert(sizeof(thread_t) == sizeof(void*), "thread_t musst be of same size as void*"); 65 59 66 extern "C" { 60 #endif61 //--------------------62 // Basic types63 struct pthread_runner_t {64 pthread_t handle;65 __bin_sem_t sem;66 };67 typedef pthread_runner_t * thread_t;68 69 67 //-------------------- 70 68 // Basic thread support … … 98 96 //-------------------- 99 97 // Basic kernel features 100 void thrdlib_setproccnt( int ) { 101 102 } 103 104 105 #if defined(__cforall) || defined(__cpluplus) 98 void thrdlib_init( int ) {} 106 99 } 107 #endif
Note:
See TracChangeset
for help on using the changeset viewer.