Changeset c3a2007


Ignore:
Timestamp:
Oct 28, 2019, 4:28:37 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
8364209
Parents:
c921712 (diff), 9bdb8b7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
1 added
3 deleted
59 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    rc921712 rc3a2007  
    224224//Routine responsible of sending the email notification once the build is completed
    225225//===========================================================================================================
     226@NonCPS
     227def SplitLines(String text) {
     228        def list = []
     229
     230        text.eachLine {
     231                list += it
     232        }
     233
     234        return list
     235}
     236
    226237def GitLogMessage() {
    227238        if (!Settings || !Settings.GitOldRef || !Settings.GitNewRef) return "\nERROR retrieveing git information!\n"
    228239
    229         sh "${SrcDir}/tools/PrettyGitLogs.sh ${SrcDir} ${BuildDir} ${Settings.GitOldRef} ${Settings.GitNewRef}"
    230 
    231         def gitUpdate = readFile("${BuildDir}/GIT_UPDATE")
    232         def gitLog    = readFile("${BuildDir}/GIT_LOG")
    233         def gitDiff   = readFile("${BuildDir}/GIT_DIFF")
     240        def oldRef = Settings.GitOldRef
     241        def newRef = Settings.GitNewRef
     242
     243        def revText = sh(returnStdout: true, script: "git rev-list ${oldRef}..${newRef}").trim()
     244        def revList = SplitLines( revText )
     245
     246        def gitUpdate = ""
     247        revList.each { rev ->
     248                def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim()
     249                gitUpdate = gitUpdate + "       via  ${rev} (${type})"
     250        }
     251
     252        def rev = oldRef
     253        def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim()
     254        gitUpdate = gitUpdate + "      from  ${rev} (${type})"
     255
     256        def gitLog    = sh(returnStdout: true, script: "git rev-list --format=short ${oldRef}...${newRef}").trim()
     257
     258        def gitDiff   = sh(returnStdout: true, script: "git diff --stat --color ${newRef} ${oldRef}").trim()
     259        gitDiff = gitDiff.replace('[32m', '<span style="color: #00AA00;">')
     260        gitDiff = gitDiff.replace('[31m', '<span style="color: #AA0000;">')
     261        gitDiff = gitDiff.replace('[m', '</span>')
    234262
    235263        return """
  • Makefile.in

    rc921712 rc3a2007  
    264264CCDEPMODE = @CCDEPMODE@
    265265CFACC = @CFACC@
     266CFACC_INSTALL = @CFACC_INSTALL@
    266267CFACPP = @CFACPP@
    267268CFA_BACKEND_CC = @CFA_BACKEND_CC@
  • benchmark/Makefile.am

    rc921712 rc3a2007  
    2222
    2323AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror
    24 AM_CFAFLAGS = -quiet -nodebug -in-tree
     24AM_CFAFLAGS = -quiet -nodebug
    2525AM_UPPFLAGS = -quiet -nodebug -multi -std=c++14
    2626
  • benchmark/Makefile.in

    rc921712 rc3a2007  
    214214CCDEPMODE = @CCDEPMODE@
    215215CFACC = @CFACC@
     216CFACC_INSTALL = @CFACC_INSTALL@
    216217CFACPP = @CFACPP@
    217218CFA_BACKEND_CC = @CFA_BACKEND_CC@
     
    375376# applies to both programs
    376377AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror
    377 AM_CFAFLAGS = -quiet -nodebug -in-tree
     378AM_CFAFLAGS = -quiet -nodebug
    378379AM_UPPFLAGS = -quiet -nodebug -multi -std=c++14
    379380BENCH_V_CC = $(__bench_v_CC_$(__quiet))
  • configure

    rc921712 rc3a2007  
    715715BUILD_IN_TREE_FLAGS
    716716CFACPP
     717CFACC_INSTALL
    717718CFACC
    718719DRIVER_DIR
     
    33033304DRIVER_DIR=${TOP_BUILDDIR}driver/
    33043305CFACC=${DRIVER_DIR}cfa
     3306CFACC_INSTALL=${CFA_BINDIR}${CFA_NAME}
    33053307CFACPP=${DRIVER_DIR}cfa-cpp
     3308
    33063309
    33073310
  • configure.ac

    rc921712 rc3a2007  
    9393DRIVER_DIR=${TOP_BUILDDIR}driver/
    9494CFACC=${DRIVER_DIR}cfa
     95CFACC_INSTALL=${CFA_BINDIR}${CFA_NAME}
    9596CFACPP=${DRIVER_DIR}cfa-cpp
    9697AC_SUBST(DRIVER_DIR)
    9798AC_SUBST(CFACC)
     99AC_SUBST(CFACC_INSTALL)
    98100AC_SUBST(CFACPP)
    99101
  • driver/Makefile.in

    rc921712 rc3a2007  
    201201CCDEPMODE = @CCDEPMODE@
    202202CFACC = @CFACC@
     203CFACC_INSTALL = @CFACC_INSTALL@
    203204CFACPP = @CFACPP@
    204205CFA_BACKEND_CC = @CFA_BACKEND_CC@
  • driver/cc1.cc

    rc921712 rc3a2007  
    1010// Created On       : Fri Aug 26 14:23:51 2005
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep  9 17:50:53 2019
    13 // Update Count     : 384
     12// Last Modified On : Sun Oct 20 08:14:33 2019
     13// Update Count     : 385
    1414//
    1515
     
    503503                execvp( args[0], (char * const *)args );                // should not return
    504504                perror( "CC1 Translator error: stage 2 cc1, execvp" );
    505                 cerr << " invoked " << cargs[0] << endl;
     505                cerr << " invoked " << args[0] << endl;
    506506                exit( EXIT_FAILURE );                                                   // tell gcc not to go any further
    507507        } // if
  • driver/cfa.cc

    rc921712 rc3a2007  
    1515
    1616#include <iostream>
    17 #include <cstdio>                                                                               // perror
    18 #include <cstdlib>                                                                              // putenv, exit
    19 #include <unistd.h>                                                                             // execvp
    20 #include <string>                                                                               // STL version
    21 #include <string.h>                                                                             // strcmp
    22 #include <algorithm>                                                                    // find
     17#include <cstdio>      // perror
     18#include <cstdlib>     // putenv, exit
     19#include <climits>     // PATH_MAX
     20#include <unistd.h>    // execvp
     21#include <string>      // STL version
     22#include <string.h>    // strcmp
     23#include <algorithm>   // find
    2324
    2425#include <sys/types.h>
     
    3536// #define __DEBUG_H__
    3637
    37 static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );               // "N__=" suffix
     38// "N__=" suffix
     39static string __CFA_FLAGPREFIX__( "__CFA_FLAG" );
    3840
    3941void Putenv( char * argv[], string arg ) {
     
    5759}
    5860
    59 bool suffix( const string & arg ) {                                             // check if string has suffix
     61// check if string has suffix
     62bool suffix( const string & arg ) {
    6063        enum { NumSuffixes = 3 };
    6164        static const string suffixes[NumSuffixes] = { "cfa", "hfa", "ifa" };
     
    7679static inline string dir(const string & path) {
    7780        return path.substr(0, path.find_last_of('/'));
     81}
     82
     83// Different path modes
     84enum PathMode {
     85        Installed,     // cfa is installed, use prefix
     86        BuildTree,     // cfa is in the tree, use source and build tree
     87        Distributed    // cfa is distributed, use build tree for includes and executable directory for .cfs
     88};
     89
     90// Get path mode from /proc
     91PathMode FromProc() {
     92        std::string abspath;
     93        abspath.resize(PATH_MAX);
     94
     95        // get executable path from /proc/self/exe
     96        ssize_t size = readlink("/proc/self/exe", const_cast<char*>(abspath.c_str()), abspath.size());
     97        if(size <= 0) {
     98                std::cerr << "Error could not evaluate absolute path from /proc/self/exe" << std::endl;
     99                std::cerr << "Failed with " << std::strerror(errno) << std::endl;
     100                std::exit(1);
     101        }
     102
     103        // Trim extra characters
     104        abspath.resize(size);
     105
     106        // Are we installed
     107        if(abspath.rfind(CFA_BINDIR  , 0) == 0) { return Installed; }
     108
     109        // Is this the build tree
     110        if(abspath.rfind(TOP_BUILDDIR, 0) == 0) { return BuildTree; }
     111
     112        // Does this look like distcc
     113        if(abspath.find("/.cfadistcc/") != std::string::npos) { return Distributed; }
     114
     115        // None of the above? Give up since we don't know where the prelude or include directories are
     116        std::cerr << "Cannot find required files from excutable path " << abspath << std::endl;
     117        std::exit(1);
    78118}
    79119
     
    113153        bool m32 = false;                                                                       // -m32 flag
    114154        bool m64 = false;                                                                       // -m64 flag
    115         bool intree = false;                                                            // build in tree
    116155        bool compiling_libs = false;
    117         bool disttree = false;
    118156        int o_file = 0;                                                                         // -o filename position
     157
     158        PathMode path = FromProc();
    119159
    120160        const char *args[argc + 100];                                           // cfa command line values, plus some space for additional flags
     
    171211                        } else if ( arg == "-no-include-stdhdr" ) {
    172212                                noincstd_flag = true;                                   // strip the no-include-stdhdr flag
    173                         } else if ( arg == "-in-tree" ) {
    174                                 intree = true;
    175                         } else if ( arg == "-dist-tree" ) {
    176                                 disttree = true;
    177213                        } else if ( arg == "-cfalib") {
    178214                                compiling_libs = true;
     
    283319
    284320        // add the CFA include-library paths, which allow direct access to header files without directory qualification
    285         if ( ! intree ) {
     321        string libbase;
     322        switch(path) {
     323        case Installed:
    286324                args[nargs++] = "-I" CFA_INCDIR;
    287                 if ( ! noincstd_flag ) {                                                // do not use during build
     325                // do not use during build
     326                if ( ! noincstd_flag ) {
    288327                        args[nargs++] = "-I" CFA_INCDIR "stdhdr";
    289328                } // if
    290329                args[nargs++] = "-I" CFA_INCDIR "concurrency";
    291330                args[nargs++] = "-I" CFA_INCDIR "containers";
    292         } else {
     331                libbase = CFA_LIBDIR;
     332                break;
     333        case BuildTree:
     334        case Distributed:
    293335                args[nargs++] = "-I" TOP_SRCDIR "libcfa/src";
    294                 if ( ! noincstd_flag ) {                                                // do not use during build
     336                // do not use during build
     337                if ( ! noincstd_flag ) {
    295338                        args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr";
    296339                } // if
    297340                args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency";
    298341                args[nargs++] = "-I" TOP_SRCDIR "libcfa/src" "/containers";
     342
     343                libbase = TOP_BUILDDIR "libcfa/";
     344
     345                break;
    299346        } // if
    300347
     
    302349        args[nargs++] = "-imacros";
    303350        args[nargs++] = "stdbool.h";
    304 
    305         string libbase;
    306         if ( ! intree ) {
    307                 libbase = CFA_LIBDIR;
    308         } else {
    309                 libbase = TOP_BUILDDIR "libcfa/";
    310         } // if
    311351
    312352        if( compiling_libs ) {
     
    326366        string libdir = libbase + arch + "-" + config;
    327367
    328         if (!disttree) {
     368        if (path != Distributed) {
    329369                if ( ! nolib && ! dirExists( libdir ) ) {
    330370                        cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
     
    344384        } // if
    345385
    346         if(disttree) {
    347                 Putenv( argv, "--prelude-dir=" + dir(argv[0]) );
    348         } else if(intree) {
    349                 Putenv( argv, "--prelude-dir=" + libdir + "/prelude" );
    350         } else {
    351                 Putenv( argv, "--prelude-dir=" + libdir );
     386        switch(path) {
     387        case Installed   : Putenv( argv, "--prelude-dir=" + libdir ); break;
     388        case BuildTree   : Putenv( argv, "--prelude-dir=" + libdir + "/prelude" ); break;
     389        case Distributed : Putenv( argv, "--prelude-dir=" + dir(argv[0]) ); break;
    352390        }
    353391
     
    365403
    366404                // include the cfa library in case it is needed
    367                 args[nargs++] = ( *new string( string("-L" ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
    368                 args[nargs++] = ( *new string( string("-Wl,-rpath," ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
     405                args[nargs++] = ( *new string( string("-L" ) + libdir + (path != Installed ? "/src/.libs" : "")) ).c_str();
     406                args[nargs++] = ( *new string( string("-Wl,-rpath," ) + libdir + (path != Installed ? "/src/.libs" : "")) ).c_str();
    369407                args[nargs++] = "-Wl,--push-state,--as-needed";
    370408                args[nargs++] = "-lcfathread";
     
    410448
    411449        if ( bprefix.length() == 0 ) {
    412                 if(disttree) {
    413                         bprefix = dir(argv[0]);
    414                 } else if(intree) {
    415                         bprefix = srcdriverdir;
    416                 } else {
    417                         bprefix = installlibdir;
     450                switch(path) {
     451                case Installed   : bprefix = installlibdir; break;
     452                case BuildTree   : bprefix = srcdriverdir ; break;
     453                case Distributed : bprefix = dir(argv[0]) ; break;
    418454                }
    419455                if ( bprefix[bprefix.length() - 1] != '/' ) bprefix += '/';
  • libcfa/Makefile.in

    rc921712 rc3a2007  
    296296PACKAGE_VERSION = @PACKAGE_VERSION@
    297297PATH_SEPARATOR = @PATH_SEPARATOR@
    298 PRELUDEFLAG = @PRELUDEFLAG@
    299298RANLIB = @RANLIB@
    300299SED = @SED@
  • libcfa/configure

    rc921712 rc3a2007  
    707707CONFIG_CFLAGS
    708708ARCH_FLAGS
    709 PRELUDEFLAG
    710709CFADIR_HASH
    711710LOCAL_CC1
     
    29602959if test x$enable_distcc = xno; then
    29612960        CFACC=${DRIVER_DIR}cfa
    2962         PRELUDEFLAG='-in-tree'
    29632961        echo "no"
    29642962else
     
    29682966        CFADIR_HASH=$($tools/distcc_hash $config)
    29692967        CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa"
    2970         PRELUDEFLAG='-dist-tree'
    29712968        echo "yes (hash=${CFADIR_HASH})"
    29722969fi
     
    29822979  ENABLE_DISTCC_FALSE=
    29832980fi
    2984 
    29852981
    29862982
  • libcfa/configure.ac

    rc921712 rc3a2007  
    3434if test x$enable_distcc = xno; then
    3535        CFACC=${DRIVER_DIR}cfa
    36         PRELUDEFLAG='-in-tree'
    3736        echo "no"
    3837else
     
    4241        CFADIR_HASH=$($tools/distcc_hash $config)
    4342        CFACC="distcc ~/.cfadistcc/${CFADIR_HASH}/cfa"
    44         PRELUDEFLAG='-dist-tree'
    4543        echo "yes (hash=${CFADIR_HASH})"
    4644fi
     
    5755AC_SUBST(CFADIR_HASH)
    5856AC_SUBST(CFA_VERSION)
    59 AC_SUBST(PRELUDEFLAG)
    6057
    6158#==============================================================================
  • libcfa/prelude/Makefile.in

    rc921712 rc3a2007  
    239239PACKAGE_VERSION = @PACKAGE_VERSION@
    240240PATH_SEPARATOR = @PATH_SEPARATOR@
    241 PRELUDEFLAG = @PRELUDEFLAG@
    242241RANLIB = @RANLIB@
    243242SED = @SED@
  • libcfa/prelude/extras.regx

    rc921712 rc3a2007  
    1919typedef.* uint32_t;
    2020typedef.* uint64_t;
     21typedef.* __uint_least16_t;
     22typedef.* __uint_least32_t;
    2123typedef.* char16_t;
    2224typedef.* char32_t;
  • libcfa/src/Makefile.am

    rc921712 rc3a2007  
    3232# use -no-include-stdhdr to prevent rebuild cycles
    3333# The built sources must not depend on the installed headers
    34 AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
     34AM_CFAFLAGS = -quiet -cfalib -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
    3535AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
    3636AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     
    9696
    9797prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
    98         ${AM_V_GEN}$(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
     98        ${AM_V_GEN}$(CFACOMPILE) -quiet -XCFA -l ${<} -c -o ${@}
    9999
    100100prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
    101101        ${AM_V_GEN}$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
    102         $(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
     102        $(CFACOMPILE) -quiet -XCFA -l ${<} -c -o ${@}
    103103
    104104#----------------------------------------------------------------------------------------------------------------
  • libcfa/src/Makefile.in

    rc921712 rc3a2007  
    349349PACKAGE_VERSION = @PACKAGE_VERSION@
    350350PATH_SEPARATOR = @PATH_SEPARATOR@
    351 PRELUDEFLAG = @PRELUDEFLAG@
    352351RANLIB = @RANLIB@
    353352SED = @SED@
     
    445444# use -no-include-stdhdr to prevent rebuild cycles
    446445# The built sources must not depend on the installed headers
    447 AM_CFAFLAGS = -quiet -cfalib @PRELUDEFLAG@ -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
     446AM_CFAFLAGS = -quiet -cfalib -I$(srcdir)/stdhdr $(if $(findstring ${gdbwaittarget}, ${@}), -XCFA --gdb) @CONFIG_CFAFLAGS@
    448447AM_CFLAGS = -g -Wall -Wno-unused-function -fPIC @ARCH_FLAGS@ @CONFIG_CFLAGS@
    449448AM_CCASFLAGS = -g -Wall -Wno-unused-function @ARCH_FLAGS@ @CONFIG_CFLAGS@
     
    954953
    955954prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
    956         ${AM_V_GEN}$(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
     955        ${AM_V_GEN}$(CFACOMPILE) -quiet -XCFA -l ${<} -c -o ${@}
    957956
    958957prelude.lo: prelude.cfa extras.cf gcc-builtins.cf builtins.cf @LOCAL_CFACC@ @CFACPP@
    959958        ${AM_V_GEN}$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
    960         $(CFACOMPILE) -quiet @PRELUDEFLAG@ -XCFA -l ${<} -c -o ${@}
     959        $(CFACOMPILE) -quiet -XCFA -l ${<} -c -o ${@}
    961960
    962961#----------------------------------------------------------------------------------------------------------------
  • libcfa/src/concurrency/kernel_private.hfa

    rc921712 rc3a2007  
    3434static inline void WakeThread( thread_desc * thrd ) {
    3535        if( !thrd ) return;
     36
     37        verify(thrd->state == Inactive);
    3638
    3739        disable_interrupts();
  • libcfa/src/heap.cfa

    rc921712 rc3a2007  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 24 13:12:45 2019
    13 // Update Count     : 550
     12// Last Modified On : Fri Oct 18 07:42:09 2019
     13// Update Count     : 556
    1414//
    1515
     
    541541        // along with the block and is a multiple of the alignment size.
    542542
     543  if ( unlikely( size > ~0ul - sizeof(HeapManager.Storage) ) ) return 0;
    543544        size_t tsize = size + sizeof(HeapManager.Storage);
    544545        if ( likely( tsize < mmapStart ) ) {                            // small size => sbrk
     
    592593                block->header.kind.real.home = freeElem;                // pointer back to free list of apropriate size
    593594        } else {                                                                                        // large size => mmap
     595  if ( unlikely( size > ~0ul - pageSize ) ) return 0;
    594596                tsize = libCeiling( tsize, pageSize );                  // must be multiple of page size
    595597                #ifdef __STATISTICS__
     
    888890        } // realloc
    889891
    890 
    891892        // The obsolete function memalign() allocates size bytes and returns a pointer to the allocated memory. The memory
    892893        // address will be a multiple of alignment, which must be a power of two.
     
    992993        size_t malloc_alignment( void * addr ) {
    993994          if ( unlikely( addr == 0 ) ) return libAlign();       // minimum alignment
    994                 HeapManager.Storage.Header * header = (HeapManager.Storage.Header *)( (char *)addr - sizeof(HeapManager.Storage) );
     995                HeapManager.Storage.Header * header = headerAddr( addr );
    995996                if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ?
    996997                        return header->kind.fake.alignment & -2;        // remove flag from value
     
    10041005        bool malloc_zero_fill( void * addr ) {
    10051006          if ( unlikely( addr == 0 ) ) return false;            // null allocation is not zero fill
    1006 
    1007                 HeapManager.Storage.Header * header = (HeapManager.Storage.Header *)( (char *)addr - sizeof(HeapManager.Storage) );
     1007                HeapManager.Storage.Header * header = headerAddr( addr );
    10081008                if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ?
    10091009                        header = (HeapManager.Storage.Header *)((char *)header - header->kind.fake.offset);
  • libcfa/src/stdlib.cfa

    rc921712 rc3a2007  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun 24 17:34:44 2019
    13 // Update Count     : 462
     12// Last Modified On : Tue Oct 22 08:57:52 2019
     13// Update Count     : 478
    1414//
    1515
     
    2121#include <string.h>                                                                             // memcpy, memset
    2222#include <malloc.h>                                                                             // malloc_usable_size
    23 #include <math.h>                                                                               // fabsf, fabs, fabsl
     23//#include <math.h>                                                                             // fabsf, fabs, fabsl
    2424#include <complex.h>                                                                    // _Complex_I
    2525#include <assert.h>
     
    2727//---------------------------------------
    2828
    29 // resize, non-array types
    30 forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill ) {
    31         size_t olen = malloc_usable_size( ptr );                        // current allocation
    32     char * nptr = (void *)realloc( (void *)ptr, dim * (size_t)sizeof(T) ); // C realloc
    33         size_t nlen = malloc_usable_size( nptr );                       // new allocation
    34         if ( nlen > olen ) {                                                            // larger ?
    35                 memset( nptr + olen, (int)fill, nlen - olen );  // initialize added storage
    36         } //
    37     return (T *)nptr;
    38 } // alloc
     29forall( dtype T | sized(T) ) {
     30        T * alloc_set( T ptr[], size_t dim, char fill ) {       // realloc array with fill
     31                size_t olen = malloc_usable_size( ptr );                // current allocation
     32                char * nptr = (char *)realloc( (void *)ptr, dim * sizeof(T) ); // C realloc
     33                size_t nlen = malloc_usable_size( nptr );               // new allocation
     34                if ( nlen > olen ) {                                                    // larger ?
     35                        memset( nptr + olen, (int)fill, nlen - olen ); // initialize added storage
     36                } // if
     37                return (T *)nptr;
     38        } // alloc_set
     39
     40        T * alloc_align( T ptr[], size_t align ) {                      // aligned realloc array
     41                char * nptr;
     42                size_t alignment = malloc_alignment( ptr );
     43                if ( align != alignment && (uintptr_t)ptr % align != 0 ) {
     44                        size_t olen = malloc_usable_size( ptr );        // current allocation
     45                        nptr = (char *)memalign( align, olen );
     46                        size_t nlen = malloc_usable_size( nptr );       // new allocation
     47                        size_t lnth = olen < nlen ? olen : nlen;        // min
     48                        memcpy( nptr, ptr, lnth );                                      // initialize storage
     49                        free( ptr );
     50                } else {
     51                        nptr = (char *)ptr;
     52                } // if
     53                return (T *)nptr;
     54        } // alloc_align
     55
     56        T * alloc_align( T ptr[], size_t align, size_t dim ) { // aligned realloc array
     57                char * nptr;
     58                size_t alignment = malloc_alignment( ptr );
     59                if ( align != alignment ) {
     60                        size_t olen = malloc_usable_size( ptr );        // current allocation
     61                        nptr = (char *)memalign( align, dim * sizeof(T) );
     62                        size_t nlen = malloc_usable_size( nptr );       // new allocation
     63                        size_t lnth = olen < nlen ? olen : nlen;        // min
     64                        memcpy( nptr, ptr, lnth );                                      // initialize storage
     65                        free( ptr );
     66                } else {
     67                        nptr = (char *)realloc( (void *)ptr, dim * sizeof(T) ); // C realloc
     68                } // if
     69                return (T *)nptr;
     70        } // alloc_align
     71
     72        T * alloc_align_set( T ptr[], size_t align, char fill ) { // aligned realloc with fill
     73                size_t olen = malloc_usable_size( ptr );                // current allocation
     74                char * nptr = alloc_align( ptr, align );
     75                size_t nlen = malloc_usable_size( nptr );               // new allocation
     76                if ( nlen > olen ) {                                                    // larger ?
     77                        memset( nptr + olen, (int)fill, nlen - olen ); // initialize added storage
     78                } // if
     79                return (T *)nptr;
     80        } // alloc_align_set
     81} // distribution
    3982
    4083// allocation/deallocation and constructor/destructor, non-array types
    4184forall( dtype T | sized(T), ttype Params | { void ?{}( T &, Params ); } )
    4285T * new( Params p ) {
    43         return &(*malloc()){ p };                                                               // run constructor
     86        return &(*malloc()){ p };                                                       // run constructor
    4487} // new
    4588
     
    4790void delete( T * ptr ) {
    4891        if ( ptr ) {                                                                            // ignore null
    49                 ^(*ptr){};                                                                                      // run destructor
     92                ^(*ptr){};                                                                              // run destructor
    5093                free( ptr );
    5194        } // if
     
    5598void delete( T * ptr, Params rest ) {
    5699        if ( ptr ) {                                                                            // ignore null
    57                 ^(*ptr){};                                                                                      // run destructor
     100                ^(*ptr){};                                                                              // run destructor
    58101                free( ptr );
    59102        } // if
  • libcfa/src/stdlib.hfa

    rc921712 rc3a2007  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 23 14:14:59 2019
    13 // Update Count     : 373
     12// Last Modified On : Sun Oct 20 22:57:33 2019
     13// Update Count     : 390
    1414//
    1515
     
    2525        void * memset( void * dest, int fill, size_t size ); // string.h
    2626        void * memcpy( void * dest, const void * src, size_t size ); // string.h
    27     void * cmemalign( size_t alignment, size_t noOfElems, size_t elemSize ); // CFA
     27    void * cmemalign( size_t alignment, size_t noOfElems, size_t elemSize ); // CFA heap
    2828} // extern "C"
    2929
     
    5252        T * realloc( T * ptr, size_t size ) {
    5353                if ( unlikely( ptr == 0 ) ) return malloc();
    54                 return (T *)(void *)realloc( (void *)ptr, size );
     54                return (T *)(void *)realloc( (void *)ptr, size ); // C realloc
    5555        } // realloc
    5656
    5757        T * memalign( size_t align ) {
    58                 return (T *)memalign( align, sizeof(T) );
     58                return (T *)memalign( align, sizeof(T) );               // C memalign
    5959        } // memalign
    6060
    6161        T * aligned_alloc( size_t align ) {
    62                 return (T *)aligned_alloc( align, sizeof(T) );
     62                return (T *)aligned_alloc( align, sizeof(T) );  // C aligned_alloc
    6363        } // aligned_alloc
    6464
     
    6767        } // posix_memalign
    6868
    69 
    7069        // Cforall dynamic allocation
    7170
     
    7473        } // alloc
    7574
    76         T * alloc( char fill ) {
    77                 T * ptr;
    78                 if ( _Alignof(T) <= libAlign() ) ptr = (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc
    79                 else ptr = (T *)memalign( _Alignof(T), sizeof(T) );
    80                 return (T *)memset( ptr, (int)fill, sizeof(T) ); // initialize with fill value
    81         } // alloc
    82 
    8375        T * alloc( size_t dim ) {
    84                 if ( _Alignof(T) <= libAlign() ) return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc
     76                if ( _Alignof(T) <= libAlign() ) return (T *)(void *)malloc( dim * (size_t)sizeof(T) );
    8577                else return (T *)memalign( _Alignof(T), dim * sizeof(T) );
    8678        } // alloc
    8779
    88         T * alloc( size_t dim, char fill ) {
     80        T * alloc( T ptr[], size_t dim ) {                                      // realloc
     81                return realloc( ptr, dim * sizeof(T) );
     82        } // alloc
     83
     84        T * alloc_set( char fill ) {
     85                return (T *)memset( (T *)alloc(), (int)fill, sizeof(T) ); // initialize with fill value
     86        } // alloc
     87
     88        T * alloc_set( T fill ) {
     89                return (T *)memcpy( (T *)alloc(), &fill, sizeof(T) ); // initialize with fill value
     90        } // alloc
     91
     92        T * alloc_set( size_t dim, char fill ) {
    8993                return (T *)memset( (T *)alloc( dim ), (int)fill, dim * sizeof(T) ); // initialize with fill value
    9094        } // alloc
    9195
    92         T * alloc( T ptr[], size_t dim ) {
    93                 return realloc( ptr, dim * sizeof(T) );
    94         } // alloc
    95 } // distribution
    96 
    97 
    98 static inline forall( dtype T | sized(T) ) {
    99         T * align_alloc( size_t align ) {
     96        T * alloc_set( size_t dim, T fill ) {
     97                T * r = (T *)alloc( dim );
     98                for ( i; dim ) { memcpy( &r[i], &fill, sizeof(T) ); } // initialize with fill value
     99                return r;
     100        } // alloc
     101
     102        T * alloc_set( size_t dim, const T fill[] ) {
     103                return (T *)memcpy( (T *)alloc( dim ), fill, dim * sizeof(T) ); // initialize with fill value
     104        } // alloc
     105} // distribution
     106
     107forall( dtype T | sized(T) ) {
     108        T * alloc_set( T ptr[], size_t dim, char fill );        // realloc array with fill
     109} // distribution
     110
     111static inline forall( dtype T | sized(T) ) {
     112        T * alloc_align( size_t align ) {
    100113                return (T *)memalign( align, sizeof(T) );
    101         } // align_alloc
    102 
    103         T * align_alloc( size_t align, char fill ) {
    104                 T * ptr = (T *)memalign( align, sizeof(T) );
    105                 return (T *)memset( ptr, (int)fill, sizeof(T) );
    106         } // align_alloc
    107 
    108         T * align_alloc( size_t align, size_t dim ) {
     114        } // alloc_align
     115
     116        T * alloc_align( size_t align, size_t dim ) {
    109117                return (T *)memalign( align, dim * sizeof(T) );
    110         } // align_alloc
    111 
    112         T * align_alloc( size_t align, size_t dim, char fill ) {
    113                 if ( fill == '\0' ) {
    114                         return (T *)cmemalign( align, dim, sizeof(T) );
    115                 } else {
    116                         return (T *)memset( (T *)memalign( align, dim * sizeof(T) ), (int)fill, dim * sizeof(T) );
    117                 } // if
    118         } // align_alloc
    119 } // distribution
    120 
    121 forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill );
    122 
     118        } // alloc_align
     119
     120        T * alloc_align_set( size_t align, char fill ) {
     121                return (T *)memset( (T *)alloc_align( align ), (int)fill, sizeof(T) ); // initialize with fill value
     122        } // alloc_align
     123
     124        T * alloc_align_set( size_t align, T fill ) {
     125                return (T *)memcpy( (T *)alloc_align( align ), &fill, sizeof(T) ); // initialize with fill value
     126        } // alloc_align
     127
     128        T * alloc_align_set( size_t align, size_t dim, char fill ) {
     129                return (T *)memset( (T *)alloc_align( align, dim ), (int)fill, dim * sizeof(T) ); // initialize with fill value
     130        } // alloc_align
     131
     132        T * alloc_align_set( size_t align, size_t dim, T fill ) {
     133                T * r = (T *)alloc_align( align, dim );
     134                for ( i; dim ) { memcpy( &r[i], &fill, sizeof(T) ); } // initialize with fill value
     135                return r;
     136        } // alloc_align
     137
     138        T * alloc_align_set( size_t align, size_t dim, const T fill[] ) {
     139                return (T *)memcpy( (T *)alloc_align( align, dim ), fill, dim * sizeof(T) );
     140        } // alloc_align
     141} // distribution
     142
     143forall( dtype T | sized(T) ) {
     144        T * alloc_align( T ptr[], size_t align );                       // realign
     145        T * alloc_align( T ptr[], size_t align, size_t dim ); // aligned realloc array
     146        T * alloc_align_set( T ptr[], size_t align, size_t dim, char fill ); // aligned realloc array with fill
     147} // distribution
    123148
    124149static inline forall( dtype T | sized(T) ) {
    125150        // data, non-array types
    126 
    127151        T * memset( T * dest, char fill ) {
    128152                return (T *)memset( dest, fill, sizeof(T) );
     
    136160static inline forall( dtype T | sized(T) ) {
    137161        // data, array types
    138 
    139162        T * amemset( T dest[], char fill, size_t dim ) {
    140163                return (T *)(void *)memset( dest, fill, dim * sizeof(T) ); // C memset
  • longrun_tests/Makefile.am

    rc921712 rc3a2007  
    4242        -I$(abs_top_srcdir)/tests \
    4343        -I$(srcdir) \
    44         -DTEST_$(shell cat .type | tr a-z A-Z) \
    45         -in-tree
     44        -DTEST_$(shell cat .type | tr a-z A-Z)
    4645
    4746TESTS = block coroutine create disjoint enter enter3 processor stack wait yield
  • longrun_tests/Makefile.in

    rc921712 rc3a2007  
    348348CCDEPMODE = @CCDEPMODE@
    349349CFACC = @CFACC@
     350CFACC_INSTALL = @CFACC_INSTALL@
    350351CFACPP = @CFACPP@
    351352CFA_BACKEND_CC = @CFA_BACKEND_CC@
     
    525526        -I$(abs_top_srcdir)/tests \
    526527        -I$(srcdir) \
    527         -DTEST_$(shell cat .type | tr a-z A-Z) \
    528         -in-tree
     528        -DTEST_$(shell cat .type | tr a-z A-Z)
    529529
    530530TESTS = block coroutine create disjoint enter enter3 processor stack wait yield
  • src/CodeGen/CodeGenerator.cc

    rc921712 rc3a2007  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr May  2 10:47:00 2019
    13 // Update Count     : 497
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Oct 19 19:30:38 2019
     13// Update Count     : 506
    1414//
    1515#include "CodeGenerator.h"
     
    198198                // deleted decls should never be used, so don't print them
    199199                if ( objectDecl->isDeleted && options.genC ) return;
    200                 if (objectDecl->get_name().empty() && options.genC ) {
     200
     201                // gcc allows an empty declarator (no name) for bit-fields and C states: 6.7.2.1 Structure and union specifiers,
     202                // point 4, page 113: If the (bit field) value is zero, the declaration shall have no declarator.  For anything
     203                // else, the anonymous name refers to the anonymous object for plan9 inheritance.
     204                if ( objectDecl->get_name().empty() && options.genC && ! objectDecl->get_bitfieldWidth() ) {
    201205                        // only generate an anonymous name when generating C code, otherwise it clutters the output too much
    202206                        static UniqueName name = { "__anonymous_object" };
    203207                        objectDecl->set_name( name.newName() );
    204             // Stops unused parameter warnings.
    205             if ( options.anonymousUnused ) {
    206                 objectDecl->attributes.push_back( new Attribute( "unused" ) );
    207             }
     208                        // Stops unused parameter warnings.
     209                        if ( options.anonymousUnused ) {
     210                                objectDecl->attributes.push_back( new Attribute( "unused" ) );
     211                        }
    208212                }
    209213
  • src/CodeGen/GenType.cc

    rc921712 rc3a2007  
    335335                        typeString = "_Atomic " + typeString;
    336336                } // if
    337                 if ( type->get_lvalue() && ! options.genC ) {
    338                         // when not generating C code, print lvalue for debugging.
    339                         typeString = "lvalue " + typeString;
    340                 }
    341337        }
    342338} // namespace CodeGen
  • src/ControlStruct/MLEMutator.cc

    rc921712 rc3a2007  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  8 17:08:25 2018
    13 // Update Count     : 219
     12// Last Modified On : Tue Oct 22 17:22:44 2019
     13// Update Count     : 220
    1414//
    1515
     
    313313        }
    314314
     315        void MLEMutator::premutate( TryStmt * tryStmt ) {
     316                // generate a label for breaking out of a labeled if
     317                bool labeledBlock = !(tryStmt->get_labels().empty());
     318                if ( labeledBlock ) {
     319                        Label brkLabel = generator->newLabel("blockBreak", tryStmt);
     320                        enclosingControlStructures.push_back( Entry( tryStmt, brkLabel ) );
     321                        GuardAction( [this]() { enclosingControlStructures.pop_back(); } );
     322                } // if
     323        }
     324
     325        Statement * MLEMutator::postmutate( TryStmt * tryStmt ) {
     326                bool labeledBlock = !(tryStmt->get_labels().empty());
     327                if ( labeledBlock ) {
     328                        if ( ! enclosingControlStructures.back().useBreakExit().empty() ) {
     329                                set_breakLabel( enclosingControlStructures.back().useBreakExit() );
     330                        } // if
     331                } // if
     332                return tryStmt;
     333        }
     334
    315335        void MLEMutator::premutate( CaseStmt *caseStmt ) {
    316336                visit_children = false;
  • src/ControlStruct/MLEMutator.h

    rc921712 rc3a2007  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  8 16:42:32 2018
    13 // Update Count     : 41
     12// Last Modified On : Tue Oct 22 17:22:47 2019
     13// Update Count     : 45
    1414//
    1515
     
    4747                void premutate( SwitchStmt *switchStmt );
    4848                Statement * postmutate( SwitchStmt *switchStmt );
     49                void premutate( TryStmt *tryStmt );
     50                Statement * postmutate( TryStmt *tryStmt );
    4951
    5052                Statement *mutateLoop( Statement *bodyLoop, Entry &e );
     
    7375                        explicit Entry( SwitchStmt *stmt, Label breakExit, Label fallDefaultExit ) :
    7476                                stmt( stmt ), breakExit( breakExit ), fallDefaultExit( fallDefaultExit ) {}
     77
     78                        explicit Entry( TryStmt *stmt, Label breakExit ) :
     79                                stmt( stmt ), breakExit( breakExit ) {}
    7580
    7681                        bool operator==( const Statement *other ) { return stmt == other; }
  • src/GenPoly/Box.cc

    rc921712 rc3a2007  
    837837                                        deref->args.push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) );
    838838                                        deref->result = arg->get_type()->clone();
    839                                         deref->result->set_lvalue( true );
    840839                                        return deref;
    841840                                } // if
  • src/GenPoly/Lvalue.cc

    rc921712 rc3a2007  
    5454                                delete ret->result;
    5555                                ret->result = base->clone();
    56                                 ret->result->set_lvalue( true );
    5756                                return ret;
    5857                        } else {
     
    167166                                ReferenceType * result = strict_dynamic_cast< ReferenceType * >( appExpr->result );
    168167                                appExpr->result = result->base->clone();
    169                                 appExpr->result->set_lvalue( true );
    170168                                if ( ! inIntrinsic ) {
    171169                                        // when not in an intrinsic function, add a cast to
     
    436434                                delete ret->result;
    437435                                ret->result = castExpr->result;
    438                                 ret->result->set_lvalue( true ); // ensure result is lvalue
     436                                assert( ret->get_lvalue() ); // ensure result is lvalue
    439437                                castExpr->env = nullptr;
    440438                                castExpr->arg = nullptr;
  • src/Makefile.in

    rc921712 rc3a2007  
    231231        SynTree/Initializer.$(OBJEXT) \
    232232        SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \
    233         SynTree/DeclReplacer.$(OBJEXT) SynTree/TopLvalue.$(OBJEXT)
     233        SynTree/DeclReplacer.$(OBJEXT)
    234234am__objects_8 = CompilationState.$(OBJEXT) $(am__objects_1) \
    235235        $(am__objects_2) Concurrency/Keywords.$(OBJEXT) \
     
    411411CCDEPMODE = @CCDEPMODE@
    412412CFACC = @CFACC@
     413CFACC_INSTALL = @CFACC_INSTALL@
    413414CFACPP = @CFACPP@
    414415CFA_BACKEND_CC = @CFA_BACKEND_CC@
     
    695696      SynTree/TypeSubstitution.cc \
    696697      SynTree/Attribute.cc \
    697       SynTree/DeclReplacer.cc \
    698       SynTree/TopLvalue.cc
     698      SynTree/DeclReplacer.cc
    699699
    700700
     
    10251025SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \
    10261026        SynTree/$(DEPDIR)/$(am__dirstamp)
    1027 SynTree/TopLvalue.$(OBJEXT): SynTree/$(am__dirstamp) \
    1028         SynTree/$(DEPDIR)/$(am__dirstamp)
    10291027Tuples/$(am__dirstamp):
    10301028        @$(MKDIR_P) Tuples
     
    13371335@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ReferenceType.Po@am__quote@
    13381336@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Statement.Po@am__quote@
    1339 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TopLvalue.Po@am__quote@
    13401337@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleExpr.Po@am__quote@
    13411338@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleType.Po@am__quote@
  • src/ResolvExpr/ConversionCost.cc

    rc921712 rc3a2007  
    157157                        if ( typesCompatibleIgnoreQualifiers( src, destAsRef->base, indexer, env ) ) {
    158158                                PRINT( std::cerr << "converting compatible base type" << std::endl; )
    159                                 assert( src->get_lvalue() == srcIsLvalue );
    160159                                if ( srcIsLvalue ) {
    161160                                        PRINT(
  • src/ResolvExpr/ResolveAssertions.cc

    rc921712 rc3a2007  
    156156                        for ( const auto& assn : x.assns ) {
    157157                                // compute conversion cost from satisfying decl to assertion
    158                                 assert( !assn.match.adjType->get_lvalue() );
    159158                                k += computeConversionCost(
    160159                                        assn.match.adjType, assn.decl->get_type(), false, indexer, x.env );
  • src/SymTab/Autogen.h

    rc921712 rc3a2007  
    9797                        //   type->get_qualifiers() = Type::Qualifiers();
    9898                        Type * castType = addCast->clone();
    99                         castType->get_qualifiers() -= Type::Qualifiers( Type::Lvalue | Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );
     99                        castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );
    100100                        // castType->set_lvalue( true ); // xxx - might not need this
    101101                        dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) );
  • src/SymTab/ManglerCommon.cc

    rc921712 rc3a2007  
    8888                                { Type::Atomic, "DA" }, // A is array, so need something unique for atmoic. For now, go with multiletter DA
    8989                                { Type::Mutex, "X" },
    90                                 { Type::Lvalue, "L" },
    9190                        };
    9291
  • src/SymTab/Validate.cc

    rc921712 rc3a2007  
    8181#include "SynTree/Label.h"             // for operator==, Label
    8282#include "SynTree/Mutator.h"           // for Mutator
    83 #include "SynTree/TopLvalue.h"         // for assertTopLvalue, clearInnerLvalue
    8483#include "SynTree/Type.h"              // for Type, TypeInstType, EnumInstType
    8584#include "SynTree/TypeSubstitution.h"  // for TypeSubstitution
     
    309308                PassVisitor<FixQualifiedTypes> fixQual;
    310309
    311                 assertTopLvalue( translationUnit );
    312310                {
    313311                        Stats::Heap::newPass("validate-A");
     
    318316                        acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes_old because it is an indexer and needs correct types for mangling
    319317                }
    320                 assertTopLvalue( translationUnit );
    321318                {
    322319                        Stats::Heap::newPass("validate-B");
    323320                        Stats::Time::BlockGuard guard("validate-B");
    324                         assertTopLvalue( translationUnit );
    325321                        Stats::Time::TimeBlock("Link Reference To Types", [&]() {
    326322                                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    327323                        });
    328                         clearInnerLvalue( translationUnit );
    329                         assertTopLvalue( translationUnit );
    330324                        Stats::Time::TimeBlock("Fix Qualified Types", [&]() {
    331325                                mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes_old, because aggregate members are accessed
    332326                        });
    333                         assertTopLvalue( translationUnit );
    334327                        Stats::Time::TimeBlock("Hoist Structs", [&]() {
    335328                                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    336329                        });
    337                         assertTopLvalue( translationUnit );
    338330                        Stats::Time::TimeBlock("Eliminate Typedefs", [&]() {
    339331                                EliminateTypedef::eliminateTypedef( translationUnit ); //
    340332                        });
    341333                }
    342                 assertTopLvalue( translationUnit );
    343334                {
    344335                        Stats::Heap::newPass("validate-C");
     
    349340                        InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
    350341                }
    351                 assertTopLvalue( translationUnit );
    352342                {
    353343                        Stats::Heap::newPass("validate-D");
    354344                        Stats::Time::BlockGuard guard("validate-D");
    355                         assertTopLvalue( translationUnit );
    356345                        Stats::Time::TimeBlock("Apply Concurrent Keywords", [&]() {
    357346                                Concurrency::applyKeywords( translationUnit );
    358347                        });
    359                         clearInnerLvalue( translationUnit );
    360                         assertTopLvalue( translationUnit );
    361348                        Stats::Time::TimeBlock("Forall Pointer Decay", [&]() {
    362349                                acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
    363350                        });
    364                         assertTopLvalue( translationUnit );
    365351                        Stats::Time::TimeBlock("Hoist Control Declarations", [&]() {
    366352                                ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
    367353                        });
    368                         assertTopLvalue( translationUnit );
    369354                        Stats::Time::TimeBlock("Generate Autogen routines", [&]() {
    370355                                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay_old
    371356                        });
    372                         clearInnerLvalue( translationUnit );
    373                 }
    374                 assertTopLvalue( translationUnit );
     357                }
    375358                {
    376359                        Stats::Heap::newPass("validate-E");
    377360                        Stats::Time::BlockGuard guard("validate-E");
    378                         assertTopLvalue( translationUnit );
    379361                        Stats::Time::TimeBlock("Implement Mutex Func", [&]() {
    380362                                Concurrency::implementMutexFuncs( translationUnit );
    381363                        });
    382                         clearInnerLvalue( translationUnit );
    383                         assertTopLvalue( translationUnit );
    384364                        Stats::Time::TimeBlock("Implement Thread Start", [&]() {
    385365                                Concurrency::implementThreadStarter( translationUnit );
    386366                        });
    387                         assertTopLvalue( translationUnit );
    388367                        Stats::Time::TimeBlock("Compound Literal", [&]() {
    389368                                mutateAll( translationUnit, compoundliteral );
    390369                        });
    391                         assertTopLvalue( translationUnit );
    392370                        Stats::Time::TimeBlock("Resolve With Expressions", [&]() {
    393371                                ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
    394372                        });
    395                         clearInnerLvalue( translationUnit );
    396                 }
    397                 assertTopLvalue( translationUnit );
     373                }
    398374                {
    399375                        Stats::Heap::newPass("validate-F");
    400376                        Stats::Time::BlockGuard guard("validate-F");
    401                         assertTopLvalue( translationUnit );
    402377                        Stats::Time::TimeBlock("Fix Object Type", [&]() {
    403378                                FixObjectType::fix( translationUnit );
    404379                        });
    405                         assertTopLvalue( translationUnit );
    406380                        Stats::Time::TimeBlock("Array Length", [&]() {
    407381                                ArrayLength::computeLength( translationUnit );
    408382                        });
    409                         clearInnerLvalue( translationUnit );
    410                         assertTopLvalue( translationUnit );
    411383                        Stats::Time::TimeBlock("Find Special Declarations", [&]() {
    412384                                Validate::findSpecialDecls( translationUnit );
    413385                        });
    414                         assertTopLvalue( translationUnit );
    415386                        Stats::Time::TimeBlock("Fix Label Address", [&]() {
    416387                                mutateAll( translationUnit, labelAddrFixer );
    417388                        });
    418                         assertTopLvalue( translationUnit );
    419389                        Stats::Time::TimeBlock("Handle Attributes", [&]() {
    420390                                Validate::handleAttributes( translationUnit );
    421391                        });
    422392                }
    423                 assertTopLvalue( translationUnit );
    424393        }
    425394
     
    13341303        void FixObjectType::previsit( ObjectDecl * objDecl ) {
    13351304                Type * new_type = ResolvExpr::resolveTypeof( objDecl->get_type(), indexer );
    1336                 new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
    13371305                objDecl->set_type( new_type );
    13381306        }
     
    13401308        void FixObjectType::previsit( FunctionDecl * funcDecl ) {
    13411309                Type * new_type = ResolvExpr::resolveTypeof( funcDecl->type, indexer );
    1342                 new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
    13431310                funcDecl->set_type( new_type );
    13441311        }
     
    13471314                if ( typeDecl->get_base() ) {
    13481315                        Type * new_type = ResolvExpr::resolveTypeof( typeDecl->get_base(), indexer );
    1349                         new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type
    13501316                        typeDecl->set_base( new_type );
    13511317                } // if
  • src/SynTree/AddressExpr.cc

    rc921712 rc3a2007  
    5353                        } // if
    5454                }
    55                 // result of & is never an lvalue
    56                 get_result()->set_lvalue( false );
    5755        }
    5856}
  • src/SynTree/ApplicationExpr.cc

    rc921712 rc3a2007  
    2525#include "Declaration.h"         // for Declaration
    2626#include "Expression.h"          // for ParamEntry, ApplicationExpr, Expression
     27#include "InitTweak/InitTweak.h" // for getFunction
    2728#include "ResolvExpr/typeops.h"  // for extractResultType
    2829#include "Type.h"                // for Type, PointerType, FunctionType
     
    7778
    7879bool ApplicationExpr::get_lvalue() const {
    79         return result->get_lvalue();
     80        // from src/GenPoly/Lvalue.cc: isIntrinsicReference
     81        static std::set<std::string> lvalueFunctions = { "*?", "?[?]" };
     82        if ( const DeclarationWithType * func = InitTweak::getFunction( this ) ) {
     83                return func->linkage == LinkageSpec::Intrinsic && lvalueFunctions.count(func->name);
     84        }
     85        return false;
    8086}
    8187
  • src/SynTree/ArrayType.cc

    rc921712 rc3a2007  
    2626ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes )
    2727        : Type( tq, attributes ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) {
    28         base->set_lvalue( false );
    2928}
    3029
  • src/SynTree/CommaExpr.cc

    rc921712 rc3a2007  
    2323CommaExpr::CommaExpr( Expression *arg1, Expression *arg2 )
    2424                : Expression(), arg1( arg1 ), arg2( arg2 ) {
    25         // xxx - result of a comma expression is never an lvalue, so should set lvalue
    26         // to false on all result types. Actually doing this causes some strange things
    27         // to happen in later passes (particularly, Specialize, Lvalue, and Box). This needs to be looked into.
    2825        set_result( maybeClone( arg2->get_result() ) );
    29         // get_type->set_isLvalue( false );
    3026}
    3127
     
    4036
    4137bool CommaExpr::get_lvalue() const {
    42         // xxx - as above, shouldn't be an lvalue but that information is used anyways.
    43         return result->get_lvalue();
     38        // This is wrong by C, but the current implementation uses it.
     39        // (ex: Specialize, Lvalue and Box)
     40        return arg2->get_lvalue();
    4441}
    4542
  • src/SynTree/Expression.cc

    rc921712 rc3a2007  
    1919#include <iostream>                  // for ostream, operator<<, basic_ostream
    2020#include <list>                      // for list, _List_iterator, list<>::co...
     21#include <set>                       // for set
    2122
    2223#include "Common/utility.h"          // for maybeClone, cloneAll, deleteAll
     
    6465
    6566bool Expression::get_lvalue() const {
    66         assert( !result->get_lvalue() );
    6767        return false;
    6868}
     
    115115        assert( var->get_type() );
    116116        Type * type = var->get_type()->clone();
    117         type->set_lvalue( true );
    118117
    119118        // xxx - doesn't quite work yet - get different alternatives with the same cost
     
    125124        //      long long int value;
    126125        //      if ( decl->valueOf( var, value ) ) {
    127         //              type->set_lvalue( false );
     126        //              type->set_lvalue( false ); // Would have to move to get_lvalue.
    128127        //      }
    129128        // }
     
    140139
    141140bool VariableExpr::get_lvalue() const {
    142         return result->get_lvalue();
     141        // It isn't always an lvalue, but it is never an rvalue.
     142        return true;
    143143}
    144144
     
    277277
    278278bool CastExpr::get_lvalue() const {
    279         return result->get_lvalue();
     279        // This is actually wrong by C, but it works with our current set-up.
     280        return arg->get_lvalue();
    280281}
    281282
     
    360361}
    361362
     363bool UntypedMemberExpr::get_lvalue() const {
     364        return aggregate->get_lvalue();
     365}
     366
    362367void UntypedMemberExpr::print( std::ostream & os, Indenter indent ) const {
    363368        os << "Untyped Member Expression, with field: " << std::endl << indent+1;
     
    378383        sub.apply( res );
    379384        result = res;
    380         result->set_lvalue( true );
    381385        result->get_qualifiers() |= aggregate->result->get_qualifiers();
    382386}
     
    392396
    393397bool MemberExpr::get_lvalue() const {
    394         assert( result->get_lvalue() );
     398        // This is actually wrong by C, but it works with our current set-up.
    395399        return true;
    396400}
     
    427431                        // if references are still allowed in the AST, dereference returns a reference
    428432                        ret->set_result( new ReferenceType( Type::Qualifiers(), ret->get_result() ) );
    429                 } else {
    430                         // references have been removed, in which case dereference returns an lvalue of the base type.
    431                         ret->result->set_lvalue( true );
    432433                }
    433434        }
     
    447448
    448449bool UntypedExpr::get_lvalue() const {
    449         return result->get_lvalue();
     450        // from src/GenPoly/Lvalue.cc: isIntrinsicReference
     451        static std::set<std::string> lvalueFunctions = { "*?", "?[?]" };
     452        std::string fname = InitTweak::getFunctionName( const_cast< UntypedExpr * >( this ) );
     453        return lvalueFunctions.count(fname);
    450454}
    451455
     
    510514
    511515bool ConditionalExpr::get_lvalue() const {
    512         return result->get_lvalue();
     516        return false;
    513517}
    514518
     
    570574
    571575bool ConstructorExpr::get_lvalue() const {
    572         return result->get_lvalue();
     576        return false;
    573577}
    574578
     
    582586CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : initializer( initializer ) {
    583587        assert( type && initializer );
    584         type->set_lvalue( true );
    585588        set_result( type );
    586589}
     
    593596
    594597bool CompoundLiteralExpr::get_lvalue() const {
    595         assert( result->get_lvalue() );
    596598        return true;
    597599}
     
    648650}
    649651bool StmtExpr::get_lvalue() const {
    650         return result->get_lvalue();
     652        return false;
    651653}
    652654void StmtExpr::print( std::ostream & os, Indenter indent ) const {
  • src/SynTree/Expression.h

    rc921712 rc3a2007  
    275275        virtual ~UntypedMemberExpr();
    276276
     277        bool get_lvalue() const final;
     278
    277279        Expression * get_member() const { return member; }
    278280        void set_member( Expression * newValue ) { member = newValue; }
  • src/SynTree/TupleExpr.cc

    rc921712 rc3a2007  
    5858
    5959bool TupleExpr::get_lvalue() const {
    60         return result->get_lvalue();
     60        return false;
    6161}
    6262
     
    7171        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
    7272        set_result( (*std::next( type->get_types().begin(), index ))->clone() );
    73         // like MemberExpr, TupleIndexExpr is always an lvalue
    74         get_result()->set_lvalue( true );
    7573}
    7674
     
    8381
    8482bool TupleIndexExpr::get_lvalue() const {
    85         assert( result->get_lvalue() );
    86         return true;
     83        return tuple->get_lvalue();
    8784}
    8885
  • src/SynTree/Type.cc

    rc921712 rc3a2007  
    8585const char * Type::FuncSpecifiersNames[] = { "inline", "_Noreturn", "fortran" };
    8686const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "_Thread_local" };
    87 const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" };
     87const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "mutex", "_Atomic" };
    8888
    8989Type * Type::stripDeclarator() {
  • src/SynTree/Type.h

    rc921712 rc3a2007  
    102102        }; // StorageClasses
    103103
    104         enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Lvalue = 1 << 3, Mutex = 1 << 4, Atomic = 1 << 5, NumTypeQualifier = 6 };
     104        enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Mutex = 1 << 3, Atomic = 1 << 4, NumTypeQualifier = 5 };
    105105        static const char * QualifiersNames[];
    106106        union Qualifiers {
    107                 enum { Mask = ~(Restrict | Lvalue) };
     107                enum { Mask = ~Restrict };
    108108                unsigned int val;
    109109                struct {
     
    111111                        bool is_restrict : 1;
    112112                        bool is_volatile : 1;
    113                         bool is_lvalue : 1;
    114113                        bool is_mutex : 1;
    115114                        bool is_atomic : 1;
     
    153152        bool get_volatile() const { return tq.is_volatile; }
    154153        bool get_restrict() const { return tq.is_restrict; }
    155         bool get_lvalue() const { return tq.is_lvalue; }
    156154        bool get_mutex() const { return tq.is_mutex; }
    157155        bool get_atomic() const { return tq.is_atomic; }
     
    159157        void set_volatile( bool newValue ) { tq.is_volatile = newValue; }
    160158        void set_restrict( bool newValue ) { tq.is_restrict = newValue; }
    161         void set_lvalue( bool newValue ) { tq.is_lvalue = newValue; }
    162159        void set_mutex( bool newValue ) { tq.is_mutex = newValue; }
    163160        void set_atomic( bool newValue ) { tq.is_atomic = newValue; }
  • src/SynTree/module.mk

    rc921712 rc3a2007  
    4949      SynTree/TypeSubstitution.cc \
    5050      SynTree/Attribute.cc \
    51       SynTree/DeclReplacer.cc \
    52       SynTree/TopLvalue.cc
     51      SynTree/DeclReplacer.cc
    5352
    5453SRC += $(SRC_SYNTREE)
  • src/Tuples/TupleExpansion.cc

    rc921712 rc3a2007  
    304304                // produce the TupleType which aggregates the types of the exprs
    305305                std::list< Type * > types;
    306                 Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Lvalue | Type::Atomic | Type::Mutex );
     306                Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic | Type::Mutex );
    307307                for ( Expression * expr : exprs ) {
    308308                        assert( expr->get_result() );
  • src/main.cc

    rc921712 rc3a2007  
    5959#include "ResolvExpr/Resolver.h"            // for resolve
    6060#include "SymTab/Validate.h"                // for validate
    61 #include "SynTree/TopLvalue.h"              // for assertTopLvalue, clearInn...
    6261#include "SynTree/Declaration.h"            // for Declaration
    6362#include "SynTree/Visitor.h"                // for acceptAll
     
    259258                Stats::Time::StopBlock();
    260259
    261                 //std::cerr << "Post-Parse Check" << std::endl;
    262                 clearInnerLvalue( translationUnit );
    263                 assertTopLvalue( translationUnit );
    264 
    265260                // add the assignment statement after the initialization of a type parameter
    266261                PASS( "Validate", SymTab::validate( translationUnit, symtabp ) );
     
    281276                } // if
    282277
    283                 assertTopLvalue( translationUnit );
    284278                PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) );
    285                 assertTopLvalue( translationUnit );
    286279                PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
    287                 assertTopLvalue( translationUnit );
    288280                PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
    289                 assertTopLvalue( translationUnit );
    290281                PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
    291                 assertTopLvalue( translationUnit );
    292282                if ( libcfap ) {
    293283                        // generate the bodies of cfa library functions
     
    313303                } // if
    314304
    315                 assertTopLvalue( translationUnit );
    316 
    317305                PASS( "Resolve", ResolvExpr::resolve( translationUnit ) );
    318306                if ( exprp ) {
     
    321309                } // if
    322310
    323                 clearInnerLvalue( translationUnit );
    324                 assertTopLvalue( translationUnit );
    325 
    326311                // fix ObjectDecl - replaces ConstructorInit nodes
    327312                PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) );
    328                 clearInnerLvalue( translationUnit );
    329                 assertTopLvalue( translationUnit );
    330313                if ( ctorinitp ) {
    331314                        dump ( translationUnit );
     
    334317
    335318                PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
    336                 assertTopLvalue( translationUnit );
    337319
    338320                PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) );
    339                 assertTopLvalue( translationUnit );
    340321
    341322                PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) );
    342                 clearInnerLvalue( translationUnit );
    343                 assertTopLvalue( translationUnit );
    344323
    345324                PASS( "Convert Specializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
    346                 clearInnerLvalue( translationUnit );
    347                 assertTopLvalue( translationUnit );
    348325
    349326                PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
    350                 assertTopLvalue( translationUnit );
    351327
    352328                if ( tuplep ) {
     
    356332
    357333                PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
    358                 assertTopLvalue( translationUnit );
    359334
    360335                PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) );
     
    363338                        return EXIT_SUCCESS;
    364339                } // if
    365                 clearInnerLvalue( translationUnit );
    366                 assertTopLvalue( translationUnit );
     340
    367341                PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) );
    368                 clearInnerLvalue( translationUnit );
    369                 assertTopLvalue( translationUnit );
    370342
    371343                if ( bboxp ) {
     
    374346                } // if
    375347                PASS( "Box", GenPoly::box( translationUnit ) );
    376                 clearInnerLvalue( translationUnit );
    377                 assertTopLvalue( translationUnit );
    378348
    379349                if ( bcodegenp ) {
     
    387357
    388358                CodeTools::fillLocations( translationUnit );
    389                 assertTopLvalue( translationUnit );
    390359                PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) );
    391360
  • tests/.expect/alloc-ERROR.txt

    rc921712 rc3a2007  
    1 alloc.cfa:265:1 error: No reasonable alternatives for expression Applying untyped:
     1alloc.cfa:311:1 error: No reasonable alternatives for expression Applying untyped:
    22  Name: ?=?
    33...to:
     
    1919
    2020
    21 alloc.cfa:266:1 error: No reasonable alternatives for expression Applying untyped:
     21alloc.cfa:312:1 error: No reasonable alternatives for expression Applying untyped:
    2222  Name: ?=?
    2323...to:
     
    3939
    4040
    41 alloc.cfa:267:1 error: No reasonable alternatives for expression Applying untyped:
     41alloc.cfa:313:1 error: No reasonable alternatives for expression Applying untyped:
    4242  Name: ?=?
    4343...to:
     
    5050
    5151
    52 alloc.cfa:268:1 error: No reasonable alternatives for expression Applying untyped:
     52alloc.cfa:314:1 error: No reasonable alternatives for expression Applying untyped:
    5353  Name: ?=?
    5454...to:
  • tests/.expect/alloc.txt

    rc921712 rc3a2007  
    22CFA malloc 0xdeadbeef
    33CFA alloc 0xdeadbeef
    4 CFA alloc, fill ffffffff
     4CFA array alloc, fill 0xde
     5CFA alloc, fill dededede
     6CFA alloc, fill 3
    57
    68C   array calloc, fill 0
     
    1012CFA array alloc, no fill
    11130xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
    12 CFA array alloc, fill 0xff
    13 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
     14CFA array alloc, fill 0xde
     150xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede
     16CFA array alloc, fill 0xef
     170xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef
     18CFA array alloc, fill from array
     190xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef, 0xefefefef 0xefefefef,
    1420
    15 C   realloc
    16 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
     21C realloc
     220xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef
    1723CFA realloc
    18 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101
     240xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101
    1925
    20 CFA resize alloc
     26CFA resize array alloc
    21270xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
    2228CFA resize array alloc
     
    25310xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
    2632CFA resize array alloc, fill
    27 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
     330xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede
    2834CFA resize array alloc, fill
    29 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
     350xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
    3036CFA resize array alloc, fill
    31 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff
     370xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede
    3238
    3339C   memalign 42 42.5
     
    3541CFA posix_memalign 42 42.5
    3642CFA posix_memalign 42 42.5
    37 CFA aligned_alloc 42 42.5
    38 CFA align_alloc 42 42.5
    39 CFA align_alloc fill 0xffffffff -nan
     43CFA alloc_align 42 42.5
     44CFA alloc_align 42 42.5
     45CFA alloc_align fill 0xdededede -0x1.ededededededep+494
     46CFA alloc_align fill 42 42.5
     47CFA alloc_align 42 42.5
    4048
    41 CFA array align_alloc
     49CFA array alloc_align
    425042 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5,
    43 CFA array align_alloc, fill
    44 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan,
     51CFA array alloc_align, fill
     520xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494,
     53CFA array alloc_align, fill
     5442 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5,
     55CFA array alloc_align, fill array
     5642 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5,
     57CFA realloc array alloc_align
     5842 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5, 42 42.5,
    4559
    46 CFA memset 0xffffffff -nan
    47 CFA memcpy 0xffffffff -nan
     60CFA memset 0xdededede -0x1.ededededededep+494
     61CFA memcpy 0xdededede -0x1.ededededededep+494
    4862
    4963CFA array memset
    50 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan,
     640xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494,
    5165CFA array memcpy
    52 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan, 0xffffffff -nan,
     660xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494, 0xdededede -0x1.ededededededep+494,
    5367
    5468CFA new initialize
  • tests/.expect/attributes.x64.txt

    rc921712 rc3a2007  
    784784signed int _X4apd7Fi_Fi_i_Fi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object23)(__attribute__ ((unused)) signed int __anonymous_object24), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object25)(__attribute__ ((unused)) signed int __anonymous_object26));
    785785struct Vad {
    786     __attribute__ ((unused)) signed int __anonymous_object27:4;
    787     __attribute__ ((unused)) signed int __anonymous_object28:4;
    788     __attribute__ ((unused,unused)) signed int __anonymous_object29:6;
     786    __attribute__ ((unused)) signed int :4;
     787    __attribute__ ((unused)) signed int :4;
     788    __attribute__ ((unused,unused)) signed int :6;
    789789};
    790790static inline void _X12_constructorFv_S3Vad_autogen___1(struct Vad *_X4_dstS3Vad_1);
  • tests/.expect/attributes.x86.txt

    rc921712 rc3a2007  
    784784signed int _X4apd7Fi_Fi_i_Fi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object23)(__attribute__ ((unused)) signed int __anonymous_object24), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object25)(__attribute__ ((unused)) signed int __anonymous_object26));
    785785struct Vad {
    786     __attribute__ ((unused)) signed int __anonymous_object27:4;
    787     __attribute__ ((unused)) signed int __anonymous_object28:4;
    788     __attribute__ ((unused,unused)) signed int __anonymous_object29:6;
     786    __attribute__ ((unused)) signed int :4;
     787    __attribute__ ((unused)) signed int :4;
     788    __attribute__ ((unused,unused)) signed int :6;
    789789};
    790790static inline void _X12_constructorFv_S3Vad_autogen___1(struct Vad *_X4_dstS3Vad_1);
  • tests/Makefile.am

    rc921712 rc3a2007  
    2424archiveerrors=
    2525
    26 INSTALL_FLAGS=-in-tree
    2726DEBUG_FLAGS=-debug -O0
    2827
     
    4342        -DIN_DIR="${abs_srcdir}/.in/"
    4443
     44# get the desired cfa to test
     45TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
     46
    4547# adjust CC to current flags
    46 CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
     48CC = $(if $(ifeq $(DISTCC_CFA_PATH),yes),distcc $(DISTCC_CFA_PATH),$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
    4749CFACC = $(CC)
    4850
     
    5153
    5254# adjusted CC but without the actual distcc call
    53 CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
     55CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH),$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
    5456
    5557PRETTY_PATH=mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
  • tests/Makefile.in

    rc921712 rc3a2007  
    214214
    215215# adjust CC to current flags
    216 CC = $(if $(DISTCC_CFA_PATH),distcc $(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
     216CC = $(if $(ifeq $(DISTCC_CFA_PATH),yes),distcc $(DISTCC_CFA_PATH),$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
    217217CCAS = @CCAS@
    218218CCASDEPMODE = @CCASDEPMODE@
     
    220220CCDEPMODE = @CCDEPMODE@
    221221CFACC = $(CC)
     222CFACC_INSTALL = @CFACC_INSTALL@
    222223CFACPP = @CFACPP@
    223224CFA_BACKEND_CC = @CFA_BACKEND_CC@
     
    381382installed = no
    382383archiveerrors =
    383 INSTALL_FLAGS = -in-tree
    384384DEBUG_FLAGS = -debug -O0
    385385quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes
     
    398398
    399399
     400# get the desired cfa to test
     401TARGET_CFA = $(if $(filter $(installed),yes), @CFACC_INSTALL@, @CFACC@)
     402
    400403# get local binary for depedencies
    401404CFACCBIN = @CFACC@
    402405
    403406# adjusted CC but without the actual distcc call
    404 CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH) -dist-tree -in-tree,@CFACC@ ${DEBUG_FLAGS} ${INSTALL_FLAGS} ${ARCH_FLAGS})
     407CFACCLOCAL = $(if $(DISTCC_CFA_PATH),$(DISTCC_CFA_PATH),$(TARGET_CFA) ${DEBUG_FLAGS} ${ARCH_FLAGS})
    405408PRETTY_PATH = mkdir -p $(dir $(abspath ${@})) && cd ${srcdir} &&
    406409avl_test_SOURCES = avltree/avl_test.cfa avltree/avl0.cfa avltree/avl1.cfa avltree/avl2.cfa avltree/avl3.cfa avltree/avl4.cfa avltree/avl-private.cfa
  • tests/alloc.cfa

    rc921712 rc3a2007  
    1010// Created On       : Wed Feb  3 07:56:22 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:50:52 2018
    13 // Update Count     : 339
     12// Last Modified On : Sun Oct 20 21:45:21 2019
     13// Update Count     : 391
    1414//
    1515
     
    1919#include <stdlib.h>                                                                             // posix_memalign
    2020#include <fstream.hfa>
    21 #include <stdlib.hfa>                                                                           // access C malloc, realloc
     21#include <stdlib.hfa>                                                                   // access C malloc, realloc
    2222
    2323int * foo( int * p, int c ) { return p; }
     
    2727int main( void ) {
    2828        size_t dim = 10;
    29         char fill = '\xff';
    30         int * p;
     29        char fill = '\xde';
     30        int * p, * p1;
    3131
    3232        // allocation, non-array types
    33 
    34         // int & r = malloc();
    35         // r = 0xdeadbeef;
    36         // printf( "C   malloc %#x\n", r );
    37         // free( &r );
    3833
    3934        p = (int *)malloc( sizeof(*p) );                                        // C malloc, type unsafe
     
    5247        free( p );
    5348
    54         p = alloc( fill );                                  // CFA alloc, fill
     49        p = alloc_set( fill );                                                          // CFA alloc, fill
     50        printf( "CFA array alloc, fill %#hhx\n", fill );
    5551        printf( "CFA alloc, fill %08x\n", *p );
     52        free( p );
     53
     54        p = alloc_set( 3 );                                                                     // CFA alloc, fill
     55        printf( "CFA alloc, fill %d\n", *p );
    5656        free( p );
    5757
     
    7979        free( p );
    8080
    81         p = alloc( 2 * dim, fill );                         // CFA array alloc, fill
     81        p = alloc_set( 2 * dim, fill );                                         // CFA array alloc, fill
    8282        printf( "CFA array alloc, fill %#hhx\n", fill );
    8383        for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
    8484        printf( "\n" );
    85         // do not free
     85        free( p );
     86
     87        p = alloc_set( 2 * dim, 0xdeadbeef );                           // CFA array alloc, fill
     88        printf( "CFA array alloc, fill %#hhx\n", 0xdeadbeef );
     89        for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
     90        printf( "\n" );
     91        // do not free
     92
     93        p1 = alloc_set( 2 * dim, p );                                           // CFA array alloc, fill
     94        printf( "CFA array alloc, fill from array\n" );
     95        for ( i; 2 * dim ) { printf( "%#x %#x, ", p[i], p1[i] ); }
     96        free( p1 );
     97        printf( "\n" );
    8698
    8799
     
    90102
    91103        p = (int *)realloc( p, dim * sizeof(*p) );                      // C realloc
    92         for ( i; dim ) { p[i] = 0xdeadbeef; }
    93         printf( "C   realloc\n" );
    94         for ( i; dim ) { printf( "%#x ", p[i] ); }
    95         printf( "\n" );
     104        printf( "C realloc\n" );
     105        for ( i; dim ) { printf( "%#x ", p[i] ); }
     106        printf( "\n" );
     107        // do not free
    96108
    97109        p = realloc( p, 2 * dim * sizeof(*p) );             // CFA realloc
     
    108120        p = alloc( p, dim );                                // CFA resize array alloc
    109121        for ( i; dim ) { p[i] = 0xdeadbeef; }
    110         printf( "CFA resize alloc\n" );
    111         for ( i; dim ) { printf( "%#x ", p[i] ); }
    112         printf( "\n" );
     122        printf( "CFA resize array alloc\n" );
     123        for ( i; dim ) { printf( "%#x ", p[i] ); }
     124        printf( "\n" );
     125        // do not free
    113126
    114127        p = alloc( p, 2 * dim );                            // CFA resize array alloc
     
    117130        for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
    118131        printf( "\n" );
    119 
    120         p = alloc( p, dim );                                // CFA array alloc
     132        // do not free
     133
     134        p = alloc( p, dim );                                // CFA resize array alloc
    121135        printf( "CFA resize array alloc\n" );
    122136        for ( i; dim ) { printf( "%#x ", p[i] ); }
    123137        printf( "\n" );
    124 
    125         free( p );
    126         p = 0;
    127 
    128         p = alloc( p, dim, fill );                          // CFA array alloc, fill
     138        // do not free
     139
     140        p = alloc_set( p, 3 * dim, fill );                                      // CFA resize array alloc, fill
    129141        printf( "CFA resize array alloc, fill\n" );
    130         for ( i; dim ) { printf( "%#x ", p[i] ); }
    131         printf( "\n" );
    132 
    133         p = alloc( p, 2 * dim, fill );                      // CFA array alloc, fill
     142        for ( i; 3 * dim ) { printf( "%#x ", p[i] ); }
     143        printf( "\n" );
     144        // do not free
     145
     146        p = alloc_set( p, dim, fill );                                          // CFA resize array alloc, fill
    134147        printf( "CFA resize array alloc, fill\n" );
    135         for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
    136         printf( "\n" );
    137 
    138         p = alloc( p, dim, fill );                          // CFA array alloc, fill
     148        for ( i; dim ) { printf( "%#x ", p[i] ); }
     149        printf( "\n" );
     150        // do not free
     151
     152        p = alloc_set( p, 3 * dim, fill );                                      // CFA resize array alloc, fill
    139153        printf( "CFA resize array alloc, fill\n" );
    140         for ( i; dim ) { printf( "%#x ", p[i] );; }
     154        for ( i; 3 * dim ) { printf( "%#x ", p[i] );; }
    141155        printf( "\n" );
    142156        free( p );
     
    172186        free( stp );
    173187
    174         stp = &(*aligned_alloc( Alignment )){ 42, 42.5 };     // CFA aligned_alloc
    175         assert( (uintptr_t)stp % Alignment == 0 );
    176         printf( "CFA aligned_alloc %d %g\n", stp->x, stp->y );
    177         free( stp );
    178 
    179         stp = &(*align_alloc( Alignment )){ 42, 42.5 };       // CFA align_alloc
    180         assert( (uintptr_t)stp % Alignment == 0 );
    181         printf( "CFA align_alloc %d %g\n", stp->x, stp->y );
    182         free( stp );
    183 
    184         stp = align_alloc( Alignment, fill );               // CFA memalign, fill
    185         assert( (uintptr_t)stp % Alignment == 0 );
    186         printf( "CFA align_alloc fill %#x %a\n", stp->x, stp->y );
     188        stp = &(*alloc_align( Alignment)){ 42, 42.5 };          // CFA alloc_align
     189        assert( (uintptr_t)stp % Alignment == 0 );
     190        printf( "CFA alloc_align %d %g\n", stp->x, stp->y );
     191        free( stp );
     192
     193        stp = &(*alloc_align( Alignment )){ 42, 42.5 };         // CFA alloc_align
     194        assert( (uintptr_t)stp % Alignment == 0 );
     195        printf( "CFA alloc_align %d %g\n", stp->x, stp->y );
     196        free( stp );
     197
     198        stp = alloc_align_set( Alignment, fill );                       // CFA memalign, fill
     199        assert( (uintptr_t)stp % Alignment == 0 );
     200        printf( "CFA alloc_align fill %#x %a\n", stp->x, stp->y );
     201        free( stp );
     202
     203        stp = alloc_align_set( Alignment, (Struct){ 42, 42.5 } ); // CFA memalign, fill
     204        assert( (uintptr_t)stp % Alignment == 0 );
     205        printf( "CFA alloc_align fill %d %g\n", stp->x, stp->y );
     206        // do not free
     207
     208        stp = &(*alloc_align( stp, 4096 )){ 42, 42.5 };         // CFA realign
     209        assert( (uintptr_t)stp % 4096 == 0 );
     210        printf( "CFA alloc_align %d %g\n", stp->x, stp->y );
    187211        free( stp );
    188212
     
    191215        printf( "\n" );
    192216
    193         stp = align_alloc( Alignment, dim );                // CFA array memalign
     217        stp = alloc_align( Alignment, dim );                // CFA array memalign
    194218        assert( (uintptr_t)stp % Alignment == 0 );
    195219        for ( i; dim ) { stp[i] = (Struct){ 42, 42.5 }; }
    196         printf( "CFA array align_alloc\n" );
     220        printf( "CFA array alloc_align\n" );
    197221        for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); }
    198222        printf( "\n" );
    199223        free( stp );
    200224
    201         stp = align_alloc( Alignment, dim, fill );          // CFA array memalign, fill
    202         assert( (uintptr_t)stp % Alignment == 0 );
    203         printf( "CFA array align_alloc, fill\n" );
     225        stp = alloc_align_set( Alignment, dim, fill );          // CFA array memalign, fill
     226        assert( (uintptr_t)stp % Alignment == 0 );
     227        printf( "CFA array alloc_align, fill\n" );
    204228        for ( i; dim ) { printf( "%#x %a, ", stp[i].x, stp[i].y ); }
     229        printf( "\n" );
     230        free( stp );
     231
     232        stp = alloc_align_set( Alignment, dim, (Struct){ 42, 42.5 } ); // CFA array memalign, fill
     233        assert( (uintptr_t)stp % Alignment == 0 );
     234        printf( "CFA array alloc_align, fill\n" );
     235        for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); }
     236        printf( "\n" );
     237        // do not free
     238
     239        stp1 = alloc_align_set( Alignment, dim, stp );          // CFA array memalign, fill
     240        assert( (uintptr_t)stp % Alignment == 0 );
     241        printf( "CFA array alloc_align, fill array\n" );
     242        for ( i; dim ) { printf( "%d %g, ", stp1[i].x, stp1[i].y ); }
     243        printf( "\n" );
     244        free( stp1 );
     245
     246        stp = alloc_align( stp, 4096, dim );                            // CFA aligned realloc array
     247        assert( (uintptr_t)stp % 4096 == 0 );
     248        for ( i; dim ) { stp[i] = (Struct){ 42, 42.5 }; }
     249        printf( "CFA realloc array alloc_align\n" );
     250        for ( i; dim ) { printf( "%d %g, ", stp[i].x, stp[i].y ); }
    205251        printf( "\n" );
    206252        free( stp );
  • tests/concurrent/examples/quickSort.cfa

    rc921712 rc3a2007  
    1111// Created On       : Wed Dec  6 12:15:52 2017
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Fri Jun 21 08:27:45 2019
    14 // Update Count     : 172
     13// Last Modified On : Thu Oct 10 13:58:18 2019
     14// Update Count     : 176
    1515//
    1616
     
    6666                        if ( depth > 0 ) {
    6767                                depth -= 1;
    68                                 Quicksort rqs = { values, low, right, depth }; // concurrently sort upper half
    69                                 //Quicksort lqs( values, left, high, depth ); // concurrently sort lower half
    70                                 sort( values, left, high, depth );              // concurrently sort lower half
     68                                Quicksort lqs = { values, low, right, depth }; // concurrently sort lower half
     69                                Quicksort rqs = { values, left, high, depth }; // concurrently sort upper half
     70                                // Quicksort lqs = { values, low, right, depth }; // concurrently sort lower half
     71                                // sort( values, left, high, depth );           // concurrently sort upper half
    7172                        } else {
    7273                                sort( values, low, right, 0 );                  // sequentially sort lower half
     
    162163                processor processors[ (1 << depth) - 1 ] __attribute__(( unused )); // create 2^depth-1 kernel threads
    163164
    164                 int * values = alloc( size );                           // values to be sorted, too large to put on stack
    165                 for ( counter; size ) {                                         // generate unsorted numbers
     165                int * values = alloc( size );                                   // values to be sorted, too large to put on stack
     166                for ( counter; size ) {                                                 // generate unsorted numbers
    166167                        values[counter] = size - counter;                       // descending values
     168                } // for
     169                for ( int i = 0; i < 200; i +=1 ) {                             // random shuffle a few values
     170                        swap( values[rand() % size], values[rand() % size] );
    167171                } // for
    168172                {
     
    178182} // main
    179183
     184// for depth in 0 1 2 3 4 5 ; do echo "sort 500000000 values with ${depth} depth" ; time -f "%Uu %Ss %E %Mkb" a.out -t 500000000 ${depth} ; done
     185
    180186// Local Variables: //
    181187// tab-width: 4 //
  • tests/labelledExit.cfa

    rc921712 rc3a2007  
    1010// Created On       : Wed Aug 10 07:29:39 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:57:42 2018
    13 // Update Count     : 4
     12// Last Modified On : Fri Oct 25 17:41:51 2019
     13// Update Count     : 7
    1414//
    1515
     
    136136        }
    137137
     138        // all nested control options, labelled exits
     139
     140  Comp: {
     141          Try: try {
     142                  For: for ( ;; ) {
     143                          While: while ( true ) {
     144                                  Do: do {
     145                                          If: if ( true ) {
     146                                                  Switch2: switch ( 3 ) {
     147                                                          case 3:
     148                                                                break Try;
     149                                                                break Comp;
     150                                                                break For;              continue For;
     151                                                                break While;    continue While;
     152                                                                break Do;               continue Do;
     153                                                                break If;
     154                                                                break Switch2;
     155                                                        } // switch
     156                                                } // if
     157                                        } while ( true );
     158                                } // while
     159                        } // for
     160                } finally {} // always executed
     161        } // compound
     162
    138163        // computed goto
    139164        // {
  • tests/pybin/settings.py

    rc921712 rc3a2007  
    9696                        distribute = False
    9797
    98                 self.string = "installed" if value else "in-tree"
    99                 self.flags  = """INSTALL_FLAGS=%s""" % ("" if value else "-in-tree")
     98                self.string = "installed" if value else "in tree"
     99                self.flags  = """installed=%s""" % ("yes" if value else "no")
    100100
    101101class Timeouts:
  • tests/pybin/tools.py

    rc921712 rc3a2007  
    343343        # make a directory for this test
    344344        # mkdir makes the parent directory only so add a dummy
    345         mkdir(os.path.join(dst, "dir"))
     345        mkdir(os.path.join(dst, name ))
    346346
    347347        # moves the files
  • tools/Makefile.in

    rc921712 rc3a2007  
    208208CCDEPMODE = @CCDEPMODE@
    209209CFACC = @CFACC@
     210CFACC_INSTALL = @CFACC_INSTALL@
    210211CFACPP = @CFACPP@
    211212CFA_BACKEND_CC = @CFA_BACKEND_CC@
  • tools/prettyprinter/Makefile.in

    rc921712 rc3a2007  
    237237CCDEPMODE = @CCDEPMODE@
    238238CFACC = @CFACC@
     239CFACC_INSTALL = @CFACC_INSTALL@
    239240CFACPP = @CFACPP@
    240241CFA_BACKEND_CC = @CFA_BACKEND_CC@
Note: See TracChangeset for help on using the changeset viewer.