Changes in / [779a4a3:f465f0e]


Ignore:
Files:
2 deleted
48 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/concurrency/Makefile

    r779a4a3 rf465f0e  
    7575        mkdir -p ${Build}
    7676
    77 ${BASE}.out.ps: ${Build}
    78         ln -fs ${Build}/Paper.out.ps .
     77${BASE}.out.ps:
     78        ln -fs build/Paper.out.ps .
    7979
    8080WileyNJD-AMA.bst:
    8181        ln -fs ../AMA/AMA-stix/ama/WileyNJD-AMA.bst .
    8282
    83 %.tex : %.fig ${Build}
     83%.tex : %.fig
    8484        fig2dev -L eepic $< > ${Build}/$@
    8585
    86 %.ps : %.fig ${Build}
     86%.ps : %.fig
    8787        fig2dev -L ps $< > ${Build}/$@
    8888
    89 %.pstex : %.fig ${Build}
     89%.pstex : %.fig
    9090        fig2dev -L pstex $< > ${Build}/$@
    9191        fig2dev -L pstex_t -p ${Build}/$@ $< > ${Build}/$@_t
  • doc/papers/general/Makefile

    r779a4a3 rf465f0e  
    6969        mkdir -p ${Build}
    7070
    71 ${BASE}.out.ps: ${Build}
    72         ln -fs ${Build}/Paper.out.ps .
     71${BASE}.out.ps:
     72        ln -fs build/Paper.out.ps .
    7373
    7474WileyNJD-AMA.bst:
    7575        ln -fs ../AMA/AMA-stix/ama/WileyNJD-AMA.bst .
    7676
    77 ${GRAPHS} : ${Build} timing.gp timing.dat
     77${GRAPHS} : timing.gp timing.dat
    7878        gnuplot -e Build="'${Build}/'" evaluation/timing.gp
    7979
    80 %.tex : %.fig ${Build}
     80%.tex : %.fig
    8181        fig2dev -L eepic $< > ${Build}/$@
    8282
    83 %.ps : %.fig ${Build}
     83%.ps : %.fig
    8484        fig2dev -L ps $< > ${Build}/$@
    8585
    86 %.pstex : %.fig ${Build}
     86%.pstex : %.fig
    8787        fig2dev -L pstex $< > ${Build}/$@
    8888        fig2dev -L pstex_t -p ${Build}/$@ $< > ${Build}/$@_t
  • doc/papers/general/Paper.tex

    r779a4a3 rf465f0e  
    228228Nevertheless, C, first standardized over thirty years ago, lacks many features that make programming in more modern languages safer and more productive.
    229229
    230 \CFA (pronounced ``C-for-all'', and written \CFA or Cforall) is an evolutionary extension of the C programming language that adds modern language-features to C, while maintaining both source and runtime compatibility with C and a familiar programming model for programmers.
     230\CFA (pronounced ``C-for-all'', and written \CFA or Cforall) is an evolutionary extension of the C programming language that aims to add modern language features to C, while maintaining both source and runtime compatibility with C and a familiar programming model for programmers.
    231231The four key design goals for \CFA~\cite{Bilson03} are:
    232232(1) The behaviour of standard C code must remain the same when translated by a \CFA compiler as when translated by a C compiler;
     
    237237\CC is used similarly, but has the disadvantages of multiple legacy design-choices that cannot be updated and active divergence of the language model from C, requiring significant effort and training to incrementally add \CC to a C-based project.
    238238
    239 All languages features discussed in this paper are working, except some advanced exception-handling features.
    240 Not discussed in this paper are the integrated concurrency-constructs and user-level threading-library~\cite{Delisle18}.
    241239\CFA is an \emph{open-source} project implemented as an source-to-source translator from \CFA to the gcc-dialect of C~\cite{GCCExtensions}, allowing it to leverage the portability and code optimizations provided by gcc, meeting goals (1)--(3).
    242240Ultimately, a compiler is necessary for advanced features and optimal performance.
    243 % @plg2[9]% cd cfa-cc/src; cloc ArgTweak CodeGen CodeTools Common Concurrency ControlStruct Designators GenPoly InitTweak MakeLibCfa.cc MakeLibCfa.h Parser ResolvExpr SymTab SynTree Tuples driver prelude main.cc
    244 % -------------------------------------------------------------------------------
    245 % Language                     files          blank        comment           code
    246 % -------------------------------------------------------------------------------
    247 % C++                            108           5420           5232          34961
    248 % C/C++ Header                    86           2379           2450           8464
    249 % Teamcenter def                   2            115             65           1387
    250 % make                             5            168             87           1052
    251 % C                               20            109            403            488
    252 % awk                              1             12             26            121
    253 % sed                              1              0              0              6
    254 % -------------------------------------------------------------------------------
    255 % SUM:                           223           8203           8263          46479
    256 % -------------------------------------------------------------------------------
    257 The \CFA translator is 200+ files and 46,000+ lines of code written in C/\CC.
    258 Starting with a translator versus a compiler makes it easier and faster to generate and debug C object-code rather than intermediate, assembler or machine code.
    259 The translator design is based on the \emph{visitor pattern}, allowing multiple passes over the abstract code-tree, which works well for incrementally adding new feature through additional visitor passes.
    260 At the heart of the translator is the type resolver, which handles the polymorphic routine/type overload-resolution.
    261 % @plg2[8]% cd cfa-cc/src; cloc libcfa
    262 % -------------------------------------------------------------------------------
    263 % Language                     files          blank        comment           code
    264 % -------------------------------------------------------------------------------
    265 % C                               35           1256           1240           9116
    266 % C/C++ Header                    54            358           1106           1198
    267 % make                             2            201            325           1167
    268 % C++                              3             18             17            124
    269 % Assembly                         3             56             97            111
    270 % Bourne Shell                     2              2              0             25
    271 % awk                              1              4              0             22
    272 % -------------------------------------------------------------------------------
    273 % SUM:                           100           1895           2785          11763
    274 % -------------------------------------------------------------------------------
    275 The \CFA runtime system is 100+ files and 11,000+ lines of code, written in \CFA.
    276 Currently, the \CFA runtime is the largest \emph{user} of \CFA providing a vehicle to test the language features and implementation.
    277 % @plg2[6]% cd cfa-cc/src; cloc tests examples benchmark
    278 % -------------------------------------------------------------------------------
    279 % Language                     files          blank        comment           code
    280 % -------------------------------------------------------------------------------
    281 % C                              237          12260           2869          23286
    282 % make                             8            464            245           2838
    283 % C/C++ Header                    22            225            175            785
    284 % Python                           5            131             93            420
    285 % C++                             10             48              5            201
    286 % Lua                              2             31              4            126
    287 % Java                             4              5              0             80
    288 % Go                               2             11              9             40
    289 % -------------------------------------------------------------------------------
    290 % SUM:                           290          13175           3400          27776
    291 % -------------------------------------------------------------------------------
    292 The \CFA tests are 290+ files and 27,000+ lines of code.
    293 The tests illustrate syntactic and semantic features in \CFA, plus a growing number of runtime benchmarks.
    294 The tests check for correctness and are used for daily regression testing of commits (3800+).
     241All features discussed in this paper are working, unless otherwise stated as under construction.
    295242
    296243Finally, it is impossible to describe a programming language without usages before definitions.
     
    313260There are only two hard things in Computer Science: cache invalidation and \emph{naming things} -- Phil Karlton
    314261\end{quote}
    315 \vspace{-10pt}
    316262C already has a limited form of ad-hoc polymorphism in the form of its basic arithmetic operators, which apply to a variety of different types using identical syntax.
    317263\CFA extends the built-in operator overloading by allowing users to define overloads for any function, not just operators, and even any variable;
     
    408354
    409355\CFA has replacement libraries condensing hundreds of existing C functions into tens of \CFA overloaded functions, all without rewriting the actual computations (see Section~\ref{sec:libraries}).
    410 For example, it is possible to write a type-safe \CFA wrapper @malloc@ based on the C @malloc@, where the return type supplies the type/size of the allocation, which is impossible in most type systems.
     356For example, it is possible to write a type-safe \CFA wrapper @malloc@ based on the C @malloc@:
    411357\begin{cfa}
    412358forall( dtype T | sized(T) ) T * malloc( void ) { return (T *)malloc( sizeof(T) ); }
    413 // select type and size from left-hand side
    414 int * ip = malloc();  double * dp = malloc();  struct S {...} * sp = malloc();
    415 \end{cfa}
     359int * ip = malloc();                                            $\C{// select type and size from left-hand side}$
     360double * dp = malloc();
     361struct S {...} * sp = malloc();
     362\end{cfa}
     363where the return type supplies the type/size of the allocation, which is impossible in most type systems.
    416364
    417365Call-site inferencing and nested functions provide a localized form of inheritance.
     
    425373}
    426374\end{cfa}
    427 The local version of @?<?@ performs @?>?@ overriding the built-in @?<?@ so it is passed to @qsort@.
     375Within the block, the nested version of @?<?@ performs @?>?@ and this local version overrides the built-in @?<?@ so it is passed to @qsort@.
    428376Hence, programmers can easily form local environments, adding and modifying appropriate functions, to maximize reuse of other existing functions and types.
    429377
     
    434382        inline {                                                                        $\C{// nested distribution block, add forall/inline to declarations}$
    435383                void push( stack(`T`) & s, `T` value ) ...      $\C{// generic operations}$
     384                T pop( stack(`T`) & s ) ...
    436385        }
    437386}
     
    439388
    440389
    441 \vspace*{-2pt}
    442390\subsection{Traits}
    443391
    444392\CFA provides \newterm{traits} to name a group of type assertions, where the trait name allows specifying the same set of assertions in multiple locations, preventing repetition mistakes at each function declaration:
    445 
    446393\begin{cquote}
    447394\lstDeleteShortInline@%
     
    515462
    516463
    517 \vspace*{-2pt}
    518464\section{Generic Types}
    519465
     
    528474
    529475\CC, Java, and other languages use \newterm{generic types} to produce type-safe abstract data-types.
    530 \CFA generic types integrate efficiently and naturally with the existing polymorphic functions, while retaining backwards compatibility with C and providing separate compilation.
     476\CFA also implements generic types that integrate efficiently and naturally with the existing polymorphic functions, while retaining backwards compatibility with C and providing separate compilation.
    531477However, for known concrete parameters, the generic-type definition can be inlined, like \CC templates.
    532478
     
    534480\begin{cquote}
    535481\lstDeleteShortInline@%
    536 \begin{tabular}{@{}l|@{\hspace{2\parindentlnth}}l@{}}
     482\begin{tabular}{@{}l@{\hspace{2\parindentlnth}}l@{}}
    537483\begin{cfa}
    538484forall( otype R, otype S ) struct pair {
     
    14271373resume( $\emph{alternate-stack}$ )
    14281374\end{cfa}
    1429 These overloads of @resume@ raise the specified exception or the currently propagating exception (reresume) at another \CFA coroutine or task~\cite{Delisle18}.
     1375These overloads of @resume@ raise the specified exception or the currently propagating exception (reresume) at another \CFA coroutine or task\footnote{\CFA coroutine and concurrency features are discussed in a separately submitted paper.}~\cite{Delisle18}.
    14301376Nonlocal raise is restricted to resumption to provide the exception handler the greatest flexibility because processing the exception does not unwind its stack, allowing it to continue after the handler returns.
    14311377
     
    20942040
    20952041
    2096 \begin{comment}
    20972042\subsection{Integral Suffixes}
    20982043
     
    21282073\lstMakeShortInline@%
    21292074\end{cquote}
    2130 \end{comment}
    21312075
    21322076
     
    27002644Figure~\ref{fig:eval} and Table~\ref{tab:eval} show the results of running the benchmark in Figure~\ref{fig:BenchmarkTest} and its C, \CC, and \CCV equivalents.
    27012645The graph plots the median of 5 consecutive runs of each program, with an initial warm-up run omitted.
    2702 All code is compiled at \texttt{-O2} by gcc or g++ 6.4.0, with all \CC code compiled as \CCfourteen.
     2646All code is compiled at \texttt{-O2} by gcc or g++ 6.3.0, with all \CC code compiled as \CCfourteen.
    27032647The benchmarks are run on an Ubuntu 16.04 workstation with 16 GB of RAM and a 6-core AMD FX-6300 CPU with 3.5 GHz maximum clock frequency.
    27042648
     
    27182662                                                                        & \CT{C}        & \CT{\CFA}     & \CT{\CC}      & \CT{\CCV}             \\ \hline
    27192663maximum memory usage (MB)                       & 10,001        & 2,502         & 2,503         & 11,253                \\
    2720 source code size (lines)                        & 201           & 191           & 125           & 294                   \\
     2664source code size (lines)                        & 196           & 186           & 125           & 290                   \\
    27212665redundant type annotations (lines)      & 27            & 0                     & 2                     & 16                    \\
    27222666binary size (KB)                                        & 14            & 257           & 14            & 37                    \\
     
    28212765data-parallel features have not yet been added to \CFA, but are easily incorporated within its design, while concurrency primitives similar to those in $\mu$\CC have already been added~\cite{Delisle18}.
    28222766Finally, CCured~\cite{Necula02} and Ironclad \CC~\cite{DeLozier13} attempt to provide a more memory-safe C by annotating pointer types with garbage collection information; type-checked polymorphism in \CFA covers several of C's memory-safety issues, but more aggressive approaches such as annotating all pointer types with their nullability or requiring runtime garbage collection are contradictory to \CFA's backwards compatibility goals.
     2767
     2768
     2769\begin{comment}
     2770\subsection{Control Structures / Declarations / Literals}
     2771
     2772Java has default fall through like C/\CC.
     2773Pascal/Ada/Go/Rust do not have default fall through.
     2774\Csharp does not have fall through but still requires a break.
     2775Python uses dictionary mapping. \\
     2776\CFA choose is like Rust match.
     2777
     2778Java has labelled break/continue. \\
     2779Languages with and without exception handling.
     2780
     2781Alternative C declarations. \\
     2782Different references \\
     2783Constructors/destructors
     2784
     27850/1 Literals \\
     2786user defined: D, Objective-C
     2787\end{comment}
    28232788
    28242789
     
    29102875}
    29112876_Bool stack_empty( const stack * s ) {
    2912         return s->head == NULL;
     2877         return s->head == NULL;
    29132878}
    29142879void push_stack( stack * s, void * v ) {
    2915         node * n = malloc( sizeof(node) ); /***/
     2880        node * n = malloc(sizeof(node)); /***/
    29162881        *n = (node){ v, s->head }; /***/
    29172882        s->head = n;
     
    29432908        };
    29442909        struct stack { node(T) * head; };
    2945         void ?{}( stack(T) & s, stack(T) t ) { // copy
     2910        void ?{}( stack(T) & s ) { (s.head){ 0 }; }
     2911        void ?{}( stack(T) & s, stack(T) t ) {
    29462912                node(T) ** cr = &s.head;
    29472913                for ( node(T) * nx = t.head; nx; nx = nx->next ) {
     
    29572923                        nx = cr->next;
    29582924                        ^(*cr){};
    2959                         free( cr );
     2925                        free(cr);
    29602926                }
    29612927                head = 0;
    29622928        }
    2963 
    29642929\end{cfa}
    29652930&
    29662931\begin{cfa}[xleftmargin=0pt,aboveskip=0pt,belowskip=0pt]
    2967         void ?{}( stack(T) & s ) { (s.head){ 0 }; }
    29682932        void ^?{}( stack(T) & s) { clear( s ); }
    29692933        stack(T) ?=?( stack(T) & s, stack(T) t ) {
     
    29902954        }
    29912955}
     2956
    29922957\end{cfa}
    29932958\end{tabular}
     
    30383003                return *this;
    30393004        }
    3040         bool empty() const {
    3041                 return head == nullptr;
    3042         }
     3005        bool empty() const { return head == nullptr; }
    30433006        void push( const T & value ) {
    30443007                head = new node{ value, head };  /***/
     
    30523015        }
    30533016};
     3017
     3018
    30543019
    30553020\end{cfa}
     
    31013066                return *this;
    31023067        }
    3103         bool empty() const {
    3104                 return head == nullptr;
    3105         }
     3068        bool empty() const { return head == nullptr; }
    31063069        void push( const object & value ) {
    31073070                head = new node{ value, head }; /***/
     
    31163079};
    31173080
     3081
     3082
    31183083\end{cfa}
    31193084\end{tabular}
  • doc/papers/general/evaluation/c-stack.c

    r779a4a3 rf465f0e  
    2727}
    2828
    29 stack new_stack() {
    30         return (stack){ NULL }; /***/
    31 }
     29stack new_stack() { return (stack){ NULL }; /***/ }
    3230
    3331stack * assign_stack( stack * s, const stack * t,
     
    3937}
    4038
    41 _Bool stack_empty( const stack * s ) {
    42         return s->head == NULL;
    43 }
     39_Bool stack_empty( const stack * s ) { return s->head == NULL; }
    4440
    4541void push_stack( stack * s, void * v ) {
  • doc/papers/general/evaluation/c-stack.h

    r779a4a3 rf465f0e  
    66} stack;
    77
     8stack new_stack();
    89void copy_stack(stack * dst, const stack * src, void * (* copy)(const void *));
    9 void clear_stack(stack * s, void (*free_el)(void *));
    10 stack new_stack();
    1110stack * assign_stack( stack * dst, const stack * src,
    1211        void * (* copy_el)(const void *), void (* free_el)(void *));
     12void clear_stack(stack * s, void (*free_el)(void *));
    1313
    1414_Bool stack_empty( const stack * s );
  • doc/papers/general/evaluation/cfa-stack.c

    r779a4a3 rf465f0e  
    88        };
    99
    10         void ?{}( stack(T) & s, stack(T) t ) {          // copy
     10        void ?{}( stack(T) & s ) { (s.head){ 0 }; }
     11
     12        void ?{}( stack(T) & s, stack(T) t ) {
    1113                node(T) ** cr = &s.head;
    1214                for ( node(T) * nx = t.head; nx; nx = nx->next ) {
     
    1820        }
    1921
    20         void clear( stack(T) & s ) with( s ) {
     22        void ^?{}( stack(T) & s) { clear( s ); }
     23
     24    void clear( stack(T) & s ) with( s ) {
    2125                for ( node(T) * nx = head; nx; ) {
    2226                        node(T) * cr = nx;
    2327                        nx = cr->next;
    2428                        ^(*cr){};
    25                         free( cr );
     29                        free(cr);
    2630                }
    2731                head = 0;
    2832        }
    29 
    30         void ?{}( stack(T) & s ) { (s.head){ 0 }; }
    31         void ^?{}( stack(T) & s) { clear( s ); }
    3233
    3334        stack(T) ?=?( stack(T) & s, stack(T) t ) {
     
    3839        }
    3940
    40         _Bool empty( const stack(T) & s ) {
    41                 return s.head == 0;
    42         }
     41        _Bool empty( const stack(T) & s ) { return s.head == 0; }
    4342
    4443        void push( stack(T) & s, T value ) with( s ) {
  • doc/papers/general/evaluation/cfa-stack.h

    r779a4a3 rf465f0e  
    77        };
    88
     9        void ?{}( stack(T) & s );
    910        void ?{}( stack(T) & s, stack(T) t );
     11        void ^?{}( stack(T) & s);
    1012        void clear( stack(T) & s );
    11         void ?{}( stack(T) & s );
    12         void ^?{}( stack(T) & s);
    1313
    1414        stack(T) ?=?( stack(T) & s, stack(T) t );
  • doc/papers/general/evaluation/cpp-stack.hpp

    r779a4a3 rf465f0e  
    1010        node * head;
    1111
    12         void copy( const stack<T> & o ) {
    13                 node ** cr = &head;
    14                 for ( node * nx = o.head; nx; nx = nx->next ) {
    15                         *cr = new node{ nx->value }; /***/
    16                         cr = &(*cr)->next;
    17                 }
    18                 *cr = nullptr;
    19         }
     12        stack() : head( nullptr ) {}
     13        stack( const stack<T> & o ) { copy( o ); }
    2014
    2115        void clear() {
     
    2822        }
    2923
    30         stack() : head( nullptr ) {}
    31         stack( const stack<T> & o ) { copy( o ); }
     24        void copy( const stack<T> & o ) {
     25                node ** cr = &head;
     26                for ( node * nx = o.head; nx; nx = nx->next ) {
     27                        *cr = new node{ nx->value }; /***/
     28                        cr = &(*cr)->next;
     29                }
     30                *cr = nullptr;
     31        }
     32
    3233        ~stack() { clear(); }
    3334
    34         stack & operator=( const stack<T> & o ) {
     35        stack & operator= ( const stack<T> & o ) {
    3536                if ( this == &o ) return *this;
    3637                clear();
     
    3940        }
    4041
    41         bool empty() const {
    42                 return head == nullptr;
    43         }
     42        bool empty() const { return head == nullptr; }
    4443
    45         void push( const T & value ) {
    46                 head = new node{ value, head };  /***/
    47         }
     44        void push( const T & value ) { head = new node{ value, head };  /***/ }
    4845
    4946        T pop() {
  • doc/papers/general/evaluation/cpp-vstack.cpp

    r779a4a3 rf465f0e  
    33
    44stack::node::node( const object & v, node * n ) : value( v.new_copy() ), next( n ) {}
     5
     6void stack::clear() {
     7        for ( node * nx = head; nx; ) {
     8                node * cr = nx;
     9                nx = cr->next;
     10                delete cr;
     11        }
     12        head = nullptr;
     13}
    514
    615void stack::copy( const stack & o ) {
     
    1120        }
    1221        *cr = nullptr;
    13 }
    14 
    15 void stack::clear() {
    16         for ( node * nx = head; nx; ) {
    17                 node * cr = nx;
    18                 nx = cr->next;
    19                 delete cr;
    20         }
    21         head = nullptr;
    2222}
    2323
     
    3333}
    3434
    35 bool stack::empty() const {
    36         return head == nullptr;
    37 }
     35bool stack::empty() const { return head == nullptr; }
    3836
    39 void stack::push( const object & value ) {
    40         head = new node{ value, head }; /***/
    41 }
     37void stack::push( const object & value ) { head = new node{ value, head }; /***/ }
    4238
    4339ptr<object> stack::pop() {
  • doc/papers/general/evaluation/cpp-vstack.hpp

    r779a4a3 rf465f0e  
    1010        node * head;
    1111
     12        void clear();
    1213        void copy( const stack & o );
    13         void clear();
    1414
    1515        stack();
  • doc/papers/general/evaluation/timing.dat

    r779a4a3 rf465f0e  
    11"400 million repetitions"       "C"     "\\CFA{}"       "\\CC{}"        "\\CC{obj}"
    2 "push\nint"     2911    2034    1504    3246
    3 "copy\nint"     2953    1622    1526    3075
    4 "clear\nint"    1397    754     753     1452
    5 "pop\nint"      1446    1203    760     5016
    6 "push\npair"    3673    2297    955     6971
    7 "copy\npair"    6027    1183    998     7204
    8 "clear\npair"   2840    773     748     3511
    9 "pop\npair"     3025    5414    813     23867
    10 
     2"push\nint"     3002    2459    1542    3269
     3"copy\nint"     2985    2057    1539    3083
     4"clear\nint"    1374    827     756     1469
     5"pop\nint"      1416    1221    760     5098
     6"push\npair"    4214    2752    950     6873
     7"copy\npair"    6127    2105    987     7293
     8"clear\npair"   2881    885     751     3460
     9"pop\npair"     3046    5434    822     24962
  • doc/papers/general/evaluation/timing.gp

    r779a4a3 rf465f0e  
    2424set yrange [0:10]
    2525
    26 set label "23.9" at 7.125,10.5
     26set label "25.0" at 7.125,10.5
    2727
    2828# set datafile separator ","
  • doc/refrat/Makefile

    r779a4a3 rf465f0e  
    3434
    3535DOCUMENT = refrat.pdf
    36 BASE = ${basename ${DOCUMENT}}
    3736
    3837# Directives #
     
    4342
    4443clean :
    45         @rm -frv ${DOCUMENT} ${BASE}.ps ${Build}
     44        @rm -frv ${DOCUMENT} ${basename ${DOCUMENT}}.ps ${Build}
    4645
    4746# File Dependencies #
    4847
    49 ${DOCUMENT} : ${BASE}.ps
     48${DOCUMENT} : ${basename ${DOCUMENT}}.ps
    5049        ps2pdf $<
    5150
    52 ${BASE}.ps : ${BASE}.dvi
     51${basename ${DOCUMENT}}.ps : ${basename ${DOCUMENT}}.dvi
    5352        dvips ${Build}/$< -o $@
    5453
    55 ${BASE}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
     54${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
    5655                ${Macros}/common.tex ${Macros}/lstlang.sty ${Macros}/indexstyle ../bibliography/pl.bib
    5756        # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run.
     
    7170
    7271predefined :
    73         sed -f predefined.sed ${BASE}.tex > ${basename $@}.cf
     72        sed -f predefined.sed ${basename ${DOCUMENT}}.tex > ${basename $@}.cf
    7473
    7574## Define the default recipes.
     
    7877        mkdir -p ${Build}
    7978
    80 %.tex : %.fig ${Build}
     79%.tex : %.fig
    8180        fig2dev -L eepic $< > ${Build}/$@
    8281
    83 %.ps : %.fig ${Build}
     82%.ps : %.fig
    8483        fig2dev -L ps $< > ${Build}/$@
    8584
    86 %.pstex : %.fig ${Build}
     85%.pstex : %.fig
    8786        fig2dev -L pstex $< > ${Build}/$@
    8887        fig2dev -L pstex_t -p ${Build}/$@ $< > ${Build}/$@_t
  • doc/user/Makefile

    r779a4a3 rf465f0e  
    3838
    3939DOCUMENT = user.pdf
    40 BASE = ${basename ${DOCUMENT}}
    4140
    4241# Directives #
     
    4746
    4847clean :
    49         @rm -frv ${DOCUMENT} ${BASE}.ps ${Build}
     48        @rm -frv ${DOCUMENT} ${basename ${DOCUMENT}}.ps ${Build}
    5049
    5150# File Dependencies #
    5251
    53 ${DOCUMENT} : ${BASE}.ps
     52${DOCUMENT} : ${basename ${DOCUMENT}}.ps
    5453        ps2pdf $<
    5554
    56 ${BASE}.ps : ${BASE}.dvi
     55${basename ${DOCUMENT}}.ps : ${basename ${DOCUMENT}}.dvi
    5756        dvips ${Build}/$< -o $@
    5857
    59 ${BASE}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
     58${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
    6059                ${Macros}/common.tex ${Macros}/lstlang.sty ${Macros}/indexstyle ../bibliography/pl.bib
    6160        # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run.
     
    7978        mkdir -p ${Build}
    8079
    81 %.tex : %.fig ${Build}
     80%.tex : %.fig
    8281        fig2dev -L eepic $< > ${Build}/$@
    8382
    84 %.ps : %.fig ${Build}
     83%.ps : %.fig
    8584        fig2dev -L ps $< > ${Build}/$@
    8685
    87 %.pstex : %.fig ${Build}
     86%.pstex : %.fig
    8887        fig2dev -L pstex $< > ${Build}/$@
    8988        fig2dev -L pstex_t -p ${Build}/$@ $< > ${Build}/$@_t
  • src/CodeGen/CodeGenerator.cc

    r779a4a3 rf465f0e  
    887887                if ( asmStmt->get_instruction() ) asmStmt->get_instruction()->accept( *visitor );
    888888                output << " )" ;
    889         }
    890 
    891         void CodeGenerator::postvisit( DirectiveStmt * dirStmt ) {
    892                 output << dirStmt->directive;
    893889        }
    894890
  • src/CodeGen/CodeGenerator.h

    r779a4a3 rf465f0e  
    9999                void postvisit( ExprStmt * );
    100100                void postvisit( AsmStmt * );
    101                 void postvisit( DirectiveStmt * );
    102101                void postvisit( AsmDecl * );                            // special: statement in declaration context
    103102                void postvisit( IfStmt * );
  • src/Common/PassVisitor.h

    r779a4a3 rf465f0e  
    7171        virtual void visit( ExprStmt * exprStmt ) override final;
    7272        virtual void visit( AsmStmt * asmStmt ) override final;
    73         virtual void visit( DirectiveStmt * dirStmt ) override final;
    7473        virtual void visit( IfStmt * ifStmt ) override final;
    7574        virtual void visit( WhileStmt * whileStmt ) override final;
     
    169168        virtual Statement * mutate( ExprStmt * exprStmt ) override final;
    170169        virtual Statement * mutate( AsmStmt * asmStmt ) override final;
    171         virtual Statement * mutate( DirectiveStmt * dirStmt ) override final;
    172170        virtual Statement * mutate( IfStmt * ifStmt ) override final;
    173171        virtual Statement * mutate( WhileStmt * whileStmt ) override final;
  • src/Common/PassVisitor.impl.h

    r779a4a3 rf465f0e  
    777777
    778778//--------------------------------------------------------------------------
    779 // AsmStmt
    780 template< typename pass_type >
    781 void PassVisitor< pass_type >::visit( DirectiveStmt * node ) {
    782         VISIT_START( node )
    783 
    784         VISIT_END( node );
    785 }
    786 
    787 template< typename pass_type >
    788 Statement * PassVisitor< pass_type >::mutate( DirectiveStmt * node ) {
    789         MUTATE_START( node );
    790 
    791         MUTATE_END( Statement, node );
    792 }
    793 
    794 //--------------------------------------------------------------------------
    795779// IfStmt
    796780template< typename pass_type >
  • src/Common/SemanticError.cc

    r779a4a3 rf465f0e  
    77// SemanticError.cc --
    88//
    9 // Author           : Thierry Delisle
     9// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May  2 18:13:37 2018
    13 // Update Count     : 8
     12// Last Modified On : Tue Aug 29 18:17:35 2017
     13// Update Count     : 3
    1414//
    1515
    1616#include <cstdarg>
    1717#include <cstdio>                                                                               // for fileno, stderr
    18 #include <cstring>
    1918#include <unistd.h>                                                                             // for isatty
    2019#include <iostream>                                                                             // for basic_ostream, operator<<, ostream
    2120#include <list>                                                                                 // for list, _List_iterator
    2221#include <string>                                                                               // for string, operator<<, operator+, to_string
    23 #include <vector>
    2422
    2523#include "Common/utility.h"                                                             // for to_string, CodeLocation (ptr only)
    2624#include "SemanticError.h"
    2725
    28 //-----------------------------------------------------------------------------
    29 // Severity Handling
    30 std::vector<Severity> & get_severities() {
    31         static std::vector<Severity> severities;
    32         if(severities.empty()) {
    33                 severities.reserve((size_t)Warning::NUMBER_OF_WARNINGS);
    34                 for ( const auto w : WarningFormats ) {
    35                         severities.push_back( w.default_severity );
    36                 } // for
    37         }
    38         return severities;
    39 }
    40 
    41 void SemanticWarning_SuppressAll() {
    42         for( auto & s : get_severities() ) {
    43                 s = Severity::Suppress;
    44         }
    45 }
    46 
    47 void SemanticWarning_EnableAll() {
    48         for( auto & s : get_severities() ) {
    49                 s = Severity::Warn;
    50         }
    51 }
    52 
    53 void SemanticWarning_WarningAsError() {
    54         for( auto & s : get_severities() ) {
    55                 if(s == Severity::Warn) s = Severity::Error;
    56         }
    57 }
    58 
    59 void SemanticWarning_Set(const char * const name, Severity s) {
    60         size_t idx = 0;
    61         for ( const auto & w : WarningFormats ) {
    62                 if ( std::strcmp( name, w.name ) == 0 ) {
    63                         get_severities()[idx] = s;
    64                         break;
    65                 }
    66                 idx++;
    67         }
    68 }
    69 
    70 //-----------------------------------------------------------------------------
    71 // Semantic Error
    7226SemanticErrorException::SemanticErrorException( CodeLocation location, std::string error ) {
    7327        append( location, error );
     
    11569
    11670void SemanticWarningImpl( CodeLocation location, Warning warning, const char * const fmt, ... ) {
    117         Severity severity = get_severities()[(int)warning];
     71        Severity severity = WarningFormats[(int)warning].severity;
    11872        switch(severity) {
    11973        case Severity::Suppress :
  • src/Common/SemanticError.h

    r779a4a3 rf465f0e  
    77// SemanticError.h --
    88//
    9 // Author           : Thierry Delisle
     9// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May  2 18:13:15 2018
    13 // Update Count     : 29
     12// Last Modified On : Thu Apr 19 17:52:03 2018
     13// Update Count     : 19
    1414//
    1515
     
    1717
    1818#include "ErrorObjects.h"
    19 #include <cstring>
    2019
    2120//-----------------------------------------------------------------------------
     
    4746        const char * const name;
    4847        const char * const message;
    49         const Severity default_severity;
     48        mutable Severity severity;
    5049};
    5150
    52 constexpr WarningData WarningFormats[] = {
    53         {"self-assign"            , "self assignment of expression: %s"            , Severity::Warn},
    54         {"reference-conversion"   , "rvalue to reference conversion of rvalue: %s" , Severity::Warn},
     51constexpr const WarningData WarningFormats[] = {
     52        {"self-assign"         , "self assignment of expression: %s"           , Severity::Warn},
     53        {"reference-conversion", "rvalue to reference conversion of rvalue: %s", Severity::Warn},
    5554        {"qualifiers-zero_t-one_t", "questionable use of type qualifier %s with %s", Severity::Warn},
    5655};
     
    7271void SemanticWarningImpl (CodeLocation loc, Warning warn, const char * const fmt, ...) __attribute__((format(printf, 3, 4)));
    7372
    74 void SemanticWarning_SuppressAll   ();
    75 void SemanticWarning_EnableAll     ();
    76 void SemanticWarning_WarningAsError();
    77 void SemanticWarning_Set           (const char * const name, Severity s);
    78 
    79 // SKULLDUGGERY: cfa.cc is built before SemanticError.cc but needs this routine.
    80 static inline bool SemanticWarning_Exist(const char * const name) {
    81         for ( const auto & w : WarningFormats ) {
    82                 if ( std::strcmp( name, w.name ) == 0 ) return true;
    83         }
    84         return false;
    85 }
    8673
    8774//-----------------------------------------------------------------------------
  • src/Common/module.mk

    r779a4a3 rf465f0e  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk --
     8## module.mk -- 
    99##
    1010## Author           : Richard C. Bilson
     
    1818       Common/UniqueName.cc \
    1919       Common/DebugMalloc.cc \
    20        Common/Assert.cc \
    21        Common/Heap.cc
     20       Common/Assert.cc
  • src/Common/utility.h

    r779a4a3 rf465f0e  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu May  3 12:18:31 2018
    13 // Update Count     : 39
     12// Last Modified On : Fri Apr 20 22:35:33 2018
     13// Update Count     : 38
    1414//
    1515
     
    441441
    442442template<typename T>
    443 inline
    444 #if __GNUC__ > 4
    445 constexpr
    446 #endif
    447 T ilog2(const T & t) {
    448         if(std::is_integral<T>::value) {
     443inline constexpr T ilog2(const T & t) {
     444        if ( std::is_integral<T>::value ) {
    449445                const constexpr int r = sizeof(t) * __CHAR_BIT__ - 1;
    450                 if( sizeof(T) == sizeof(unsigned       int) ) return r - __builtin_clz  ( t );
    451                 if( sizeof(T) == sizeof(unsigned      long) ) return r - __builtin_clzl ( t );
    452                 if( sizeof(T) == sizeof(unsigned long long) ) return r - __builtin_clzll( t );
    453         }
    454         assert(false);
     446                if ( sizeof(T) == sizeof(unsigned int ) ) return r - __builtin_clz( t );
     447                if ( sizeof(T) == sizeof(unsigned long) ) return r - __builtin_clzl( t );
     448                if ( sizeof(T) == sizeof(unsigned long long) ) return r - __builtin_clzll( t );
     449        } // if
    455450        return -1;
    456 } // ilog2
     451} // ilong2
    457452
    458453
  • src/Makefile.in

    r779a4a3 rf465f0e  
    164164        Common/driver_cfa_cpp-DebugMalloc.$(OBJEXT) \
    165165        Common/driver_cfa_cpp-Assert.$(OBJEXT) \
    166         Common/driver_cfa_cpp-Heap.$(OBJEXT) \
    167166        ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT) \
    168167        ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) \
     
    487486        Concurrency/Waitfor.cc Common/SemanticError.cc \
    488487        Common/UniqueName.cc Common/DebugMalloc.cc Common/Assert.cc \
    489         Common/Heap.cc ControlStruct/LabelGenerator.cc \
    490         ControlStruct/LabelFixer.cc ControlStruct/MLEMutator.cc \
    491         ControlStruct/Mutate.cc ControlStruct/ForExprMutator.cc \
     488        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
     489        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
     490        ControlStruct/ForExprMutator.cc \
    492491        ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \
    493492        GenPoly/GenPoly.cc GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc \
     
    673672        Common/$(DEPDIR)/$(am__dirstamp)
    674673Common/driver_cfa_cpp-Assert.$(OBJEXT): Common/$(am__dirstamp) \
    675         Common/$(DEPDIR)/$(am__dirstamp)
    676 Common/driver_cfa_cpp-Heap.$(OBJEXT): Common/$(am__dirstamp) \
    677674        Common/$(DEPDIR)/$(am__dirstamp)
    678675ControlStruct/$(am__dirstamp):
     
    976973@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-Assert.Po@am__quote@
    977974@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Po@am__quote@
    978 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-Heap.Po@am__quote@
    979975@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Po@am__quote@
    980976@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
     
    13121308@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-Assert.obj `if test -f 'Common/Assert.cc'; then $(CYGPATH_W) 'Common/Assert.cc'; else $(CYGPATH_W) '$(srcdir)/Common/Assert.cc'; fi`
    13131309
    1314 Common/driver_cfa_cpp-Heap.o: Common/Heap.cc
    1315 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-Heap.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-Heap.Tpo -c -o Common/driver_cfa_cpp-Heap.o `test -f 'Common/Heap.cc' || echo '$(srcdir)/'`Common/Heap.cc
    1316 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-Heap.Tpo Common/$(DEPDIR)/driver_cfa_cpp-Heap.Po
    1317 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/Heap.cc' object='Common/driver_cfa_cpp-Heap.o' libtool=no @AMDEPBACKSLASH@
    1318 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1319 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-Heap.o `test -f 'Common/Heap.cc' || echo '$(srcdir)/'`Common/Heap.cc
    1320 
    1321 Common/driver_cfa_cpp-Heap.obj: Common/Heap.cc
    1322 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-Heap.obj -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-Heap.Tpo -c -o Common/driver_cfa_cpp-Heap.obj `if test -f 'Common/Heap.cc'; then $(CYGPATH_W) 'Common/Heap.cc'; else $(CYGPATH_W) '$(srcdir)/Common/Heap.cc'; fi`
    1323 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-Heap.Tpo Common/$(DEPDIR)/driver_cfa_cpp-Heap.Po
    1324 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Common/Heap.cc' object='Common/driver_cfa_cpp-Heap.obj' libtool=no @AMDEPBACKSLASH@
    1325 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1326 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-Heap.obj `if test -f 'Common/Heap.cc'; then $(CYGPATH_W) 'Common/Heap.cc'; else $(CYGPATH_W) '$(srcdir)/Common/Heap.cc'; fi`
    1327 
    13281310ControlStruct/driver_cfa_cpp-LabelGenerator.o: ControlStruct/LabelGenerator.cc
    13291311@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelGenerator.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelGenerator.o `test -f 'ControlStruct/LabelGenerator.cc' || echo '$(srcdir)/'`ControlStruct/LabelGenerator.cc
  • src/Parser/ParseNode.h

    r779a4a3 rf465f0e  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr 30 09:19:17 2018
    13 // Update Count     : 831
     12// Last Modified On : Sun Apr 29 14:04:05 2018
     13// Update Count     : 830
    1414//
    1515
     
    416416Statement * build_finally( StatementNode * stmt );
    417417Statement * build_compound( StatementNode * first );
    418 Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
    419 Statement * build_directive( std::string * directive );
     418Statement * build_asmstmt( bool voltile, Expression * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr );
     419Statement * build_dirstmt( std::string * directive );
    420420WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when );
    421421WaitForStmt * build_waitfor( ExpressionNode * target, StatementNode * stmt, ExpressionNode * when, WaitForStmt * existing );
  • src/Parser/StatementNode.cc

    r779a4a3 rf465f0e  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Apr 30 09:21:16 2018
    13 // Update Count     : 354
     12// Last Modified On : Sun Apr 29 14:21:45 2018
     13// Update Count     : 353
    1414//
    1515
     
    310310}
    311311
    312 Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output, ExpressionNode * input, ExpressionNode * clobber, LabelNode * gotolabels ) {
     312Statement * build_asmstmt( bool voltile, Expression * instruction, ExpressionNode * output, ExpressionNode * input, ExpressionNode * clobber, LabelNode * gotolabels ) {
    313313        std::list< Expression * > out, in;
    314314        std::list< ConstantExpr * > clob;
     
    320320}
    321321
    322 Statement * build_directive( string * directive ) {
    323         return new DirectiveStmt( *directive );
     322Statement * build_dirstmt( string * directive ) {
     323        cout << *directive << endl;
     324        return nullptr;
    324325}
    325326
  • src/Parser/lex.ll

    r779a4a3 rf465f0e  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu May  3 13:42:40 2018
    13  * Update Count     : 676
     12 * Last Modified On : Sun Apr 29 14:10:49 2018
     13 * Update Count     : 675
    1414 */
    1515
     
    174174}
    175175
    176                                 /* preprocessor-style directives */
     176                                /* ignore preprocessor-style directives (for now) */
    177177^{h_white}*"#"[^\n]*"\n" { RETURN_VAL( DIRECTIVE ); }
    178178
  • src/Parser/parser.yy

    r779a4a3 rf465f0e  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu May  3 08:20:09 2018
    13 // Update Count     : 3225
     12// Last Modified On : Sun Apr 29 14:20:17 2018
     13// Update Count     : 3206
    1414//
    1515
     
    877877        | asm_statement
    878878        | DIRECTIVE
    879                 { $$ = new StatementNode( build_directive( $1 ) ); }
     879                { $$ = new StatementNode( build_dirstmt( $1 ) ); }
    880880        ;
    881881
     
    12071207asm_statement:
    12081208        ASM asm_volatile_opt '(' string_literal ')' ';'
    1209                 { $$ = new StatementNode( build_asm( $2, $4, 0 ) ); }
     1209                { $$ = new StatementNode( build_asmstmt( $2, $4, 0 ) ); }
    12101210        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ')' ';' // remaining GCC
    1211                 { $$ = new StatementNode( build_asm( $2, $4, $6 ) ); }
     1211                { $$ = new StatementNode( build_asmstmt( $2, $4, $6 ) ); }
    12121212        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ':' asm_operands_opt ')' ';'
    1213                 { $$ = new StatementNode( build_asm( $2, $4, $6, $8 ) ); }
     1213                { $$ = new StatementNode( build_asmstmt( $2, $4, $6, $8 ) ); }
    12141214        | ASM asm_volatile_opt '(' string_literal ':' asm_operands_opt ':' asm_operands_opt ':' asm_clobbers_list_opt ')' ';'
    1215                 { $$ = new StatementNode( build_asm( $2, $4, $6, $8, $10 ) ); }
     1215                { $$ = new StatementNode( build_asmstmt( $2, $4, $6, $8, $10 ) ); }
    12161216        | ASM asm_volatile_opt GOTO '(' string_literal ':' ':' asm_operands_opt ':' asm_clobbers_list_opt ':' label_list ')' ';'
    1217                 { $$ = new StatementNode( build_asm( $2, $5, 0, $8, $10, $12 ) ); }
     1217                { $$ = new StatementNode( build_asmstmt( $2, $5, 0, $8, $10, $12 ) ); }
    12181218        ;
    12191219
     
    24052405        | ASM '(' string_literal ')' ';'                                        // GCC, global assembler statement
    24062406                {
    2407                         $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asm( false, $3, 0 ) ) );
     2407                        $$ = DeclarationNode::newAsmStmt( new StatementNode( build_asmstmt( false, $3, 0 ) ) );
    24082408                }
    24092409        | EXTERN STRINGliteral                                                          // C++-style linkage specifier
     
    24512451        | declaration_qualifier_list type_qualifier_list
    24522452                {
    2453                         // forall must be in the type_qualifier_list
    2454                         if ( $2->type->forall ) xxx = forall = true; // remember generic type
     2453                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
    24552454                }
    24562455          push '{' external_definition_list '}'                         // CFA, namespace
  • src/ResolvExpr/AlternativeFinder.cc

    r779a4a3 rf465f0e  
    459459        /// Adds type variables to the open variable set and marks their assertions
    460460        void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions ) {
    461                 for ( Type::ForallList::const_iterator tyvar = type->forall.begin(); tyvar != type->forall.end(); ++tyvar ) {
     461                for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    462462                        unifiableVars[ (*tyvar)->get_name() ] = TypeDecl::Data{ *tyvar };
    463                         for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->assertions.begin(); assert != (*tyvar)->assertions.end(); ++assert ) {
     463                        for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->get_assertions().begin(); assert != (*tyvar)->get_assertions().end(); ++assert ) {
    464464                                needAssertions[ *assert ].isUsed = true;
    465465                        }
  • src/ResolvExpr/AlternativeFinder.h

    r779a4a3 rf465f0e  
    126126        void printAlts( const AltList &list, std::ostream &os, unsigned int indentAmt = 0 );
    127127
    128         /// Adds type variables to the open variable set and marks their assertions
    129         void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions );
    130 
    131128        template< typename InputIterator >
    132129        void simpleCombineEnvironments( InputIterator begin, InputIterator end, TypeEnvironment &result ) {
  • src/ResolvExpr/Resolver.cc

    r779a4a3 rf465f0e  
    544544                                                        OpenVarSet openVars;
    545545                                                        AssertionSet resultNeed, resultHave;
    546                                                         TypeEnvironment resultEnv( func.env );
    547                                                         makeUnifiableVars( function, openVars, resultNeed );
    548                                                         // add all type variables as open variables now so that those not used in the parameter
    549                                                         // list are still considered open.
    550                                                         resultEnv.add( function->forall );
     546                                                        TypeEnvironment resultEnv;
    551547
    552548                                                        // Load type variables from arguemnts into one shared space
     
    587583                                                                        ss << "' to '";
    588584                                                                        arg.expr->get_result()->print( ss );
    589                                                                         ss << "' with env '";
    590                                                                         resultEnv.print(ss);
    591585                                                                        ss << "'\n";
    592586                                                                        SemanticError( function, ss.str() );
  • src/SynTree/Mutator.h

    r779a4a3 rf465f0e  
    3939        virtual Statement * mutate( ExprStmt * exprStmt ) = 0;
    4040        virtual Statement * mutate( AsmStmt * asmStmt ) = 0;
    41         virtual Statement * mutate( DirectiveStmt * dirStmt ) = 0;
    4241        virtual Statement * mutate( IfStmt * ifStmt ) = 0;
    4342        virtual Statement * mutate( WhileStmt * whileStmt ) = 0;
  • src/SynTree/Statement.cc

    r779a4a3 rf465f0e  
    9494
    9595
    96 DirectiveStmt::DirectiveStmt( const std::string & directive ) : Statement(), directive( directive ) {}
    97 
    98 void DirectiveStmt::print( std::ostream &os, Indenter ) const {
    99         os << "GCC Directive:" << directive << endl;
    100 }
    101 
    102 
    10396const char *BranchStmt::brType[] = { "Goto", "Break", "Continue" };
    10497
  • src/SynTree/Statement.h

    r779a4a3 rf465f0e  
    126126};
    127127
    128 class DirectiveStmt : public Statement {
    129         public:
    130         std::string directive;
    131 
    132         DirectiveStmt( const std::string & );
    133         virtual ~DirectiveStmt(){}
    134 
    135         virtual DirectiveStmt * clone() const { return new DirectiveStmt( *this ); }
    136         virtual void accept( Visitor & v ) { v.visit( this ); }
    137         virtual Statement * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    138         virtual void print( std::ostream & os, Indenter indent = {} ) const;
    139 };
    140 
    141128class IfStmt : public Statement {
    142129  public:
  • src/SynTree/SynTree.h

    r779a4a3 rf465f0e  
    4444class ExprStmt;
    4545class AsmStmt;
    46 class DirectiveStmt;
    4746class IfStmt;
    4847class WhileStmt;
  • src/SynTree/Visitor.h

    r779a4a3 rf465f0e  
    4141        virtual void visit( ExprStmt * exprStmt ) = 0;
    4242        virtual void visit( AsmStmt * asmStmt ) = 0;
    43         virtual void visit( DirectiveStmt * directiveStmt ) = 0;
    4443        virtual void visit( IfStmt * ifStmt ) = 0;
    4544        virtual void visit( WhileStmt * whileStmt ) = 0;
  • src/benchmark/bench.h

    r779a4a3 rf465f0e  
    66        #include <stdlib.h>
    77        #include <unistd.h>                                     // sysconf
    8 #if ! defined(__cforall)
     8        #include <sys/times.h>                                  // times
    99        #include <time.h>
    10         #include <sys/time.h>
    11 #else
     10#if defined(__cforall)
    1211}
    13 #include <time>
     12//#include <bits/cfatime.h>
    1413#endif
    1514
    1615
    17 static inline unsigned long long int bench_time() {
     16static inline unsigned long long int Time() {
    1817    struct timespec ts;
    1918    clock_gettime(
     
    4241        }                                               \
    4342        long long int StartTime, EndTime;       \
    44         StartTime = bench_time();               \
     43        StartTime = Time();                     \
    4544        statement;                                      \
    46         EndTime = bench_time();                 \
     45        EndTime = Time();                               \
    4746        unsigned long long int output =         \
    4847        ( EndTime - StartTime ) / n;
    4948
    50 #if defined(__cforall)
    51 Duration default_preemption() {
     49__cfa_time_t default_preemption() {
    5250        return 0;
    5351}
    54 #endif
  • src/benchmark/ctxswitch/cfa_cor.c

    r779a4a3 rf465f0e  
    11#include <stdio.h>
    2 #include <kernel>
    32#include <thread>
    43
  • src/driver/Makefile.am

    r779a4a3 rf465f0e  
    1111## Created On       : Sun May 31 08:49:31 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon Apr 30 17:44:17 2018
    14 ## Update Count     : 11
     13## Last Modified On : Fri Oct 28 13:46:06 2016
     14## Update Count     : 10
    1515###############################################################################
    1616
    1717# applies to both programs
    18 AM_CXXFLAGS = -Wall -O2 -g -std=c++14 -I${abs_top_srcdir}/src
     18AM_CXXFLAGS = -Wall -O2 -g -std=c++14
    1919if BUILD_NO_LIB
    2020else
  • src/driver/Makefile.in

    r779a4a3 rf465f0e  
    294294
    295295# applies to both programs
    296 AM_CXXFLAGS = -Wall -O2 -g -std=c++14 -I${abs_top_srcdir}/src \
    297         $(am__append_1) $(am__append_2) $(am__append_3)
     296AM_CXXFLAGS = -Wall -O2 -g -std=c++14 $(am__append_1) $(am__append_2) \
     297        $(am__append_3)
    298298cfa_SOURCES = cfa.cc
    299299
  • src/driver/cfa.cc

    r779a4a3 rf465f0e  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May  2 17:57:43 2018
    13 // Update Count     : 224
     12// Last Modified On : Mon Feb  5 22:05:28 2018
     13// Update Count     : 166
    1414//
    1515
     
    1919#include <unistd.h>                                                                             // execvp
    2020#include <string>                                                                               // STL version
    21 #include <string.h>                                                                             // strcmp
    22 
    23 #include "Common/SemanticError.h"
     21
    2422#include "config.h"                                                                             // configure info
    2523
     
    162160                                args[nargs] = argv[i];                                  // pass the argument along
    163161                                nargs += 1;
    164                         } else if ( arg == "-w" ) {
    165                                 args[nargs] = argv[i];                                  // pass the argument along
    166                                 nargs += 1;
    167                                 args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
    168                                 nargs += 1;
    169                         } else if ( prefix( arg, "-W" ) ) {                     // check before next tests
    170                                 if ( arg == "-Werror" || arg == "-Wall" ) {
    171                                         args[nargs] = argv[i];                          // pass the argument along
    172                                         nargs += 1;
    173                                         args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str(); // add the argument for cfa-cpp
    174                                         nargs += 1;
    175                                 } else {
    176                                         unsigned int adv = prefix( arg, "-Wno-" ) ? 5 : 2;
    177                                         args[nargs] = argv[i];                          // conditionally pass the argument along
    178                                         const char * warning = argv[i] + adv;     // extract warning
    179                                         if ( SemanticWarning_Exist( warning ) ) { // replace the argument for cfa-cpp
    180                                                 args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + arg ) ).c_str();
    181                                         } // if
    182                                         nargs += 1;
    183                                 } // if
    184162                        } else if ( prefix( arg, "-B" ) ) {
    185163                                Bprefix = arg.substr(2);                                // strip the -B flag
     
    269247                #if ! defined(HAVE_LIBCFA_RELEASE)
    270248                        if( !debug ) {
    271                                 cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;
     249                                cerr << "error: Option -nodebug is not available, libcfa was not installed." << endl;
    272250                                exit( EXIT_FAILURE );
    273251                                }
     
    275253                #if ! defined(HAVE_LIBCFA_DEBUG)
    276254                        if( debug ) {
    277                                 cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;
     255                                cerr << "error: Option -debug is not available, libcfa-d was not installed." << endl;
    278256                                exit( EXIT_FAILURE );
    279257                                }
  • src/libcfa/concurrency/preemption.c

    r779a4a3 rf465f0e  
    404404}
    405405
    406 //=============================================================================================
    407 // Kernel Signal Debug
    408 //=============================================================================================
    409 
    410 void __cfaabi_check_preemption() {
    411         bool ready = TL_GET( preemption_state ).enabled;
    412         if(!ready) { abort("Preemption should be ready"); }
    413 
    414         sigset_t oldset;
    415         int ret;
    416         ret = sigprocmask(0, NULL, &oldset);
    417         if(ret != 0) { abort("ERROR sigprocmask returned %d", ret); }
    418 
    419         ret = sigismember(&oldset, SIGUSR1);
    420         if(ret <  0) { abort("ERROR sigismember returned %d", ret); }
    421 
    422         if(ret == 1) { abort("ERROR SIGUSR1 is disabled"); }
    423 }
    424 
    425406// Local Variables: //
    426407// mode: c //
  • src/libcfa/concurrency/thread

    r779a4a3 rf465f0e  
    2020
    2121#include "coroutine"
    22 #include "kernel"
    2322#include "monitor"
    2423
  • src/libcfa/interpose.c

    r779a4a3 rf465f0e  
    1010// Created On       : Wed Mar 29 16:10:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May  1 15:05:35 2018
    13 // Update Count     : 83
     12// Last Modified On : Thu Feb  8 16:18:09 2018
     13// Update Count     : 75
    1414//
    1515
     
    9595void sigHandler_fpe  ( __CFA_SIGPARMS__ );
    9696void sigHandler_abort( __CFA_SIGPARMS__ );
    97 void sigHandler_term ( __CFA_SIGPARMS__ );
    9897
    9998struct {
     
    115114                __cfaabi_sigaction( SIGFPE , sigHandler_fpe  , SA_SIGINFO ); // Failure handler
    116115                __cfaabi_sigaction( SIGABRT, sigHandler_abort, SA_SIGINFO ); // Failure handler
    117                 __cfaabi_sigaction( SIGTERM, sigHandler_term , SA_SIGINFO ); // Failure handler
    118                 __cfaabi_sigaction( SIGINT , sigHandler_term , SA_SIGINFO ); // Failure handler
    119116        }
    120117}
     
    271268}
    272269
    273 void sigHandler_term( __CFA_SIGPARMS__ ) {
    274         abort( "Application stopped by %s signal.", sig == SIGINT ? "an interrupt (SIGINT)" : "a terminate (SIGTERM)" );
    275 }
    276 
    277270// Local Variables: //
    278271// mode: c //
  • src/main.cc

    r779a4a3 rf465f0e  
     1
    12//
    23// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     
    1011// Created On       : Fri May 15 23:12:02 2015
    1112// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May  2 14:59:02 2018
    13 // Update Count     : 490
     13// Last Modified On : Tue Oct 31 12:22:40 2017
     14// Update Count     : 445
    1415//
    1516
     
    3435#include "CodeTools/DeclStats.h"            // for printDeclStats
    3536#include "CodeTools/TrackLoc.h"             // for fillLocations
     37#include "Common/PassVisitor.h"
    3638#include "Common/CompilerError.h"           // for CompilerError
    37 #include "Common/Heap.h"
    38 #include "Common/PassVisitor.h"
    3939#include "Common/SemanticError.h"           // for SemanticError
    4040#include "Common/UnimplementedError.h"      // for UnimplementedError
     
    175175        signal( SIGABRT, sigAbortHandler );
    176176
    177         // std::cout << "main" << std::endl;
    178         // for ( int i = 0; i < argc; i += 1 ) {
    179         //      std::cout << '\t' << argv[i] << std::endl;
    180         // } // for
    181 
    182177        parse_cmdline( argc, argv, filename );                          // process command-line arguments
    183178        CodeGen::FixMain::setReplaceMain( !nomainp );
     
    359354                OPTPRINT( "end" )
    360355
    361 
    362356                if ( output != &cout ) {
    363357                        delete output;
     
    390384
    391385        deleteAll( translationUnit );
    392         HeapStats::printStats();
    393386        return 0;
    394387} // main
     
    423416        opterr = 0;                                                                                     // (global) prevent getopt from printing error messages
    424417
    425         bool Werror = false;
    426418        int c;
    427         while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrstTvwW:yzZD:F:", long_opts, &long_index )) != -1 ) {
     419        while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrstTvyzZD:F:", long_opts, &long_index )) != -1 ) {
    428420                switch ( c ) {
    429421                  case Ast:
     
    461453                        yydebug = true;
    462454                        break;
    463                   case 'G':                                                                             // dump AST after instantiate generics
     455                  case 'G':                   // dump AST after instantiate generics
    464456                        genericsp = true;
    465457                        break;
     
    509501                  case 'v':                                                                             // dump AST after decl validation pass
    510502                        validp = true;
    511                         break;
    512                   case 'w':
    513                         SemanticWarning_SuppressAll();
    514                         break;
    515                   case 'W':
    516                         if ( strcmp( optarg, "all" ) == 0 ) {
    517                                 SemanticWarning_EnableAll();
    518                         } else if ( strcmp( optarg, "error" ) == 0 ) {
    519                                 Werror = true;
    520                         } else {
    521                                 char * warning = optarg;
    522                                 Severity s;
    523                                 if ( strncmp( optarg, "no-", 3 ) == 0 ) {
    524                                         warning += 3;
    525                                         s = Severity::Suppress;
    526                                 } else {
    527                                         s = Severity::Warn;
    528                                 } // if
    529                                 SemanticWarning_Set( warning, s );
    530                         } // if
    531503                        break;
    532504                  case 'y':                                                                             // dump AST on error
     
    558530                } // switch
    559531        } // while
    560 
    561         if ( Werror ) {
    562                 SemanticWarning_WarningAsError();
    563         } // if
    564         // for ( const auto w : WarningFormats ) {
    565         //      cout << w.name << ' ' << (int)w.severity << endl;
    566         // } // for
    567532} // parse_cmdline
    568533
  • src/tests/concurrent/examples/boundedBufferEXT.c

    r779a4a3 rf465f0e  
    88// Created On       : Wed Apr 18 22:52:12 2018
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Wed May  2 16:12:58 2018
    11 // Update Count     : 7
     10// Last Modified On : Fri Apr 20 22:25:14 2018
     11// Update Count     : 6
    1212//
    1313
     
    2222enum { BufferSize = 50 };
    2323
    24 forall( otype T ) {
    25         monitor Buffer {
    26                 int front, back, count;
    27                 T elements[BufferSize];
    28         }; // Buffer
     24forall( otype T )
     25monitor Buffer {
     26        int front, back, count;
     27        T elements[BufferSize];
     28};
    2929
    30         void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
     30forall( otype T )
     31void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
    3132
    32         int query( Buffer(T) & buffer ) { return buffer.count; } // read-only, no mutual exclusion
     33forall( otype T )
     34int query( Buffer(T) & buffer ) { return buffer.count; }
    3335
    34         T remove( Buffer(T) & mutex buffer );                           // forward
     36forall( otype T )                                                                               // forward
     37T remove( Buffer(T) & mutex buffer );
    3538
    36         void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
    37                 if ( count == BufferSize ) waitfor( remove, buffer );
    38                 elements[back] = elem;
    39                 back = ( back + 1 ) % BufferSize;
    40                 count += 1;
    41         } // insert
     39forall( otype T )
     40void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
     41        if ( count == BufferSize ) waitfor( remove, buffer );
     42        elements[back] = elem;
     43        back = ( back + 1 ) % BufferSize;
     44        count += 1;
     45}
    4246
    43         T remove( Buffer(T) & mutex buffer ) with( buffer ) {
    44                 if ( count == 0 ) waitfor( insert, buffer );
    45                 T elem = elements[front];
    46                 front = ( front + 1 ) % BufferSize;
    47                 count -= 1;
    48                 return elem;
    49         } // remove
     47forall( otype T )
     48T remove( Buffer(T) & mutex buffer ) with( buffer ) {
     49        if ( count == 0 ) waitfor( insert, buffer );
     50        T elem = elements[front];
     51        front = ( front + 1 ) % BufferSize;
     52        count -= 1;
     53        return elem;
    5054}
    5155
  • src/tests/concurrent/examples/boundedBufferINT.c

    r779a4a3 rf465f0e  
    88// Created On       : Mon Oct 30 12:45:13 2017
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Thu Apr 26 23:08:17 2018
    11 // Update Count     : 82
     10// Last Modified On : Fri Apr 20 22:18:18 2018
     11// Update Count     : 78
    1212//
    1313
     
    2222enum { BufferSize = 50 };
    2323
    24 forall( otype T ) {
    25         monitor Buffer {
    26                 condition full, empty;
    27                 int front, back, count;
    28                 T elements[BufferSize];
    29         }; // Buffer
     24forall( otype T )
     25monitor Buffer {
     26        condition full, empty;
     27        int front, back, count;
     28        T elements[BufferSize];
     29};
    3030
    31         void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
     31forall( otype T )
     32void ?{}( Buffer(T) & buffer ) with( buffer ) { [front, back, count] = 0; }
    3233
    33         int query( Buffer(T) & buffer ) { return buffer.count; } // read-only, no mutual exclusion
     34forall( otype T )
     35int query( Buffer(T) & buffer ) { return buffer.count; }
    3436
    35         void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
    36                 if ( count == BufferSize ) wait( empty );
    37                 elements[back] = elem;
    38                 back = ( back + 1 ) % BufferSize;
    39                 count += 1;
    40                 signal( full );
    41         } // insert
     37forall( otype T )
     38void insert( Buffer(T) & mutex buffer, T elem ) with( buffer ) {
     39        if ( count == BufferSize ) wait( empty );
     40        elements[back] = elem;
     41        back = ( back + 1 ) % BufferSize;
     42        count += 1;
     43        signal( full );
     44}
    4245
    43         T remove( Buffer(T) & mutex buffer ) with( buffer ) {
    44                 if ( count == 0 ) wait( full );
    45                 T elem = elements[front];
    46                 front = ( front + 1 ) % BufferSize;
    47                 count -= 1;
    48                 signal( empty );
    49                 return elem;
    50         } // remove
     46forall( otype T )
     47T remove( Buffer(T) & mutex buffer ) with( buffer ) {
     48        if ( count == 0 ) wait( full );
     49        T elem = elements[front];
     50        front = ( front + 1 ) % BufferSize;
     51        count -= 1;
     52        signal( empty );
     53        return elem;
    5154}
    5255
  • src/tests/concurrent/preempt.c

    r779a4a3 rf465f0e  
    1717#endif
    1818
    19 extern void __cfaabi_check_preemption();
    20 
    2119static volatile int counter = 0;
    2220
     
    3129void main(worker_t & this) {
    3230        while(counter < N) {
    33                 __cfaabi_check_preemption();
    3431                if( (counter % 7) == this.value ) {
    35                         __cfaabi_check_preemption();
    3632                        int next = __atomic_add_fetch_4(&counter, 1, __ATOMIC_SEQ_CST);
    37                         __cfaabi_check_preemption();
    3833                        if( (next % 100) == 0 ) printf("%d\n", (int)next);
    39                         __cfaabi_check_preemption();
    4034                }
    41                 __cfaabi_check_preemption();
    4235        }
    4336}
Note: See TracChangeset for help on using the changeset viewer.