Changeset 48f6252


Ignore:
Timestamp:
Dec 8, 2020, 6:40:21 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
364a03c
Parents:
0f7a0ea (diff), d7a10af (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:
13 edited

Legend:

Unmodified
Added
Removed
  • Jenkins/Distribute

    r0f7a0ea r48f6252  
    1515        SrcDir    = pwd tmp: false
    1616        Settings  = null
     17        Version   = ''
    1718
    1819        // Local variables
     
    2223        currentBuild.result = "SUCCESS"
    2324
    24         try {
    25                 //Wrap build to add timestamp to command line
    26                 wrap([$class: 'TimestamperBuildWrapper']) {
     25        //Wrap build to add timestamp to command line
     26        wrap([$class: 'TimestamperBuildWrapper']) {
    2727
    28                         final commit, build
    29                         (commit, build) = prepare_build()
     28                final commit, build
     29                (commit, build) = prepare_build()
    3030
    31                         node('x64') {
    32                                 BuildDir  = pwd tmp: true
    33                                 SrcDir    = pwd tmp: false
    34 
    35                                 Tools.Clean()
    36 
    37                                 Tools.Checkout( commit )
    38 
    39                                 final version = GetVersion( build )
    40                         }
    41 
    42                         // Update the build directories when exiting the node
     31                node('x64') {
    4332                        BuildDir  = pwd tmp: true
    4433                        SrcDir    = pwd tmp: false
     34
     35                        Tools.Clean()
     36
     37                        Tools.Checkout( commit )
     38
     39                        Version = GetVersion( build )
     40
     41                        Configure()
     42
     43                        Package()
     44
     45                        Test()
     46
     47                        Archive()
    4548                }
     49
     50                // Update the build directories when exiting the node
     51                BuildDir  = pwd tmp: true
     52                SrcDir    = pwd tmp: false
    4653        }
    4754
    48         //If an exception is caught we need to change the status and remember to
    49         //attach the build log to the email
    50         // catch (Exception caughtError) {
    51                 // //rethrow error later
    52                 // err = caughtError
    53 
    54                 // echo err.toString()
    55 
    56                 // //An error has occured, the build log is relevent
    57                 // log_needed = true
    58 
    59                 // //Store the result of the build log
    60                 // currentBuild.result = "${StageName} FAILURE".trim()
    61         // }
    62 
    63         finally {
    64                 // //Send email with final results if this is not a full build
    65                 // email(log_needed)
    66 
    67                 // echo 'Distribution Completed'
    68 
    69                 // /* Must re-throw exception to propagate error */
    70                 // if (err) {
    71                 //      throw err
    72                 // }
    73         }
    7455}
    7556
     
    9071
    9172        return version
     73}
     74
     75def Configure() {
     76        Tools.BuildStage('Configure', true) {
     77                // Configure must be run inside the tree
     78                dir (SrcDir) {
     79                        // Generate the necessary build files
     80                        sh './autogen.sh'
     81                }
     82
     83                // Build outside of the src tree to ease cleaning
     84                dir (BuildDir) {
     85                        // Configure the compilation (Output is not relevant)
     86                        // Use the current directory as the installation target so nothing escapes the sandbox
     87                        // Also specify the compiler by hand
     88                        sh "${SrcDir}/configure CXX=g++-9 CC=gcc-9 AR=gcc-ar RANLIB=gcc-ranlib --quiet"
     89
     90                        // Configure libcfa
     91                        sh 'make -j 8 --no-print-directory configure-libcfa'
     92                }
     93        }
     94}
     95
     96def Package() {
     97        Tools.BuildStage('Package', true) {
     98                dir (BuildDir) {
     99                        sh "make VERSION=${Version} dist"
     100                }
     101        }
     102}
     103
     104def Test() {
     105        Tools.BuildStage('Test', true) {
     106                dir (BuildDir) {
     107                        sh "make VERSION=${Version} distcheck -j 8"
     108                }
     109        }
     110}
     111
     112def Archive() {
     113        Tools.BuildStage('Archive', true) {
     114                dir (BuildDir) {
     115                        archiveArtifacts artifacts: "cfa-cc-*.tar.gz", fingerprint: true
     116                }
     117        }
    92118}
    93119
  • Jenkins/FullBuild

    r0f7a0ea r48f6252  
    2626                                        gcc_5_x64_old: { trigger_build( 'gcc-5',   'x64', false ) },
    2727                                        clang_x64_old: { trigger_build( 'clang',   'x64', false ) },
    28                                         // clang_x64_new: { trigger_build( 'clang',   'x64', true  ) },
     28                                        clang_x64_new: { trigger_build( 'clang',   'x64', true  ) },
    2929                                )
     30                        }
     31
     32                        stage('Package') {
     33                                build job: 'Cforall_Distribute_Ref', parameters: [string(name: 'GitRef', value: gitRefNewValue), string(name: 'Build', value: currentBuild.number)]
    3034                        }
    3135                }
  • Jenkinsfile

    r0f7a0ea r48f6252  
    9393                // Build outside of the src tree to ease cleaning
    9494                dir (BuildDir) {
    95                         //Configure the conpilation (Output is not relevant)
     95                        //Configure the compilation (Output is not relevant)
    9696                        //Use the current directory as the installation target so nothing escapes the sandbox
    9797                        //Also specify the compiler by hand
  • Makefile.am

    r0f7a0ea r48f6252  
    2121
    2222SUBDIRS = driver src . @LIBCFA_TARGET_DIRS@
    23 DIST_SUBDIRS = driver src . libcfa benchmark longrun_tests tests tools tools/prettyprinter
     23DIST_SUBDIRS = driver src . libcfa tests tools tools/prettyprinter
    2424
    2525@LIBCFA_TARGET_MAKEFILES@ : Makefile $(srcdir)/libcfa/configure
  • configure.ac

    r0f7a0ea r48f6252  
    33
    44AC_PREREQ([2.68])
    5 AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
     5AC_INIT([cfa-cc],[1.0.0],[cforall@plg.uwaterloo.ca])
    66AC_CONFIG_AUX_DIR([automake])
    77AC_CONFIG_MACRO_DIRS([automake])
     
    2828# New AST toggling support
    2929AH_TEMPLATE([CFA_USE_NEW_AST],[Sets whether or not to use the new-ast, this is adefault value and can be overrided by --old-ast and --new-ast])
    30 DEFAULT_NEW_AST="False"
     30DEFAULT_NEW_AST="True"
    3131AC_ARG_ENABLE(new-ast,
    3232        [  --enable-new-ast     whether or not to use new ast as the default AST algorithm],
     
    3535                no)  newast=false; DEFAULT_NEW_AST="False" ;;
    3636                *) AC_MSG_ERROR([bad value ${enableval} for --enable-new-ast]) ;;
    37         esac],[newast=false])
     37        esac],[newast=true])
    3838AC_DEFINE_UNQUOTED([CFA_USE_NEW_AST], $newast)
    3939AC_SUBST(DEFAULT_NEW_AST)
     
    103103# Create variables for commonly used targets
    104104
    105 TOP_SRCDIR="$(readlink -m $ac_confdir/)/"
    106 TOP_BUILDDIR="$(readlink -m $ac_pwd/)/"
     105TOP_SRCDIR="$(readlink -e $ac_abs_confdir/)/"
     106TOP_BUILDDIR="$(readlink -e $ac_pwd/)/"
    107107
    108108AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory])
     
    139139                \'--enable-gprofiler=*) ;;
    140140                \'--disable-gprofiler) ;;
     141
     142                # skip the target hosts
     143                \'--enable-new-ast=*) ;;
     144                \'--disable-new-ast) ;;
    141145
    142146                # skip this, it only causes problems
     
    287291        libcfa/Makefile:libcfa/Makefile.dist.in
    288292        tests/Makefile
    289         longrun_tests/Makefile
    290         benchmark/Makefile
    291         benchmark/io/http/Makefile
    292293        tools/Makefile
    293294        tools/prettyprinter/Makefile
    294295        ])
    295296
     297# Some of our makefile don't need to be distributed
     298AM_CONDITIONAL([CFORALL_DISTRIBUTE], [test -e $TOP_SRCDIR/autogen.sh])
     299AM_COND_IF([CFORALL_DISTRIBUTE],
     300        [AC_CONFIG_FILES([
     301                longrun_tests/Makefile
     302                benchmark/Makefile
     303                benchmark/io/http/Makefile
     304                ])])
     305
    296306AC_CONFIG_LINKS([tests/test.py:tests/test.py])
    297307
  • libcfa/configure.ac

    r0f7a0ea r48f6252  
    33
    44AC_PREREQ([2.68])
    5 AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
     5AC_INIT([cfa-cc],[1.0.0],[cforall@plg.uwaterloo.ca])
    66AC_CONFIG_AUX_DIR([automake])
    77AC_CONFIG_MACRO_DIRS([automake])
  • libcfa/src/Makefile.am

    r0f7a0ea r48f6252  
    4343        clock.hfa \
    4444        exception.hfa \
     45        exception.h \
    4546        gmp.hfa \
    4647        math.hfa \
     
    7778        bits/debug.cfa \
    7879        exception.c \
    79         exception.h \
    8080        interpose.cfa \
    8181        lsda.h \
     
    8787# not all platforms support concurrency, add option do disable it
    8888inst_thread_headers_nosrc = \
     89        bits/collection.hfa \
    8990        bits/random.hfa \
     91        bits/sequence.hfa \
    9092        concurrency/clib/cfathread.h \
    9193        concurrency/invoke.h \
  • libcfa/src/concurrency/preemption.cfa

    r0f7a0ea r48f6252  
    405405                #define RELOC_SUFFIX ""
    406406        #endif
    407         #define __cfaasm_label( label ) static struct asm_region label = \
     407        #define __cfaasm_label( label ) struct asm_region label = \
    408408                ({ \
    409409                        struct asm_region region; \
     
    424424                #define RELOC_SUFFIX ""
    425425        #endif
    426         #define __cfaasm_label( label ) static struct asm_region label = \
     426        #define __cfaasm_label( label ) struct asm_region label = \
    427427                ({ \
    428428                        struct asm_region region; \
     
    437437        #ifdef __PIC__
    438438                // Note that this works only for gcc
    439                 #define __cfaasm_label( label ) static struct asm_region label = \
     439                #define __cfaasm_label( label ) struct asm_region label = \
    440440                ({ \
    441441                        struct asm_region region; \
     
    452452                #error this is not the right thing to do
    453453                /*
    454                 #define __cfaasm_label( label ) static struct asm_region label = \
     454                #define __cfaasm_label( label ) struct asm_region label = \
    455455                ({ \
    456456                        struct asm_region region; \
  • src/AST/module.mk

    r0f7a0ea r48f6252  
    5959        AST/SymbolTable.cpp \
    6060        AST/SymbolTable.hpp \
     61        AST/TranslationUnit.hpp \
    6162        AST/Type.cpp \
    6263        AST/Type.hpp \
  • src/Common/CodeLocationTools.cpp

    r0f7a0ea r48f6252  
    2727struct has_code_location : public std::is_base_of<ast::ParseNode, node_t> {};
    2828
    29 // Fill every location
    30 class FillCore : public ast::WithGuards {
    31         CodeLocation const * parent;
    32 
    33         // This mimics a partially specialized method.
    34         template<typename node_t, bool has_location>
    35         struct FillNode;
    36         template<typename node_t, bool has_location>
    37         friend struct FillNode;
    38 
    39         template<typename node_t>
    40         struct FillNode<node_t, true> {
    41                 static node_t const * go( FillCore * core, node_t const * node ) {
    42                         node_t * newNode = nullptr;
    43                         if ( node->location.isUnset() ) {
    44                                 // Just hoping that top level nodes are always marked.
    45                                 assert( core->parent );
    46                                 newNode = ast::mutate( node );
    47                                 newNode->location = *core->parent;
    48                         }
    49                         core->GuardValue( core->parent );
    50                         core->parent = &node->location;
    51                         return (newNode) ? newNode : node;
    52                 }
    53         };
    54 
    55         template<typename node_t>
    56         struct FillNode<node_t, false> {
    57                 static node_t const * go( FillCore *, node_t const * node ) {
    58                         return node;
    59                 }
    60         };
    61 public:
    62         FillCore() : parent( nullptr ) {}
    63 
    64         template<typename node_t>
    65         node_t const * previsit( node_t const * node ) {
    66                 using Filler = FillNode<node_t, has_code_location<node_t>::value>;
    67                 return Filler::go( this, node );
    68         }
    69 };
    70 
    7129template<typename node_t, bool has_location>
    7230struct __GetCL;
     
    7432template<typename node_t>
    7533struct __GetCL<node_t, true> {
    76         static CodeLocation const * get( node_t const * node ) {
     34        static inline CodeLocation const * get( node_t const * node ) {
     35                return &node->location;
     36        }
     37
     38        static inline CodeLocation * get( node_t * node ) {
    7739                return &node->location;
    7840        }
     
    8143template<typename node_t>
    8244struct __GetCL<node_t, false> {
    83         static CodeLocation const * get( node_t const * ) {
     45        static inline CodeLocation * get( node_t const * ) {
    8446                return nullptr;
    8547        }
     
    9052        return __GetCL< node_t, has_code_location< node_t >::value >::get( node );
    9153}
     54
     55template<typename node_t>
     56CodeLocation * get_code_location( node_t * node ) {
     57        return __GetCL< node_t, has_code_location< node_t >::value >::get( node );
     58}
     59
     60// Fill every location with a nearby (parent) location.
     61class FillCore : public ast::WithGuards {
     62        CodeLocation const * parent;
     63public:
     64        FillCore() : parent( nullptr ) {}
     65
     66        template<typename node_t>
     67        node_t const * previsit( node_t const * node ) {
     68                GuardValue( parent );
     69                CodeLocation const * location = get_code_location( node );
     70                if ( location && location->isUnset() ) {
     71                        assert( parent );
     72                        node_t * newNode = ast::mutate( node );
     73                        CodeLocation * newLocation = get_code_location( newNode );
     74                        assert( newLocation );
     75                        *newLocation = *parent;
     76                        parent = newLocation;
     77                        return newNode;
     78                } else if ( location ) {
     79                        parent = location;
     80                }
     81                return node;
     82        }
     83};
    9284
    9385// Collect pointers to all the nodes with unset code locations.
  • tests/Makefile.am

    r0f7a0ea r48f6252  
    6868.INTERMEDIATE: .validate .validate.cfa
    6969EXTRA_PROGRAMS = avl_test .dummy_hack # build but do not install
     70EXTRA_DIST = test.py \
     71        pybin/__init__.py \
     72        pybin/print-core.gdb \
     73        pybin/settings.py \
     74        pybin/test_run.py \
     75        pybin/tools.py \
     76        long_tests.hfa \
     77        .in/io.data \
     78        avltree/avl.h \
     79        avltree/avl-private.h \
     80        concurrent/clib.c \
     81        exceptions/with-threads.hfa \
     82        exceptions/except-io.hfa
     83
     84dist-hook:
     85        echo "Gathering test files"
     86        for file in `${TEST_PY} --list-dist`; do \
     87                if test -f ${srcdir}/$${file}; then \
     88                        $(MKDIR_P) $$(dirname ${distdir}/$${file}); \
     89                        cp -df ${srcdir}/$${file} ${distdir}/$${file}; \
     90                fi; \
     91        done
    7092
    7193avl_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/pybin/tools.py

    r0f7a0ea r48f6252  
    191191        cmd = [s for s in cmd if s]
    192192        return sh(*cmd, output_file=output_file, error=error)
     193
     194def make_recon(target):
     195        cmd = [
     196                *settings.make,
     197                '-W',
     198                os.path.abspath(os.path.join(settings.BUILDDIR, '../driver/cfa')),
     199                '--recon',
     200                target
     201        ]
     202        cmd = [s for s in cmd if s]
     203        return sh(*cmd, output_file=subprocess.PIPE)
    193204
    194205def which(program):
  • tests/test.py

    r0f7a0ea r48f6252  
    143143        parser.add_argument('-j', '--jobs', help='Number of tests to run simultaneously', type=int)
    144144        parser.add_argument('--list-comp', help='List all valide arguments', action='store_true')
     145        parser.add_argument('--list-dist', help='List all tests for distribution', action='store_true')
    145146        parser.add_argument('-I','--include', help='Directory of test to include, can be used multiple time, All  if omitted', action='append')
    146147        parser.add_argument('-E','--exclude', help='Directory of test to exclude, can be used multiple time, None if omitted', action='append')
     
    155156
    156157        # script must have at least some tests to run or be listing
    157         listing    = options.list or options.list_comp
     158        listing    = options.list or options.list_comp or options.list_dist
    158159        all_tests  = options.all
    159160        some_tests = len(options.tests) > 0
     
    334335        settings.init( options )
    335336
    336         # users may want to simply list the tests
     337        # --------------------------------------------------
     338        # list all the test for auto completion programs
     339        # not pretty, single line, with the command line options
    337340        if options.list_comp :
    338341                # fetch the liest of all valid tests
     
    340343
    341344                # print the possible options
    342                 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --archive-errors --install --timeout --global-timeout --timeout-with-gdb -j --jobs -I --include -E --exclude --continue ", end='')
     345                print("-h --help --debug --dry-run --list --ast=new --ast=old --arch --all --regenerate-expected --archive-errors --install --timeout --global-timeout --timeout-with-gdb -j --jobs -I --include -E --exclude --continue ", end='')
    343346                print(" ".join(map(lambda t: "%s" % (t.target()), tests)))
    344347
    345         elif options.list :
     348                # done
     349                sys.exit(0)
     350
     351        # --------------------------------------------------
     352        # list all the test for auto completion programs
     353        if options.list_dist :
     354                # fetch the liest of all valid tests
     355                tests = list_tests( None, None )
     356
     357                for t in tests:
     358                        print(os.path.relpath(t.expect(), settings.SRCDIR), end=' ')
     359                        print(os.path.relpath(t.input() , settings.SRCDIR), end=' ')
     360                        code, out = make_recon(t.target())
     361
     362                        if code != 0:
     363                                print('ERROR: recond failed for test {}'.format(t.target()), file=sys.stderr)
     364                                sys.exit(1)
     365
     366                        print(' '.join(re.findall('([^\s]+\.cfa)', out)), end=' ')
     367
     368                print('')
     369
     370                # done
     371                sys.exit(0)
     372
     373
     374        # --------------------------------------------------
     375        # list all the tests for users, in a pretty format
     376        if options.list :
    346377                # fetch the liest of all valid tests
    347378                tests = list_tests( options.include, options.exclude )
     
    350381                fancy_print("\n".join(map(lambda t: t.toString(), tests)))
    351382
     383                # done
     384                sys.exit(0)
     385
     386        # fetch the liest of all valid tests
     387        all_tests = list_tests( options.include, options.exclude )
     388
     389        # if user wants all tests than no other treatement of the test list is required
     390        if options.all or options.include :
     391                tests = all_tests
     392
     393        #otherwise we need to validate that the test list that was entered is valid
    352394        else :
    353                 # fetch the liest of all valid tests
    354                 all_tests = list_tests( options.include, options.exclude )
    355 
    356                 # if user wants all tests than no other treatement of the test list is required
    357                 if options.all or options.include :
    358                         tests = all_tests
    359 
    360                 #otherwise we need to validate that the test list that was entered is valid
    361                 else :
    362                         tests = valid_tests( options )
    363 
    364                 # make sure we have at least some test to run
    365                 if not tests :
    366                         print('ERROR: No valid test to run', file=sys.stderr)
    367                         sys.exit(1)
    368 
    369                 # prep invariants
    370                 settings.prep_output(tests)
    371                 failed = 0
    372 
    373                 # check if the expected files aren't empty
    374                 if not options.regenerate_expected:
    375                         for t in tests:
    376                                 if is_empty(t.expect()):
    377                                         print('WARNING: test "{}" has empty .expect file'.format(t.target()), file=sys.stderr)
    378 
    379                 # for each build configurations, run the test
    380                 with Timed() as total_dur:
    381                         for ast, arch, debug, install in itertools.product(settings.all_ast, settings.all_arch, settings.all_debug, settings.all_install):
    382                                 settings.ast     = ast
    383                                 settings.arch    = arch
    384                                 settings.debug   = debug
    385                                 settings.install = install
    386 
    387                                 # filter out the tests for a different architecture
    388                                 # tests are the same across debug/install
    389                                 local_tests = settings.ast.filter( tests )
    390                                 local_tests = settings.arch.filter( local_tests )
    391                                 options.jobs, forceJobs = job_count( options, local_tests )
    392                                 settings.update_make_cmd(forceJobs, options.jobs)
    393 
    394                                 # check the build configuration works
    395                                 settings.validate()
    396 
    397                                 # print configuration
    398                                 print('%s %i tests on %i cores (%s:%s - %s)' % (
    399                                         'Regenerating' if settings.generating else 'Running',
    400                                         len(local_tests),
    401                                         options.jobs,
    402                                         settings.ast.string,
    403                                         settings.arch.string,
    404                                         settings.debug.string
    405                                 ))
    406                                 if not local_tests :
    407                                         print('WARNING: No tests for this configuration')
    408                                         continue
    409 
    410                                 # otherwise run all tests and make sure to return the correct error code
    411                                 failed = run_tests(local_tests, options.jobs)
    412                                 if failed:
    413                                         result = 1
    414                                         if not settings.continue_:
    415                                                 break
    416 
    417                 print('Tests took %s' % fmtDur( total_dur.duration ))
    418                 sys.exit( failed )
     395                tests = valid_tests( options )
     396
     397        # make sure we have at least some test to run
     398        if not tests :
     399                print('ERROR: No valid test to run', file=sys.stderr)
     400                sys.exit(1)
     401
     402        # prep invariants
     403        settings.prep_output(tests)
     404        failed = 0
     405
     406        # check if the expected files aren't empty
     407        if not options.regenerate_expected:
     408                for t in tests:
     409                        if is_empty(t.expect()):
     410                                print('WARNING: test "{}" has empty .expect file'.format(t.target()), file=sys.stderr)
     411
     412        # for each build configurations, run the test
     413        with Timed() as total_dur:
     414                for ast, arch, debug, install in itertools.product(settings.all_ast, settings.all_arch, settings.all_debug, settings.all_install):
     415                        settings.ast     = ast
     416                        settings.arch    = arch
     417                        settings.debug   = debug
     418                        settings.install = install
     419
     420                        # filter out the tests for a different architecture
     421                        # tests are the same across debug/install
     422                        local_tests = settings.ast.filter( tests )
     423                        local_tests = settings.arch.filter( local_tests )
     424                        options.jobs, forceJobs = job_count( options, local_tests )
     425                        settings.update_make_cmd(forceJobs, options.jobs)
     426
     427                        # check the build configuration works
     428                        settings.validate()
     429
     430                        # print configuration
     431                        print('%s %i tests on %i cores (%s:%s - %s)' % (
     432                                'Regenerating' if settings.generating else 'Running',
     433                                len(local_tests),
     434                                options.jobs,
     435                                settings.ast.string,
     436                                settings.arch.string,
     437                                settings.debug.string
     438                        ))
     439                        if not local_tests :
     440                                print('WARNING: No tests for this configuration')
     441                                continue
     442
     443                        # otherwise run all tests and make sure to return the correct error code
     444                        failed = run_tests(local_tests, options.jobs)
     445                        if failed:
     446                                result = 1
     447                                if not settings.continue_:
     448                                        break
     449
     450        print('Tests took %s' % fmtDur( total_dur.duration ))
     451        sys.exit( failed )
Note: See TracChangeset for help on using the changeset viewer.