Changes in / [341bb80:6d44da1]


Ignore:
Files:
113 added
95 deleted
65 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    r341bb80 r6d44da1  
    3838libcfa/prelude/gcc-builtins.cf
    3939libcfa/prelude/gcc-builtins.c
    40 libcfa/prelude/prelude.cf
     40libcfa/prelude/prelude.cfa
    4141libcfa/x64-debug/
    4242libcfa/x64-nodebug/
     
    5656src/Parser/parser.h
    5757src/Parser/parser.hh
     58src/demangler
    5859
    5960tools/prettyprinter/parser.output
  • Jenkinsfile

    r341bb80 r6d44da1  
    128128                        //Run the tests from the tests directory
    129129                        if ( Settings.RunAllTests ) {
    130                                 sh 'make --no-print-directory -C tests all-tests debug=yes'
    131                                 sh 'make --no-print-directory -C tests all-tests debug=no '
     130                                sh 'make --no-print-directory -C tests timeouts="--timeout=600" all-tests debug=yes'
     131                                sh 'make --no-print-directory -C tests timeouts="--timeout=600" all-tests debug=no '
    132132                        }
    133133                        else {
  • automake/cfa.m4

    r341bb80 r6d44da1  
    5757
    5858AC_DEFUN([M4CFA_CANNON_CPU], [
    59         case $arch_name in
     59        case $1 in
    6060                "host") arch_name=${host_cpu};;
    61                 *) ;;
     61                *) arch_name=$1;;
    6262        esac
    6363
  • benchmark/Makefile.am

    r341bb80 r6d44da1  
    3333TIME_FORMAT = "%E"
    3434PRINT_FORMAT = %20s: #Comments needed for spacing
    35 
    36 LIBFIBRE_DIR ?= /home/tdelisle/software/KOS/src/
    3735
    3836.NOTPARALLEL:
     
    111109
    112110## =========================================================================================================
    113 ctxswitch$(EXEEXT): \
     111CTXSWITCH_DEPEND  =                \
    114112        loop.run                                \
    115113        function.run                    \
     
    121119        ctxswitch-upp_coroutine.run     \
    122120        ctxswitch-upp_thread.run        \
    123         -ctxswitch-kos_fibre.run        \
    124         -ctxswitch-kos_fibre2.run       \
    125121        ctxswitch-goroutine.run         \
    126122        ctxswitch-java_thread.run
    127123
     124if WITH_LIBFIBRE
     125CTXSWITCH_DEPEND  +=           \
     126        ctxswitch-kos_fibre.run  \
     127        ctxswitch-kos_fibre2.run
     128
     129
     130ctxswitch-kos_fibre$(EXEEXT):
     131        @$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
     132
     133ctxswitch-kos_fibre2$(EXEEXT):
     134        @$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
     135endif
     136
     137ctxswitch$(EXEEXT): $(CTXSWITCH_DEPEND)
     138
    128139ctxswitch-pthread$(EXEEXT):
    129140        @$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c
     
    143154ctxswitch-upp_thread$(EXEEXT):
    144155        @$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc
    145 
    146 ctxswitch-kos_fibre$(EXEEXT):
    147         @$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
    148 
    149 ctxswitch-kos_fibre2$(EXEEXT):
    150         @$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
    151156
    152157ctxswitch-goroutine$(EXEEXT):
  • benchmark/Makefile.in

    r341bb80 r6d44da1  
    9393host_triplet = @host@
    9494noinst_PROGRAMS =
     95@WITH_LIBFIBRE_TRUE@am__append_1 = \
     96@WITH_LIBFIBRE_TRUE@    ctxswitch-kos_fibre.run  \
     97@WITH_LIBFIBRE_TRUE@    ctxswitch-kos_fibre2.run
     98
    9599subdir = benchmark
    96100ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
     
    278282TIME_FORMAT = "%E"
    279283PRINT_FORMAT = %20s: #Comments needed for spacing
     284CTXSWITCH_DEPEND = loop.run function.run fetch_add.run \
     285        ctxswitch-pthread.run ctxswitch-cfa_coroutine.run \
     286        ctxswitch-cfa_thread.run ctxswitch-cfa_thread2.run \
     287        ctxswitch-upp_coroutine.run ctxswitch-upp_thread.run \
     288        ctxswitch-goroutine.run ctxswitch-java_thread.run \
     289        $(am__append_1)
    280290testdir = $(top_srcdir)/tests
    281291all: all-am
     
    470480
    471481
    472 .cfa.o: $(CFACC) $(CFACPP)
     482.cfa.o:
    473483        $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
    474484        $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
    475485        $(am__mv) $$depbase.Tpo $$depbase.Po
    476486
     487<<<<<<< HEAD
    477488.cfa.lo:
    478489        $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
     
    482493LIBFIBRE_DIR ?= /home/tdelisle/software/KOS/src/
    483494
     495=======
     496>>>>>>> master
    484497.NOTPARALLEL:
    485498
     
    551564        $(COMPILE) -DBENCH_N=500000000  fetch_add.c
    552565
    553 ctxswitch$(EXEEXT): \
    554         loop.run                                \
    555         function.run                    \
    556         fetch_add.run                   \
    557         ctxswitch-pthread.run           \
    558         ctxswitch-cfa_coroutine.run     \
    559         ctxswitch-cfa_thread.run        \
    560         ctxswitch-cfa_thread2.run       \
    561         ctxswitch-upp_coroutine.run     \
    562         ctxswitch-upp_thread.run        \
    563         -ctxswitch-kos_fibre.run        \
    564         -ctxswitch-kos_fibre2.run       \
    565         ctxswitch-goroutine.run         \
    566         ctxswitch-java_thread.run
     566@WITH_LIBFIBRE_TRUE@ctxswitch-kos_fibre$(EXEEXT):
     567@WITH_LIBFIBRE_TRUE@    @$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
     568
     569@WITH_LIBFIBRE_TRUE@ctxswitch-kos_fibre2$(EXEEXT):
     570@WITH_LIBFIBRE_TRUE@    @$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
     571
     572ctxswitch$(EXEEXT): $(CTXSWITCH_DEPEND)
    567573
    568574ctxswitch-pthread$(EXEEXT):
     
    583589ctxswitch-upp_thread$(EXEEXT):
    584590        @$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc
    585 
    586 ctxswitch-kos_fibre$(EXEEXT):
    587         @$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
    588 
    589 ctxswitch-kos_fibre2$(EXEEXT):
    590         @$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
    591591
    592592ctxswitch-goroutine$(EXEEXT):
  • configure

    r341bb80 r6d44da1  
    630630GREP
    631631CPP
     632WITH_LIBFIBRE_FALSE
     633WITH_LIBFIBRE_TRUE
    632634RANLIB
    633635LEXLIB
     
    25282530
    25292531
     2532
    25302533# don't use the default CFLAGS as they unconditonnaly add -O2
    25312534: ${CFLAGS=""}
     
    34593462
    34603463
    3461         case $arch_name in
     3464        case ${arch_name} in
    34623465                "host") arch_name=${host_cpu};;
    3463                 *) ;;
     3466                *) arch_name=${arch_name};;
    34643467        esac
    34653468
     
    34983501
    34993502
    3500         case $arch_name in
     3503        case ${host_cpu} in
    35013504                "host") arch_name=${host_cpu};;
    3502                 *) ;;
     3505                *) arch_name=${host_cpu};;
    35033506        esac
    35043507
     
    54385441
    54395442# Checks for libraries.
     5443{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fibre::yield in -lfibre" >&5
     5444$as_echo_n "checking for Fibre::yield in -lfibre... " >&6; }
     5445if ${ac_cv_lib_fibre_Fibre__yield+:} false; then :
     5446  $as_echo_n "(cached) " >&6
     5447else
     5448  ac_check_lib_save_LIBS=$LIBS
     5449LIBS="-lfibre  $LIBS"
     5450cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     5451/* end confdefs.h.  */
     5452
     5453/* Override any GCC internal prototype to avoid an error.
     5454   Use char because int might match the return type of a GCC
     5455   builtin and then its argument prototype would still apply.  */
     5456#ifdef __cplusplus
     5457extern "C"
     5458#endif
     5459char Fibre::yield ();
     5460int
     5461main ()
     5462{
     5463return Fibre::yield ();
     5464  ;
     5465  return 0;
     5466}
     5467_ACEOF
     5468if ac_fn_c_try_link "$LINENO"; then :
     5469  ac_cv_lib_fibre_Fibre__yield=yes
     5470else
     5471  ac_cv_lib_fibre_Fibre__yield=no
     5472fi
     5473rm -f core conftest.err conftest.$ac_objext \
     5474    conftest$ac_exeext conftest.$ac_ext
     5475LIBS=$ac_check_lib_save_LIBS
     5476fi
     5477{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fibre_Fibre__yield" >&5
     5478$as_echo "$ac_cv_lib_fibre_Fibre__yield" >&6; }
     5479if test "x$ac_cv_lib_fibre_Fibre__yield" = xyes; then :
     5480  HAVE_LIBFIBRE=1
     5481else
     5482  HAVE_LIBFIBRE=0
     5483fi
     5484
     5485 if test "$HAVE_LIBFIBRE" -eq 1; then
     5486  WITH_LIBFIBRE_TRUE=
     5487  WITH_LIBFIBRE_FALSE='#'
     5488else
     5489  WITH_LIBFIBRE_TRUE='#'
     5490  WITH_LIBFIBRE_FALSE=
     5491fi
     5492
    54405493
    54415494# Checks for header files.
     
    64776530if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then
    64786531  as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined.
     6532Usually this means the macro was only invoked conditionally." "$LINENO" 5
     6533fi
     6534if test -z "${WITH_LIBFIBRE_TRUE}" && test -z "${WITH_LIBFIBRE_FALSE}"; then
     6535  as_fn_error $? "conditional \"WITH_LIBFIBRE\" was never defined.
    64796536Usually this means the macro was only invoked conditionally." "$LINENO" 5
    64806537fi
  • configure.ac

    r341bb80 r6d44da1  
    204204
    205205# Checks for libraries.
     206AC_CHECK_LIB([fibre], [Fibre::yield], [HAVE_LIBFIBRE=1], [HAVE_LIBFIBRE=0])
     207AM_CONDITIONAL([WITH_LIBFIBRE], [test "$HAVE_LIBFIBRE" -eq 1])
    206208
    207209# Checks for header files.
  • doc/bibliography/pl.bib

    r341bb80 r6d44da1  
    701701% B
    702702
     703@article{Michael13,
     704    contributer = {pabuhr@plg},
     705    author      = {Maged M. Michael},
     706    title       = {The Balancing Act of Choosing Nonblocking Features},
     707    journal     = cacm,
     708    volume      = 56,
     709    number      = 9,
     710    month       = sep,
     711    year        = 2013,
     712    pages       = {46--53},
     713    publisher   = {ACM},
     714    address     = {New York, NY, USA},
     715}
     716
    703717@incollection{beta:old,
    704718    keywords    = {beta, patterns, virtual types},
     
    908922
    909923@misc{Cforall,
     924    contributer = {pabuhr@plg},
    910925    key         = {Cforall},
    911     title       = {\textsf{C}{$\mathbf{\forall}$} Features},
    912     howpublished= {\url{https://plg.uwaterloo.ca/~cforall/features}},
     926    author      = {{\textsf{C}{$\mathbf{\forall}$} Features}},
     927    howpublished= {\href{https://plg.uwaterloo.ca/~cforall/features}{https://\-plg.uwaterloo.ca/\-~cforall/\-features}},
    913928    optnote     = {Accessed: 2018-01-01},
    914929}
     
    926941
    927942@misc{CFAStackEvaluation,
     943    contributer = {a3moss@plg},
    928944    author      = {Aaron Moss},
    929945    title       = {\textsf{C}$\mathbf{\forall}$ Stack Evaluation Programs},
    930946    year        = 2018,
    931     howpublished= {\href{https://cforall.uwaterloo.ca/CFAStackEvaluation.zip}{\textcolor{blue}{Q4: https://cforall.uwaterloo.ca/\-CFAStackEvaluation.zip}}},
     947    howpublished= {\href{https://cforall.uwaterloo.ca/CFAStackEvaluation.zip}{https://cforall.uwaterloo.ca/\-CFAStackEvaluation.zip}},
    932948    optnote     = {[Accessed May 2018]},
    933949}
    934950
    935951@article{Moss18,
    936     keywords    = {concurrency, C++},
     952    keywords    = {type systems, tuples, Cforall},
    937953    contributer = {pabuhr@plg},
    938954    author      = {Aaron Moss and Robert Schluntz and Peter A. Buhr},
    939955    title       = {\textsf{C}$\mathbf{\forall}$ : Adding Modern Programming Language Features to C},
    940956    year        = 2018,
     957    month       = aug,
    941958    journal     = spe,
    942     note        = {Accepted, to appear},
     959    note        = {\href{http://dx.doi.org/10.1002/spe.2624}{http://\-dx.doi.org/\-10.1002/\-spe.2624}},
    943960}
    944961
     
    962979    comment     = {
    963980        The evidence given is thin.
    964         }
     981    },
    965982}
    966983
     
    14161433}
    14171434
     1435@misc{NThreadCode13,
     1436    keywords    = {N-thread software-solution mutual exclusion},
     1437    contributer = {pabuhr@plg},
     1438    key         = {concurrent locking},
     1439    author      = {Peter A. Buhr and David Dice and Wim H. Hesselink},
     1440    title       = {concurrent-locking},
     1441    howpublished= {\href{https://github.com/pabuhr/concurrent-locking}{https://\-github.com/\-pabuhr/\-concurrent-locking}},
     1442    optnote     = {[Accessed April 2017]},
     1443}
     1444
    14181445@incollection{Reppy93,
    14191446    keywords    = {ML, concurrency, continuation passing},
     
    14891516    month       = dec,
    14901517    year        = 2017,
    1491     note        = {\href{http://plg.uwaterloo.ca/~usystem/pub/uSystem/u++-7.0.0.sh}{http://\-plg.\-uwaterloo.\-ca/\-$\sim$usystem/\-pub/\-uSystem/\-u++-7.0.0.sh}},
     1518    note        = {\href{https://plg.uwaterloo.ca/~usystem/pub/uSystem/uC++.pdf}{https://\-plg.uwaterloo.ca/\-~usystem/\-pub/\-uSystem/uC++.pdf}},
    14921519}
    14931520
     
    15561583}
    15571584
     1585@mastersthesis{Sun15,
     1586    author      = {Sun, Xianda},
     1587    title       = {Concurrent High-performance Persistent Hash Table In {J}ava},
     1588    school      = {School of Computer Science, University of Waterloo},
     1589    year        = 2015,
     1590    optaddress  = {Waterloo, Ontario, Canada, N2L 3G1},
     1591    note        = {\href{https://uwspace.uwaterloo.ca/handle/10012/10013}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/\-10013}},
     1592}
     1593
    15581594@book{Andrews91:book,
    15591595    keywords    = {concurrency},
     
    15801616
    15811617@mastersthesis{Delisle18,
    1582     author      = {Thierry Delisle },
     1618    keywords    = {concurrency, Cforall},
     1619    contributer = {pabuhr@plg},
     1620    author      = {Thierry Delisle},
    15831621    title       = {Concurrency in \textsf{C}$\mathbf{\forall}$},
    15841622    school      = {School of Computer Science, University of Waterloo},
    15851623    year        = 2018,
    1586     address     = {Waterloo, Ontario, Canada, N2L 3G1},
     1624    optaddress  = {Waterloo, Ontario, Canada, N2L 3G1},
    15871625    note        = {\href{https://uwspace.uwaterloo.ca/handle/10012/12888}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/\-12888}},
     1626}
     1627
     1628@article{Delisle18b,
     1629    keywords    = {concurrency, Cforall},
     1630    contributer = {pabuhr@plg},
     1631    author      = {Thierry Delisle and Peter A. Buhr},
     1632    title       = {Concurrency in \textsf{C}$\mathbf{\forall}$},
     1633    year        = 2018,
     1634    journal     = spe,
     1635    pages       = {1-32},
     1636    note        = {submitted},
    15881637}
    15891638
     
    18271876    key         = {Peter Buhr},
    18281877    title       = {CS343},
    1829     year        = 2017,
     1878    year        = 2018,
    18301879    howpublished= {\href{https://www.student.cs.uwaterloo.ca/~cs343}{https://\-www.student.cs.uwaterloo.ca/\-~cs343}},
    18311880}
     
    28642913    keywords    = {concurrency, mutual exclusion, performance experiment, software solutions},
    28652914    title       = {Fast mutual exclusion by the {T}riangle algorithm},
    2866     author      = {Wim H. Hesselink and Peter Buhr and David Dice},
     2915    author      = {Wim H. Hesselink and Peter A. Buhr and David Dice},
    28672916    journal     = ccpe,
    28682917    volume      = 30,
     
    28712920    month       = feb,
    28722921    publisher   = {John Wiley \& Sons},
    2873     note        = {\url{https://doi.org/10.1002/cpe.4183}}
     2922    note        = {\href{https://doi.org/10.1002/cpe.4183}{https://\-doi.org/\-10.1002/\-cpe.4183}}
    28742923}
    28752924
     
    32833332    edition     = {{S}imon {M}arlow},
    32843333    year        = 2010,
    3285     note        = {\href{https://haskell.org/definition/haskell2010.pdf}{https://haskell.org/\-definition/\-haskell2010.pdf}},
     3334    note        = {\href{https://haskell.org/definition/haskell2010.pdf}{https://\-haskell.org/\-definition/\-haskell2010.pdf}},
    32863335}
    32873336
     
    33573406}
    33583407
    3359 @article{Hesselink17,
     3408@article{Hesselink17b,
    33603409    keywords    = {concurrency, mutual exclusion, performance experiment, software solutions},
    33613410    title       = {High-Contention Mutual Exclusion by Elevator Algorithms},
    3362     author      = {Peter Buhr and David Dice and Wim H. Hesselink},
     3411    author      = {Peter A. Buhr and David Dice and Wim H. Hesselink},
    33633412    journal     = ccpe,
    3364     volumeopt   = 30,
    3365     numberopt   = 4,
     3413    volume      = 30,
     3414    number      = 18,
    33663415    year        = 2018,
    3367     month       = may,
     3416    month       = sep,
    33683417    publisher   = {John Wiley \& Sons},
    3369     note        = {\url{https://doi-org.proxy.lib.uwaterloo.ca/10.1002/cpe.4475}}
     3418    note        = {\href{https://doi-org.proxy.lib.uwaterloo.ca/10.1002/cpe.4475}{https://\-doi-org.proxy.lib.uwaterloo.ca/\-10.1002/\-cpe.4475}},
    33703419}
    33713420
     
    38463895% K
    38473896
     3897@inproceedings{Buhr96b,
     3898    author      = {Peter A. Buhr and Martin Karsten and Jun Shih},
     3899    title       = {{\small\textsf{KDB}}: A Multi-threaded Debugger for Multi-threaded Applications},
     3900    booktitle   = {Proceedings of SPDT'96: SIGMETRICS Symposium on Parallel and Distributed Tools},
     3901    publisher   = {ACM Press},
     3902    address     = {Philadelphia, Pennsylvania, U.S.A.},
     3903    month       = may,
     3904    year        = 1996,
     3905    pages       = {80-87},
     3906}
     3907
    38483908@article{Duggan96,
    38493909    keywords    = {concurrency, critical section},
    38503910    contributer = {pabuhr@plg},
    3851     author      = {Dominic Duggan and G. V. Cormack and John Ophel},
     3911    author      = {Dominic Duggan and Gordon V. Cormack and John Ophel},
    38523912    title       = {Kinded Type Inference for Parametric Overloading},
    38533913    journal     = acta,
     
    45334593% N
    45344594
     4595@techreport{Drepper03,
     4596    keywords    = {NPTL, threading, 1:1 model},
     4597    contributer = {pabuhr@plg},
     4598    author      = {Ulrich Drepper and Ingo Molnar},
     4599    title       = {The Native POSIX Thread Library for Linux},
     4600    institution = {Red Hat},
     4601    year        = 2003,
     4602    note        = {\href{http://www.cs.utexas.edu/~witchel/372/lectures/POSIX_Linux_Threading.pdf}{http://www.cs.utexas.edu/\-$\sim$witchel/\-372/\-lectures/\-POSIX\_Linux\_Threading.pdf}},
     4603}
     4604
    45354605@article{Haddon77,
    45364606    keywords    = {monitors, nested monitor calls},
     
    46564726    volume      = 9,
    46574727    pages       = {157-164},
     4728}
     4729
     4730@misc{nginx,
     4731    key         = {nginx},
     4732    author      = {{NGINX}},
     4733    howpublished= {\href{https://www.nginx.com}{https://\-www.nginx.com}},
    46584734}
    46594735
     
    47684844@misc{obj-c-book,
    47694845    keywords    = {objective-c},
    4770     contributor = {a3moss@uwaterloo.ca},
     4846    contributor = {pabuhr@plg},
    47714847    key         = {Objective-C},
    4772     title       = {Objective-C},
     4848    author      = {Objective-C},
    47734849    publisher   = {Apple Inc.},
    4774     year        = 2015,
    4775     howpublished= {\href{https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/ObjectiveC.html}{https://developer.apple.com/\-library/\-content/\-documentation/\-General/\-Conceptual/\-DevPedia-\-CocoaCore/\-ObjectiveC.html}},
     4850    year        = 2014,
     4851    howpublished= {\href{https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC}{https://\-developer.apple.com/\-library/archive/\-documentation/\-Cocoa/\-Conceptual/\-ProgrammingWithObjectiveC}},
    47764852    optnote     = {Accessed: 2018-03}
    47774853}
     
    47834859    title       = {{X}code 7 Release Notes},
    47844860    year        = 2015,
    4785     howpublished= {\href{https://developer.apple.com/library/content/documentation/Xcode/Conceptual/RN-Xcode-Archive/Chapters/xc7_release_notes.html}{https://developer.apple.com/\-library/\-content/\-documentation/\-Xcode/\-Conceptual/\-RN-Xcode-Archive/\-Chapters/\-xc7\_release\_notes.html}},
     4861    howpublished= {\href{https://developer.apple.com/library/content/documentation/Xcode/Conceptual/RN-Xcode-Archive/Chapters/xc7_release_notes.html}{https://\-developer.apple.com/\-library/\-content/\-documentation/\-Xcode/\-Conceptual/\-RN-Xcode-Archive/\-Chapters/\-xc7\_release\_notes.html}},
    47864862    optnote     = {Accessed: 2017-04}
    47874863}
     
    52835359}
    52845360
     5361@misc{perf,
     5362    contributer = {pabuhr@plg},
     5363    key         = {perf},
     5364    author      = {perf},
     5365    howpublished= {\href{https://perf.wiki.kernel.org/index.php/Tutorial}{https://\-perf.wiki.kernel.org/\-index.php/\-Tutorial}},
     5366}
     5367
     5368@misc{Verch12,
     5369    contributer = {pabuhr@plg},
     5370    author      = {Shaun Verch},
     5371    title       = {Performance Analysis of 64-Bit Capriccio},
     5372    month       = may,
     5373    year        = 2012,
     5374    howpublished= {\href{http://cs.brown.edu/research/pubs/theses/masters/2012/verch.pdf}{http://cs.brown.edu/\-research/\-pubs/\-theses/\-masters/\-2012/\-verch.pdf}},
     5375    optnote     = {Accessed: 2013-10-4}
     5376}
     5377
    52855378@article{Anderson90,
    52865379    keywords    = {spin locks, back off, performance},
     
    55035596    note        = {Proceedings of the OOPSLA'89 Conference, Oct. 1--6, 1989, New Orleans, Lousiana},
    55045597    abstract    = {},
     5598}
     5599
     5600@inproceedings{Buhr98,
     5601    keywords    = {profiling, monitoring, visualization},
     5602    contributer = {pabuhr@plg},
     5603    author      = {Peter A. Buhr and Robert Denda},
     5604    title       = {{$\mu$Profiler} : Profiling User-Level Threads in a Shared-Memory Programming Environment},
     5605    booktitle   = {Proceedings of the Second International Symposium on Computing in Object-Oriented Parallel Environments (ISCOPE'98)},
     5606    series      = {Lecture Notes in Computer Science},
     5607    publisher   = {Springer-Verlag},
     5608    volume      = 1505,
     5609    opteditor   = {Dennis Caromel and Rodney R. Oldehoeft and Marydell Tholburn},
     5610    address     = {Santa Fe, New Mexico, U.S.A.},
     5611    month       = dec,
     5612    year        = 1998,
     5613    pages       = {159-166},
    55055614}
    55065615
     
    58555964    keywords    = {Cyclone, existential types, polymorphism, type variables},
    58565965    contributer = {a3moss@plg},
    5857     author      = {D. Grossman},
     5966    author      = {Dan Grossman},
    58585967    title       = {Quantified Types in an Imperative Language},
    58595968    journal     = toplas,
     
    59646073}
    59656074
     6075@article{Ronsse03,
     6076    keywords    = {profiling, replay},
     6077    contributer = {pabuhr@plg},
     6078    author      = {Michiel Ronsse and De Bosschere, Koen and Mark Christiaens and Jacques Chassin de Kergommeaux and Dieter Kranzlm\"{u}ller},
     6079    title       = {Record/Replay for Nondeterministic Program Executions},
     6080    journal     = cacm,
     6081    month       = sep,
     6082    year        = 2003,
     6083    volume      = 46,
     6084    number      = 9,
     6085    pages       = {62-67},
     6086}
     6087
    59666088@article{Robinson48,
    59676089    keywords    = {recursion, Ackermann function},
     
    60026124}
    60036125
     6126@mastersthesis{Schuster99,
     6127    author      = {Oliver Schuster},
     6128    title       = {Replay of Concurrent Shared-Memory Programs},
     6129    school      = {Universit\"at Mannheim},
     6130    address     = {Mannheim, Deutschland},
     6131    year        = 1999,
     6132    month       = apr,
     6133    type        = {Diplomarbeit},
     6134    note        = {\href{ftp://plg.uwaterloo.ca/pub/theses/SchusterThesis.ps.gz}{ftp://\-plg.uwaterloo.ca/\-pub/\-theses/\-SchusterThesis.ps.gz}},
     6135}
     6136
    60046137@article{Euclid,
    60056138    keywords    = {Euclid},
     
    60336166    school      = {School of Computer Science, University of Waterloo},
    60346167    year        = 2017,
    6035     address     = {Waterloo, Ontario, Canada, N2L 3G1},
     6168    optaddress  = {Waterloo, Ontario, Canada, N2L 3G1},
    60366169    note        = {\href{https://uwspace.uwaterloo.ca/handle/10012/11830}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/\-11830}},
    60376170}
     
    68606993    contributer = {pabuhr@plg},
    68616994    key         = {TIOBE Index},
    6862     title       = {{TIOBE} Index},
     6995    author      = {{TIOBE Index}},
    68636996    howpublished= {\href{http://www.tiobe.com/tiobe_index}{http://\-www.tiobe.com/\-tiobe\_index}},
    68646997    optnote     = {Accessed: 2018-09},
     
    70007133    year        = 1980
    70017134}
     7135
     7136@misc{TraceCompass,
     7137    contributer = {pabuhr@plg},
     7138    key         = {Trace Compass},
     7139    author      = {{T}race {C}ompass},
     7140    howpublished= {\href{https://projects.eclipse.org/proposals/trace-compass}{https://\-projects.eclipse.org/\-proposals/\-trace-compass}},
     7141}
    70027142 
    70037143@article{Leroy00,
     
    71357275    title       = {Usability Challenges in Exception Handling},
    71367276    booktitle   = {5th International Workshop on Exception Handling (WEH)},
    7137     organization= {16th International Symposium on the Foundations of Software Engineering (FSE 16)},
     7277    optorganization= {16th International Symposium on the Foundations of Software Engineering (FSE 16)},
    71387278    address     = {Zurich, Switzerland},
    71397279    month       = jun,
     
    72797419}
    72807420
     7421@inproceedings{vonBehren03,
     7422    keywords    = {threads, events, web server},
     7423    contributer = {pabuhr@plg},
     7424    author      = {Rob von Behren and Jeremy Condit and Eric Brewer},
     7425    title       = {Why Events Are a Bad Idea (for high-concurrency servers)},
     7426    booktitle   = {HotOS IX: The 9th Workshop on Hot Topics in Operating Systems},
     7427    publisher   = {USENIX Association},
     7428    address     = {Lihue, Hawaii, U.S.A.},
     7429    month       = may,
     7430    year        = 2003,
     7431    pages       = {19-24},
     7432}
     7433
    72817434@techreport{Moss90,
    72827435    keywords    = {Swizzling, database},
     
    73437496    year        = 1986,
    73447497    editor      = {Norman Meyrowitz},
    7345     publisher   = sigplan # " 21(11)",
     7498    publisher   = sigplan,
    73467499    organization= {Association for Computing Machinery},
    73477500    address     = {Portland, Oregon},
    7348     month       = sep # { 29}
     7501    month       = sep,
    73497502}
    73507503
     
    73557508    year        = 1987,
    73567509    editor      = {Norman Meyrowitz},
    7357     publisher   = sigplan # " 22(12)",
     7510    publisher   = sigplan,
    73587511    organization= {Association for Computing Machinery},
    73597512    address     = {Orlando, Florida},
    7360     month       = oct # { 4--8}
     7513    month       = oct,
    73617514}
    73627515
     
    73677520    year        = 1988,
    73687521    editor      = {Norman Meyrowitz},
    7369     publisher   = sigplan # " 23(11)",
     7522    publisher   = sigplan,
    73707523    organization= {Association for Computing Machinery},
    73717524    address     = {San Diego, California},
    7372     month       = sep # { 25--30}
     7525    month       = sep,
    73737526}
    73747527
     
    73797532    year        = 1989,
    73807533    editor      = {Norman Meyrowitz},
    7381     publisher   = sigplan # " 24(10)",
     7534    publisher   = sigplan,
    73827535    organization= {Association for Computing Machinery},
    73837536    address     = {New Orleans, Louisiana},
    7384     month       = oct # { 1--6}
     7537    month       = oct,
    73857538}
    73867539
     
    73917544    year        = 1990,
    73927545    editor      = {Norman Meyrowitz},
    7393     publisher   = sigplan # " 25(10)",
     7546    publisher   = sigplan,
    73947547    organization= {Association for Computing Machinery},
    73957548    address     = {Ottawa, Canada},
    7396     month       = oct # { 21--25}
     7549    month       = oct,
    73977550}
    73987551
     
    74037556    year        = 1991,
    74047557    editor      = {Andreas Paepcke},
    7405     publisher   = sigplan # " 26(11)",
     7558    publisher   = sigplan,
    74067559    organization= {Association for Computing Machinery},
    74077560    address     = {Phoenix, Arizona},
    7408     month       = oct # { 6--11}
    7409 }
     7561    month       = oct,
     7562}
  • doc/papers/general/Paper.tex

    r341bb80 r6d44da1  
    196196\author[1]{Robert Schluntz}
    197197\author[1]{Peter A. Buhr}
    198 \author[]{\textcolor{blue}{Q1 AUTHOR NAMES CORRECT}}
    199198\authormark{MOSS \textsc{et al}}
    200199
     
    208207The C programming language is a foundational technology for modern computing with millions of lines of code implementing everything from hobby projects to commercial operating systems.
    209208This installation base and the programmers producing it represent a massive software engineering investment spanning decades and likely to continue for decades more.
    210 Nevertheless, C, which was first standardized almost 30 \textcolor{blue}{CHANGE ``40'' TO ``30''} years ago, lacks many features that make programming in more modern languages safer and more productive.
     209Nevertheless, C, which was first standardized almost 30 years ago, lacks many features that make programming in more modern languages safer and more productive.
    211210The goal of the \CFA project (pronounced ``C for all'') is to create an extension of C that provides modern safety and productivity features while still ensuring strong backward compatibility with C and its programmers.
    212211Prior projects have attempted similar goals but failed to honor the C programming style;
     
    226225
    227226
     227\vspace*{-10pt}
    228228\section{Introduction}
    229229
    230230The C programming language is a foundational technology for modern computing with millions of lines of code implementing everything from hobby projects to commercial operating systems.
    231231This installation base and the programmers producing it represent a massive software engineering investment spanning decades and likely to continue for decades more.
    232 The TIOBE index~\cite{TIOBE} \textcolor{blue}{CHANGE ``TIOBE'' TO ``The TIOBE index''} ranks the top five most \emph{popular} programming languages as Java 15\%, \Textbf{C 12\%}, \Textbf{\CC 5.5\%}, and Python 5\%, \Csharp 4.5\% = 42\%, where the next 50 languages are less than 4\% each with a long tail.
     232The TIOBE index~\cite{TIOBE} ranks the top five most \emph{popular} programming languages as Java 15\%, \Textbf{C 12\%}, \Textbf{\CC 5.5\%}, and Python 5\%, \Csharp 4.5\% = 42\%, where the next 50 languages are less than 4\% each with a long tail.
    233233The top three rankings over the past 30 years are as follows.
    234 \newpage
    235 \textcolor{blue}{MOVE TABLE HERE}
    236234\begin{center}
    237235\setlength{\tabcolsep}{10pt}
     
    246244\lstMakeShortInline@%
    247245\end{center}
    248 
    249246Love it or hate it, C is extremely popular, highly used, and one of the few systems languages.
    250247In many cases, \CC is often used solely as a better C.
    251 Nevertheless, C, which was first standardized almost 30 \textcolor{blue}{CHANGE ``40'' TO ``30''} years ago~\cite{ANSI89:C}, lacks many features that make programming in more modern languages safer and more productive.
     248Nevertheless, C, which was first standardized almost 30 years ago~\cite{ANSI89:C}, lacks many features that make programming in more modern languages safer and more productive.
    252249
    253250\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 source and runtime compatibility in the familiar C programming model.
     
    281278ultimately, a compiler is necessary for advanced features and optimal performance.
    282279% 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.
    283 Two key translator components are expression analysis, determining expression validity and what operations are required for its implementation, and code generation, dealing with multiple forms of overloading, polymorphism, and multiple return values by converting them into C code for a C compiler that supports none of these features.
     280Two key translator components are expression analysis, determining expression validity and what operations are required for its implementation, and code generation, dealing with multiple forms of overloading, polymorphism, and multiple return values by converting them into the C code for a C compiler that supports none of these features.
    284281Details of these components are available in chapters 2 and 3 in the work of Bilson~\cite{Bilson03} and form the base for the current \CFA translator.
    285282% @plg2[8]% cd cfa-cc/src; cloc libcfa
     
    345342Section~\ref{sec:libraries} includes a number of examples of how this overloading simplifies \CFA programming relative to C.
    346343Code generation for these overloaded functions and variables is implemented by the usual approach of mangling the identifier names to include a representation of their type, while \CFA decides which overload to apply based on the same ``usual arithmetic conversions'' used in C to disambiguate operator overloads.
    347 \textcolor{blue}{REMOVE ``We have the following as an example''}
     344
    348345\newpage
    349 \textcolor{blue}{UPDATE FOLLOWING PROGRAM EXAMPLE WITH ADJUSTED COMMENTS TO FIT PAGE WIDTH.}
    350346\begin{cfa}
    351347int max = 2147483647;                                           $\C[4in]{// (1)}$
     
    362358In some cases, hundreds of names can be reduced to tens, resulting in a significant cognitive reduction.
    363359In the above, the name @max@ has a consistent meaning, and a programmer only needs to remember the single concept: maximum.
    364 To prevent significant ambiguities, \CFA uses the return type in selecting overloads, \eg in the assignment to @m@, the compiler use @m@'s type to unambiguously select the most appropriate call to function @max@ (as does Ada).
     360To prevent significant ambiguities, \CFA uses the return type in selecting overloads, \eg in the assignment to @m@, the compiler uses @m@'s type to unambiguously select the most appropriate call to function @max@ (as does Ada).
    365361As is shown later, there are a number of situations where \CFA takes advantage of available type information to disambiguate, where other programming languages generate ambiguities.
    366362
     
    380376\label{sec:poly-fns}
    381377
    382 The signature feature of \CFA is parametric-polymorphic functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a @forall@ clause (giving the language its name). \textcolor{blue}{REMOVE ``as follows''}
     378The signature feature of \CFA is parametric-polymorphic functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a @forall@ clause (giving the language its name).
    383379\begin{cfa}
    384380`forall( otype T )` T identity( T val ) { return val; }
     
    395391
    396392Since bare polymorphic types provide a restricted set of available operations, \CFA provides a \newterm{type assertion}~\cite[pp.~37-44]{Alphard} mechanism to provide further type information, where type assertions may be variable or function declarations that depend on a polymorphic type variable.
    397 For example, the function @twice@ can be defined using the \CFA syntax for operator overloading. \textcolor{blue}{REMOVE ``as follows''}
     393For example, the function @twice@ can be defined using the \CFA syntax for operator overloading.
    398394\begin{cfa}
    399395forall( otype T `| { T ?+?(T, T); }` ) T twice( T x ) { return x `+` x; }  $\C{// ? denotes operands}$
     
    409405Crucial to the design of a new programming language are the libraries to access thousands of external software features.
    410406Like \CC, \CFA inherits a massive compatible library base, where other programming languages must rewrite or provide fragile interlanguage communication with C.
    411 A simple example is leveraging the existing type-unsafe (@void *@) C @bsearch@ to binary search a sorted float array. \textcolor{blue}{REMOVE ``as follows''}
     407A simple example is leveraging the existing type-unsafe (@void *@) C @bsearch@ to binary search a sorted float array.
    412408\begin{cfa}
    413409void * bsearch( const void * key, const void * base, size_t nmemb, size_t size,
     
    605601To enable interoperation among equivalent instantiations of a generic type, the translator saves the set of instantiations currently in scope and reuses the generated structure declarations where appropriate.
    606602A function declaration that accepts or returns a concrete generic type produces a declaration for the instantiated structure in the same scope, which all callers may reuse.
    607 For example, the concrete instantiation for @pair( const char *, int )@ is \textcolor{blue}{REMOVE ``as follows.''}
     603For example, the concrete instantiation for @pair( const char *, int )@ is
    608604\begin{cfa}
    609605struct _pair_conc0 {
     
    634630If a dynamic generic type is declared to be passed or returned by value from a polymorphic function, the translator can safely assume that the generic type is complete (\ie has a known layout) at any call site, and the offset array is passed from the caller;
    635631if the generic type is concrete at the call site, the elements of this offset array can even be statically generated using the C @offsetof@ macro.
    636 As an example, the body of the second @value@ function is implemented as \textcolor{blue}{REMOVE ``follows.''}
     632As an example, the body of the second @value@ function is implemented as
    637633\begin{cfa}
    638634_assign_T( _retval, p + _offsetof_pair[1] ); $\C{// return *p.second}$
     
    640636\newpage
    641637\noindent
    642 \textcolor{blue}{NO PARAGRAPH INDENT} Here, @_assign_T@ is passed in as an implicit parameter from @otype T@, and takes two @T *@ (@void *@ in the generated code), a destination and a source, and @_retval@ is the pointer to a caller-allocated buffer for the return value, the usual \CFA method to handle dynamically sized return types.
     638Here, @_assign_T@ is passed in as an implicit parameter from @otype T@, and takes two @T *@ (@void *@ in the generated code), a destination and a source, and @_retval@ is the pointer to a caller-allocated buffer for the return value, the usual \CFA method to handle dynamically sized return types.
    643639@_offsetof_pair@ is the offset array passed into @value@;
    644 this array is generated at the call site as \textcolor{blue}{REMOVE ``follows.''}
     640this array is generated at the call site as
    645641\begin{cfa}
    646642size_t _offsetof_pair[] = { offsetof( _pair_conc0, first ), offsetof( _pair_conc0, second ) }
     
    677673
    678674Another useful pattern enabled by reused dtype-static type instantiations is zero-cost \newterm{tag structures}.
    679 Sometimes, information is only used for type checking and can be omitted at runtime. \textcolor{blue}{REMOVE ``As an example, we have the following''}
     675Sometimes, information is only used for type checking and can be omitted at runtime.
    680676\begin{cquote}
    681677\lstDeleteShortInline@%
     
    724720Both approaches are awkward.
    725721% FIX
    726 Alternatively, a programming language can directly support returning multiple values, \eg \CFA provides the following. \textcolor{blue}{REPLACE ``in \CFA, we have the following'' WITH ``\CFA provides the following''}
     722Alternatively, a programming language can directly support returning multiple values, \eg \CFA provides the following.
    727723\begin{cfa}
    728724[ int, int ] div( int num, int den );           $\C{// return two integers}$
     
    745741As such, \CFA allows assigning multiple values from a function into multiple variables, using a square-bracketed list of lvalue expressions (as above), called a \newterm{tuple}.
    746742
    747 However, functions also use \newterm{composition} (nested calls), with the direct consequence that MRVFs must also support composition to be orthogonal with single-returning-value functions (SRVFs), \eg, \CFA provides the following. \textcolor{blue}{REPLACE ``As an example, we have the following'' WITH ``\CFA provides the following''}
     743However, functions also use \newterm{composition} (nested calls), with the direct consequence that MRVFs must also support composition to be orthogonal with single-returning-value functions (SRVFs), \eg, \CFA provides the following.
    748744\begin{cfa}
    749745printf( "%d %d\n", div( 13, 5 ) );                      $\C{// return values seperated into arguments}$
     
    781777printf( "%d %d\n", qr );
    782778\end{cfa}
    783 \CFA also supports \newterm{tuple indexing} to access single components of a tuple expression. \textcolor{blue}{REMOVE ``as follows''}
     779\CFA also supports \newterm{tuple indexing} to access single components of a tuple expression.
    784780\begin{cfa}
    785781[int, int] * p = &qr;                                           $\C{// tuple pointer}$
     
    809805In the call to @f@, @x@ is implicitly flattened so the components of @x@ are passed as two arguments.
    810806In the call to @g@, the values @y@ and @10@ are structured into a single argument of type @[int, int]@ to match the parameter type of @g@.
    811 Finally, in the call to @h@, @x@ is flattened to yield an argument list of length 3, of which the first component of @x@ is passed as the first parameter of @h@, and the second component \textcolor{blue}{CHANGE ``components'' TO ``component''} of @x@ and @y@ are structured into the second argument of type @[int, int]@.
    812 The flexible structure of tuples permits a simple and expressive function call syntax to work seamlessly with both SRVFs and MRVFs \textcolor{blue}{REMOVE ``and''} with any number of arguments of arbitrarily complex structure.
     807Finally, in the call to @h@, @x@ is flattened to yield an argument list of length 3, of which the first component of @x@ is passed as the first parameter of @h@, and the second component of @x@ and @y@ are structured into the second argument of type @[int, int]@.
     808The flexible structure of tuples permits a simple and expressive function call syntax to work seamlessly with both SRVFs and MRVFs with any number of arguments of arbitrarily complex structure.
    813809
    814810
    815811\subsection{Tuple assignment}
    816812
     813\enlargethispage{-10pt}
    817814An assignment where the left side is a tuple type is called \newterm{tuple assignment}.
    818815There are two kinds of tuple assignment depending on whether the right side of the assignment operator has a tuple type or a nontuple type, called \newterm{multiple} and \newterm{mass assignment}, respectively.
     
    828825Both kinds of tuple assignment have parallel semantics, so that each value on the left and right sides is evaluated before any assignments occur.
    829826As a result, it is possible to swap the values in two variables without explicitly creating any temporary variables or calling a function, \eg, @[x, y] = [y, x]@.
    830 This semantics means mass assignment differs from C cascading
    831 \newpage
    832 assignment (\eg @a = b = c@) in that conversions are applied in each individual assignment, which prevents data loss from the chain of conversions that can happen during a cascading assignment.
     827This semantics means mass assignment differs from C cascading assignment (\eg @a = b = c@) in that conversions are applied in each individual assignment, which prevents data loss from the chain of conversions that can happen during a cascading assignment.
    833828For example, @[y, x] = 3.14@ performs the assignments @y = 3.14@ and @x = 3.14@, yielding @y == 3.14@ and @x == 3@, whereas C cascading assignment @y = x = 3.14@ performs the assignments @x = 3.14@ and @y = x@, yielding @3@ in @y@ and @x@.
    834829Finally, tuple assignment is an expression where the result type is the type of the left-hand side of the assignment, just like all other assignment expressions in C.
     
    857852[int, int, int] y = x.[2, 0, 2];                        $\C{// duplicate: [y.0, y.1, y.2] = [x.2, x.0.x.2]}$
    858853\end{cfa}
    859 It is also possible for a member access to contain other member accesses. \textcolor{blue}{REMOVE ``, as follows.''}
     854It is also possible for a member access to contain other member accesses.
    860855\begin{cfa}
    861856struct A { double i; int j; };
     
    969964Since nothing is known about a parameter pack by default, assertion parameters are key to doing anything meaningful.
    970965Unlike variadic templates, @ttype@ polymorphic functions can be separately compiled.
    971 For example, the following is a \textcolor{blue}{CHANGE ``As an example, we have the following'' TO ``For example, the following is a''} generalized @sum@ function.
     966For example, the following is a generalized @sum@ function.
    972967\begin{cfa}
    973968int sum$\(_0\)$() { return 0; }
     
    1003998Unlike C variadic functions, it is unnecessary to hard code the number and expected types.
    1004999Furthermore, this code is extendable for any user-defined type with a @?+?@ operator.
    1005 Summing \textcolor{blue}{REMOVE ``up''} arbitrary heterogeneous lists is possible with similar code by adding the appropriate type variables and addition operators.
     1000Summing arbitrary heterogeneous lists is possible with similar code by adding the appropriate type variables and addition operators.
    10061001
    10071002It is also possible to write a type-safe variadic print function to replace @printf@:
     
    10391034Tuples are implemented in the \CFA translator via a transformation into \newterm{generic types}.
    10401035For each $N$, the first time an $N$-tuple is seen in a scope, a generic type with $N$ type parameters is generated.
    1041 For example, the following \textcolor{blue}{CHANGE ``, as follows:'' TO ``For example, the following''}
     1036For example, the following
    10421037\begin{cfa}
    10431038[int, int] f() {
     
    15191514\end{cfa}
    15201515
    1521 \textcolor{blue}{PARAGRAPH INDENT} Finally, \CFA provides a Java-like  @finally@ clause after the catch clauses.
     1516Finally, \CFA provides a Java-like  @finally@ clause after the catch clauses.
    15221517\begin{cfa}
    15231518try {
     
    16551650
    16561651C declaration syntax is notoriously confusing and error prone.
    1657 For example, many C programmers are confused by a declaration as simple as the following. \textcolor{blue}{CHANGE ``simple a declaration as in'' TO ``declaration as simple as''}
     1652For example, many C programmers are confused by a declaration as simple as the following.
    16581653\begin{cquote}
    16591654\lstDeleteShortInline@%
     
    17091704% Specifically, the character @*@ is used to indicate a pointer, square brackets @[@\,@]@ are used to represent an array or function return value, and parentheses @()@ are used to indicate a function parameter.
    17101705However, unlike C, \CFA type declaration tokens are distributed across all variables in the declaration list.
    1711 For instance, variables @x@ and @y@ of type pointer to integer are defined in \CFA as \textcolor{blue}{REMOVE ``follows.''}
     1706For instance, variables @x@ and @y@ of type pointer to integer are defined in \CFA as
    17121707\begin{cquote}
    17131708\lstDeleteShortInline@%
     
    19591954Since \CFA in not object oriented, adopting dynamic scoping does not make sense;
    19601955instead, \CFA adopts \CC static nesting, using the member-selection operator ``@.@'' for type qualification, as does Java, rather than the \CC type-selection operator ``@::@'' (see Figure~\ref{f:TypeNestingQualification}).
     1956In the C left example, types @C@, @U@ and @T@ are implicitly hoisted outside of type @S@ into the containing block scope.
     1957In the \CFA right example, the types are not hoisted and accessible.
    19611958
    19621959\begin{figure}
     
    20282025\vspace*{-8pt}
    20292026\end{figure}
    2030 
    2031 In the C left example, types @C@, @U@ and @T@ are implicitly hoisted outside of type @S@ into the containing block scope.
    2032 In the \CFA right example, the types are not hoisted and accessible.
    20332027
    20342028
     
    20662060For details of the code-generation placement of implicit constructor and destructor calls among complex executable statements, see section~2.2 in the work of Schlintz~\cite{Schluntz17}.
    20672061
    2068 \CFA also provides syntax for \newterm{initialization} and \newterm{copy}. \textcolor{blue}{REMOVE ``, as follows''}
     2062\CFA also provides syntax for \newterm{initialization} and \newterm{copy}.
    20692063\begin{cfa}
    20702064void ?{}( VLA & vla, int size, char fill = '\0' ) {  $\C{// initialization}$
     
    21312125
    21322126A simple example is allowing the underscore, as in Ada, to separate prefixes, digits, and suffixes in all \CFA constants, \eg @0x`_`1.ffff`_`ffff`_`p`_`128`_`l@, where the underscore is also the standard separator in C identifiers.
    2133 \CC uses a single quote as a separator, but it is restricted among digits, precluding its use in the literal prefix or suffix, \eg @0x1.ffff@@`'@@ffffp128l@, and causes problems with most \textcolor{blue}{Q2 CHANGE ``IDEs'' TO ``integrated development environments (IDEs)''}, which must be extended to deal with this alternate use of the single quote.
     2127\CC uses a single quote as a separator, but it is restricted among digits, precluding its use in the literal prefix or suffix, \eg @0x1.ffff@@`'@@ffffp128l@, and causes problems with most integrated development environments (IDEs), which must be extended to deal with this alternate use of the single quote.
    21342128
    21352129
     
    22032197y = "12345678901234567890123456789"|`mp| + "12345678901234567890123456789"|`mp|;
    22042198\end{cfa}
    2205 Because \CFA uses a standard function, all types and literals are applicable, as well as overloading and conversions, where @?`@ \textcolor{blue}{USE CHARACTER \lstinline@`@ NOT \textsf{'}} denotes a postfix-function name and @`@ \textcolor{blue}{USE CHARACTER \lstinline@`@ NOT `} denotes a postfix-function call.
     2199Because \CFA uses a standard function, all types and literals are applicable, as well as overloading and conversions, where @?`@ denotes a postfix-function name and @`@ denotes a postfix-function call.
    22062200}%
    22072201\begin{cquote}
     
    23452339\lstMakeShortInline@%
    23462340\end{cquote}
    2347 The result is a significant reduction in names to access typed constants. \textcolor{blue}{REMOVE ``, as follows.''}
     2341The result is a significant reduction in names to access typed constants.
    23482342\begin{cquote}
    23492343\lstDeleteShortInline@%
     
    23902384\lstMakeShortInline@%
    23912385\end{cquote}
    2392 The result is a significant reduction in names to access math functions. \textcolor{blue}{REMOVE ``, as follows.''}
     2386The result is a significant reduction in names to access math functions.
    23932387\begin{cquote}
    23942388\lstDeleteShortInline@%
     
    24372431\lstMakeShortInline@%
    24382432\end{cquote}
    2439 The result is a significant reduction in names to access the utility functions. \textcolor{blue}{REMOVE ``, as follows.''}
     2433The result is a significant reduction in names to access the utility functions.
    24402434\begin{cquote}
    24412435\lstDeleteShortInline@%
     
    24582452In addition, there are polymorphic functions, like @min@ and @max@, that work on any type with operator @?<?@ or @?>?@.
    24592453
    2460 The following shows one example where \CFA \textcolor{blue}{ADD SPACE} \emph{extends} an existing standard C interface to reduce complexity and provide safety.
     2454The following shows one example where \CFA \emph{extends} an existing standard C interface to reduce complexity and provide safety.
    24612455C/\Celeven provide a number of complex and overlapping storage-management operations to support the following capabilities.
    24622456\begin{list}{}{\itemsep=0pt\parsep=0pt\labelwidth=0pt\leftmargin\parindent\itemindent-\leftmargin\let\makelabel\descriptionlabel}
     
    26492643\label{s:MultiPrecisionIntegers}
    26502644
    2651 \CFA has an interface to the \textcolor{blue}{Q3 CHANGE ``GMP multiprecision'' TO ``GNU multiple precision (GMP)''} signed integers~\cite{GMP}, similar to the \CC interface provided by GMP.
     2645\CFA has an interface to the GNU multiple precision (GMP) signed integers~\cite{GMP}, similar to the \CC interface provided by GMP.
    26522646The \CFA interface wraps GMP functions into operator functions to make programming with multiprecision integers identical to using fixed-sized integers.
    26532647The \CFA type name for multiprecision signed integers is @Int@ and the header file is @gmp@.
     
    27422736Figure~\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.
    27432737The graph plots the median of five consecutive runs of each program, with an initial warm-up run omitted.
    2744 All code is compiled at \texttt{-O2} by gcc or g++ 6.4.0, with all \CC code compiled as \CCfourteen. \textcolor{blue}{CHANGE ``\CC{}fourteen'' TO ``\CCfourteen''}
    2745 The 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 \textcolor{blue}{REMOVE ``of''} maximum clock frequency.
     2738All code is compiled at \texttt{-O2} by gcc or g++ 6.4.0, with all \CC code compiled as \CCfourteen.
     2739The 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.
    27462740
    27472741\begin{figure}
     
    27702764\end{table}
    27712765
     2766\enlargethispage{-10pt}
    27722767The C and \CCV variants are generally the slowest with the largest memory footprint, due to their less-efficient memory layout and the pointer indirection necessary to implement generic types;
    27732768this inefficiency is exacerbated by the second level of generic types in the pair benchmarks.
     
    28602855Tuples are a generalization of @std::pair@, in that they allow for arbitrary length, fixed-size aggregation of heterogeneous values.
    28612856Operations include @std::get<N>@ to extract values, @std::tie@ to create a tuple of references used for assignment, and lexicographic comparisons.
    2862 \CCseventeen \textcolor{blue}{CHANGE ``\CC{}seventeen TO ``\CCseventeen''} proposes \emph{structured bindings}~\cite{Sutter15} to eliminate predeclaring variables and the use of @std::tie@ for binding the results.
     2857\CCseventeen proposes \emph{structured bindings}~\cite{Sutter15} to eliminate predeclaring variables and the use of @std::tie@ for binding the results.
    28632858This extension requires the use of @auto@ to infer the types of the new variables; hence, complicated expressions with a nonobvious type must be documented with some other mechanism.
    28642859Furthermore, structured bindings are not a full replacement for @std::tie@, as it always declares new variables.
  • doc/user/user.tex

    r341bb80 r6d44da1  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Thu Jul 26 17:29:05 2018
    14 %% Update Count     : 3366
     13%% Last Modified On : Fri Aug 31 07:54:50 2018
     14%% Update Count     : 3396
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    210210Even with all its problems, C continues to be popular because it allows writing software at virtually any level in a computer system without restriction.
    211211For system programming, where direct access to hardware, storage management, and real-time issues are a requirement, C is usually the only language of choice.
    212 The TIOBE index~\cite{TIOBE} for July 2018 ranks the top 5 most \emph{popular} programming languages as: \Index*{Java} 16\%, C 14\%, \Index*[C++]{\CC{}} 7.5\%, Python 6\%, Visual Basic 4\% = 47.5\%, where the next 50 languages are less than 4\% each, with a long tail.
     212The TIOBE index~\cite{TIOBE} for July 2018 ranks the top five most \emph{popular} programming languages as \Index*{Java} 16\%, C 14\%, \Index*[C++]{\CC{}} 7.5\%, Python 6\%, Visual Basic 4\% = 47.5\%, where the next 50 languages are less than 4\% each, with a long tail.
    213213The top 3 rankings over the past 30 years are:
    214214\begin{center}
     
    351351The 2011 C standard plus GNU extensions.
    352352\item
    353 \Indexc[deletekeywords=inline]{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline[deletekeywords=inline]@-fgnu89-inline@}}
     353\Indexc[deletekeywords=inline]{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline[deletekeywords=inline]$-fgnu89-inline$}}
    354354Use the traditional GNU semantics for inline routines in C11 mode, which allows inline routines in header files.
    355355\end{description}
     
    455455#endif
    456456
    457 ®#include_next <bfdlink.h>                                      §\C{// must have internal check for multiple expansion}§
     457®#include_next <bfdlink.h>                      §\C{// must have internal check for multiple expansion}§
    458458®
    459459#if defined( with ) && defined( __CFA_BFD_H__ ) §\C{// reset only if set}§
     
    504504
    505505C, \CC, and Java (and many other programming languages) have no exponentiation operator\index{exponentiation!operator}\index{operator!exponentiation}, \ie $x^y$, and instead use a routine, like \Indexc{pow}, to perform the exponentiation operation.
    506 \CFA extends the basic operators with the exponentiation operator ©?\?©\index{?\\?@\lstinline@?\?@} and ©?\=?©\index{?\\=?@\lstinline@?\=?@}, as in, ©x \ y© and ©x \= y©, which means $x^y$ and $x \leftarrow x^y$.
     506\CFA extends the basic operators with the exponentiation operator ©?\?©\index{?\\?@©?\?©} and ©?\=?©\index{?\\=?@©\=?©}, as in, ©x \ y© and ©x \= y©, which means $x^y$ and $x \leftarrow x^y$.
    507507The priority of the exponentiation operator is between the cast and multiplicative operators, so that ©w * (int)x \ (int)y * z© is parenthesized as ©((w * (((int)x) \ ((int)y))) * z)©.
    508508
     
    516516256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i
    517517\end{cfa}
    518 Parenthesis are necessary for the complex constants or the expression is parsed as ©1.0f+(2.0fi \ 3.0f)+2.0fi©.
     518Parenthesis are necessary for complex constants or the expression is parsed as ©1.0f+®(®2.0fi \ 3.0f®)®+2.0fi©.
    519519The exponentiation operator is available for all the basic types, but for user-defined types, only the integral-computation versions are available.
    520520For returning an integral value, the user type ©T© must define multiplication, ©*©, and one, ©1©;
     
    527527
    528528
    529 %\subsection{\texorpdfstring{\protect\lstinline@if@ Statement}{if Statement}}
    530 \subsection{\texorpdfstring{\LstKeywordStyle{if} Statement}{if Statement}}
    531 
    532 The ©if© expression allows declarations, similar to ©for© declaration expression:
    533 \begin{cfa}
    534 if ( int x = f() ) ...                                          §\C{// x != 0}§
    535 if ( int x = f(), y = g() ) ...                         §\C{// x != 0 \&\& y != 0}§
    536 if ( int x = f(), y = g(); ®x < y® ) ...        §\C{// relational expression}§
    537 \end{cfa}
    538 Unless a relational expression is specified, each variable is compared not equal to 0, which is the standard semantics for the ©if© expression, and the results are combined using the logical ©&&© operator.\footnote{\CC only provides a single declaration always compared not equal to 0.}
     529%\subsection{\texorpdfstring{\protect\lstinline@if@/\protect\lstinline@while@ Statement}{if Statement}}
     530\subsection{\texorpdfstring{\LstKeywordStyle{if}/\LstKeywordStyle{while} Statement}{if/while Statement}}
     531
     532The ©if©/©while© expression allows declarations, similar to ©for© declaration expression.
     533(Does not make sense for ©do©-©while©.)
     534\begin{cfa}
     535if ( ®int x = f()® ) ...                                        §\C{// x != 0}§
     536if ( ®int x = f(), y = g()® ) ...                       §\C{// x != 0 \&\& y != 0}§
     537if ( ®int x = f(), y = g(); x < y® ) ...        §\C{// relational expression}§
     538if ( ®struct S { int i; } x = { f() }; x.i < 4® ) §\C{// relational expression}§
     539
     540while ( ®int x = f()® ) ...                                     §\C{// x != 0}§
     541while ( ®int x = f(), y = g()® ) ...            §\C{// x != 0 \&\& y != 0}§
     542while ( ®int x = f(), y = g(); x < y® ) ... §\C{// relational expression}§
     543while ( ®struct S { int i; } x = { f() }; x.i < 4® ) ... §\C{// relational expression}§
     544\end{cfa}
     545Unless a relational expression is specified, each variable is compared not equal to 0, which is the standard semantics for the ©if©/©while© expression, and the results are combined using the logical ©&&© operator.\footnote{\CC only provides a single declaration always compared not equal to 0.}
    539546The scope of the declaration(s) is local to the @if@ statement but exist within both the ``then'' and ``else'' clauses.
     547
     548
     549%\subsection{\texorpdfstring{\protect\lstinline@for@ Statement}{for Statement}}
     550\subsection{\texorpdfstring{\LstKeywordStyle{for} Statement}{for Statement}}
     551
     552The ©for©/©while©/©do-while© loop-control allows empty or simplified ranges.
     553An empty conditional implies ©1©.
     554The up-to range ©~©\index{~@©~©} means exclusive range [M,N);
     555the up-to range ©~=©\index{~=@©~=©} means inclusive range [M,N].
     556The down-to range ©-~©\index{-~@©-~©} means exclusive range [N,M);
     557the down-to range ©-~=©\index{-~=@©-~=©} means inclusive range [N,M].
     558©0© is the implicit start value;
     559©1© is the implicit increment value for an up-to range and ©-1© for an implicit down-to range.
     560The loop index is polymorphic in the type of the start value or comparison value when start is implicitly ©0©.
     561\begin{cquote}
     562\begin{tabular}{@{}ll|l@{}}
     563\multicolumn{2}{c|}{for control} & \multicolumn{1}{c}{output} \\
     564\hline
     565\begin{cfa}
     566while ®()® { sout | "empty"; break; }
     567do { sout | "empty"; break; } while ®()®;
     568for ®()® { sout | "empty"; break; }
     569for ( ®0® ) { sout | "A"; }
     570for ( ®1® ) { sout | "A"; }
     571for ( ®10® ) { sout | "A"; }
     572for ( ®1 ~= 10 ~ 2® ) { sout | "B"; }
     573for ( ®10 -~= 1 ~ -2® ) { sout | "C"; }
     574for ( ®0.5 ~ 5.5® ) { sout | "D"; }
     575for ( ®5.5 -~ 0.5® ) { sout | "E"; }
     576for ( ®i; 10® ) { sout | i; }
     577for ( ®i; 1 ~= 10 ~ 2® ) { sout | i; }
     578for ( ®i; 10 -~= 1 ~ -2® ) { sout | i; }
     579for ( ®i; 0.5 ~ 5.5® ) { sout | i; }
     580for ( ®i; 5.5 -~ 0.5® ) { sout | i; }
     581for ( ®ui; 2u ~= 10u ~ 2u® ) { sout | ui; }
     582for ( ®ui; 10u -~= 2u ~ -2u® ) { sout | ui; }
     583int start = 3, comp = 10, inc = 2;
     584for ( ®i; start ~ comp ~ inc + 1® ) { sout | i; }
     585\end{cfa}
     586&
     587\begin{cfa}
     588sout | endl;
     589sout | endl;
     590sout | endl;
     591sout | endl;
     592sout | endl;
     593sout | endl;
     594sout | endl;
     595sout | endl;
     596sout | endl;
     597sout | endl;
     598sout | endl;
     599sout | endl;
     600sout | endl;
     601sout | endl;
     602sout | endl;
     603sout | endl;
     604sout | endl;
     605
     606sout | endl;
     607\end{cfa}
     608&
     609\begin{cfa}
     610empty
     611empty
     612empty
     613
     614A
     615A A A A A A A A A A
     616B B B B B
     617C C C C C
     618D D D D D
     619E E E E E
     6200 1 2 3 4 5 6 7 8 9
     6211 3 5 7 9
     62210 8 6 4 2
     6230.5 1.5 2.5 3.5 4.5
     6245.5 4.5 3.5 2.5 1.5
     6252 4 6 8 10
     62610 8 6 4 2
     627
     6283 6 9
     629\end{cfa}
     630\end{tabular}
     631\end{cquote}
    540632
    541633
     
    800892
    801893
     894% for ()  => for ( ;; )
     895% for ( 10 - t ) => for ( typeof(10 - t) ? = 0 ; ? < 10 - t; ? += 1 ) // using 0 and 1
     896% for ( i ; 10 - t ) => for ( typeof(10 - t) i = 0 ; i < 10 - t; i += 1 ) // using 0 and 1
     897% for ( T i ; 10 - t ) => for ( T i = 0 ; i < 10 - t; i += 1 ) // using 0 and 1
     898% for ( 3~9 ) => for ( int ? = 3 ; ? < 9; ? += 1 ) // using 1
     899% for ( i ; 3~9 ) => for ( int i = 3 ; i < 9; i += 1 ) // using 1
     900% for ( T i ; 3~9 ) => for ( T i = 3 ; i < 9; i += 1 ) // using 1
     901
     902
    802903%\subsection{\texorpdfstring{Labelled \protect\lstinline@continue@ / \protect\lstinline@break@}{Labelled continue / break}}
    803904\subsection{\texorpdfstring{Labelled \LstKeywordStyle{continue} / \LstKeywordStyle{break} Statement}{Labelled continue / break Statement}}
     
    805906While C provides ©continue© and ©break© statements for altering control flow, both are restricted to one level of nesting for a particular control structure.
    806907Unfortunately, this restriction forces programmers to use \Indexc{goto} to achieve the equivalent control-flow for more than one level of nesting.
    807 To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@\lstinline@continue@!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@\lstinline@break@!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85}, as in Java.
     908To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@©continue©!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@©break©!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85}, as in Java.
    808909For both ©continue© and ©break©, the target label must be directly associated with a ©for©, ©while© or ©do© statement;
    809910for ©break©, the target label can also be associated with a ©switch©, ©if© or compound (©{}©) statement.
     
    890991\end{figure}
    891992
    892 Both labelled ©continue© and ©break© are a ©goto©\index{goto@\lstinline@goto@!restricted} restricted in the following ways:
     993Both labelled ©continue© and ©break© are a ©goto©\index{goto@©goto©!restricted} restricted in the following ways:
    893994\begin{itemize}
    894995\item
  • driver/as.cc

    r341bb80 r6d44da1  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // as.c --
     7// as.c -- map assembler file, scan for debug information. If found, expand file by one character and insert Cforall
     8//         language code on the N line from the start of the debug information.
    89//
    910// Author           : Peter A. Buhr
    1011// Created On       : Wed Aug  1 10:49:42 2018
    1112// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug  2 17:50:09 2018
    13 // Update Count     : 90
     13// Last Modified On : Sat Sep  8 08:40:16 2018
     14// Update Count     : 97
    1415//
    1516
     
    2324
    2425//#define __DEBUG_H__
     26
     27#ifdef __DEBUG_H__
     28#include <iostream>
     29using namespace std;
     30#endif // __DEBUG_H__
    2531
    2632int main( const int argc, const char * argv[] ) {
     
    3844        off_t size = mystat.st_size;
    3945
    40         char * start = (char *)mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
    41         if ( start == (void *)-1 ) { perror( "mmap" ); exit( EXIT_FAILURE ); };
     46        if ( size ) {                                                                           // cannot map 0 sized file
     47                char * start = (char *)mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
     48                if ( start == (void *)-1 ) { perror( "mmap" ); exit( EXIT_FAILURE ); };
    4249
    43         if ( char * cursor = strstr( start, ".Ldebug_info0:" ) ) { // debug information ?
    44                 // Expand file by one byte to hold 2 character Cforall language code.
    45                 if ( ftruncate( fd, size + 1 ) ) { perror( "ftruncate" ); exit( EXIT_FAILURE ); };
     50                if ( char * cursor = strstr( start, ".Ldebug_info0:" ) ) { // debug information ?
     51                        // Expand file by one byte to hold 2 character Cforall language code.
     52                        if ( ftruncate( fd, size + 1 ) ) { perror( "ftruncate" ); exit( EXIT_FAILURE ); };
    4653
    47                 for ( int i = 0; i < 8; i += 1 ) {                              // move N (magic) lines forward
    48                         cursor = strstr( cursor, "\n" ) + 1;
    49                 } // for
     54                        for ( int i = 0; i < 8; i += 1 ) {                      // move N (magic) lines forward
     55                                cursor = strstr( cursor, "\n" ) + 1;
     56                        } // for
    5057
    51                 cursor -= 2;                                                                    // backup over "c\n" language value
    52                 if ( *(cursor - 1) != 'x' ) { fprintf( stderr, "invalid C language code\n" ); exit( EXIT_FAILURE ); };
     58                        cursor -= 2;                                                            // backup over "c\n" language value
     59                        if ( *(cursor - 1) != 'x' ) { fprintf( stderr, "invalid C language code\n" ); exit( EXIT_FAILURE ); };
    5360
    54                 memmove( cursor + 2, cursor + 1, start + size - cursor - 1 ); // move remaining text 1 character right
     61                        memmove( cursor + 2, cursor + 1, start + size - cursor - 1 ); // move remaining text 1 character right
    5562
    56                 *(cursor) = '2';                                                                // replace C language value with CFA
    57                 *(cursor + 1) = '5';
     63                        *(cursor) = '2';                                                        // replace C language value with CFA
     64                        *(cursor + 1) = '5';
     65                } // if
     66
     67                if ( munmap( start, size ) ) { perror( "munmap" ); exit( EXIT_FAILURE ); }; // update on disk
    5868        } // if
    59 
    60         if ( munmap( start, size ) ) { perror( "munmap" ); exit( EXIT_FAILURE ); }; // update on disk
    6169
    6270        argv[0] = "as";
  • driver/cc1.cc

    r341bb80 r6d44da1  
    1010// Created On       : Fri Aug 26 14:23:51 2005
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 19 10:46:11 2018
    13 // Update Count     : 111
     12// Last Modified On : Mon Sep  3 16:57:05 2018
     13// Update Count     : 125
    1414//
    1515
     
    3232string compiler_name( CFA_BACKEND_CC );                                 // path/name of C compiler
    3333
    34 string D__GCC_X__( "-D__GCC_X__=" );
    3534string D__GCC_BPREFIX__( "-D__GCC_BPREFIX__=" );
    3635string D__CFA_FLAGPREFIX__( "-D__CFA_FLAG__=" );
     
    4746const string suffixes[NumSuffixes] = { "cfa", "hfa", };
    4847
    49 bool suffix( string arg ) {
     48void suffix( string arg, const char * args[], int & nargs ) {
    5049        //std::cerr << arg << std::endl;
    5150        size_t dot = arg.find_last_of( "." );
    5251        //std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;
    53         if ( dot == string::npos ) return false;
     52        if ( dot == string::npos ) return;
    5453        string sx = arg.substr( dot + 1 );
    5554        for ( int i = 0; i < NumSuffixes; i += 1 ) {
    56                 if ( sx == suffixes[i] ) return true;
    57         } // for
    58         return false;
     55                if ( sx == suffixes[i] ) {
     56                        args[nargs] = "-x";
     57                        nargs += 1;
     58                        args[nargs] = "c";
     59                        nargs += 1;
     60                        return;
     61                } // if
     62        } // for
    5963} // suffix
    6064
    6165
    62 void checkEnv( const char *args[], int &nargs ) {
     66void checkEnv( const char * args[], int & nargs ) {
    6367        char *value;
    6468
    65         value = getenv( "__COMPILER__" );
     69        value = getenv( "__CFA_COMPILER__" );
    6670        if ( value != NULL ) {
    6771                compiler_name = value;
     
    110114void Stage1( const int argc, const char * const argv[] ) {
    111115        int code;
    112         int i;
    113116
    114117        string arg;
     
    133136        cerr << "Stage1" << endl;
    134137        #endif // __DEBUG_H__
     138        checkEnv( args, nargs );                                                        // arguments passed via environment variables
     139        #ifdef __DEBUG_H__
     140        for ( int i = 1; i < argc; i += 1 ) {
     141                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
     142        } // for
     143        #endif // __DEBUG_H__
    135144
    136145        // process all the arguments
    137146
    138         checkEnv( args, nargs );                                                        // arguments passed via environment variables
    139 
    140         for ( i = 1; i < argc; i += 1 ) {
    141                 #ifdef __DEBUG_H__
    142                 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    143                 #endif // __DEBUG_H__
     147        for ( int i = 1; i < argc; i += 1 ) {
    144148                arg = argv[i];
    145                 #ifdef __DEBUG_H__
    146                 cerr << "arg:\"" << arg << "\"" << endl;
    147                 #endif // __DEBUG_H__
    148149                if ( prefix( arg, "-" ) ) {
    149150                        // strip g++ flags that are inappropriate or cause duplicates in subsequent passes
     
    179180                                ncargs += 1;
    180181                                i += 1;                                                                 // and the argument
    181                         // } else if ( prefix( arg, D__GCC_X__ ) ) {
    182                         //      args[nargs] = "-x";
    183                         //      nargs += 1;
    184                         //      args[nargs] = ( *new string( arg.substr( D__GCC_X__.size() ) ) ).c_str(); // pass the flag along
    185                         //      nargs += 1;
    186                         // } else if ( arg == "-D" && prefix( argv[i + 1], D__GCC_X__.substr(2) ) ) {
    187                         //      args[nargs] = "-x";
    188                         //      nargs += 1;
    189                         //      args[nargs] = ( *new string( string( argv[i + 1] ).substr( D__GCC_X__.size() - 2 ) ) ).c_str(); // pass the flag along
    190                         //      nargs += 1;
    191                         //      i += 1;                                                                 // and the argument
    192182                        } else if ( prefix( arg, D__GCC_BPREFIX__ ) ) {
    193183                                bprefix = arg.substr( D__GCC_BPREFIX__.size() );
     
    245235        #ifdef __DEBUG_H__
    246236        cerr << "args:";
    247         for ( i = 1; i < nargs; i += 1 ) {
     237        for ( int i = 1; i < nargs; i += 1 ) {
    248238                cerr << " " << args[i];
    249239        } // for
     
    263253
    264254                args[0] = compiler_name.c_str();
     255                suffix( cpp_in, args, nargs );                                  // check suffix
    265256                args[nargs] = cpp_in;
    266257                nargs += 1;
     
    275266                #ifdef __DEBUG_H__
    276267                cerr << "nargs: " << nargs << endl;
    277                 for ( i = 0; args[i] != NULL; i += 1 ) {
     268                for ( int i = 0; args[i] != NULL; i += 1 ) {
    278269                        cerr << args[i] << " ";
    279270                } // for
     
    310301
    311302                args[0] = compiler_name.c_str();
    312                 if ( suffix( cpp_in ) ) {
    313                         args[nargs] = "-x";
    314                         nargs += 1;
    315                         args[nargs] = "c";
    316                         nargs += 1;
    317                 } // if
     303                suffix( cpp_in, args, nargs );                                  // check suffix
    318304                args[nargs] = cpp_in;                                                   // input to cpp
    319305                nargs += 1;
     
    322308                #ifdef __DEBUG_H__
    323309                cerr << "cpp nargs: " << nargs << endl;
    324                 for ( i = 0; args[i] != NULL; i += 1 ) {
     310                for ( int i = 0; args[i] != NULL; i += 1 ) {
    325311                        cerr << args[i] << " ";
    326312                } // for
     
    354340
    355341        if ( fork() == 0 ) {                                                            // child runs CFA
    356                 cargs[0] = ( *new string( bprefix + "/cfa-cpp" ) ).c_str();
     342                cargs[0] = ( *new string( bprefix + "cfa-cpp" ) ).c_str();
    357343
    358344                // Source file-name used to generate routine names containing global initializations for TU.
     
    375361                #ifdef __DEBUG_H__
    376362                cerr << "cfa-cpp ncargs: " << o_name << " " << CFA_flag << " " << ncargs << endl;
    377                 for ( i = 0; cargs[i] != NULL; i += 1 ) {
     363                for ( int i = 0; cargs[i] != NULL; i += 1 ) {
    378364                        cerr << cargs[i] << " ";
    379365                } // for
     
    405391
    406392void Stage2( const int argc, const char * const * argv ) {
    407         int i;
    408 
    409393        string arg;
    410394
     
    417401        cerr << "Stage2" << endl;
    418402        #endif // __DEBUG_H__
     403        checkEnv( args, nargs );                                                        // arguments passed via environment variables
     404        #ifdef __DEBUG_H__
     405        for ( int i = 1; i < argc; i += 1 ) {
     406                cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
     407        } // for
     408        #endif // __DEBUG_H__
    419409
    420410        // process all the arguments
    421411
    422         checkEnv( args, nargs );                                                        // arguments passed via environment variables
    423 
    424         for ( i = 1; i < argc; i += 1 ) {
    425                 #ifdef __DEBUG_H__
    426                 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    427                 #endif // __DEBUG_H__
     412        for ( int i = 1; i < argc; i += 1 ) {
    428413                arg = argv[i];
    429                 #ifdef __DEBUG_H__
    430                 cerr << "arg:\"" << arg << "\"" << endl;
    431                 #endif // __DEBUG_H__
    432414                if ( prefix( arg, "-" ) ) {
    433415                        // strip inappropriate flags
     
    474456        #ifdef __DEBUG_H__
    475457        cerr << "args:";
    476         for ( i = 1; i < nargs; i += 1 ) {
     458        for ( int i = 1; i < nargs; i += 1 ) {
    477459                cerr << " " << args[i];
    478460        } // for
     
    490472        #ifdef __DEBUG_H__
    491473        cerr << "stage2 nargs: " << nargs << endl;
    492         for ( i = 0; args[i] != NULL; i += 1 ) {
     474        for ( int i = 0; args[i] != NULL; i += 1 ) {
    493475                cerr << args[i] << " ";
    494476        } // for
     
    504486int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) {
    505487        #ifdef __DEBUG_H__
    506         for ( int i = 0; env[i] != NULL; i += 1 ) {
     488        for ( int int i = 0; env[i] != NULL; i += 1 ) {
    507489                cerr << env[i] << endl;
    508490        } // for
  • driver/cfa.cc

    r341bb80 r6d44da1  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Aug 10 18:17:58 2018
    13 // Update Count     : 259
     12// Last Modified On : Mon Sep  3 16:47:59 2018
     13// Update Count     : 275
    1414//
    1515
     
    4343const string suffixes[NumSuffixes] = { "cfa", "hfa", };
    4444
    45 bool suffix( string arg ) {
     45bool suffix( string arg, const char * args[], int & nargs ) {
    4646        //std::cerr << arg << std::endl;
    4747        size_t dot = arg.find_last_of( "." );
     
    5050        string sx = arg.substr( dot + 1 );
    5151        for ( int i = 0; i < NumSuffixes; i += 1 ) {
    52                 if ( sx == suffixes[i] ) return true;
     52                if ( sx == suffixes[i] ) {
     53                        args[nargs] = "-x";
     54                        nargs += 1;
     55                        args[nargs] = "c";
     56                        nargs += 1;
     57                        return true;
     58                } // if
    5359        } // for
    5460        return false;
     
    8692        string Major( str( CFA_VERSION_MAJOR ) ), Minor( str( CFA_VERSION_MINOR ) ), Patch( str( CFA_VERSION_PATCH ) );
    8793
    88         string installincdir( CFA_INCDIR );                         // fixed location of include files
    89         string installlibdir( CFA_LIBDIR );                         // fixed location of cc1 and cfa-cpp commands when installed
    90         string srcdriverdir ( TOP_BUILDDIR "driver");                // fixed location of cc1 and cfa-cpp commands when in tree
     94        string installincdir( CFA_INCDIR );                                     // fixed location of include files
     95        string installlibdir( CFA_LIBDIR );                                     // fixed location of cc1 and cfa-cpp commands when installed
     96        string srcdriverdir ( TOP_BUILDDIR "driver");           // fixed location of cc1 and cfa-cpp commands when in tree
    9197
    9298        string heading;                                                                         // banner printed at start of cfa compilation
     
    123129        #ifdef __DEBUG_H__
    124130        cerr << "CFA:" << endl;
     131        for ( int i = 1; i < argc; i += 1 ) {
     132            cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
     133        } // for
    125134        #endif // __DEBUG_H__
    126135
     
    128137
    129138        for ( int i = 1; i < argc; i += 1 ) {
    130                 #ifdef __DEBUG_H__
    131                 cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
    132                 #endif // __DEBUG_H__
    133139                arg = argv[i];                                                                  // convert to string value
    134                 #ifdef __DEBUG_H__
    135                 cerr << "arg:\"" << arg << "\"" << endl;
    136                 #endif // __DEBUG_H__
    137140                if ( prefix( arg, "-" ) ) {
    138141                        // pass through arguments
     
    178181                                if ( i == argc ) continue;                              // next argument available ?
    179182                                compiler_path = argv[i];
    180                                 if ( putenv( (char *)( *new string( string( "__U_COMPILER__=" ) + argv[i]) ).c_str() ) != 0 ) {
     183                                if ( putenv( (char *)( *new string( string( "__CFA_COMPILER__=" ) + argv[i]) ).c_str() ) != 0 ) {
    181184                                        cerr << argv[0] << " error, cannot set environment variable." << endl;
    182185                                        exit( EXIT_FAILURE );
     
    197200                                args[nargs] = argv[i];                                  // pass the argument along
    198201                                nargs += 1;
    199                         } else if ( arg == "-x" ) {
    200                                 xflag = true;
    201                                 args[nargs] = argv[i];                                  // pass the argument along
    202                                 nargs += 1;
    203                                 i += 1;                                                                 // advance to argument
    204                                 args[nargs] = argv[i];                                  // pass the argument along
    205                                 nargs += 1;
    206                                 // args[nargs] = ( *new string( string("-D__GCC_X__=") + argv[i] ) ).c_str(); // add the argument for -x
    207                                 // nargs += 1;
    208                         } else if ( prefix( arg, "-x" ) ) {
    209                                 xflag = true;
    210                                 args[nargs] = argv[i];                                  // pass the argument along
    211                                 nargs += 1;
    212                                 // args[nargs] = ( *new string( string("-D__GCC_X__=") + arg.substr(2) ) ).c_str(); // add the argument for -x
    213                                 // nargs += 1;
    214202                        } else if ( arg == "-w" ) {
    215203                                args[nargs] = argv[i];                                  // pass the argument along
     
    293281                        } // if
    294282                } else {
    295                         bool opt = false;
    296                         if ( ! xflag && suffix( arg ) ) {
     283                        bool cfa = suffix( arg, args, nargs );          // check suffix
     284                        args[nargs] = argv[i];                                          // concatenate file
     285                        nargs += 1;
     286                        if ( cfa ) {
    297287                                args[nargs] = "-x";
    298288                                nargs += 1;
    299                                 args[nargs] = "c";
    300                                 nargs += 1;
    301                                 // args[nargs] = ( *new string( string("-D__GCC_X__=c") ) ).c_str(); // add the argument for -x
    302                                 // nargs += 1;
    303                                 opt = true;
    304                         } // if
    305                         // concatenate other arguments
    306                         args[nargs] = argv[i];
    307                         nargs += 1;
    308                         if ( opt ) {
    309                                 args[nargs] = "-x";
    310                                 nargs += 1;
    311289                                args[nargs] = "none";
    312290                                nargs += 1;
    313                                 // args[nargs] = ( *new string( string("-D__GCC_X__=none") ) ).c_str(); // add the argument for -x
    314                                 // nargs += 1;
    315291                        } // if
    316292                        nonoptarg = true;
     
    319295        } // for
    320296
     297    args[nargs] = "-x";                                 // turn off language
     298    nargs += 1;
     299    args[nargs] = "none";
     300    nargs += 1;
     301
    321302        #ifdef __x86_64__
    322303        args[nargs] = "-mcx16";                                                         // allow double-wide CAA
     
    341322                args[nargs] = "-I" CFA_INCDIR;
    342323                nargs += 1;
    343                 if ( ! noincstd_flag ) {                                                        // do not use during build
    344                         args[nargs] = "-I" CFA_INCDIR "/stdhdr";
     324                if ( ! noincstd_flag ) {                                                // do not use during build
     325                        args[nargs] = "-I" CFA_INCDIR "stdhdr";
    345326                        nargs += 1;
    346327                } // if
    347                 args[nargs] = "-I" CFA_INCDIR "/concurrency";
    348                 nargs += 1;
    349                 args[nargs] = "-I" CFA_INCDIR "/containers";
     328                args[nargs] = "-I" CFA_INCDIR "concurrency";
     329                nargs += 1;
     330                args[nargs] = "-I" CFA_INCDIR "containers";
    350331                nargs += 1;
    351332        } else {
    352333                args[nargs] = "-I" TOP_SRCDIR "libcfa/src";
    353334                nargs += 1;
    354                 if ( ! noincstd_flag ) {                                                        // do not use during build
     335                if ( ! noincstd_flag ) {                                                // do not use during build
    355336                        args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr";
    356337                        nargs += 1;
     
    377358        }
    378359
    379         const char * const arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU);
     360        string arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU);
     361        if ( ! m32 && ! m64 ) {
     362                if ( arch == "x86" ) {
     363                        args[nargs] = "-m32";
     364                        nargs += 1;
     365                } else if ( arch == "x64" ) {
     366                        args[nargs] = "-m64";
     367                        nargs += 1;
     368                }  // if
     369        } // if
    380370        const char * config = debug ? "debug": "nodebug";
    381371        string libdir = libbase + arch + "-" + config;
    382         if( !dirExists(libdir) ) {
     372
     373        if ( ! dirExists( libdir ) ) {
    383374                cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
    384375                cerr << "Was looking for " << libdir << endl;
    385376                libdir = libbase + arch + "-" + "nolib";
    386         }
    387 
    388         if( !dirExists(libdir) ) {
     377        } // if
     378
     379        if ( ! dirExists( libdir ) ) {
    389380                cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
    390381                cerr << "Was looking for " << libdir << endl;
    391382                exit( EXIT_FAILURE );
    392         }
     383        } // if
    393384
    394385        args[nargs] = ( *new string( string("-D__CFA_FLAG__=--prelude-dir=" ) + libdir + (intree ? "/prelude" : "")) ).c_str();
     
    472463
    473464        if ( Bprefix.length() == 0 ) {
    474                 Bprefix = !intree ? installlibdir : srcdriverdir;
     465                Bprefix = ! intree ? installlibdir : srcdriverdir;
     466                if ( Bprefix[Bprefix.length() - 1] != '/' ) Bprefix += '/';
    475467                args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
    476468                nargs += 1;
     
    506498                args[nargs] = "-D__int8_t_defined";                             // prevent gcc type-size attributes
    507499                nargs += 1;
    508                 args[nargs] = ( *new string( string("-B") + Bprefix + "/" ) ).c_str();
     500                args[nargs] = ( *new string( string("-B") + Bprefix ) ).c_str();
    509501                nargs += 1;
    510502                args[nargs] = "-lm";
  • libcfa/Makefile.in

    r341bb80 r6d44da1  
    238238CFLAGS = @CFLAGS@
    239239CONFIGURATION = @CONFIGURATION@
     240CONFIG_BUILDLIB = @CONFIG_BUILDLIB@
    240241CONFIG_CFAFLAGS = @CONFIG_CFAFLAGS@
    241242CONFIG_CFLAGS = @CONFIG_CFLAGS@
  • libcfa/configure

    r341bb80 r6d44da1  
    701701CFA_PREFIX
    702702CFA_NAME
     703BUILDLIB_FALSE
     704BUILDLIB_TRUE
     705CONFIG_BUILDLIB
    703706CONFIG_CFAFLAGS
    704707CONFIG_CFLAGS
     
    23762379
    23772380
     2381
    23782382am__api_version='1.15'
    23792383
     
    29472951                CONFIG_CFLAGS="-O0 -g"
    29482952                CONFIG_CFAFLAGS="-debug"
     2953                CONFIG_BUILDLIB="yes"
    29492954        ;;
    29502955        "nodebug" )
    29512956                CONFIG_CFLAGS="-O2 -s"
    29522957                CONFIG_CFAFLAGS="-nodebug"
     2958                CONFIG_BUILDLIB="yes"
    29532959        ;;
    29542960        "nolib"   )
    2955                 CONFIG_CFLAGS=""
    2956                 CONFIG_CFAFLAGS=""
     2961                CONFIG_CFLAGS="-O2 -s"
     2962                CONFIG_CFAFLAGS="-nodebug"
     2963                CONFIG_BUILDLIB="no"
    29572964        ;;
    29582965esac
    29592966
    29602967
     2968
     2969
     2970
     2971 if test "x${CONFIG_BUILDLIB}" = "xyes"; then
     2972  BUILDLIB_TRUE=
     2973  BUILDLIB_FALSE='#'
     2974else
     2975  BUILDLIB_TRUE='#'
     2976  BUILDLIB_FALSE=
     2977fi
    29612978
    29622979
     
    1694416961fi
    1694516962
     16963if test -z "${BUILDLIB_TRUE}" && test -z "${BUILDLIB_FALSE}"; then
     16964  as_fn_error $? "conditional \"BUILDLIB\" was never defined.
     16965Usually this means the macro was only invoked conditionally." "$LINENO" 5
     16966fi
    1694616967if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
    1694716968  as_fn_error $? "conditional \"AMDEP\" was never defined.
  • libcfa/configure.ac

    r341bb80 r6d44da1  
    4242                CONFIG_CFLAGS="-O0 -g"
    4343                CONFIG_CFAFLAGS="-debug"
     44                CONFIG_BUILDLIB="yes"
    4445        ;;
    4546        "nodebug" )
    4647                CONFIG_CFLAGS="-O2 -s"
    4748                CONFIG_CFAFLAGS="-nodebug"
     49                CONFIG_BUILDLIB="yes"
    4850        ;;
    4951        "nolib"   )
    50                 CONFIG_CFLAGS=""
    51                 CONFIG_CFAFLAGS=""
     52                CONFIG_CFLAGS="-O2 -s"
     53                CONFIG_CFAFLAGS="-nodebug"
     54                CONFIG_BUILDLIB="no"
    5255        ;;
    5356esac
     
    5558AC_SUBST(CONFIG_CFLAGS)
    5659AC_SUBST(CONFIG_CFAFLAGS)
     60AC_SUBST(CONFIG_BUILDLIB)
     61
     62AM_CONDITIONAL([BUILDLIB], [test "x${CONFIG_BUILDLIB}" = "xyes"])
    5763
    5864#==============================================================================
  • libcfa/prelude/Makefile.am

    r341bb80 r6d44da1  
    2121# put into lib for now
    2222cfalibdir = ${CFA_LIBDIR}
    23 cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c
    24 noinst_DATA = ../src/prelude.c
     23cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cfa bootloader.c
    2524
    2625CC = @CFACC@
     
    4544        ${AM_V_GEN}gcc -I${srcdir} -E ${srcdir}/prototypes.c | awk -f ${srcdir}/prototypes.awk > $@
    4645
    47 prelude.cf : prelude-gen.cc
     46prelude.cfa : prelude-gen.cc
    4847        ${AM_V_GEN}${CXX} ${AM_CXXFLAGS} ${CXXFLAGS} ${AM_CFLAGS} ${<} -o prelude-gen -Wall -Wextra -O2 -g -std=c++14
    4948        @./prelude-gen > $@
     
    6160include $(DEPDIR)/builtins.Po
    6261
    63 ../src/prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf @CFACPP@
    64         ${AM_V_GEN}@CFACPP@ --prelude-dir=${builddir} -l prelude.cf $@  # use src/cfa-cpp as not in lib until after install
    65 
    66 bootloader.c : ${srcdir}/bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf @CFACPP@
     62bootloader.c : ${srcdir}/bootloader.cf prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACPP@
    6763        ${AM_V_GEN}@CFACPP@ --prelude-dir=${builddir} -tpm ${srcdir}/bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    6864
     
    7066        rm -rf $(DEPDIR)
    7167
    72 MOSTLYCLEANFILES = bootloader.c builtins.cf extras.cf gcc-builtins.c gcc-builtins.cf prelude.cf
     68MOSTLYCLEANFILES = bootloader.c builtins.cf extras.cf gcc-builtins.c gcc-builtins.cf prelude.cfa
    7369MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
  • libcfa/prelude/Makefile.in

    r341bb80 r6d44da1  
    153153  }
    154154am__installdirs = "$(DESTDIR)$(cfalibdir)"
    155 DATA = $(cfalib_DATA) $(noinst_DATA)
     155DATA = $(cfalib_DATA)
    156156am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
    157157am__DIST_COMMON = $(srcdir)/Makefile.in
     
    181181CFLAGS = @CFLAGS@
    182182CONFIGURATION = @CONFIGURATION@
     183CONFIG_BUILDLIB = @CONFIG_BUILDLIB@
    183184CONFIG_CFAFLAGS = @CONFIG_CFAFLAGS@
    184185CONFIG_CFLAGS = @CONFIG_CFLAGS@
     
    301302# put into lib for now
    302303cfalibdir = ${CFA_LIBDIR}
     304<<<<<<< HEAD
    303305cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cf bootloader.c
    304306noinst_DATA = ../src/prelude.c
    305307AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
     308=======
     309cfalib_DATA = gcc-builtins.cf builtins.cf extras.cf prelude.cfa bootloader.c
     310AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     311>>>>>>> master
    306312AM_CFAFLAGS = @CONFIG_CFAFLAGS@
    307 MOSTLYCLEANFILES = bootloader.c builtins.cf extras.cf gcc-builtins.c gcc-builtins.cf prelude.cf
     313MOSTLYCLEANFILES = bootloader.c builtins.cf extras.cf gcc-builtins.c gcc-builtins.cf prelude.cfa
    308314MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} ${addprefix ${libdir}/,${lib_LIBRARIES}}
    309315all: all-am
     
    544550        ${AM_V_GEN}gcc -I${srcdir} -E ${srcdir}/prototypes.c | awk -f ${srcdir}/prototypes.awk > $@
    545551
    546 prelude.cf : prelude-gen.cc
     552prelude.cfa : prelude-gen.cc
    547553        ${AM_V_GEN}${CXX} ${AM_CXXFLAGS} ${CXXFLAGS} ${AM_CFLAGS} ${<} -o prelude-gen -Wall -Wextra -O2 -g -std=c++14
    548554        @./prelude-gen > $@
     
    560566include $(DEPDIR)/builtins.Po
    561567
    562 ../src/prelude.c : prelude.cf extras.cf gcc-builtins.cf builtins.cf @CFACPP@
    563         ${AM_V_GEN}@CFACPP@ --prelude-dir=${builddir} -l prelude.cf $@  # use src/cfa-cpp as not in lib until after install
    564 
    565 bootloader.c : ${srcdir}/bootloader.cf prelude.cf extras.cf gcc-builtins.cf builtins.cf @CFACPP@
     568bootloader.c : ${srcdir}/bootloader.cf prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACPP@
    566569        ${AM_V_GEN}@CFACPP@ --prelude-dir=${builddir} -tpm ${srcdir}/bootloader.cf $@  # use src/cfa-cpp as not in lib until after install
    567570
  • libcfa/prelude/prelude-gen.cc

    r341bb80 r6d44da1  
    142142
    143143int main() {
    144         cout << "# 2 \"prelude.cf\"  // needed for error messages from this file" << endl;
     144        cout << "# 2 \"prelude.cfa\"  // needed for error messages from this file" << endl;
    145145        cout << "trait sized(dtype T) {};" << endl;
    146146
  • libcfa/src/Makefile.am

    r341bb80 r6d44da1  
    2525lib_LTLIBRARIES =  libcfa.la
    2626
     27VPATH += :../prelude
     28
    2729# AM_CFLAGS for all cfa source
    2830# AM_CFAFLAGS for only cfa source
    2931# use -no-include-stdhdr to prevent rebuild cycles
    3032# The built sources must not depend on the installed headers
    31 AM_CFAFLAGS = -quiet -in-tree -imacros prelude.c -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
     33AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
    3234AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
    3335AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     
    3537
    3638#----------------------------------------------------------------------------------------------------------------
     39if BUILDLIB
    3740headers = fstream.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
    3841          containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa
     42
     43headers_nosrc = math.hfa gmp.hfa time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa
    3944
    4045# not all platforms support concurrency, add option do disable it
    4146headers += concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa concurrency/monitor.hfa concurrency/mutex.hfa
    4247
     48headers_nosrc += concurrency/invoke.h
     49
    4350libobjs = ${headers:.hfa=.lo}
    44 libsrc = prelude.c startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa \
    45         ${headers:.hfa=.cfa}
     51libsrc = startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa ${headers:.hfa=.cfa}
    4652
    4753# not all platforms support concurrency, add option do disable it
    4854libsrc += concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa concurrency/invoke.c concurrency/preemption.cfa
     55else
     56headers =
     57headers_nosrc =
     58libsrc =
     59endif
     60
    4961
    5062#----------------------------------------------------------------------------------------------------------------
    5163# add dependency to cfa-cpp so all libraries are rebuilt with new translator
    52 ${libobjs} : ${cfalib_DATA}
     64#@CFACC@ @CFACPP@ prelude.cfa
    5365
    54 libcfa_la_SOURCES = ${libsrc}
     66# add dependency of cfa files
     67libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(libsrc))))
     68$(libobjs) : @CFACC@ @CFACPP@ prelude.cfa
     69
     70
     71# .deps inclusion is not done automatically by automake for new languages
     72libdeps = $(join \
     73        $(addsuffix $(DEPDIR)/ , $(dir $(libobjs) ) ), \
     74        $(notdir ${libobjs:.lo=.Po}) \
     75)
     76
     77-include $(libdeps)
     78
     79prelude.lo : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
     80        ${AM_V_GEN}@CFACC@ ${AM_CFLAGS} ${CFLAGS} -quiet -in-tree -XCFA -l ${<} -c -o ${@}
     81
     82
     83
     84#----------------------------------------------------------------------------------------------------------------
     85libcfa_la_SOURCES = prelude.cfa ${libsrc}
    5586
    5687stdhdr = $(shell find $(srcdir)/stdhdr -type f -printf "%p ")
    5788
    5889cfa_includedir = $(CFA_INCDIR)
    59 nobase_cfa_include_HEADERS = \
    60         ${headers}             \
    61         ${stdhdr}              \
    62         math.hfa               \
    63         gmp.hfa                \
    64         time_t.hfa             \
    65         bits/align.hfa         \
    66         bits/containers.hfa    \
    67         bits/defs.hfa          \
    68         bits/debug.hfa         \
    69         bits/locks.hfa         \
    70         concurrency/invoke.h
    71 
    72 MOSTLYCLEANFILES = prelude.c
     90nobase_cfa_include_HEADERS = ${stdhdr} ${headers} ${headers_nosrc}
    7391
    7492#----------------------------------------------------------------------------------------------------------------
    7593maintainer-clean-local:
    7694        -rm -rf ${CFA_INCDIR} ${CFA_LIBDIR}
     95
     96
     97# $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
     98#       $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     99#       $(am__mv) $$depbase.Tpo $$depbase.Po
  • libcfa/src/Makefile.in

    r341bb80 r6d44da1  
    1919
    2020
    21 VPATH = @srcdir@
    2221am__is_gnu_make = { \
    2322  if test -z '$(MAKELEVEL)'; then \
     
    103102am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    104103        $(ACLOCAL_M4)
    105 DIST_COMMON = $(srcdir)/Makefile.am $(nobase_cfa_include_HEADERS) \
    106         $(am__DIST_COMMON)
     104DIST_COMMON = $(srcdir)/Makefile.am \
     105        $(am__nobase_cfa_include_HEADERS_DIST) $(am__DIST_COMMON)
    107106mkinstalldirs = $(install_sh) -d
    108107CONFIG_CLEAN_FILES =
     
    136135  }
    137136am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cfa_includedir)"
     137<<<<<<< HEAD
    138138LTLIBRARIES = $(lib_LTLIBRARIES)
    139139libcfa_la_LIBADD =
     
    155155am__v_lt_0 = --silent
    156156am__v_lt_1 =
     157=======
     158LIBRARIES = $(lib_LIBRARIES)
     159AR = ar
     160AM_V_AR = $(am__v_AR_@AM_V@)
     161am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
     162am__v_AR_0 = @echo "  AR      " $@;
     163am__v_AR_1 =
     164libcfa_a_AR = $(AR) $(ARFLAGS)
     165libcfa_a_LIBADD =
     166am__libcfa_a_SOURCES_DIST = prelude.cfa startup.cfa interpose.cfa \
     167        bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa \
     168        fstream.cfa iostream.cfa iterator.cfa limits.cfa rational.cfa \
     169        time.cfa stdlib.cfa common.cfa containers/maybe.cfa \
     170        containers/pair.cfa containers/result.cfa \
     171        containers/vector.cfa concurrency/coroutine.cfa \
     172        concurrency/thread.cfa concurrency/kernel.cfa \
     173        concurrency/monitor.cfa concurrency/mutex.cfa \
     174        concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa \
     175        concurrency/invoke.c concurrency/preemption.cfa
     176am__dirstamp = $(am__leading_dot)dirstamp
     177@BUILDLIB_TRUE@am__objects_1 = fstream.$(OBJEXT) iostream.$(OBJEXT) \
     178@BUILDLIB_TRUE@ iterator.$(OBJEXT) limits.$(OBJEXT) \
     179@BUILDLIB_TRUE@ rational.$(OBJEXT) time.$(OBJEXT) \
     180@BUILDLIB_TRUE@ stdlib.$(OBJEXT) common.$(OBJEXT) \
     181@BUILDLIB_TRUE@ containers/maybe.$(OBJEXT) \
     182@BUILDLIB_TRUE@ containers/pair.$(OBJEXT) \
     183@BUILDLIB_TRUE@ containers/result.$(OBJEXT) \
     184@BUILDLIB_TRUE@ containers/vector.$(OBJEXT) \
     185@BUILDLIB_TRUE@ concurrency/coroutine.$(OBJEXT) \
     186@BUILDLIB_TRUE@ concurrency/thread.$(OBJEXT) \
     187@BUILDLIB_TRUE@ concurrency/kernel.$(OBJEXT) \
     188@BUILDLIB_TRUE@ concurrency/monitor.$(OBJEXT) \
     189@BUILDLIB_TRUE@ concurrency/mutex.$(OBJEXT)
     190@BUILDLIB_TRUE@am__objects_2 = startup.$(OBJEXT) interpose.$(OBJEXT) \
     191@BUILDLIB_TRUE@ bits/debug.$(OBJEXT) assert.$(OBJEXT) \
     192@BUILDLIB_TRUE@ exception.$(OBJEXT) virtual.$(OBJEXT) \
     193@BUILDLIB_TRUE@ heap.$(OBJEXT) $(am__objects_1) \
     194@BUILDLIB_TRUE@ concurrency/CtxSwitch-@ARCHITECTURE@.$(OBJEXT) \
     195@BUILDLIB_TRUE@ concurrency/alarm.$(OBJEXT) \
     196@BUILDLIB_TRUE@ concurrency/invoke.$(OBJEXT) \
     197@BUILDLIB_TRUE@ concurrency/preemption.$(OBJEXT)
     198am_libcfa_a_OBJECTS = prelude.$(OBJEXT) $(am__objects_2)
     199libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
     200>>>>>>> master
    157201AM_V_P = $(am__v_P_@AM_V@)
    158202am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     
    199243am__v_CCLD_0 = @echo "  CCLD    " $@;
    200244am__v_CCLD_1 =
     245<<<<<<< HEAD
    201246SOURCES = $(libcfa_la_SOURCES)
    202247DIST_SOURCES = $(libcfa_la_SOURCES)
     248=======
     249SOURCES = $(libcfa_a_SOURCES)
     250DIST_SOURCES = $(am__libcfa_a_SOURCES_DIST)
     251>>>>>>> master
    203252am__can_run_installinfo = \
    204253  case $$AM_UPDATE_INFO_DIR in \
     
    206255    *) (install-info --version) >/dev/null 2>&1;; \
    207256  esac
     257am__nobase_cfa_include_HEADERS_DIST = ${shell find ${srcdir}/stdhdr \
     258        -type f -printf "%p "} fstream.hfa iostream.hfa iterator.hfa \
     259        limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
     260        containers/maybe.hfa containers/pair.hfa containers/result.hfa \
     261        containers/vector.hfa concurrency/coroutine.hfa \
     262        concurrency/thread.hfa concurrency/kernel.hfa \
     263        concurrency/monitor.hfa concurrency/mutex.hfa math.hfa gmp.hfa \
     264        time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa \
     265        bits/debug.hfa bits/locks.hfa concurrency/invoke.h
    208266HEADERS = $(nobase_cfa_include_HEADERS)
    209267am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     
    229287        $(top_srcdir)/automake/depcomp
    230288DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
     289VPATH = @srcdir@ :../prelude
    231290ACLOCAL = @ACLOCAL@
    232291AMTAR = @AMTAR@
     
    253312CFLAGS = @CFLAGS@
    254313CONFIGURATION = @CONFIGURATION@
     314CONFIG_BUILDLIB = @CONFIG_BUILDLIB@
    255315CONFIG_CFAFLAGS = @CONFIG_CFAFLAGS@
    256316CONFIG_CFLAGS = @CONFIG_CFLAGS@
     
    369429# create object files in directory with source files
    370430AUTOMAKE_OPTIONS = foreign subdir-objects
     431<<<<<<< HEAD
    371432ACLOCAL_AMFLAGS = -I automake
     433=======
     434>>>>>>> master
    372435ARFLAGS = cr
    373436CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS)
     
    387450# use -no-include-stdhdr to prevent rebuild cycles
    388451# The built sources must not depend on the installed headers
     452<<<<<<< HEAD
    389453AM_CFAFLAGS = -quiet -in-tree -imacros prelude.c -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
    390454AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
     455=======
     456AM_CFAFLAGS = -quiet -in-tree -I$(srcdir)/stdhdr @CONFIG_CFAFLAGS@
     457AM_CFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     458>>>>>>> master
    391459AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     460@BUILDLIB_FALSE@headers =
    392461
    393462#----------------------------------------------------------------------------------------------------------------
    394463
    395464# not all platforms support concurrency, add option do disable it
     465<<<<<<< HEAD
    396466headers = fstream.hfa iostream.hfa iterator.hfa limits.hfa \
    397467        rational.hfa time.hfa stdlib.hfa common.hfa \
     
    409479libcfa_la_SOURCES = ${libsrc}
    410480stdhdr = $(shell find $(srcdir)/stdhdr -type f -printf "%p ")
     481=======
     482@BUILDLIB_TRUE@headers = fstream.hfa iostream.hfa iterator.hfa \
     483@BUILDLIB_TRUE@ limits.hfa rational.hfa time.hfa stdlib.hfa \
     484@BUILDLIB_TRUE@ common.hfa containers/maybe.hfa \
     485@BUILDLIB_TRUE@ containers/pair.hfa containers/result.hfa \
     486@BUILDLIB_TRUE@ containers/vector.hfa concurrency/coroutine.hfa \
     487@BUILDLIB_TRUE@ concurrency/thread.hfa concurrency/kernel.hfa \
     488@BUILDLIB_TRUE@ concurrency/monitor.hfa concurrency/mutex.hfa
     489@BUILDLIB_FALSE@headers_nosrc =
     490@BUILDLIB_TRUE@headers_nosrc = math.hfa gmp.hfa time_t.hfa \
     491@BUILDLIB_TRUE@ bits/align.hfa bits/containers.hfa \
     492@BUILDLIB_TRUE@ bits/defs.hfa bits/debug.hfa bits/locks.hfa \
     493@BUILDLIB_TRUE@ concurrency/invoke.h
     494@BUILDLIB_FALSE@libsrc =
     495
     496# not all platforms support concurrency, add option do disable it
     497@BUILDLIB_TRUE@libsrc = startup.cfa interpose.cfa bits/debug.cfa \
     498@BUILDLIB_TRUE@ assert.cfa exception.c virtual.c heap.cfa \
     499@BUILDLIB_TRUE@ ${headers:.hfa=.cfa} \
     500@BUILDLIB_TRUE@ concurrency/CtxSwitch-@ARCHITECTURE@.S \
     501@BUILDLIB_TRUE@ concurrency/alarm.cfa concurrency/invoke.c \
     502@BUILDLIB_TRUE@ concurrency/preemption.cfa
     503
     504#----------------------------------------------------------------------------------------------------------------
     505# add dependency to cfa-cpp so all libraries are rebuilt with new translator
     506#@CFACC@ @CFACPP@ prelude.cfa
     507
     508# add dependency of cfa files
     509libobjs = $(addsuffix .o, $(basename $(filter %.cfa,$(libsrc))))
     510
     511# .deps inclusion is not done automatically by automake for new languages
     512libdeps = $(join \
     513        $(addsuffix $(DEPDIR)/ , $(dir $(libobjs) ) ), \
     514        $(notdir ${libobjs:.o=.Po}) \
     515)
     516
     517
     518#----------------------------------------------------------------------------------------------------------------
     519libcfa_a_SOURCES = prelude.cfa ${libsrc}
     520stdhdr = ${shell find ${srcdir}/stdhdr -type f -printf "%p "}
     521>>>>>>> master
    411522cfa_includedir = $(CFA_INCDIR)
    412 nobase_cfa_include_HEADERS = \
    413         ${headers}             \
    414         ${stdhdr}              \
    415         math.hfa               \
    416         gmp.hfa                \
    417         time_t.hfa             \
    418         bits/align.hfa         \
    419         bits/containers.hfa    \
    420         bits/defs.hfa          \
    421         bits/debug.hfa         \
    422         bits/locks.hfa         \
    423         concurrency/invoke.h
    424 
    425 MOSTLYCLEANFILES = prelude.c
     523nobase_cfa_include_HEADERS = ${stdhdr} ${headers} ${headers_nosrc}
    426524all: all-am
    427525
     
    554652        -rm -f *.tab.c
    555653
     654<<<<<<< HEAD
    556655@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception.Plo@am__quote@
    557656@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prelude.Plo@am__quote@
     
    559658@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@ARCHITECTURE@.Plo@am__quote@
    560659@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/invoke.Plo@am__quote@
     660=======
     661@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exception.Po@am__quote@
     662@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virtual.Po@am__quote@
     663@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@ARCHITECTURE@.Po@am__quote@
     664@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/invoke.Po@am__quote@
     665>>>>>>> master
    561666
    562667.S.o:
     
    750855        fi
    751856mostlyclean-generic:
    752         -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
    753857
    754858clean-generic:
     
    861965
    862966
    863 .cfa.o: $(CFACC) $(CFACPP)
     967.cfa.o:
    864968        $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
    865969        $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
    866970        $(am__mv) $$depbase.Tpo $$depbase.Po
    867 
     971$(libobjs) : @CFACC@ @CFACPP@ prelude.cfa
     972
     973<<<<<<< HEAD
    868974.cfa.lo:
    869975        $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
     
    874980# add dependency to cfa-cpp so all libraries are rebuilt with new translator
    875981${libobjs} : ${cfalib_DATA}
     982=======
     983-include $(libdeps)
     984
     985prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
     986        ${AM_V_GEN}@CFACC@ ${AM_CFLAGS} ${CFLAGS} -quiet -in-tree -XCFA -l ${<} -c -o ${@}
     987>>>>>>> master
    876988
    877989#----------------------------------------------------------------------------------------------------------------
     
    879991        -rm -rf ${CFA_INCDIR} ${CFA_LIBDIR}
    880992
     993# $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
     994#       $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
     995#       $(am__mv) $$depbase.Tpo $$depbase.Po
     996
    881997# Tell versions [3.59,3.63) of GNU make to not export all variables.
    882998# Otherwise a system limit (for SysV at least) may be exceeded.
  • libcfa/src/heap.cfa

    r341bb80 r6d44da1  
    1 // #comment TD : this file uses both spaces and tabs for indentation
    2 
    31//
    42// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     
    1210// Created On       : Tue Dec 19 21:58:35 2017
    1311// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Sat Aug 11 08:22:16 2018
    15 // Update Count     : 495
     12// Last Modified On : Thu Sep  6 09:01:30 2018
     13// Update Count     : 513
    1614//
    1715
     
    2523
    2624// #comment TD : Many of these should be merged into math I believe
    27 #include "bits/align.hfa"                                                                       // libPow2
    28 #include "bits/defs.hfa"                                                                        // likely, unlikely
    29 #include "bits/locks.hfa"                                                                       // __spinlock_t
     25#include "bits/align.hfa"                                                               // libPow2
     26#include "bits/defs.hfa"                                                                // likely, unlikely
     27#include "bits/locks.hfa"                                                               // __spinlock_t
    3028#include "startup.hfa"                                                                  // STARTUP_PRIORITY_MEMORY
    31 #include "stdlib.hfa"                                                                           // bsearchl
     29#include "stdlib.hfa"                                                                   // bsearchl
    3230#include "malloc.h"
    3331
     
    151149
    152150extern "C" {
    153 void heapAppStart() {                                                                   // called by __cfaabi_appready_startup
    154         allocFree = 0;
    155 } // heapAppStart
    156 
    157 void heapAppStop() {                                                                    // called by __cfaabi_appready_startdown
    158         fclose( stdin ); fclose( stdout );
    159         checkUnfreed();
    160 } // heapAppStop
     151        void heapAppStart() {                                                           // called by __cfaabi_appready_startup
     152                allocFree = 0;
     153        } // heapAppStart
     154
     155        void heapAppStop() {                                                            // called by __cfaabi_appready_startdown
     156                fclose( stdin ); fclose( stdout );
     157                checkUnfreed();
     158        } // heapAppStop
    161159} // extern "C"
    162160#endif // __CFA_DEBUG__
     
    167165
    168166        struct Storage {
    169             struct Header {                                                                     // header
     167                struct Header {                                                                 // header
    170168                        union Kind {
    171169                                struct RealHeader {
    172170                                        union {
    173                                                 // #comment TD : this code use byte size but the comment uses bit size
    174 
    175                                                 struct {                                                // 32-bit word => 64-bit header, 64-bit word => 128-bit header
     171                                                struct {                                                // 4-byte word => 8-byte header, 8-byte word => 16-byte header
    176172                                                        #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_POINTER__ == 4
    177173                                                        uint32_t padding;                       // unused, force home/blocksize to overlay alignment in fake header
    178                                                         #endif // __ORDER_BIG_ENDIAN__ && __U_WORDSIZE__ == 32
     174                                                        #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_POINTER__ == 4
    179175
    180176                                                        union {
     
    189185                                                        #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_POINTER__ == 4
    190186                                                        uint32_t padding;                       // unused, force home/blocksize to overlay alignment in fake header
    191                                                         #endif // __ORDER_LITTLE_ENDIAN__ && __U_WORDSIZE__ == 32
    192 
     187                                                        #endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_POINTER__ == 4
    193188                                                };
    194 
    195                                                 // #comment TD : C++ code
     189                                                // future code
    196190                                                #if BUCKLOCK == LOCKFREE
    197191                                                Stack<Storage>::Link next;              // freed block points next freed block of same size (double-wide)
     
    211205                                } fake; // FakeHeader
    212206                        } kind; // Kind
    213             } header; // Header
    214             char pad[ALIGN - sizeof( Header )];
    215             char data[0];                                                                       // storage
     207                } header; // Header
     208                char pad[ALIGN - sizeof( Header )];
     209                char data[0];                                                                   // storage
    216210        }; // Storage
    217211
     
    220214        struct FreeHeader {
    221215                #if BUCKLOCK == SPINLOCK
    222             __spinlock_t lock;                                                          // must be first field for alignment
    223             Storage * freeList;
     216                __spinlock_t lock;                                                              // must be first field for alignment
     217                Storage * freeList;
    224218                #elif BUCKLOCK == LOCKFREE
    225                 // #comment TD : C++ code
    226             StackLF<Storage> freeList;
     219                // future code
     220                StackLF<Storage> freeList;
    227221                #else
    228                         #error undefined lock type for bucket lock
     222                #error undefined lock type for bucket lock
    229223                #endif // SPINLOCK
    230             size_t blockSize;                                                           // size of allocations on this list
     224                size_t blockSize;                                                               // size of allocations on this list
    231225        }; // FreeHeader
    232226
     
    249243static unsigned int maxBucketsUsed;                                             // maximum number of buckets in use
    250244
    251 // #comment TD : This array is not const but it feels like it should be
    252245// Powers of 2 are common allocation sizes, so make powers of 2 generate the minimum required size.
    253 static unsigned int bucketSizes[NoBucketSizes] @= {             // different bucket sizes
     246static const unsigned int bucketSizes[NoBucketSizes] @= { // different bucket sizes
    254247        16, 32, 48, 64,
    255248        64 + sizeof(HeapManager.Storage), 96, 112, 128, 128 + sizeof(HeapManager.Storage), 160, 192, 224,
     
    279272// #comment TD : The return type of this function should be commented
    280273static inline bool setMmapStart( size_t value ) {
    281         if ( value < pageSize || bucketSizes[NoBucketSizes - 1] < value ) return true;
     274  if ( value < pageSize || bucketSizes[NoBucketSizes - 1] < value ) return true;
    282275        mmapStart = value;                                                                      // set global
    283276
     
    313306        sbrk( (char *)libCeiling( (long unsigned int)End, libAlign() ) - End ); // move start of heap to multiple of alignment
    314307        heapBegin = heapEnd = sbrk( 0 );                                        // get new start point
    315 } // HeapManager
     308                           } // HeapManager
    316309
    317310
     
    323316        // } // if
    324317        #endif // __STATISTICS__
    325 } // ~HeapManager
     318                                } // ~HeapManager
    326319
    327320
     
    329322void memory_startup( void ) {
    330323        #ifdef __CFA_DEBUG__
    331         if ( unlikely( heapBoot ) ) {                                   // check for recursion during system boot
     324        if ( unlikely( heapBoot ) ) {                                           // check for recursion during system boot
    332325                // DO NOT USE STREAMS AS THEY MAY BE UNAVAILABLE AT THIS POINT.
    333326                abort( "boot() : internal error, recursively invoked during system boot." );
     
    336329        #endif // __CFA_DEBUG__
    337330
    338         // #comment TD : This assertion seems redundent with the above code
    339         assert( heapManager.heapBegin == 0 );
    340         heapManager{};
     331        //assert( heapManager.heapBegin != 0 );
     332        //heapManager{};
     333        if ( heapManager.heapBegin == 0 ) heapManager{};
    341334} // memory_startup
    342335
     
    374367        char helpText[512];
    375368        __cfaabi_dbg_bits_print_buffer( helpText, sizeof(helpText),
    376                         "\nHeap statistics:\n"
    377                         "  malloc: calls %u / storage %llu\n"
    378                         "  calloc: calls %u / storage %llu\n"
    379                         "  memalign: calls %u / storage %llu\n"
    380                         "  cmemalign: calls %u / storage %llu\n"
    381                         "  realloc: calls %u / storage %llu\n"
    382                         "  free: calls %u / storage %llu\n"
    383                         "  mmap: calls %u / storage %llu\n"
    384                         "  munmap: calls %u / storage %llu\n"
    385                         "  sbrk: calls %u / storage %llu\n",
    386                         malloc_calls, malloc_storage,
    387                         calloc_calls, calloc_storage,
    388                         memalign_calls, memalign_storage,
    389                         cmemalign_calls, cmemalign_storage,
    390                         realloc_calls, realloc_storage,
    391                         free_calls, free_storage,
    392                         mmap_calls, mmap_storage,
    393                         munmap_calls, munmap_storage,
    394                         sbrk_calls, sbrk_storage
     369                                                                        "\nHeap statistics:\n"
     370                                                                        "  malloc: calls %u / storage %llu\n"
     371                                                                        "  calloc: calls %u / storage %llu\n"
     372                                                                        "  memalign: calls %u / storage %llu\n"
     373                                                                        "  cmemalign: calls %u / storage %llu\n"
     374                                                                        "  realloc: calls %u / storage %llu\n"
     375                                                                        "  free: calls %u / storage %llu\n"
     376                                                                        "  mmap: calls %u / storage %llu\n"
     377                                                                        "  munmap: calls %u / storage %llu\n"
     378                                                                        "  sbrk: calls %u / storage %llu\n",
     379                                                                        malloc_calls, malloc_storage,
     380                                                                        calloc_calls, calloc_storage,
     381                                                                        memalign_calls, memalign_storage,
     382                                                                        cmemalign_calls, cmemalign_storage,
     383                                                                        realloc_calls, realloc_storage,
     384                                                                        free_calls, free_storage,
     385                                                                        mmap_calls, mmap_storage,
     386                                                                        munmap_calls, munmap_storage,
     387                                                                        sbrk_calls, sbrk_storage
    395388                );
    396389} // printStats
    397390
    398 // #comment TD : Why do we have this?
    399 static int printStatsXML( FILE * stream ) {
     391static int printStatsXML( FILE * stream ) {                             // see malloc_info
    400392        char helpText[512];
    401393        int len = snprintf( helpText, sizeof(helpText),
     
    431423static inline void noMemory() {
    432424        abort( "Heap memory exhausted at %zu bytes.\n"
    433                         "Possible cause is very large memory allocation and/or large amount of unfreed storage allocated by the program or system/library routines.",
    434                         ((char *)(sbrk( 0 )) - (char *)(heapManager.heapBegin)) );
     425                   "Possible cause is very large memory allocation and/or large amount of unfreed storage allocated by the program or system/library routines.",
     426                   ((char *)(sbrk( 0 )) - (char *)(heapManager.heapBegin)) );
    435427} // noMemory
    436428
     
    444436
    445437static inline bool setHeapExpand( size_t value ) {
    446         if ( heapExpand < pageSize ) return true;
     438  if ( heapExpand < pageSize ) return true;
    447439        heapExpand = value;
    448440        return false;
     
    453445        if ( unlikely( check ) ) {                                                      // bad address ?
    454446                abort( "Attempt to %s storage %p with address outside the heap.\n"
    455                                 "Possible cause is duplicate free on same block or overwriting of memory.",
    456                                 name, addr );
     447                           "Possible cause is duplicate free on same block or overwriting of memory.",
     448                           name, addr );
    457449        } // if
    458450} // checkHeader
     
    484476
    485477        #ifdef __CFA_DEBUG__
    486                         checkHeader( addr < heapBegin || header < (HeapManager.Storage.Header *)heapBegin, name, addr ); // bad low address ?
     478        checkHeader( addr < heapBegin || header < (HeapManager.Storage.Header *)heapBegin, name, addr ); // bad low address ?
    487479        #endif // __CFA_DEBUG__
    488480
     
    490482        //               It's called as the first statement of both branches of the last if, with the same parameters in all cases
    491483
    492                 // header may be safe to dereference
    493                 fakeHeader( header, size, alignment );
     484        // header may be safe to dereference
     485        fakeHeader( header, size, alignment );
    494486        #ifdef __CFA_DEBUG__
    495                         checkHeader( header < (HeapManager.Storage.Header *)heapBegin || (HeapManager.Storage.Header *)heapEnd < header, name, addr ); // bad address ? (offset could be + or -)
     487        checkHeader( header < (HeapManager.Storage.Header *)heapBegin || (HeapManager.Storage.Header *)heapEnd < header, name, addr ); // bad address ? (offset could be + or -)
    496488        #endif // __CFA_DEBUG__
    497489
    498                 freeElem = (HeapManager.FreeHeader *)((size_t)header->kind.real.home & -3);
     490        freeElem = (HeapManager.FreeHeader *)((size_t)header->kind.real.home & -3);
    499491        #ifdef __CFA_DEBUG__
    500                         if ( freeElem < &freeLists[0] || &freeLists[NoBucketSizes] <= freeElem ) {
    501                         abort( "Attempt to %s storage %p with corrupted header.\n"
    502                                 "Possible cause is duplicate free on same block or overwriting of header information.",
    503                                         name, addr );
    504                         } // if
     492        if ( freeElem < &freeLists[0] || &freeLists[NoBucketSizes] <= freeElem ) {
     493                abort( "Attempt to %s storage %p with corrupted header.\n"
     494                          "Possible cause is duplicate free on same block or overwriting of header information.",
     495                           name, addr );
     496        } // if
    505497        #endif // __CFA_DEBUG__
    506                 size = freeElem->blockSize;
    507                 return false;
     498        size = freeElem->blockSize;
     499        return false;
    508500} // headers
    509501
     
    521513                        return 0;
    522514                } // if
    523 #ifdef __STATISTICS__
     515                #ifdef __STATISTICS__
    524516                sbrk_calls += 1;
    525517                sbrk_storage += increase;
    526 #endif // __STATISTICS__
    527 #ifdef __CFA_DEBUG__
     518                #endif // __STATISTICS__
     519                #ifdef __CFA_DEBUG__
    528520                // Set new memory to garbage so subsequent uninitialized usages might fail.
    529521                memset( (char *)heapEnd + heapRemaining, '\377', increase );
    530 #endif // __CFA_DEBUG__
     522                #endif // __CFA_DEBUG__
    531523                rem = heapRemaining + increase - size;
    532524        } // if
     
    560552
    561553                #if defined( SPINLOCK )
    562                         lock( freeElem->lock __cfaabi_dbg_ctx2 );
    563                         block = freeElem->freeList;                                             // remove node from stack
     554                lock( freeElem->lock __cfaabi_dbg_ctx2 );
     555                block = freeElem->freeList;                                             // remove node from stack
    564556                #else
    565                         block = freeElem->freeList.pop();
     557                block = freeElem->freeList.pop();
    566558                #endif // SPINLOCK
    567559                if ( unlikely( block == 0 ) ) {                                 // no free block ?
     
    569561                        unlock( freeElem->lock );
    570562                        #endif // SPINLOCK
     563
    571564                        // Freelist for that size was empty, so carve it out of the heap if there's enough left, or get some more
    572565                        // and then carve it off.
    573566
    574567                        block = (HeapManager.Storage *)extend( tsize ); // mutual exclusion on call
    575                         if ( unlikely( block == 0 ) ) return 0;
     568  if ( unlikely( block == 0 ) ) return 0;
    576569                        #if defined( SPINLOCK )
    577570                } else {
     
    582575
    583576                block->header.kind.real.home = freeElem;                // pointer back to free list of apropriate size
    584                 } else {                                                                                        // large size => mmap
     577        } else {                                                                                        // large size => mmap
    585578                tsize = libCeiling( tsize, pageSize );                  // must be multiple of page size
    586579                #ifdef __STATISTICS__
    587                         __atomic_add_fetch( &mmap_calls, 1, __ATOMIC_SEQ_CST );
    588                         __atomic_add_fetch( &mmap_storage, tsize, __ATOMIC_SEQ_CST );
     580                __atomic_add_fetch( &mmap_calls, 1, __ATOMIC_SEQ_CST );
     581                __atomic_add_fetch( &mmap_storage, tsize, __ATOMIC_SEQ_CST );
    589582                #endif // __STATISTICS__
    590583                block = (HeapManager.Storage *)mmap( 0, tsize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, mmapFd, 0 );
     
    593586                        abort( "(HeapManager &)0x%p.doMalloc() : internal error, mmap failure, size:%zu error:%d.", &heapManager, tsize, errno );
    594587                } // if
    595 #ifdef __CFA_DEBUG__
     588                #ifdef __CFA_DEBUG__
    596589                // Set new memory to garbage so subsequent uninitialized usages might fail.
    597590                memset( block, '\377', tsize );
    598 #endif // __CFA_DEBUG__
     591                #endif // __CFA_DEBUG__
    599592                block->header.kind.real.blockSize = tsize;              // storage size for munmap
    600                 } // if
    601 
    602                 void * area = &(block->data);                                           // adjust off header to user bytes
     593        } // if
     594
     595        void * area = &(block->data);                                           // adjust off header to user bytes
    603596
    604597        #ifdef __CFA_DEBUG__
    605                         assert( ((uintptr_t)area & (libAlign() - 1)) == 0 ); // minimum alignment ?
    606                         __atomic_add_fetch( &allocFree, tsize, __ATOMIC_SEQ_CST );
    607                 if ( traceHeap() ) {
    608                         enum { BufferSize = 64 };
    609                         char helpText[BufferSize];
    610                         int len = snprintf( helpText, BufferSize, "%p = Malloc( %zu ) (allocated %zu)\n", area, size, tsize );
    611                         // int len = snprintf( helpText, BufferSize, "Malloc %p %zu\n", area, size );
    612                         __cfaabi_dbg_bits_write( helpText, len );
    613                 } // if
     598        assert( ((uintptr_t)area & (libAlign() - 1)) == 0 ); // minimum alignment ?
     599        __atomic_add_fetch( &allocFree, tsize, __ATOMIC_SEQ_CST );
     600        if ( traceHeap() ) {
     601                enum { BufferSize = 64 };
     602                char helpText[BufferSize];
     603                int len = snprintf( helpText, BufferSize, "%p = Malloc( %zu ) (allocated %zu)\n", area, size, tsize );
     604                // int len = snprintf( helpText, BufferSize, "Malloc %p %zu\n", area, size );
     605                __cfaabi_dbg_bits_write( helpText, len );
     606        } // if
    614607        #endif // __CFA_DEBUG__
    615608
     
    620613static inline void doFree( void * addr ) with ( heapManager ) {
    621614        #ifdef __CFA_DEBUG__
    622                 if ( unlikely( heapManager.heapBegin == 0 ) ) {
    623                         abort( "doFree( %p ) : internal error, called before heap is initialized.", addr );
    624                 } // if
     615        if ( unlikely( heapManager.heapBegin == 0 ) ) {
     616                abort( "doFree( %p ) : internal error, called before heap is initialized.", addr );
     617        } // if
    625618        #endif // __CFA_DEBUG__
    626619
     
    631624        if ( headers( "free", addr, header, freeElem, size, alignment ) ) { // mmapped ?
    632625                #ifdef __STATISTICS__
    633                         __atomic_add_fetch( &munmap_calls, 1, __ATOMIC_SEQ_CST );
    634                         __atomic_add_fetch( &munmap_storage, size, __ATOMIC_SEQ_CST );
     626                __atomic_add_fetch( &munmap_calls, 1, __ATOMIC_SEQ_CST );
     627                __atomic_add_fetch( &munmap_storage, size, __ATOMIC_SEQ_CST );
    635628                #endif // __STATISTICS__
    636629                if ( munmap( header, size ) == -1 ) {
    637630                        #ifdef __CFA_DEBUG__
    638631                        abort( "Attempt to deallocate storage %p not allocated or with corrupt header.\n"
    639                                         "Possible cause is invalid pointer.",
    640                                         addr );
     632                                   "Possible cause is invalid pointer.",
     633                                   addr );
    641634                        #endif // __CFA_DEBUG__
    642635                } // if
    643                 } else {
     636        } else {
    644637                #ifdef __CFA_DEBUG__
    645                         // Set free memory to garbage so subsequent usages might fail.
    646                         memset( ((HeapManager.Storage *)header)->data, '\377', freeElem->blockSize - sizeof( HeapManager.Storage ) );
     638                // Set free memory to garbage so subsequent usages might fail.
     639                memset( ((HeapManager.Storage *)header)->data, '\377', freeElem->blockSize - sizeof( HeapManager.Storage ) );
    647640                #endif // __CFA_DEBUG__
    648641
    649642                #ifdef __STATISTICS__
    650                         free_storage += size;
     643                free_storage += size;
    651644                #endif // __STATISTICS__
    652645                #if defined( SPINLOCK )
    653                         lock( freeElem->lock __cfaabi_dbg_ctx2 );               // acquire spin lock
    654                         header->kind.real.next = freeElem->freeList;    // push on stack
    655                         freeElem->freeList = (HeapManager.Storage *)header;
    656                         unlock( freeElem->lock );                                               // release spin lock
     646                lock( freeElem->lock __cfaabi_dbg_ctx2 );               // acquire spin lock
     647                header->kind.real.next = freeElem->freeList;    // push on stack
     648                freeElem->freeList = (HeapManager.Storage *)header;
     649                unlock( freeElem->lock );                                               // release spin lock
    657650                #else
    658                         freeElem->freeList.push( *(HeapManager.Storage *)header );
     651                freeElem->freeList.push( *(HeapManager.Storage *)header );
    659652                #endif // SPINLOCK
    660                 } // if
     653        } // if
    661654
    662655        #ifdef __CFA_DEBUG__
    663                  __atomic_add_fetch( &allocFree, -size, __ATOMIC_SEQ_CST );
    664                 if ( traceHeap() ) {
    665                         char helpText[64];
    666                         int len = snprintf( helpText, sizeof(helpText), "Free( %p ) size:%zu\n", addr, size );
    667                         __cfaabi_dbg_bits_write( helpText, len );
    668                 } // if
     656        __atomic_add_fetch( &allocFree, -size, __ATOMIC_SEQ_CST );
     657        if ( traceHeap() ) {
     658                char helpText[64];
     659                int len = snprintf( helpText, sizeof(helpText), "Free( %p ) size:%zu\n", addr, size );
     660                __cfaabi_dbg_bits_write( helpText, len );
     661        } // if
    669662        #endif // __CFA_DEBUG__
    670663} // doFree
     
    674667        size_t total = 0;
    675668        #ifdef __STATISTICS__
    676                 __cfaabi_dbg_bits_acquire();
    677                 __cfaabi_dbg_bits_print_nolock( "\nBin lists (bin size : free blocks on list)\n" );
     669        __cfaabi_dbg_bits_acquire();
     670        __cfaabi_dbg_bits_print_nolock( "\nBin lists (bin size : free blocks on list)\n" );
    678671        #endif // __STATISTICS__
    679672        for ( unsigned int i = 0; i < maxBucketsUsed; i += 1 ) {
     
    695688
    696689                #ifdef __STATISTICS__
    697                         __cfaabi_dbg_bits_print_nolock( "%7zu, %-7u  ", size, N );
    698                         if ( (i + 1) % 8 == 0 ) __cfaabi_dbg_bits_print_nolock( "\n" );
     690                __cfaabi_dbg_bits_print_nolock( "%7zu, %-7u  ", size, N );
     691                if ( (i + 1) % 8 == 0 ) __cfaabi_dbg_bits_print_nolock( "\n" );
    699692                #endif // __STATISTICS__
    700693        } // for
    701694        #ifdef __STATISTICS__
    702                 __cfaabi_dbg_bits_print_nolock( "\ntotal free blocks:%zu\n", total );
    703                 __cfaabi_dbg_bits_release();
     695        __cfaabi_dbg_bits_print_nolock( "\ntotal free blocks:%zu\n", total );
     696        __cfaabi_dbg_bits_release();
    704697        #endif // __STATISTICS__
    705698        return (char *)heapEnd - (char *)heapBegin - total;
    706699} // checkFree
    707700
    708 // #comment TD : This is not a good name, plus this feels like it could easily be folded into doMalloc
    709 static inline void * malloc2( size_t size ) {                   // necessary for malloc statistics
    710         assert( heapManager.heapBegin != 0 );
     701
     702static inline void * mallocNoStats( size_t size ) {             // necessary for malloc statistics
     703        //assert( heapManager.heapBegin != 0 );
     704        if ( unlikely( heapManager.heapBegin == 0 ) ) heapManager{}; // called before memory_startup ?
    711705        void * area = doMalloc( size );
    712706        if ( unlikely( area == 0 ) ) errno = ENOMEM;            // POSIX
    713707        return area;
    714 } // malloc2
    715 
    716 
    717 static inline void * memalign2( size_t alignment, size_t size ) { // necessary for malloc statistics
    718 #ifdef __CFA_DEBUG__
     708} // mallocNoStats
     709
     710
     711static inline void * memalignNoStats( size_t alignment, size_t size ) { // necessary for malloc statistics
     712        #ifdef __CFA_DEBUG__
    719713        checkAlign( alignment );                                                        // check alignment
    720 #endif // __CFA_DEBUG__
     714        #endif // __CFA_DEBUG__
    721715
    722716        // if alignment <= default alignment, do normal malloc as two headers are unnecessary
    723         if ( unlikely( alignment <= libAlign() ) ) return malloc2( size );
     717  if ( unlikely( alignment <= libAlign() ) ) return mallocNoStats( size );
    724718
    725719        // Allocate enough storage to guarantee an address on the alignment boundary, and sufficient space before it for
     
    732726        // subtract libAlign() because it is already the minimum alignment
    733727        // add sizeof(Storage) for fake header
    734         // #comment TD : this is the only place that calls doMalloc without calling malloc2, why ?
     728        // #comment TD : this is the only place that calls doMalloc without calling mallocNoStats, why ?
    735729        char * area = (char *)doMalloc( size + alignment - libAlign() + sizeof(HeapManager.Storage) );
    736         if ( unlikely( area == 0 ) ) return area;
     730  if ( unlikely( area == 0 ) ) return area;
    737731
    738732        // address in the block of the "next" alignment address
     
    749743
    750744        return user;
    751 } // memalign2
     745} // memalignNoStats
    752746
    753747
    754748extern "C" {
    755         // The malloc() function allocates size bytes and returns a pointer to the
    756         // allocated memory. The memory is not initialized. If size is 0, then malloc()
    757         // returns either NULL, or a unique pointer value that can later be successfully
    758         // passed to free().
     749        // The malloc() function allocates size bytes and returns a pointer to the allocated memory. The memory is not
     750        // initialized. If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be
     751        // successfully passed to free().
    759752        void * malloc( size_t size ) {
    760753                #ifdef __STATISTICS__
    761                         __atomic_add_fetch( &malloc_calls, 1, __ATOMIC_SEQ_CST );
    762                         __atomic_add_fetch( &malloc_storage, size, __ATOMIC_SEQ_CST );
    763                 #endif // __STATISTICS__
    764 
    765                 return malloc2( size );
    766                 } // malloc
    767 
    768         // The calloc() function allocates memory for an array of nmemb elements of
    769         // size bytes each and returns a pointer to the allocated memory. The memory
    770         // is set to zero. If nmemb or size is 0, then calloc() returns either NULL,
    771         // or a unique pointer value that can later be successfully passed to free().
    772                 void * calloc( size_t noOfElems, size_t elemSize ) {
     754                __atomic_add_fetch( &malloc_calls, 1, __ATOMIC_SEQ_CST );
     755                __atomic_add_fetch( &malloc_storage, size, __ATOMIC_SEQ_CST );
     756                #endif // __STATISTICS__
     757
     758                return mallocNoStats( size );
     759        } // malloc
     760
     761        // The calloc() function allocates memory for an array of nmemb elements of size bytes each and returns a pointer to
     762        // the allocated memory. The memory is set to zero. If nmemb or size is 0, then calloc() returns either NULL, or a
     763        // unique pointer value that can later be successfully passed to free().
     764        void * calloc( size_t noOfElems, size_t elemSize ) {
    773765                size_t size = noOfElems * elemSize;
    774766                #ifdef __STATISTICS__
    775                         __atomic_add_fetch( &calloc_calls, 1, __ATOMIC_SEQ_CST );
    776                         __atomic_add_fetch( &calloc_storage, size, __ATOMIC_SEQ_CST );
    777                 #endif // __STATISTICS__
    778 
    779                 char * area = (char *)malloc2( size );
    780                 if ( unlikely( area == 0 ) ) return 0;
     767                __atomic_add_fetch( &calloc_calls, 1, __ATOMIC_SEQ_CST );
     768                __atomic_add_fetch( &calloc_storage, size, __ATOMIC_SEQ_CST );
     769                #endif // __STATISTICS__
     770
     771                char * area = (char *)mallocNoStats( size );
     772          if ( unlikely( area == 0 ) ) return 0;
    781773
    782774                HeapManager.Storage.Header * header;
     
    790782                        memset( area, '\0', asize - sizeof(HeapManager.Storage) ); // set to zeros
    791783
    792                 header->kind.real.blockSize |= 2;               // mark as zero filled
     784                header->kind.real.blockSize |= 2;                               // mark as zero filled
    793785                return area;
    794                 } // calloc
     786        } // calloc
    795787
    796788        // #comment TD : Document this function
     
    798790                size_t size = noOfElems * elemSize;
    799791                #ifdef __STATISTICS__
    800                         __atomic_add_fetch( &cmemalign_calls, 1, __ATOMIC_SEQ_CST );
    801                         __atomic_add_fetch( &cmemalign_storage, size, __ATOMIC_SEQ_CST );
    802                 #endif // __STATISTICS__
    803 
    804                 char * area = (char *)memalign2( alignment, size );
    805                 if ( unlikely( area == 0 ) ) return 0;
     792                __atomic_add_fetch( &cmemalign_calls, 1, __ATOMIC_SEQ_CST );
     793                __atomic_add_fetch( &cmemalign_storage, size, __ATOMIC_SEQ_CST );
     794                #endif // __STATISTICS__
     795
     796                char * area = (char *)memalignNoStats( alignment, size );
     797          if ( unlikely( area == 0 ) ) return 0;
    806798                HeapManager.Storage.Header * header;
    807799                HeapManager.FreeHeader * freeElem;
     
    811803                // Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero.
    812804                if ( ! mapped )
    813                 #endif // __CFA_DEBUG__
     805                        #endif // __CFA_DEBUG__
    814806                        memset( area, '\0', asize - ( (char *)area - (char *)header ) ); // set to zeros
    815807                header->kind.real.blockSize |= 2;                               // mark as zero filled
    816808
    817809                return area;
    818                 } // cmemalign
    819 
    820         // The realloc() function changes the size of the memory block pointed to by
    821         // ptr to size bytes. The contents will be unchanged in the range from the
    822         // start of the region up to the minimum of the old and new sizes. If the new
    823         // size is larger than the old size, the added memory will not be initialized.
    824         // If ptr is NULL, then the call is equivalent to malloc(size), for all values
    825         // of size; if size is equal to zero, and ptr is not NULL, then the call is
    826         // equivalent to free(ptr). Unless ptr is NULL, it must have been returned by
    827         // an earlier call to malloc(), calloc() or realloc(). If the area pointed to
    828         // was moved, a free(ptr) is done.
    829                 void * realloc( void * addr, size_t size ) {
    830                 #ifdef __STATISTICS__
    831                         __atomic_add_fetch( &realloc_calls, 1, __ATOMIC_SEQ_CST );
    832                 #endif // __STATISTICS__
    833 
    834                 if ( unlikely( addr == 0 ) ) return malloc2( size ); // special cases
    835                 if ( unlikely( size == 0 ) ) { free( addr ); return 0; }
     810        } // cmemalign
     811
     812        // The realloc() function changes the size of the memory block pointed to by ptr to size bytes. The contents will be
     813        // unchanged in the range from the start of the region up to the minimum of the old and new sizes. If the new size
     814        // is larger than the old size, the added memory will not be initialized.  If ptr is NULL, then the call is
     815        // equivalent to malloc(size), for all values of size; if size is equal to zero, and ptr is not NULL, then the call
     816        // is equivalent to free(ptr). Unless ptr is NULL, it must have been returned by an earlier call to malloc(),
     817        // calloc() or realloc(). If the area pointed to was moved, a free(ptr) is done.
     818        void * realloc( void * addr, size_t size ) {
     819                #ifdef __STATISTICS__
     820                __atomic_add_fetch( &realloc_calls, 1, __ATOMIC_SEQ_CST );
     821                #endif // __STATISTICS__
     822
     823          if ( unlikely( addr == 0 ) ) return mallocNoStats( size ); // special cases
     824          if ( unlikely( size == 0 ) ) { free( addr ); return 0; }
    836825
    837826                HeapManager.Storage.Header * header;
     
    848837
    849838                #ifdef __STATISTICS__
    850                         __atomic_add_fetch( &realloc_storage, size, __ATOMIC_SEQ_CST );
     839                __atomic_add_fetch( &realloc_storage, size, __ATOMIC_SEQ_CST );
    851840                #endif // __STATISTICS__
    852841
     
    855844                        area = memalign( alignment, size );                     // create new area
    856845                } else {
    857                         area = malloc2( size ); // create new area
     846                        area = mallocNoStats( size );                           // create new area
    858847                } // if
    859                 if ( unlikely( area == 0 ) ) return 0;
     848          if ( unlikely( area == 0 ) ) return 0;
    860849                if ( unlikely( header->kind.real.blockSize & 2 ) ) { // previous request zero fill (calloc/cmemalign) ?
    861850                        assert( (header->kind.real.blockSize & 1) == 0 );
     
    864853                        // Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero.
    865854                        if ( ! mapped )
    866                         #endif // __CFA_DEBUG__
     855                                #endif // __CFA_DEBUG__
    867856                                memset( (char *)area + usize, '\0', asize - ( (char *)area - (char *)header ) - usize ); // zero-fill back part
    868857                        header->kind.real.blockSize |= 2;                       // mark new request as zero fill
     
    874863
    875864
    876         // The obsolete function memalign() allocates size bytes and returns
    877         // a pointer to the allocated memory. The memory address will be a
    878         // multiple of alignment, which must be a power of two.
    879         void * memalign( size_t alignment, size_t size ) __attribute__ ((deprecated));
    880                 void * memalign( size_t alignment, size_t size ) {
     865        // The obsolete function memalign() allocates size bytes and returns a pointer to the allocated memory. The memory
     866        // address will be a multiple of alignment, which must be a power of two.
     867        void * memalign( size_t alignment, size_t size ) {
    881868                #ifdef __STATISTICS__
    882869                __atomic_add_fetch( &memalign_calls, 1, __ATOMIC_SEQ_CST );
     
    884871                #endif // __STATISTICS__
    885872
    886                 void * area = memalign2( alignment, size );
     873                void * area = memalignNoStats( alignment, size );
    887874
    888875                return area;
    889                 } // memalign
    890 
    891         // The function aligned_alloc() is the same as memalign(), except for
    892         // the added restriction that size should be a multiple of alignment.
     876        } // memalign
     877
     878        // The function aligned_alloc() is the same as memalign(), except for the added restriction that size should be a
     879        // multiple of alignment.
    893880        void * aligned_alloc( size_t alignment, size_t size ) {
    894881                return memalign( alignment, size );
     
    896883
    897884
    898         // The function posix_memalign() allocates size bytes and places the address
    899         // of the allocated memory in *memptr. The address of the allocated memory
    900         // will be a multiple of alignment, which must be a power of two and a multiple
    901         // of sizeof(void *). If size is 0, then posix_memalign() returns either NULL,
    902         // or a unique pointer value that can later be successfully passed to free(3).
     885        // The function posix_memalign() allocates size bytes and places the address of the allocated memory in *memptr. The
     886        // address of the allocated memory will be a multiple of alignment, which must be a power of two and a multiple of
     887        // sizeof(void *). If size is 0, then posix_memalign() returns either NULL, or a unique pointer value that can later
     888        // be successfully passed to free(3).
    903889        int posix_memalign( void ** memptr, size_t alignment, size_t size ) {
    904                 if ( alignment < sizeof(void *) || ! libPow2( alignment ) ) return EINVAL; // check alignment
     890          if ( alignment < sizeof(void *) || ! libPow2( alignment ) ) return EINVAL; // check alignment
    905891                * memptr = memalign( alignment, size );
    906                 if ( unlikely( * memptr == 0 ) ) return ENOMEM;
     892          if ( unlikely( * memptr == 0 ) ) return ENOMEM;
    907893                return 0;
    908894        } // posix_memalign
    909895
    910         // The obsolete function valloc() allocates size bytes and returns a pointer
    911         // to the allocated memory. The memory address will be a multiple of the page size.
    912         // It is equivalent to memalign(sysconf(_SC_PAGESIZE),size).
    913         void * valloc( size_t size ) __attribute__ ((deprecated));
     896        // The obsolete function valloc() allocates size bytes and returns a pointer to the allocated memory. The memory
     897        // address will be a multiple of the page size.  It is equivalent to memalign(sysconf(_SC_PAGESIZE),size).
    914898        void * valloc( size_t size ) {
    915899                return memalign( pageSize, size );
     
    917901
    918902
    919         // The free() function frees the memory space pointed to by ptr, which must
    920         // have been returned by a previous call to malloc(), calloc() or realloc().
    921         // Otherwise, or if free(ptr) has already been called before, undefined
    922         // behavior occurs. If ptr is NULL, no operation is performed.
     903        // The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to
     904        // malloc(), calloc() or realloc().  Otherwise, or if free(ptr) has already been called before, undefined behavior
     905        // occurs. If ptr is NULL, no operation is performed.
    923906        void free( void * addr ) {
    924907                #ifdef __STATISTICS__
    925                         __atomic_add_fetch( &free_calls, 1, __ATOMIC_SEQ_CST );
     908                __atomic_add_fetch( &free_calls, 1, __ATOMIC_SEQ_CST );
    926909                #endif // __STATISTICS__
    927910
     
    931914                if ( unlikely( addr == 0 ) ) {                                  // special case
    932915                        #ifdef __CFA_DEBUG__
    933                                 if ( traceHeap() ) {
    934                                         #define nullmsg "Free( 0x0 ) size:0\n"
    935                                         // Do not debug print free( 0 ), as it can cause recursive entry from sprintf.
    936                                         __cfaabi_dbg_bits_write( nullmsg, sizeof(nullmsg) - 1 );
    937                                 } // if
     916                        if ( traceHeap() ) {
     917                                #define nullmsg "Free( 0x0 ) size:0\n"
     918                                // Do not debug print free( 0 ), as it can cause recursive entry from sprintf.
     919                                __cfaabi_dbg_bits_write( nullmsg, sizeof(nullmsg) - 1 );
     920                        } // if
    938921                        #endif // __CFA_DEBUG__
    939922                        return;
     
    943926        } // free
    944927
    945         // The mallopt() function adjusts parameters that control the behavior of the
    946         // memory-allocation functions (see malloc(3)). The param argument specifies
    947         // the parameter to be modified, and value specifies the new value for that
     928        // The mallopt() function adjusts parameters that control the behavior of the memory-allocation functions (see
     929        // malloc(3)). The param argument specifies the parameter to be modified, and value specifies the new value for that
    948930        // parameter.
    949                 int mallopt( int option, int value ) {
     931        int mallopt( int option, int value ) {
    950932                choose( option ) {
    951                         case M_TOP_PAD:
    952                                 if ( setHeapExpand( value ) ) fallthru default;
    953                         case M_MMAP_THRESHOLD:
    954                                 if ( setMmapStart( value ) ) fallthru default;
    955                         default:
    956                                 // #comment TD : 1 for unsopported feels wrong
    957                                 return 1;                                                                       // success, or unsupported
     933                  case M_TOP_PAD:
     934                        if ( setHeapExpand( value ) ) fallthru default;
     935                  case M_MMAP_THRESHOLD:
     936                        if ( setMmapStart( value ) ) fallthru default;
     937                  default:
     938                        // #comment TD : 1 for unsopported feels wrong
     939                        return 1;                                                                       // success, or unsupported
    958940                } // switch
    959941                return 0;                                                                               // error
    960942        } // mallopt
    961943
    962         // The malloc_trim() function attempts to release free memory at the top
    963         // of the heap (by calling sbrk(2) with a suitable argument).
     944        // The malloc_trim() function attempts to release free memory at the top of the heap (by calling sbrk(2) with a
     945        // suitable argument).
    964946        int malloc_trim( size_t ) {
    965947                return 0;                                                                               // => impossible to release memory
    966948        } // malloc_trim
    967949
    968         // The malloc_usable_size() function returns the number of usable bytes in the
    969         // block pointed to by ptr, a pointer to a block of memory allocated by
    970         // malloc(3) or a related function.
    971                 size_t malloc_usable_size( void * addr ) {
    972                 if ( unlikely( addr == 0 ) ) return 0;                  // null allocation has 0 size
     950        // The malloc_usable_size() function returns the number of usable bytes in the block pointed to by ptr, a pointer to
     951        // a block of memory allocated by malloc(3) or a related function.
     952        size_t malloc_usable_size( void * addr ) {
     953          if ( unlikely( addr == 0 ) ) return 0;                        // null allocation has 0 size
    973954
    974955                HeapManager.Storage.Header * header;
     
    982963
    983964
    984                 // #comment TD : Document this function
     965    // The malloc_alignment() function returns the alignment of the allocation.
    985966        size_t malloc_alignment( void * addr ) {
    986                 if ( unlikely( addr == 0 ) ) return libAlign(); // minimum alignment
     967          if ( unlikely( addr == 0 ) ) return libAlign();       // minimum alignment
    987968                HeapManager.Storage.Header * header = (HeapManager.Storage.Header *)( (char *)addr - sizeof(HeapManager.Storage) );
    988969                if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ?
     
    991972                        return libAlign ();                                                     // minimum alignment
    992973                } // if
    993                 } // malloc_alignment
    994 
    995 
    996                 // #comment TD : Document this function
     974        } // malloc_alignment
     975
     976
     977    // The malloc_zero_fill() function returns true if the allocation is zero filled, i.e., initially allocated by calloc().
    997978        bool malloc_zero_fill( void * addr ) {
    998                 if ( unlikely( addr == 0 ) ) return false;              // null allocation is not zero fill
     979          if ( unlikely( addr == 0 ) ) return false;            // null allocation is not zero fill
    999980
    1000981                HeapManager.Storage.Header * header = (HeapManager.Storage.Header *)( (char *)addr - sizeof(HeapManager.Storage) );
     
    1003984                } // if
    1004985                return (header->kind.real.blockSize & 2) != 0;  // zero filled (calloc/cmemalign) ?
    1005                 } // malloc_zero_fill
    1006 
    1007 
    1008         // #comment TD : Document this function
     986        } // malloc_zero_fill
     987
     988
     989    // The malloc_stats() function prints (on default standard error) statistics about memory allocated by malloc(3) and
     990    // related functions.
    1009991        void malloc_stats( void ) {
    1010992                #ifdef __STATISTICS__
    1011                         printStats();
    1012                         if ( checkFree() ) checkFree( heapManager );
    1013                 #endif // __STATISTICS__
    1014                 } // malloc_stats
    1015 
    1016         // #comment TD : Document this function
    1017                 int malloc_stats_fd( int fd ) {
    1018                 #ifdef __STATISTICS__
    1019                         int temp = statfd;
    1020                         statfd = fd;
    1021                         return temp;
     993                printStats();
     994                if ( checkFree() ) checkFree( heapManager );
     995                #endif // __STATISTICS__
     996        } // malloc_stats
     997
     998        // The malloc_stats_fd() function changes the file descripter where malloc_stats() writes the statistics.
     999        int malloc_stats_fd( int fd ) {
     1000                #ifdef __STATISTICS__
     1001                int temp = statfd;
     1002                statfd = fd;
     1003                return temp;
    10221004                #else
    1023                         return -1;
    1024                 #endif // __STATISTICS__
    1025                 } // malloc_stats_fd
    1026 
    1027 
    1028         // #comment TD : Document this function
     1005                return -1;
     1006                #endif // __STATISTICS__
     1007        } // malloc_stats_fd
     1008
     1009        // The malloc_info() function exports an XML string that describes the current state of the memory-allocation
     1010        // implementation in the caller.  The string is printed on the file stream stream.  The exported string includes
     1011        // information about all arenas (see malloc(3)).
    10291012        int malloc_info( int options, FILE * stream ) {
    10301013                return printStatsXML( stream );
     
    10321015
    10331016
    1034         // #comment TD : What are these two functions for?
     1017        // The malloc_get_state() function records the current state of all malloc(3) internal bookkeeping variables (but
     1018        // not the actual contents of the heap or the state of malloc_hook(3) functions pointers).  The state is recorded in
     1019        // a system-dependent opaque data structure dynamically allocated via malloc(3), and a pointer to that data
     1020        // structure is returned as the function result.  (It is the caller's responsibility to free(3) this memory.)
    10351021        void * malloc_get_state( void ) {
    1036                 return 0;
     1022                return 0;                                                                               // unsupported
    10371023        } // malloc_get_state
    10381024
     1025
     1026        // The malloc_set_state() function restores the state of all malloc(3) internal bookkeeping variables to the values
     1027        // recorded in the opaque data structure pointed to by state.
    10391028        int malloc_set_state( void * ptr ) {
    1040                 return 0;
     1029                return 0;                                                                               // unsupported
    10411030        } // malloc_set_state
    10421031} // extern "C"
  • src/CodeTools/module.mk

    r341bb80 r6d44da1  
    1616
    1717SRC += CodeTools/DeclStats.cc \
     18        CodeTools/ResolvProtoDump.cc \
    1819        CodeTools/TrackLoc.cc
  • src/CompilationState.cc

    r341bb80 r6d44da1  
    3030        parsep = false,
    3131        resolvep = false,
     32        resolvprotop = false,
    3233        symtabp = false,
    3334        treep = false,
  • src/CompilationState.h

    r341bb80 r6d44da1  
    3131        parsep,
    3232        resolvep,
     33        resolvprotop,
    3334        symtabp,
    3435        treep,
  • src/GenPoly/ScrubTyVars.cc

    r341bb80 r6d44da1  
    5050                                delete typeInst;
    5151                                return new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) );
     52                          default:
     53                                assertf(false, "Unhandled tyvar kind: %d", tyVar->second.kind);
    5254                        } // switch
    5355                } // if
  • src/Makefile.am

    r341bb80 r6d44da1  
    4444# put into lib for now
    4545cfa_cpplibdir = $(CFA_LIBDIR)
    46 cfa_cpplib_PROGRAMS = ../driver/cfa-cpp
     46cfa_cpplib_PROGRAMS = ../driver/cfa-cpp demangler
    4747___driver_cfa_cpp_SOURCES = $(SRC)
    4848___driver_cfa_cpp_LDADD = -ldl                  # yywrap
     
    5050AM_CXXFLAGS = @HOST_FLAGS@ -Wno-deprecated -Wall -Wextra -DDEBUG_ALL -I./Parser -I$(srcdir)/Parser -I$(srcdir)/include -DYY_NO_INPUT -O2 -g -std=c++14
    5151AM_LDFLAGS  = @HOST_FLAGS@ -Xlinker -export-dynamic
     52ARFLAGS     = cr
     53
     54demangler_SOURCES = SymTab/demangler.cc
     55
     56demangler_LDADD = libdemangle.a     # yywrap
     57
     58noinst_LIBRARIES = libdemangle.a
     59libdemangle_a_SOURCES = SymTab/Demangle.cc SymTab/ManglerCommon.cc \
     60  SynTree/Type.cc \
     61  SynTree/VoidType.cc \
     62  SynTree/BasicType.cc \
     63  SynTree/PointerType.cc \
     64  SynTree/ArrayType.cc \
     65  SynTree/ReferenceType.cc \
     66  SynTree/FunctionType.cc \
     67  SynTree/ReferenceToType.cc \
     68  SynTree/TupleType.cc \
     69  SynTree/TypeofType.cc \
     70  SynTree/AttrType.cc \
     71  SynTree/VarArgsType.cc \
     72  SynTree/ZeroOneType.cc \
     73  SynTree/Constant.cc \
     74  SynTree/Expression.cc \
     75  SynTree/TupleExpr.cc \
     76  SynTree/CommaExpr.cc \
     77  SynTree/TypeExpr.cc \
     78  SynTree/ApplicationExpr.cc \
     79  SynTree/AddressExpr.cc \
     80  SynTree/Statement.cc \
     81  SynTree/CompoundStmt.cc \
     82  SynTree/DeclStmt.cc \
     83  SynTree/Declaration.cc \
     84  SynTree/DeclarationWithType.cc \
     85  SynTree/ObjectDecl.cc \
     86  SynTree/FunctionDecl.cc \
     87  SynTree/AggregateDecl.cc \
     88  SynTree/NamedTypeDecl.cc \
     89  SynTree/TypeDecl.cc \
     90  SynTree/Initializer.cc \
     91  SynTree/TypeSubstitution.cc \
     92  SynTree/Attribute.cc \
     93  SynTree/DeclReplacer.cc \
     94  CompilationState.cc \
     95  CodeGen/CodeGenerator.cc \
     96  CodeGen/FixMain.cc \
     97  CodeGen/GenType.cc \
     98  CodeGen/OperatorTable.cc \
     99  Common/Assert.cc \
     100  Common/Eval.cc \
     101  Common/SemanticError.cc \
     102  Common/UniqueName.cc \
     103  Concurrency/Keywords.cc \
     104  ControlStruct/ForExprMutator.cc \
     105  ControlStruct/LabelFixer.cc \
     106  ControlStruct/LabelGenerator.cc \
     107  ControlStruct/MLEMutator.cc \
     108  ControlStruct/Mutate.cc \
     109  GenPoly/GenPoly.cc \
     110  GenPoly/Lvalue.cc \
     111  InitTweak/GenInit.cc \
     112  InitTweak/InitTweak.cc \
     113  Parser/LinkageSpec.cc \
     114  ResolvExpr/AdjustExprType.cc \
     115  ResolvExpr/Alternative.cc \
     116  ResolvExpr/AlternativeFinder.cc \
     117  ResolvExpr/ExplodedActual.cc \
     118  ResolvExpr/CastCost.cc \
     119  ResolvExpr/CommonType.cc \
     120  ResolvExpr/ConversionCost.cc \
     121  ResolvExpr/CurrentObject.cc \
     122  ResolvExpr/FindOpenVars.cc \
     123  ResolvExpr/Occurs.cc \
     124  ResolvExpr/PolyCost.cc \
     125  ResolvExpr/PtrsAssignable.cc \
     126  ResolvExpr/PtrsCastable.cc \
     127  ResolvExpr/RenameVars.cc \
     128  ResolvExpr/Resolver.cc \
     129  ResolvExpr/ResolveTypeof.cc \
     130  ResolvExpr/TypeEnvironment.cc \
     131  ResolvExpr/Unify.cc \
     132  SymTab/Autogen.cc \
     133  SymTab/FixFunction.cc \
     134  SymTab/Indexer.cc \
     135  SymTab/Mangler.cc \
     136  SymTab/Validate.cc \
     137  Tuples/Explode.cc \
     138  Tuples/TupleAssignment.cc \
     139  Tuples/TupleExpansion.cc \
     140  Validate/HandleAttributes.cc
    52141
    53142MAINTAINERCLEANFILES += ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}}
  • src/Makefile.in

    r341bb80 r6d44da1  
    6262######################### -*- Mode: Makefile-Gmake -*- ########################
    6363###############################################################################
     64
    6465
    6566VPATH = @srcdir@
     
    137138build_triplet = @build@
    138139host_triplet = @host@
    139 cfa_cpplib_PROGRAMS = ../driver/cfa-cpp$(EXEEXT)
     140cfa_cpplib_PROGRAMS = ../driver/cfa-cpp$(EXEEXT) demangler$(EXEEXT)
    140141subdir = src
    141142ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
     
    149150CONFIG_CLEAN_FILES =
    150151CONFIG_CLEAN_VPATH_FILES =
     152LIBRARIES = $(noinst_LIBRARIES)
     153AR = ar
     154AM_V_AR = $(am__v_AR_@AM_V@)
     155am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
     156am__v_AR_0 = @echo "  AR      " $@;
     157am__v_AR_1 =
     158libdemangle_a_AR = $(AR) $(ARFLAGS)
     159libdemangle_a_LIBADD =
     160am__dirstamp = $(am__leading_dot)dirstamp
     161am_libdemangle_a_OBJECTS = SymTab/Demangle.$(OBJEXT) \
     162        SymTab/ManglerCommon.$(OBJEXT) SynTree/Type.$(OBJEXT) \
     163        SynTree/VoidType.$(OBJEXT) SynTree/BasicType.$(OBJEXT) \
     164        SynTree/PointerType.$(OBJEXT) SynTree/ArrayType.$(OBJEXT) \
     165        SynTree/ReferenceType.$(OBJEXT) SynTree/FunctionType.$(OBJEXT) \
     166        SynTree/ReferenceToType.$(OBJEXT) SynTree/TupleType.$(OBJEXT) \
     167        SynTree/TypeofType.$(OBJEXT) SynTree/AttrType.$(OBJEXT) \
     168        SynTree/VarArgsType.$(OBJEXT) SynTree/ZeroOneType.$(OBJEXT) \
     169        SynTree/Constant.$(OBJEXT) SynTree/Expression.$(OBJEXT) \
     170        SynTree/TupleExpr.$(OBJEXT) SynTree/CommaExpr.$(OBJEXT) \
     171        SynTree/TypeExpr.$(OBJEXT) SynTree/ApplicationExpr.$(OBJEXT) \
     172        SynTree/AddressExpr.$(OBJEXT) SynTree/Statement.$(OBJEXT) \
     173        SynTree/CompoundStmt.$(OBJEXT) SynTree/DeclStmt.$(OBJEXT) \
     174        SynTree/Declaration.$(OBJEXT) \
     175        SynTree/DeclarationWithType.$(OBJEXT) \
     176        SynTree/ObjectDecl.$(OBJEXT) SynTree/FunctionDecl.$(OBJEXT) \
     177        SynTree/AggregateDecl.$(OBJEXT) \
     178        SynTree/NamedTypeDecl.$(OBJEXT) SynTree/TypeDecl.$(OBJEXT) \
     179        SynTree/Initializer.$(OBJEXT) \
     180        SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \
     181        SynTree/DeclReplacer.$(OBJEXT) CompilationState.$(OBJEXT) \
     182        CodeGen/CodeGenerator.$(OBJEXT) CodeGen/FixMain.$(OBJEXT) \
     183        CodeGen/GenType.$(OBJEXT) CodeGen/OperatorTable.$(OBJEXT) \
     184        Common/Assert.$(OBJEXT) Common/Eval.$(OBJEXT) \
     185        Common/SemanticError.$(OBJEXT) Common/UniqueName.$(OBJEXT) \
     186        Concurrency/Keywords.$(OBJEXT) \
     187        ControlStruct/ForExprMutator.$(OBJEXT) \
     188        ControlStruct/LabelFixer.$(OBJEXT) \
     189        ControlStruct/LabelGenerator.$(OBJEXT) \
     190        ControlStruct/MLEMutator.$(OBJEXT) \
     191        ControlStruct/Mutate.$(OBJEXT) GenPoly/GenPoly.$(OBJEXT) \
     192        GenPoly/Lvalue.$(OBJEXT) InitTweak/GenInit.$(OBJEXT) \
     193        InitTweak/InitTweak.$(OBJEXT) Parser/LinkageSpec.$(OBJEXT) \
     194        ResolvExpr/AdjustExprType.$(OBJEXT) \
     195        ResolvExpr/Alternative.$(OBJEXT) \
     196        ResolvExpr/AlternativeFinder.$(OBJEXT) \
     197        ResolvExpr/ExplodedActual.$(OBJEXT) \
     198        ResolvExpr/CastCost.$(OBJEXT) ResolvExpr/CommonType.$(OBJEXT) \
     199        ResolvExpr/ConversionCost.$(OBJEXT) \
     200        ResolvExpr/CurrentObject.$(OBJEXT) \
     201        ResolvExpr/FindOpenVars.$(OBJEXT) ResolvExpr/Occurs.$(OBJEXT) \
     202        ResolvExpr/PolyCost.$(OBJEXT) \
     203        ResolvExpr/PtrsAssignable.$(OBJEXT) \
     204        ResolvExpr/PtrsCastable.$(OBJEXT) \
     205        ResolvExpr/RenameVars.$(OBJEXT) ResolvExpr/Resolver.$(OBJEXT) \
     206        ResolvExpr/ResolveTypeof.$(OBJEXT) \
     207        ResolvExpr/TypeEnvironment.$(OBJEXT) \
     208        ResolvExpr/Unify.$(OBJEXT) SymTab/Autogen.$(OBJEXT) \
     209        SymTab/FixFunction.$(OBJEXT) SymTab/Indexer.$(OBJEXT) \
     210        SymTab/Mangler.$(OBJEXT) SymTab/Validate.$(OBJEXT) \
     211        Tuples/Explode.$(OBJEXT) Tuples/TupleAssignment.$(OBJEXT) \
     212        Tuples/TupleExpansion.$(OBJEXT) \
     213        Validate/HandleAttributes.$(OBJEXT)
     214libdemangle_a_OBJECTS = $(am_libdemangle_a_OBJECTS)
    151215am__installdirs = "$(DESTDIR)$(cfa_cpplibdir)"
    152216PROGRAMS = $(cfa_cpplib_PROGRAMS)
    153 am__dirstamp = $(am__leading_dot)dirstamp
    154217am__objects_1 = main.$(OBJEXT) MakeLibCfa.$(OBJEXT) \
    155218        CompilationState.$(OBJEXT) CodeGen/Generate.$(OBJEXT) \
     
    157220        CodeGen/FixNames.$(OBJEXT) CodeGen/FixMain.$(OBJEXT) \
    158221        CodeGen/OperatorTable.$(OBJEXT) CodeTools/DeclStats.$(OBJEXT) \
     222        CodeTools/ResolvProtoDump.$(OBJEXT) \
    159223        CodeTools/TrackLoc.$(OBJEXT) Concurrency/Keywords.$(OBJEXT) \
    160224        Concurrency/Waitfor.$(OBJEXT) Common/SemanticError.$(OBJEXT) \
     
    196260        ResolvExpr/CurrentObject.$(OBJEXT) \
    197261        ResolvExpr/ExplodedActual.$(OBJEXT) SymTab/Indexer.$(OBJEXT) \
    198         SymTab/Mangler.$(OBJEXT) SymTab/Validate.$(OBJEXT) \
    199         SymTab/FixFunction.$(OBJEXT) SymTab/Autogen.$(OBJEXT) \
    200         SynTree/Type.$(OBJEXT) SynTree/VoidType.$(OBJEXT) \
    201         SynTree/BasicType.$(OBJEXT) SynTree/PointerType.$(OBJEXT) \
    202         SynTree/ArrayType.$(OBJEXT) SynTree/ReferenceType.$(OBJEXT) \
    203         SynTree/FunctionType.$(OBJEXT) \
     262        SymTab/Mangler.$(OBJEXT) SymTab/ManglerCommon.$(OBJEXT) \
     263        SymTab/Validate.$(OBJEXT) SymTab/FixFunction.$(OBJEXT) \
     264        SymTab/Autogen.$(OBJEXT) SynTree/Type.$(OBJEXT) \
     265        SynTree/VoidType.$(OBJEXT) SynTree/BasicType.$(OBJEXT) \
     266        SynTree/PointerType.$(OBJEXT) SynTree/ArrayType.$(OBJEXT) \
     267        SynTree/ReferenceType.$(OBJEXT) SynTree/FunctionType.$(OBJEXT) \
    204268        SynTree/ReferenceToType.$(OBJEXT) SynTree/TupleType.$(OBJEXT) \
    205269        SynTree/TypeofType.$(OBJEXT) SynTree/AttrType.$(OBJEXT) \
     
    225289___driver_cfa_cpp_OBJECTS = $(am____driver_cfa_cpp_OBJECTS)
    226290___driver_cfa_cpp_DEPENDENCIES =
     291am_demangler_OBJECTS = SymTab/demangler.$(OBJEXT)
     292demangler_OBJECTS = $(am_demangler_OBJECTS)
     293demangler_DEPENDENCIES = libdemangle.a
    227294AM_V_P = $(am__v_P_@AM_V@)
    228295am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     
    279346am__v_CCLD_0 = @echo "  CCLD    " $@;
    280347am__v_CCLD_1 =
    281 SOURCES = $(___driver_cfa_cpp_SOURCES)
    282 DIST_SOURCES = $(___driver_cfa_cpp_SOURCES)
     348SOURCES = $(libdemangle_a_SOURCES) $(___driver_cfa_cpp_SOURCES) \
     349        $(demangler_SOURCES)
     350DIST_SOURCES = $(libdemangle_a_SOURCES) $(___driver_cfa_cpp_SOURCES) \
     351        $(demangler_SOURCES)
    283352am__can_run_installinfo = \
    284353  case $$AM_UPDATE_INFO_DIR in \
     
    451520        CodeGen/FixNames.cc CodeGen/FixMain.cc \
    452521        CodeGen/OperatorTable.cc CodeTools/DeclStats.cc \
    453         CodeTools/TrackLoc.cc Concurrency/Keywords.cc \
    454         Concurrency/Waitfor.cc Common/SemanticError.cc \
    455         Common/UniqueName.cc Common/DebugMalloc.cc Common/Assert.cc \
    456         Common/Heap.cc Common/Eval.cc ControlStruct/LabelGenerator.cc \
     522        CodeTools/ResolvProtoDump.cc CodeTools/TrackLoc.cc \
     523        Concurrency/Keywords.cc Concurrency/Waitfor.cc \
     524        Common/SemanticError.cc Common/UniqueName.cc \
     525        Common/DebugMalloc.cc Common/Assert.cc Common/Heap.cc \
     526        Common/Eval.cc ControlStruct/LabelGenerator.cc \
    457527        ControlStruct/LabelFixer.cc ControlStruct/MLEMutator.cc \
    458528        ControlStruct/Mutate.cc ControlStruct/ForExprMutator.cc \
     
    477547        ResolvExpr/Occurs.cc ResolvExpr/TypeEnvironment.cc \
    478548        ResolvExpr/CurrentObject.cc ResolvExpr/ExplodedActual.cc \
    479         SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \
    480         SymTab/FixFunction.cc SymTab/Autogen.cc SynTree/Type.cc \
    481         SynTree/VoidType.cc SynTree/BasicType.cc \
     549        SymTab/Indexer.cc SymTab/Mangler.cc SymTab/ManglerCommon.cc \
     550        SymTab/Validate.cc SymTab/FixFunction.cc SymTab/Autogen.cc \
     551        SynTree/Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \
    482552        SynTree/PointerType.cc SynTree/ArrayType.cc \
    483553        SynTree/ReferenceType.cc SynTree/FunctionType.cc \
     
    511581AM_CXXFLAGS = @HOST_FLAGS@ -Wno-deprecated -Wall -Wextra -DDEBUG_ALL -I./Parser -I$(srcdir)/Parser -I$(srcdir)/include -DYY_NO_INPUT -O2 -g -std=c++14
    512582AM_LDFLAGS = @HOST_FLAGS@ -Xlinker -export-dynamic
     583ARFLAGS = cr
     584demangler_SOURCES = SymTab/demangler.cc
     585demangler_LDADD = libdemangle.a     # yywrap
     586noinst_LIBRARIES = libdemangle.a
     587libdemangle_a_SOURCES = SymTab/Demangle.cc SymTab/ManglerCommon.cc \
     588  SynTree/Type.cc \
     589  SynTree/VoidType.cc \
     590  SynTree/BasicType.cc \
     591  SynTree/PointerType.cc \
     592  SynTree/ArrayType.cc \
     593  SynTree/ReferenceType.cc \
     594  SynTree/FunctionType.cc \
     595  SynTree/ReferenceToType.cc \
     596  SynTree/TupleType.cc \
     597  SynTree/TypeofType.cc \
     598  SynTree/AttrType.cc \
     599  SynTree/VarArgsType.cc \
     600  SynTree/ZeroOneType.cc \
     601  SynTree/Constant.cc \
     602  SynTree/Expression.cc \
     603  SynTree/TupleExpr.cc \
     604  SynTree/CommaExpr.cc \
     605  SynTree/TypeExpr.cc \
     606  SynTree/ApplicationExpr.cc \
     607  SynTree/AddressExpr.cc \
     608  SynTree/Statement.cc \
     609  SynTree/CompoundStmt.cc \
     610  SynTree/DeclStmt.cc \
     611  SynTree/Declaration.cc \
     612  SynTree/DeclarationWithType.cc \
     613  SynTree/ObjectDecl.cc \
     614  SynTree/FunctionDecl.cc \
     615  SynTree/AggregateDecl.cc \
     616  SynTree/NamedTypeDecl.cc \
     617  SynTree/TypeDecl.cc \
     618  SynTree/Initializer.cc \
     619  SynTree/TypeSubstitution.cc \
     620  SynTree/Attribute.cc \
     621  SynTree/DeclReplacer.cc \
     622  CompilationState.cc \
     623  CodeGen/CodeGenerator.cc \
     624  CodeGen/FixMain.cc \
     625  CodeGen/GenType.cc \
     626  CodeGen/OperatorTable.cc \
     627  Common/Assert.cc \
     628  Common/Eval.cc \
     629  Common/SemanticError.cc \
     630  Common/UniqueName.cc \
     631  Concurrency/Keywords.cc \
     632  ControlStruct/ForExprMutator.cc \
     633  ControlStruct/LabelFixer.cc \
     634  ControlStruct/LabelGenerator.cc \
     635  ControlStruct/MLEMutator.cc \
     636  ControlStruct/Mutate.cc \
     637  GenPoly/GenPoly.cc \
     638  GenPoly/Lvalue.cc \
     639  InitTweak/GenInit.cc \
     640  InitTweak/InitTweak.cc \
     641  Parser/LinkageSpec.cc \
     642  ResolvExpr/AdjustExprType.cc \
     643  ResolvExpr/Alternative.cc \
     644  ResolvExpr/AlternativeFinder.cc \
     645  ResolvExpr/ExplodedActual.cc \
     646  ResolvExpr/CastCost.cc \
     647  ResolvExpr/CommonType.cc \
     648  ResolvExpr/ConversionCost.cc \
     649  ResolvExpr/CurrentObject.cc \
     650  ResolvExpr/FindOpenVars.cc \
     651  ResolvExpr/Occurs.cc \
     652  ResolvExpr/PolyCost.cc \
     653  ResolvExpr/PtrsAssignable.cc \
     654  ResolvExpr/PtrsCastable.cc \
     655  ResolvExpr/RenameVars.cc \
     656  ResolvExpr/Resolver.cc \
     657  ResolvExpr/ResolveTypeof.cc \
     658  ResolvExpr/TypeEnvironment.cc \
     659  ResolvExpr/Unify.cc \
     660  SymTab/Autogen.cc \
     661  SymTab/FixFunction.cc \
     662  SymTab/Indexer.cc \
     663  SymTab/Mangler.cc \
     664  SymTab/Validate.cc \
     665  Tuples/Explode.cc \
     666  Tuples/TupleAssignment.cc \
     667  Tuples/TupleExpansion.cc \
     668  Validate/HandleAttributes.cc
     669
    513670all: $(BUILT_SOURCES)
    514671        $(MAKE) $(AM_MAKEFLAGS) all-am
     
    546703        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    547704$(am__aclocal_m4_deps):
     705
     706clean-noinstLIBRARIES:
     707        -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
     708SymTab/$(am__dirstamp):
     709        @$(MKDIR_P) SymTab
     710        @: > SymTab/$(am__dirstamp)
     711SymTab/$(DEPDIR)/$(am__dirstamp):
     712        @$(MKDIR_P) SymTab/$(DEPDIR)
     713        @: > SymTab/$(DEPDIR)/$(am__dirstamp)
     714SymTab/Demangle.$(OBJEXT): SymTab/$(am__dirstamp) \
     715        SymTab/$(DEPDIR)/$(am__dirstamp)
     716SymTab/ManglerCommon.$(OBJEXT): SymTab/$(am__dirstamp) \
     717        SymTab/$(DEPDIR)/$(am__dirstamp)
     718SynTree/$(am__dirstamp):
     719        @$(MKDIR_P) SynTree
     720        @: > SynTree/$(am__dirstamp)
     721SynTree/$(DEPDIR)/$(am__dirstamp):
     722        @$(MKDIR_P) SynTree/$(DEPDIR)
     723        @: > SynTree/$(DEPDIR)/$(am__dirstamp)
     724SynTree/Type.$(OBJEXT): SynTree/$(am__dirstamp) \
     725        SynTree/$(DEPDIR)/$(am__dirstamp)
     726SynTree/VoidType.$(OBJEXT): SynTree/$(am__dirstamp) \
     727        SynTree/$(DEPDIR)/$(am__dirstamp)
     728SynTree/BasicType.$(OBJEXT): SynTree/$(am__dirstamp) \
     729        SynTree/$(DEPDIR)/$(am__dirstamp)
     730SynTree/PointerType.$(OBJEXT): SynTree/$(am__dirstamp) \
     731        SynTree/$(DEPDIR)/$(am__dirstamp)
     732SynTree/ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \
     733        SynTree/$(DEPDIR)/$(am__dirstamp)
     734SynTree/ReferenceType.$(OBJEXT): SynTree/$(am__dirstamp) \
     735        SynTree/$(DEPDIR)/$(am__dirstamp)
     736SynTree/FunctionType.$(OBJEXT): SynTree/$(am__dirstamp) \
     737        SynTree/$(DEPDIR)/$(am__dirstamp)
     738SynTree/ReferenceToType.$(OBJEXT): SynTree/$(am__dirstamp) \
     739        SynTree/$(DEPDIR)/$(am__dirstamp)
     740SynTree/TupleType.$(OBJEXT): SynTree/$(am__dirstamp) \
     741        SynTree/$(DEPDIR)/$(am__dirstamp)
     742SynTree/TypeofType.$(OBJEXT): SynTree/$(am__dirstamp) \
     743        SynTree/$(DEPDIR)/$(am__dirstamp)
     744SynTree/AttrType.$(OBJEXT): SynTree/$(am__dirstamp) \
     745        SynTree/$(DEPDIR)/$(am__dirstamp)
     746SynTree/VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \
     747        SynTree/$(DEPDIR)/$(am__dirstamp)
     748SynTree/ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \
     749        SynTree/$(DEPDIR)/$(am__dirstamp)
     750SynTree/Constant.$(OBJEXT): SynTree/$(am__dirstamp) \
     751        SynTree/$(DEPDIR)/$(am__dirstamp)
     752SynTree/Expression.$(OBJEXT): SynTree/$(am__dirstamp) \
     753        SynTree/$(DEPDIR)/$(am__dirstamp)
     754SynTree/TupleExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     755        SynTree/$(DEPDIR)/$(am__dirstamp)
     756SynTree/CommaExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     757        SynTree/$(DEPDIR)/$(am__dirstamp)
     758SynTree/TypeExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     759        SynTree/$(DEPDIR)/$(am__dirstamp)
     760SynTree/ApplicationExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     761        SynTree/$(DEPDIR)/$(am__dirstamp)
     762SynTree/AddressExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     763        SynTree/$(DEPDIR)/$(am__dirstamp)
     764SynTree/Statement.$(OBJEXT): SynTree/$(am__dirstamp) \
     765        SynTree/$(DEPDIR)/$(am__dirstamp)
     766SynTree/CompoundStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
     767        SynTree/$(DEPDIR)/$(am__dirstamp)
     768SynTree/DeclStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
     769        SynTree/$(DEPDIR)/$(am__dirstamp)
     770SynTree/Declaration.$(OBJEXT): SynTree/$(am__dirstamp) \
     771        SynTree/$(DEPDIR)/$(am__dirstamp)
     772SynTree/DeclarationWithType.$(OBJEXT): SynTree/$(am__dirstamp) \
     773        SynTree/$(DEPDIR)/$(am__dirstamp)
     774SynTree/ObjectDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     775        SynTree/$(DEPDIR)/$(am__dirstamp)
     776SynTree/FunctionDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     777        SynTree/$(DEPDIR)/$(am__dirstamp)
     778SynTree/AggregateDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     779        SynTree/$(DEPDIR)/$(am__dirstamp)
     780SynTree/NamedTypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     781        SynTree/$(DEPDIR)/$(am__dirstamp)
     782SynTree/TypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     783        SynTree/$(DEPDIR)/$(am__dirstamp)
     784SynTree/Initializer.$(OBJEXT): SynTree/$(am__dirstamp) \
     785        SynTree/$(DEPDIR)/$(am__dirstamp)
     786SynTree/TypeSubstitution.$(OBJEXT): SynTree/$(am__dirstamp) \
     787        SynTree/$(DEPDIR)/$(am__dirstamp)
     788SynTree/Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
     789        SynTree/$(DEPDIR)/$(am__dirstamp)
     790SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \
     791        SynTree/$(DEPDIR)/$(am__dirstamp)
     792CodeGen/$(am__dirstamp):
     793        @$(MKDIR_P) CodeGen
     794        @: > CodeGen/$(am__dirstamp)
     795CodeGen/$(DEPDIR)/$(am__dirstamp):
     796        @$(MKDIR_P) CodeGen/$(DEPDIR)
     797        @: > CodeGen/$(DEPDIR)/$(am__dirstamp)
     798CodeGen/CodeGenerator.$(OBJEXT): CodeGen/$(am__dirstamp) \
     799        CodeGen/$(DEPDIR)/$(am__dirstamp)
     800CodeGen/FixMain.$(OBJEXT): CodeGen/$(am__dirstamp) \
     801        CodeGen/$(DEPDIR)/$(am__dirstamp)
     802CodeGen/GenType.$(OBJEXT): CodeGen/$(am__dirstamp) \
     803        CodeGen/$(DEPDIR)/$(am__dirstamp)
     804CodeGen/OperatorTable.$(OBJEXT): CodeGen/$(am__dirstamp) \
     805        CodeGen/$(DEPDIR)/$(am__dirstamp)
     806Common/$(am__dirstamp):
     807        @$(MKDIR_P) Common
     808        @: > Common/$(am__dirstamp)
     809Common/$(DEPDIR)/$(am__dirstamp):
     810        @$(MKDIR_P) Common/$(DEPDIR)
     811        @: > Common/$(DEPDIR)/$(am__dirstamp)
     812Common/Assert.$(OBJEXT): Common/$(am__dirstamp) \
     813        Common/$(DEPDIR)/$(am__dirstamp)
     814Common/Eval.$(OBJEXT): Common/$(am__dirstamp) \
     815        Common/$(DEPDIR)/$(am__dirstamp)
     816Common/SemanticError.$(OBJEXT): Common/$(am__dirstamp) \
     817        Common/$(DEPDIR)/$(am__dirstamp)
     818Common/UniqueName.$(OBJEXT): Common/$(am__dirstamp) \
     819        Common/$(DEPDIR)/$(am__dirstamp)
     820Concurrency/$(am__dirstamp):
     821        @$(MKDIR_P) Concurrency
     822        @: > Concurrency/$(am__dirstamp)
     823Concurrency/$(DEPDIR)/$(am__dirstamp):
     824        @$(MKDIR_P) Concurrency/$(DEPDIR)
     825        @: > Concurrency/$(DEPDIR)/$(am__dirstamp)
     826Concurrency/Keywords.$(OBJEXT): Concurrency/$(am__dirstamp) \
     827        Concurrency/$(DEPDIR)/$(am__dirstamp)
     828ControlStruct/$(am__dirstamp):
     829        @$(MKDIR_P) ControlStruct
     830        @: > ControlStruct/$(am__dirstamp)
     831ControlStruct/$(DEPDIR)/$(am__dirstamp):
     832        @$(MKDIR_P) ControlStruct/$(DEPDIR)
     833        @: > ControlStruct/$(DEPDIR)/$(am__dirstamp)
     834ControlStruct/ForExprMutator.$(OBJEXT): ControlStruct/$(am__dirstamp) \
     835        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     836ControlStruct/LabelFixer.$(OBJEXT): ControlStruct/$(am__dirstamp) \
     837        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     838ControlStruct/LabelGenerator.$(OBJEXT): ControlStruct/$(am__dirstamp) \
     839        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     840ControlStruct/MLEMutator.$(OBJEXT): ControlStruct/$(am__dirstamp) \
     841        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     842ControlStruct/Mutate.$(OBJEXT): ControlStruct/$(am__dirstamp) \
     843        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     844GenPoly/$(am__dirstamp):
     845        @$(MKDIR_P) GenPoly
     846        @: > GenPoly/$(am__dirstamp)
     847GenPoly/$(DEPDIR)/$(am__dirstamp):
     848        @$(MKDIR_P) GenPoly/$(DEPDIR)
     849        @: > GenPoly/$(DEPDIR)/$(am__dirstamp)
     850GenPoly/GenPoly.$(OBJEXT): GenPoly/$(am__dirstamp) \
     851        GenPoly/$(DEPDIR)/$(am__dirstamp)
     852GenPoly/Lvalue.$(OBJEXT): GenPoly/$(am__dirstamp) \
     853        GenPoly/$(DEPDIR)/$(am__dirstamp)
     854InitTweak/$(am__dirstamp):
     855        @$(MKDIR_P) InitTweak
     856        @: > InitTweak/$(am__dirstamp)
     857InitTweak/$(DEPDIR)/$(am__dirstamp):
     858        @$(MKDIR_P) InitTweak/$(DEPDIR)
     859        @: > InitTweak/$(DEPDIR)/$(am__dirstamp)
     860InitTweak/GenInit.$(OBJEXT): InitTweak/$(am__dirstamp) \
     861        InitTweak/$(DEPDIR)/$(am__dirstamp)
     862InitTweak/InitTweak.$(OBJEXT): InitTweak/$(am__dirstamp) \
     863        InitTweak/$(DEPDIR)/$(am__dirstamp)
     864Parser/$(am__dirstamp):
     865        @$(MKDIR_P) Parser
     866        @: > Parser/$(am__dirstamp)
     867Parser/$(DEPDIR)/$(am__dirstamp):
     868        @$(MKDIR_P) Parser/$(DEPDIR)
     869        @: > Parser/$(DEPDIR)/$(am__dirstamp)
     870Parser/LinkageSpec.$(OBJEXT): Parser/$(am__dirstamp) \
     871        Parser/$(DEPDIR)/$(am__dirstamp)
     872ResolvExpr/$(am__dirstamp):
     873        @$(MKDIR_P) ResolvExpr
     874        @: > ResolvExpr/$(am__dirstamp)
     875ResolvExpr/$(DEPDIR)/$(am__dirstamp):
     876        @$(MKDIR_P) ResolvExpr/$(DEPDIR)
     877        @: > ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     878ResolvExpr/AdjustExprType.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     879        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     880ResolvExpr/Alternative.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     881        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     882ResolvExpr/AlternativeFinder.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     883        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     884ResolvExpr/ExplodedActual.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     885        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     886ResolvExpr/CastCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     887        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     888ResolvExpr/CommonType.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     889        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     890ResolvExpr/ConversionCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     891        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     892ResolvExpr/CurrentObject.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     893        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     894ResolvExpr/FindOpenVars.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     895        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     896ResolvExpr/Occurs.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     897        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     898ResolvExpr/PolyCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     899        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     900ResolvExpr/PtrsAssignable.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     901        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     902ResolvExpr/PtrsCastable.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     903        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     904ResolvExpr/RenameVars.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     905        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     906ResolvExpr/Resolver.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     907        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     908ResolvExpr/ResolveTypeof.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     909        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     910ResolvExpr/TypeEnvironment.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     911        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     912ResolvExpr/Unify.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     913        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     914SymTab/Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \
     915        SymTab/$(DEPDIR)/$(am__dirstamp)
     916SymTab/FixFunction.$(OBJEXT): SymTab/$(am__dirstamp) \
     917        SymTab/$(DEPDIR)/$(am__dirstamp)
     918SymTab/Indexer.$(OBJEXT): SymTab/$(am__dirstamp) \
     919        SymTab/$(DEPDIR)/$(am__dirstamp)
     920SymTab/Mangler.$(OBJEXT): SymTab/$(am__dirstamp) \
     921        SymTab/$(DEPDIR)/$(am__dirstamp)
     922SymTab/Validate.$(OBJEXT): SymTab/$(am__dirstamp) \
     923        SymTab/$(DEPDIR)/$(am__dirstamp)
     924Tuples/$(am__dirstamp):
     925        @$(MKDIR_P) Tuples
     926        @: > Tuples/$(am__dirstamp)
     927Tuples/$(DEPDIR)/$(am__dirstamp):
     928        @$(MKDIR_P) Tuples/$(DEPDIR)
     929        @: > Tuples/$(DEPDIR)/$(am__dirstamp)
     930Tuples/Explode.$(OBJEXT): Tuples/$(am__dirstamp) \
     931        Tuples/$(DEPDIR)/$(am__dirstamp)
     932Tuples/TupleAssignment.$(OBJEXT): Tuples/$(am__dirstamp) \
     933        Tuples/$(DEPDIR)/$(am__dirstamp)
     934Tuples/TupleExpansion.$(OBJEXT): Tuples/$(am__dirstamp) \
     935        Tuples/$(DEPDIR)/$(am__dirstamp)
     936Validate/$(am__dirstamp):
     937        @$(MKDIR_P) Validate
     938        @: > Validate/$(am__dirstamp)
     939Validate/$(DEPDIR)/$(am__dirstamp):
     940        @$(MKDIR_P) Validate/$(DEPDIR)
     941        @: > Validate/$(DEPDIR)/$(am__dirstamp)
     942Validate/HandleAttributes.$(OBJEXT): Validate/$(am__dirstamp) \
     943        Validate/$(DEPDIR)/$(am__dirstamp)
     944
     945libdemangle.a: $(libdemangle_a_OBJECTS) $(libdemangle_a_DEPENDENCIES) $(EXTRA_libdemangle_a_DEPENDENCIES)
     946        $(AM_V_at)-rm -f libdemangle.a
     947        $(AM_V_AR)$(libdemangle_a_AR) libdemangle.a $(libdemangle_a_OBJECTS) $(libdemangle_a_LIBADD)
     948        $(AM_V_at)$(RANLIB) libdemangle.a
    548949install-cfa_cpplibPROGRAMS: $(cfa_cpplib_PROGRAMS)
    549950        @$(NORMAL_INSTALL)
     
    588989clean-cfa_cpplibPROGRAMS:
    589990        -test -z "$(cfa_cpplib_PROGRAMS)" || rm -f $(cfa_cpplib_PROGRAMS)
    590 CodeGen/$(am__dirstamp):
    591         @$(MKDIR_P) CodeGen
    592         @: > CodeGen/$(am__dirstamp)
    593 CodeGen/$(DEPDIR)/$(am__dirstamp):
    594         @$(MKDIR_P) CodeGen/$(DEPDIR)
    595         @: > CodeGen/$(DEPDIR)/$(am__dirstamp)
    596991CodeGen/Generate.$(OBJEXT): CodeGen/$(am__dirstamp) \
    597992        CodeGen/$(DEPDIR)/$(am__dirstamp)
    598 CodeGen/CodeGenerator.$(OBJEXT): CodeGen/$(am__dirstamp) \
    599         CodeGen/$(DEPDIR)/$(am__dirstamp)
    600 CodeGen/GenType.$(OBJEXT): CodeGen/$(am__dirstamp) \
    601         CodeGen/$(DEPDIR)/$(am__dirstamp)
    602993CodeGen/FixNames.$(OBJEXT): CodeGen/$(am__dirstamp) \
    603         CodeGen/$(DEPDIR)/$(am__dirstamp)
    604 CodeGen/FixMain.$(OBJEXT): CodeGen/$(am__dirstamp) \
    605         CodeGen/$(DEPDIR)/$(am__dirstamp)
    606 CodeGen/OperatorTable.$(OBJEXT): CodeGen/$(am__dirstamp) \
    607994        CodeGen/$(DEPDIR)/$(am__dirstamp)
    608995CodeTools/$(am__dirstamp):
     
    6141001CodeTools/DeclStats.$(OBJEXT): CodeTools/$(am__dirstamp) \
    6151002        CodeTools/$(DEPDIR)/$(am__dirstamp)
     1003CodeTools/ResolvProtoDump.$(OBJEXT): CodeTools/$(am__dirstamp) \
     1004        CodeTools/$(DEPDIR)/$(am__dirstamp)
    6161005CodeTools/TrackLoc.$(OBJEXT): CodeTools/$(am__dirstamp) \
    6171006        CodeTools/$(DEPDIR)/$(am__dirstamp)
    618 Concurrency/$(am__dirstamp):
    619         @$(MKDIR_P) Concurrency
    620         @: > Concurrency/$(am__dirstamp)
    621 Concurrency/$(DEPDIR)/$(am__dirstamp):
    622         @$(MKDIR_P) Concurrency/$(DEPDIR)
    623         @: > Concurrency/$(DEPDIR)/$(am__dirstamp)
    624 Concurrency/Keywords.$(OBJEXT): Concurrency/$(am__dirstamp) \
    625         Concurrency/$(DEPDIR)/$(am__dirstamp)
    6261007Concurrency/Waitfor.$(OBJEXT): Concurrency/$(am__dirstamp) \
    6271008        Concurrency/$(DEPDIR)/$(am__dirstamp)
    628 Common/$(am__dirstamp):
    629         @$(MKDIR_P) Common
    630         @: > Common/$(am__dirstamp)
    631 Common/$(DEPDIR)/$(am__dirstamp):
    632         @$(MKDIR_P) Common/$(DEPDIR)
    633         @: > Common/$(DEPDIR)/$(am__dirstamp)
    634 Common/SemanticError.$(OBJEXT): Common/$(am__dirstamp) \
    635         Common/$(DEPDIR)/$(am__dirstamp)
    636 Common/UniqueName.$(OBJEXT): Common/$(am__dirstamp) \
    637         Common/$(DEPDIR)/$(am__dirstamp)
    6381009Common/DebugMalloc.$(OBJEXT): Common/$(am__dirstamp) \
    639         Common/$(DEPDIR)/$(am__dirstamp)
    640 Common/Assert.$(OBJEXT): Common/$(am__dirstamp) \
    6411010        Common/$(DEPDIR)/$(am__dirstamp)
    6421011Common/Heap.$(OBJEXT): Common/$(am__dirstamp) \
    6431012        Common/$(DEPDIR)/$(am__dirstamp)
    644 Common/Eval.$(OBJEXT): Common/$(am__dirstamp) \
    645         Common/$(DEPDIR)/$(am__dirstamp)
    646 ControlStruct/$(am__dirstamp):
    647         @$(MKDIR_P) ControlStruct
    648         @: > ControlStruct/$(am__dirstamp)
    649 ControlStruct/$(DEPDIR)/$(am__dirstamp):
    650         @$(MKDIR_P) ControlStruct/$(DEPDIR)
    651         @: > ControlStruct/$(DEPDIR)/$(am__dirstamp)
    652 ControlStruct/LabelGenerator.$(OBJEXT): ControlStruct/$(am__dirstamp) \
    653         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    654 ControlStruct/LabelFixer.$(OBJEXT): ControlStruct/$(am__dirstamp) \
    655         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    656 ControlStruct/MLEMutator.$(OBJEXT): ControlStruct/$(am__dirstamp) \
    657         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    658 ControlStruct/Mutate.$(OBJEXT): ControlStruct/$(am__dirstamp) \
    659         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    660 ControlStruct/ForExprMutator.$(OBJEXT): ControlStruct/$(am__dirstamp) \
    661         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    6621013ControlStruct/ExceptTranslate.$(OBJEXT):  \
    6631014        ControlStruct/$(am__dirstamp) \
    6641015        ControlStruct/$(DEPDIR)/$(am__dirstamp)
    665 GenPoly/$(am__dirstamp):
    666         @$(MKDIR_P) GenPoly
    667         @: > GenPoly/$(am__dirstamp)
    668 GenPoly/$(DEPDIR)/$(am__dirstamp):
    669         @$(MKDIR_P) GenPoly/$(DEPDIR)
    670         @: > GenPoly/$(DEPDIR)/$(am__dirstamp)
    6711016GenPoly/Box.$(OBJEXT): GenPoly/$(am__dirstamp) \
    6721017        GenPoly/$(DEPDIR)/$(am__dirstamp)
    673 GenPoly/GenPoly.$(OBJEXT): GenPoly/$(am__dirstamp) \
    674         GenPoly/$(DEPDIR)/$(am__dirstamp)
    6751018GenPoly/ScrubTyVars.$(OBJEXT): GenPoly/$(am__dirstamp) \
    676         GenPoly/$(DEPDIR)/$(am__dirstamp)
    677 GenPoly/Lvalue.$(OBJEXT): GenPoly/$(am__dirstamp) \
    6781019        GenPoly/$(DEPDIR)/$(am__dirstamp)
    6791020GenPoly/Specialize.$(OBJEXT): GenPoly/$(am__dirstamp) \
     
    6831024GenPoly/InstantiateGeneric.$(OBJEXT): GenPoly/$(am__dirstamp) \
    6841025        GenPoly/$(DEPDIR)/$(am__dirstamp)
    685 InitTweak/$(am__dirstamp):
    686         @$(MKDIR_P) InitTweak
    687         @: > InitTweak/$(am__dirstamp)
    688 InitTweak/$(DEPDIR)/$(am__dirstamp):
    689         @$(MKDIR_P) InitTweak/$(DEPDIR)
    690         @: > InitTweak/$(DEPDIR)/$(am__dirstamp)
    691 InitTweak/GenInit.$(OBJEXT): InitTweak/$(am__dirstamp) \
    692         InitTweak/$(DEPDIR)/$(am__dirstamp)
    6931026InitTweak/FixInit.$(OBJEXT): InitTweak/$(am__dirstamp) \
    6941027        InitTweak/$(DEPDIR)/$(am__dirstamp)
    6951028InitTweak/FixGlobalInit.$(OBJEXT): InitTweak/$(am__dirstamp) \
    6961029        InitTweak/$(DEPDIR)/$(am__dirstamp)
    697 InitTweak/InitTweak.$(OBJEXT): InitTweak/$(am__dirstamp) \
    698         InitTweak/$(DEPDIR)/$(am__dirstamp)
    6991030Parser/parser.hh: Parser/parser.cc
    7001031        @if test ! -f $@; then rm -f Parser/parser.cc; else :; fi
    7011032        @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) Parser/parser.cc; else :; fi
    702 Parser/$(am__dirstamp):
    703         @$(MKDIR_P) Parser
    704         @: > Parser/$(am__dirstamp)
    705 Parser/$(DEPDIR)/$(am__dirstamp):
    706         @$(MKDIR_P) Parser/$(DEPDIR)
    707         @: > Parser/$(DEPDIR)/$(am__dirstamp)
    7081033Parser/parser.$(OBJEXT): Parser/$(am__dirstamp) \
    7091034        Parser/$(DEPDIR)/$(am__dirstamp)
     
    7241049Parser/TypeData.$(OBJEXT): Parser/$(am__dirstamp) \
    7251050        Parser/$(DEPDIR)/$(am__dirstamp)
    726 Parser/LinkageSpec.$(OBJEXT): Parser/$(am__dirstamp) \
    727         Parser/$(DEPDIR)/$(am__dirstamp)
    7281051Parser/parserutility.$(OBJEXT): Parser/$(am__dirstamp) \
    7291052        Parser/$(DEPDIR)/$(am__dirstamp)
    730 ResolvExpr/$(am__dirstamp):
    731         @$(MKDIR_P) ResolvExpr
    732         @: > ResolvExpr/$(am__dirstamp)
    733 ResolvExpr/$(DEPDIR)/$(am__dirstamp):
    734         @$(MKDIR_P) ResolvExpr/$(DEPDIR)
    735         @: > ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    736 ResolvExpr/AlternativeFinder.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    737         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    738 ResolvExpr/Alternative.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    739         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    740 ResolvExpr/Unify.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    741         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    742 ResolvExpr/PtrsAssignable.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    743         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    744 ResolvExpr/CommonType.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    745         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    746 ResolvExpr/ConversionCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    747         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    748 ResolvExpr/CastCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    749         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    750 ResolvExpr/PtrsCastable.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    751         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    752 ResolvExpr/AdjustExprType.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    753         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    7541053ResolvExpr/AlternativePrinter.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    7551054        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    756 ResolvExpr/Resolver.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    757         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    758 ResolvExpr/ResolveTypeof.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    759         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    760 ResolvExpr/RenameVars.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    761         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    762 ResolvExpr/FindOpenVars.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    763         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    764 ResolvExpr/PolyCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    765         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    766 ResolvExpr/Occurs.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    767         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    768 ResolvExpr/TypeEnvironment.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    769         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    770 ResolvExpr/CurrentObject.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    771         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    772 ResolvExpr/ExplodedActual.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    773         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    774 SymTab/$(am__dirstamp):
    775         @$(MKDIR_P) SymTab
    776         @: > SymTab/$(am__dirstamp)
    777 SymTab/$(DEPDIR)/$(am__dirstamp):
    778         @$(MKDIR_P) SymTab/$(DEPDIR)
    779         @: > SymTab/$(DEPDIR)/$(am__dirstamp)
    780 SymTab/Indexer.$(OBJEXT): SymTab/$(am__dirstamp) \
    781         SymTab/$(DEPDIR)/$(am__dirstamp)
    782 SymTab/Mangler.$(OBJEXT): SymTab/$(am__dirstamp) \
    783         SymTab/$(DEPDIR)/$(am__dirstamp)
    784 SymTab/Validate.$(OBJEXT): SymTab/$(am__dirstamp) \
    785         SymTab/$(DEPDIR)/$(am__dirstamp)
    786 SymTab/FixFunction.$(OBJEXT): SymTab/$(am__dirstamp) \
    787         SymTab/$(DEPDIR)/$(am__dirstamp)
    788 SymTab/Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \
    789         SymTab/$(DEPDIR)/$(am__dirstamp)
    790 SynTree/$(am__dirstamp):
    791         @$(MKDIR_P) SynTree
    792         @: > SynTree/$(am__dirstamp)
    793 SynTree/$(DEPDIR)/$(am__dirstamp):
    794         @$(MKDIR_P) SynTree/$(DEPDIR)
    795         @: > SynTree/$(DEPDIR)/$(am__dirstamp)
    796 SynTree/Type.$(OBJEXT): SynTree/$(am__dirstamp) \
    797         SynTree/$(DEPDIR)/$(am__dirstamp)
    798 SynTree/VoidType.$(OBJEXT): SynTree/$(am__dirstamp) \
    799         SynTree/$(DEPDIR)/$(am__dirstamp)
    800 SynTree/BasicType.$(OBJEXT): SynTree/$(am__dirstamp) \
    801         SynTree/$(DEPDIR)/$(am__dirstamp)
    802 SynTree/PointerType.$(OBJEXT): SynTree/$(am__dirstamp) \
    803         SynTree/$(DEPDIR)/$(am__dirstamp)
    804 SynTree/ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \
    805         SynTree/$(DEPDIR)/$(am__dirstamp)
    806 SynTree/ReferenceType.$(OBJEXT): SynTree/$(am__dirstamp) \
    807         SynTree/$(DEPDIR)/$(am__dirstamp)
    808 SynTree/FunctionType.$(OBJEXT): SynTree/$(am__dirstamp) \
    809         SynTree/$(DEPDIR)/$(am__dirstamp)
    810 SynTree/ReferenceToType.$(OBJEXT): SynTree/$(am__dirstamp) \
    811         SynTree/$(DEPDIR)/$(am__dirstamp)
    812 SynTree/TupleType.$(OBJEXT): SynTree/$(am__dirstamp) \
    813         SynTree/$(DEPDIR)/$(am__dirstamp)
    814 SynTree/TypeofType.$(OBJEXT): SynTree/$(am__dirstamp) \
    815         SynTree/$(DEPDIR)/$(am__dirstamp)
    816 SynTree/AttrType.$(OBJEXT): SynTree/$(am__dirstamp) \
    817         SynTree/$(DEPDIR)/$(am__dirstamp)
    818 SynTree/VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \
    819         SynTree/$(DEPDIR)/$(am__dirstamp)
    820 SynTree/ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \
    821         SynTree/$(DEPDIR)/$(am__dirstamp)
    822 SynTree/Constant.$(OBJEXT): SynTree/$(am__dirstamp) \
    823         SynTree/$(DEPDIR)/$(am__dirstamp)
    824 SynTree/Expression.$(OBJEXT): SynTree/$(am__dirstamp) \
    825         SynTree/$(DEPDIR)/$(am__dirstamp)
    826 SynTree/TupleExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    827         SynTree/$(DEPDIR)/$(am__dirstamp)
    828 SynTree/CommaExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    829         SynTree/$(DEPDIR)/$(am__dirstamp)
    830 SynTree/TypeExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    831         SynTree/$(DEPDIR)/$(am__dirstamp)
    832 SynTree/ApplicationExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    833         SynTree/$(DEPDIR)/$(am__dirstamp)
    834 SynTree/AddressExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    835         SynTree/$(DEPDIR)/$(am__dirstamp)
    836 SynTree/Statement.$(OBJEXT): SynTree/$(am__dirstamp) \
    837         SynTree/$(DEPDIR)/$(am__dirstamp)
    838 SynTree/CompoundStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
    839         SynTree/$(DEPDIR)/$(am__dirstamp)
    840 SynTree/DeclStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
    841         SynTree/$(DEPDIR)/$(am__dirstamp)
    842 SynTree/Declaration.$(OBJEXT): SynTree/$(am__dirstamp) \
    843         SynTree/$(DEPDIR)/$(am__dirstamp)
    844 SynTree/DeclarationWithType.$(OBJEXT): SynTree/$(am__dirstamp) \
    845         SynTree/$(DEPDIR)/$(am__dirstamp)
    846 SynTree/ObjectDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    847         SynTree/$(DEPDIR)/$(am__dirstamp)
    848 SynTree/FunctionDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    849         SynTree/$(DEPDIR)/$(am__dirstamp)
    850 SynTree/AggregateDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    851         SynTree/$(DEPDIR)/$(am__dirstamp)
    852 SynTree/NamedTypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    853         SynTree/$(DEPDIR)/$(am__dirstamp)
    854 SynTree/TypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    855         SynTree/$(DEPDIR)/$(am__dirstamp)
    856 SynTree/Initializer.$(OBJEXT): SynTree/$(am__dirstamp) \
    857         SynTree/$(DEPDIR)/$(am__dirstamp)
    858 SynTree/TypeSubstitution.$(OBJEXT): SynTree/$(am__dirstamp) \
    859         SynTree/$(DEPDIR)/$(am__dirstamp)
    860 SynTree/Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
    861         SynTree/$(DEPDIR)/$(am__dirstamp)
    862 SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \
    863         SynTree/$(DEPDIR)/$(am__dirstamp)
    864 Tuples/$(am__dirstamp):
    865         @$(MKDIR_P) Tuples
    866         @: > Tuples/$(am__dirstamp)
    867 Tuples/$(DEPDIR)/$(am__dirstamp):
    868         @$(MKDIR_P) Tuples/$(DEPDIR)
    869         @: > Tuples/$(DEPDIR)/$(am__dirstamp)
    870 Tuples/TupleAssignment.$(OBJEXT): Tuples/$(am__dirstamp) \
    871         Tuples/$(DEPDIR)/$(am__dirstamp)
    872 Tuples/TupleExpansion.$(OBJEXT): Tuples/$(am__dirstamp) \
    873         Tuples/$(DEPDIR)/$(am__dirstamp)
    874 Tuples/Explode.$(OBJEXT): Tuples/$(am__dirstamp) \
    875         Tuples/$(DEPDIR)/$(am__dirstamp)
    876 Validate/$(am__dirstamp):
    877         @$(MKDIR_P) Validate
    878         @: > Validate/$(am__dirstamp)
    879 Validate/$(DEPDIR)/$(am__dirstamp):
    880         @$(MKDIR_P) Validate/$(DEPDIR)
    881         @: > Validate/$(DEPDIR)/$(am__dirstamp)
    882 Validate/HandleAttributes.$(OBJEXT): Validate/$(am__dirstamp) \
    883         Validate/$(DEPDIR)/$(am__dirstamp)
    8841055Virtual/$(am__dirstamp):
    8851056        @$(MKDIR_P) Virtual
     
    8971068        @rm -f ../driver/cfa-cpp$(EXEEXT)
    8981069        $(AM_V_CXXLD)$(CXXLINK) $(___driver_cfa_cpp_OBJECTS) $(___driver_cfa_cpp_LDADD) $(LIBS)
     1070SymTab/demangler.$(OBJEXT): SymTab/$(am__dirstamp) \
     1071        SymTab/$(DEPDIR)/$(am__dirstamp)
     1072
     1073demangler$(EXEEXT): $(demangler_OBJECTS) $(demangler_DEPENDENCIES) $(EXTRA_demangler_DEPENDENCIES)
     1074        @rm -f demangler$(EXEEXT)
     1075        $(AM_V_CXXLD)$(CXXLINK) $(demangler_OBJECTS) $(demangler_LDADD) $(LIBS)
    8991076
    9001077mostlyclean-compile:
     
    9281105@AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/OperatorTable.Po@am__quote@
    9291106@AMDEP_TRUE@@am__include@ @am__quote@CodeTools/$(DEPDIR)/DeclStats.Po@am__quote@
     1107@AMDEP_TRUE@@am__include@ @am__quote@CodeTools/$(DEPDIR)/ResolvProtoDump.Po@am__quote@
    9301108@AMDEP_TRUE@@am__include@ @am__quote@CodeTools/$(DEPDIR)/TrackLoc.Po@am__quote@
    9311109@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/Assert.Po@am__quote@
     
    9851163@AMDEP_TRUE@@am__include@ @am__quote@ResolvExpr/$(DEPDIR)/Unify.Po@am__quote@
    9861164@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/Autogen.Po@am__quote@
     1165@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/Demangle.Po@am__quote@
    9871166@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/FixFunction.Po@am__quote@
    9881167@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/Indexer.Po@am__quote@
    9891168@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/Mangler.Po@am__quote@
     1169@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/ManglerCommon.Po@am__quote@
    9901170@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/Validate.Po@am__quote@
     1171@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/demangler.Po@am__quote@
    9911172@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/AddressExpr.Po@am__quote@
    9921173@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/AggregateDecl.Po@am__quote@
     
    11361317check: $(BUILT_SOURCES)
    11371318        $(MAKE) $(AM_MAKEFLAGS) check-am
    1138 all-am: Makefile $(PROGRAMS)
     1319all-am: Makefile $(LIBRARIES) $(PROGRAMS)
    11391320installdirs:
    11401321        for dir in "$(DESTDIR)$(cfa_cpplibdir)"; do \
     
    12091390clean: clean-am
    12101391
    1211 clean-am: clean-cfa_cpplibPROGRAMS clean-generic mostlyclean-am
     1392clean-am: clean-cfa_cpplibPROGRAMS clean-generic clean-noinstLIBRARIES \
     1393        mostlyclean-am
    12121394
    12131395distclean: distclean-am
     
    12791461
    12801462.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
    1281         clean-cfa_cpplibPROGRAMS clean-generic cscopelist-am ctags \
    1282         ctags-am distclean distclean-compile distclean-generic \
    1283         distclean-tags distdir dvi dvi-am html html-am info info-am \
    1284         install install-am install-cfa_cpplibPROGRAMS install-data \
    1285         install-data-am install-dvi install-dvi-am install-exec \
    1286         install-exec-am install-html install-html-am install-info \
    1287         install-info-am install-man install-pdf install-pdf-am \
    1288         install-ps install-ps-am install-strip installcheck \
    1289         installcheck-am installdirs maintainer-clean \
    1290         maintainer-clean-generic mostlyclean mostlyclean-compile \
    1291         mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
    1292         uninstall-am uninstall-cfa_cpplibPROGRAMS
     1463        clean-cfa_cpplibPROGRAMS clean-generic clean-noinstLIBRARIES \
     1464        cscopelist-am ctags ctags-am distclean distclean-compile \
     1465        distclean-generic distclean-tags distdir dvi dvi-am html \
     1466        html-am info info-am install install-am \
     1467        install-cfa_cpplibPROGRAMS install-data install-data-am \
     1468        install-dvi install-dvi-am install-exec install-exec-am \
     1469        install-html install-html-am install-info install-info-am \
     1470        install-man install-pdf install-pdf-am install-ps \
     1471        install-ps-am install-strip installcheck installcheck-am \
     1472        installdirs maintainer-clean maintainer-clean-generic \
     1473        mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
     1474        ps ps-am tags tags-am uninstall uninstall-am \
     1475        uninstall-cfa_cpplibPROGRAMS
    12931476
    12941477.PRECIOUS: Makefile
  • src/Parser/LinkageSpec.cc

    r341bb80 r6d44da1  
    1010// Created On       : Sat May 16 13:22:09 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul  7 11:11:00 2017
    13 // Update Count     : 25
     12// Last Modified On : Thr Spt 12 15:59:00 2018
     13// Update Count     : 26
    1414//
    1515
     
    2323
    2424namespace LinkageSpec {
    25 
    26 Spec linkageCheck( CodeLocation location, const string * spec ) {
    27         assert( spec );
    28         unique_ptr<const string> guard( spec ); // allocated by lexer
    29         if ( *spec == "\"Cforall\"" ) {
    30                 return Cforall;
    31         } else if ( *spec == "\"C\"" ) {
    32                 return C;
    33         } else if ( *spec == "\"BuiltinC\"" ) {
    34                 return BuiltinC;
    35         } else {
    36                 SemanticError( location, "Invalid linkage specifier " + *spec );
    37         } // if
    38 }
    3925
    4026Spec linkageUpdate( CodeLocation location, Spec old_spec, const string * cmd ) {
  • src/Parser/LinkageSpec.h

    r341bb80 r6d44da1  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:24:28 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul  2 07:46:49 2018
    13 // Update Count     : 16
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Spt 13 15:59:00 2018
     13// Update Count     : 17
    1414//
    1515
     
    4141
    4242
    43         Spec linkageCheck( CodeLocation location, const std::string * );
    44         // Returns the Spec with the given name (limited to C, Cforall & BuiltinC)
    4543        Spec linkageUpdate( CodeLocation location, Spec old_spec, const std::string * cmd );
    4644        /* If cmd = "C" returns a Spec that is old_spec with is_mangled = false
  • src/Parser/lex.ll

    r341bb80 r6d44da1  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Wed Aug  8 17:23:17 2018
    13  * Update Count     : 685
     12 * Last Modified On : Wed Aug 29 15:02:41 2018
     13 * Update Count     : 686
    1414 */
    1515
     
    410410">>="                   { NAMEDOP_RETURN(RSassign); }
    411411
    412 "~="                    { NAMEDOP_RETURN(Erange); }                             // CFA
    413412"@="                    { NAMEDOP_RETURN(ATassign); }                   // CFA
     413"~="                    { NAMEDOP_RETURN(ErangeUpEq); }                 // CFA
     414"-~"                    { NAMEDOP_RETURN(ErangeDown); }                 // CFA
     415"-~="                   { NAMEDOP_RETURN(ErangeDownEq); }               // CFA
    414416
    415417                                /* CFA, operator identifier */
  • src/Parser/parser.yy

    r341bb80 r6d44da1  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug  8 17:50:07 2018
    13 // Update Count     : 3998
     12// Last Modified On : Thu Aug 30 17:02:25 2018
     13// Update Count     : 4029
    1414//
    1515
     
    186186} // fieldDecl
    187187
     188ExpressionNode *forInc( const OperKinds op ) {
     189        return new ExpressionNode( build_constantInteger( *new string( op == OperKinds::LThan || op == OperKinds::LEThan ? "1" : "-1" ) ) );
     190} // forInc
     191
    188192ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
     193        ConstantExpr *constant = dynamic_cast<ConstantExpr *>(type->get_expr());
     194        if ( constant && (constant->get_constant()->get_value() == "0" || constant->get_constant()->get_value() == "1") ) {
     195        type = new ExpressionNode( new CastExpr( maybeMoveBuild< Expression >(type), new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ) );
     196        } // if
    189197        return new ForCtrl(
    190198                distAttr( DeclarationNode::newTypeof( type ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ),
     
    214222
    215223// Types declaration for productions
    216 %union
    217 {
     224%union {
    218225        Token tok;
    219226        ParseNode * pn;
     
    290297%token ANDassign        ERassign        ORassign                                // &=   ^=      |=
    291298
    292 %token Erange                                                                                   // ~=
     299%token ErangeUpEq       ErangeDown      ErangeDownEq                    // ~=   -~      -~=
    293300%token ATassign                                                                                 // @=
    294301
     
    11381145                                $$ = new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr );
    11391146                        } else {
    1140                                 $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), OperKinds::LThan, $1->clone(),
    1141                                                          new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );
     1147                                $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
     1148                                                          OperKinds::LThan, $1->clone(), forInc( OperKinds::LThan ) );
    11421149                        } // if
    11431150                }
    11441151        | constant_expression inclexcl constant_expression      // CFA
    1145                 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     1152                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, forInc( $2 ) ); }
    11461153        | constant_expression inclexcl constant_expression '~' constant_expression // CFA
    11471154                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); }
     
    11541161                        } else {
    11551162                                if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) {
    1156                                         $$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), OperKinds::LThan, $3->clone(),
    1157                                                                  new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );
     1163                                        $$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
     1164                                                                  OperKinds::LThan, $3->clone(), forInc( OperKinds::LThan ) );
    11581165                                } else {
    11591166                                        SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr;
     
    11671174                        } else {
    11681175                                if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) {
    1169                                         $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );
     1176                                        $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, forInc( $4 ) );
    11701177                                } else {
    11711178                                        SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr;
     
    11941201        '~'
    11951202                { $$ = OperKinds::LThan; }
    1196         | Erange
     1203        | ErangeUpEq
    11971204                { $$ = OperKinds::LEThan; }