Changeset d99a716


Ignore:
Timestamp:
Jan 4, 2023, 1:44:19 PM (16 months ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
339e30a, a14926b
Parents:
0348fd8 (diff), 66a89e7 (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 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/random.hfa

    r0348fd8 rd99a716  
    1010// Created On       : Fri Jan 14 07:18:11 2022
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Dec 11 18:43:58 2022
    13 // Update Count     : 171
     12// Last Modified On : Thu Dec 22 20:54:22 2022
     13// Update Count     : 178
    1414//
    1515
    1616#pragma once
    1717
    18 #include <stdint.h>
     18#include <stdint.h>                                                                             // uintXX_t
    1919
    2020#define GLUE2( x, y ) x##y
     
    2424#ifdef __x86_64__                                                                               // 64-bit architecture
    2525        // 64-bit generators
    26         #define LEHMER64
     26        //#define LEHMER64
    2727        //#define XORSHIFT_12_25_27
    28         //#define XOSHIRO256PP
     28        #define XOSHIRO256PP
    2929        //#define KISS_64
    3030
    3131        // 32-bit generators
    32         #define XORSHIFT_6_21_7
    33         //#define XOSHIRO128PP
     32        //#define XORSHIFT_6_21_7
     33        #define XOSHIRO128PP
    3434#else                                                                                                   // 32-bit architecture
    3535        // 64-bit generators
    36         #define XORSHIFT_13_7_17
     36        //#define XORSHIFT_13_7_17
     37        #define XOSHIRO256PP
    3738
    3839        // 32-bit generators
    39         #define XORSHIFT_6_21_7
     40        //#define XORSHIFT_6_21_7
     41        #define XOSHIRO128PP
    4042#endif // __x86_64__
    4143
     
    4749#define PRNG_NAME_64 xoshiro256pp
    4850#define PRNG_STATE_64_T GLUE(PRNG_NAME_64,_t)
    49 typedef struct PRNG_STATE_64_T { uint64_t s[4]; } PRNG_STATE_64_T;
     51typedef struct PRNG_STATE_64_T { uint64_t s0, s1, s2, s3; } PRNG_STATE_64_T;
    5052#endif // XOSHIRO256PP
    5153
     
    5355#define PRNG_NAME_32 xoshiro128pp
    5456#define PRNG_STATE_32_T GLUE(PRNG_NAME_32,_t)
    55 typedef struct PRNG_STATE_32_T { uint32_t s[4]; } PRNG_STATE_32_T;
     57typedef struct PRNG_STATE_32_T { uint32_t s0, s1, s2, s3; } PRNG_STATE_32_T;
    5658#endif // XOSHIRO128PP
    5759
     
    110112
    111113// ALL PRNG ALGORITHMS ARE OPTIMIZED SO THAT THE PRNG LOGIC CAN HAPPEN IN PARALLEL WITH THE USE OF THE RESULT.
    112 // Therefore, the set_seed routine primes the PRNG by calling it with the state so the seed is not return as the
    113 // first random value.
     114// Specifically, the current random state is copied for returning, before computing the next value.  As a consequence,
     115// the set_seed routine primes the PRNG by calling it with the state so the seed is not return as the first random
     116// value.
     117
    114118
    115119#ifdef __cforall                                                                                // don't include in C code (invoke.h)
     
    126130
    127131#ifndef XOSHIRO256PP
    128 typedef struct xoshiro256pp_t { uint64_t s[4]; } xoshiro256pp_t;
     132typedef struct xoshiro256pp_t { uint64_t s0, s1, s2, s3; } xoshiro256pp_t;
    129133#endif // ! XOSHIRO256PP
    130134
    131135static inline uint64_t xoshiro256pp( xoshiro256pp_t & rs ) with(rs) {
    132         inline uint64_t rotl(const uint64_t x, int k) {
     136        inline uint64_t rotl( const uint64_t x, int k ) {
    133137                return (x << k) | (x >> (64 - k));
    134138        } // rotl
    135139
    136         const uint64_t result = rotl( s[0] + s[3], 23 ) + s[0];
    137         const uint64_t t = s[1] << 17;
    138 
    139         s[2] ^= s[0];
    140         s[3] ^= s[1];
    141         s[1] ^= s[2];
    142         s[0] ^= s[3];
    143         s[2] ^= t;
    144         s[3] = rotl( s[3], 45 );
     140        const uint64_t result = rotl( s0 + s3, 23 ) + s0;
     141        const uint64_t t = s1 << 17;
     142
     143        s2 ^= s0;
     144        s3 ^= s1;
     145        s1 ^= s2;
     146        s0 ^= s3;
     147        s2 ^= t;
     148        s3 = rotl( s3, 45 );
    145149        return result;
    146150} // xoshiro256pp
    147151
    148 static inline void xoshiro256pp_set_seed( xoshiro256pp_t & state,  uint64_t seed ) {
    149         state = (xoshiro256pp_t){ {seed, seed, seed, seed} };
     152static inline void xoshiro256pp_set_seed( xoshiro256pp_t & state, uint64_t seed ) {
     153        state = (xoshiro256pp_t){ seed, seed, seed, seed };
    150154        xoshiro256pp( state );
    151155} // xoshiro256pp_set_seed
     
    161165
    162166#ifndef XOSHIRO128PP
    163 typedef struct xoshiro128pp_t { uint32_t s[4]; } xoshiro128pp_t;
     167typedef struct xoshiro128pp_t { uint32_t s0, s1, s2, s3; } xoshiro128pp_t;
    164168#endif // ! XOSHIRO128PP
    165169
     
    169173        } // rotl
    170174
    171         const uint32_t result = rotl( s[0] + s[3], 7 ) + s[0];
    172         const uint32_t t = s[1] << 9;
    173 
    174         s[2] ^= s[0];
    175         s[3] ^= s[1];
    176         s[1] ^= s[2];
    177         s[0] ^= s[3];
    178         s[2] ^= t;
    179         s[3] = rotl( s[3], 11 );
     175        const uint32_t result = rotl( s0 + s3, 7 ) + s0;
     176        const uint32_t t = s1 << 9;
     177
     178        s2 ^= s0;
     179        s3 ^= s1;
     180        s1 ^= s2;
     181        s0 ^= s3;
     182        s2 ^= t;
     183        s3 = rotl( s3, 11 );
    180184        return result;
    181185} // xoshiro128pp
    182186
    183187static inline void xoshiro128pp_set_seed( xoshiro128pp_t & state, uint32_t seed ) {
    184         state = (xoshiro128pp_t){ {seed, seed, seed, seed} };
     188        state = (xoshiro128pp_t){ seed, seed, seed, seed };
    185189        xoshiro128pp( state );                                                          // prime
    186190} // xoshiro128pp_set_seed
    187191
    188192#ifdef __SIZEOF_INT128__
    189         // Pipelined to allow out-of-order overlap with reduced dependencies. Critically, the current random state is
    190         // returned (copied), and then compute and store the next random value.
    191193        //--------------------------------------------------
    192194        static inline uint64_t lehmer64( __uint128_t & state ) {
    193195                __uint128_t ret = state;
    194                 state *= 0xda942042e4dd58b5;
     196                state *= 0x_da94_2042_e4dd_58b5;
    195197                return ret >> 64;
    196198        } // lehmer64
    197199
    198200        static inline void lehmer64_set_seed( __uint128_t & state, uint64_t seed ) {
     201                // The seed needs to be coprime with the 2^64 modulus to get the largest period, so no factors of 2 in the seed.
    199202                state = seed;
    200                 lehmer64( state );
     203                lehmer64( state );                                                              // prime
    201204        } // lehmer64_set_seed
    202205
     
    272275#endif // ! KISS_64
    273276
    274 static inline uint64_t kiss_64( kiss_64_t & state ) with(state) {
    275         kiss_64_t ret = state;
     277static inline uint64_t kiss_64( kiss_64_t & rs ) with(rs) {
     278        kiss_64_t ret = rs;
    276279        z = 36969 * (z & 65535) + (z >> 16);
    277280        w = 18000 * (w & 65535) + (w >> 16);
    278         jsr ^= (jsr << 17);
    279281        jsr ^= (jsr << 13);
     282        jsr ^= (jsr >> 17);
    280283        jsr ^= (jsr << 5);
    281284        jcong = 69069 * jcong + 1234567;
     
    283286} // kiss_64
    284287
    285 static inline void kiss_64_set_seed( kiss_64_t & state, uint64_t seed ) with(state) {
     288static inline void kiss_64_set_seed( kiss_64_t & rs, uint64_t seed ) with(rs) {
    286289        z = 1; w = 1; jsr = 4; jcong = seed;
    287         kiss_64( state );                                                                       // prime
     290        kiss_64( rs );                                                                          // prime
    288291} // kiss_64_set_seed
    289292
     
    294297#endif // ! XORWOW
    295298
    296 static inline uint32_t xorwow( xorwow_t & state ) with(state) {
     299static inline uint32_t xorwow( xorwow_t & rs ) with(rs) {
    297300        // Algorithm "xorwow" from p. 5 of Marsaglia, "Xorshift RNGs".
    298301        uint32_t ret = a + counter;
     
    312315} // xorwow
    313316
    314 static inline void xorwow_set_seed( xorwow_t & state, uint32_t seed ) {
    315         state = (xorwow_t){ seed, seed, seed, seed, 0 };
    316         xorwow( state );                                                                        // prime
     317static inline void xorwow_set_seed( xorwow_t & rs, uint32_t seed ) {
     318        rs = (xorwow_t){ seed, seed, seed, seed, 0 };
     319        xorwow( rs );                                                                           // prime
    317320} // xorwow_set_seed
    318321
     
    326329
    327330// Bi-directional LCG random-number generator
    328 static inline uint32_t LCGBI_fwd( uint64_t & state ) {
    329         state = (A * state + C) & (M - 1);
    330         return state >> D;
     331static inline uint32_t LCGBI_fwd( uint64_t & rs ) {
     332        rs = (A * rs + C) & (M - 1);
     333        return rs >> D;
    331334} // LCGBI_fwd
    332335
    333 static inline uint32_t LCGBI_bck( uint64_t & state ) {
    334         unsigned int r = state >> D;
    335         state = AI * (state - C) & (M - 1);
     336static inline uint32_t LCGBI_bck( uint64_t & rs ) {
     337        unsigned int r = rs >> D;
     338        rs = AI * (rs - C) & (M - 1);
    336339        return r;
    337340} // LCGBI_bck
  • libcfa/src/heap.cfa

    r0348fd8 rd99a716  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Oct 30 20:56:20 2022
    13 // Update Count     : 1584
     12// Last Modified On : Wed Dec 28 12:37:38 2022
     13// Update Count     : 1597
    1414//
    1515
     
    1717#include <string.h>                                                                             // memset, memcpy
    1818#include <limits.h>                                                                             // ULONG_MAX
    19 #include <stdlib.h>                                                                             // EXIT_FAILURE
    2019#include <errno.h>                                                                              // errno, ENOMEM, EINVAL
    21 #include <unistd.h>                                                                             // STDERR_FILENO, sbrk, sysconf
    22 #include <malloc.h>                                                                             // memalign, malloc_usable_size
     20#include <unistd.h>                                                                             // STDERR_FILENO, sbrk, sysconf, write
    2321#include <sys/mman.h>                                                                   // mmap, munmap
    2422extern "C" {
     
    2624} // extern "C"
    2725
     26#include "heap.hfa"
    2827#include "bits/align.hfa"                                                               // libAlign
    2928#include "bits/defs.hfa"                                                                // likely, unlikely
     
    140139#endif
    141140
    142 typedef volatile uintptr_t SpinLock_t CALIGN;                   // aligned addressable word-size
     141typedef volatile uintptr_t SpinLock_t;
    143142
    144143static inline __attribute__((always_inline)) void lock( volatile SpinLock_t & slock ) {
     
    147146
    148147        for ( unsigned int i = 1;; i += 1 ) {
    149           if ( slock == 0 && __atomic_test_and_set( &slock, __ATOMIC_SEQ_CST ) == 0 ) break; // Fence
     148          if ( slock == 0 && __atomic_test_and_set( &slock, __ATOMIC_ACQUIRE ) == 0 ) break; // Fence
    150149                for ( volatile unsigned int s = 0; s < spin; s += 1 ) Pause(); // exponential spin
    151150                spin += spin;                                                                   // powers of 2
     
    156155
    157156static inline __attribute__((always_inline)) void unlock( volatile SpinLock_t & slock ) {
    158         __atomic_clear( &slock, __ATOMIC_SEQ_CST );                     // Fence
     157        __atomic_clear( &slock, __ATOMIC_RELEASE );                     // Fence
    159158} // spin_unlock
    160159
     
    261260        static_assert( libAlign() >= sizeof( Storage ), "minimum alignment < sizeof( Storage )" );
    262261
    263         struct __attribute__(( aligned (8) )) FreeHeader {
    264                 size_t blockSize __attribute__(( aligned(8) )); // size of allocations on this list
     262        struct CALIGN FreeHeader {
     263                size_t blockSize CALIGN;                                                // size of allocations on this list
    265264                #ifdef OWNERSHIP
    266265                #ifdef RETURNSPIN
     
    284283
    285284        #ifdef __CFA_DEBUG__
    286         int64_t allocUnfreed;                                                           // running total of allocations minus frees; can be negative
     285        ptrdiff_t allocUnfreed;                                                         // running total of allocations minus frees; can be negative
    287286        #endif // __CFA_DEBUG__
    288287
     
    369368// Thread-local storage is allocated lazily when the storage is accessed.
    370369static __thread size_t PAD1 CALIGN TLSMODEL __attribute__(( unused )); // protect false sharing
    371 static __thread Heap * volatile heapManager CALIGN TLSMODEL;
     370static __thread Heap * heapManager CALIGN TLSMODEL;
    372371static __thread size_t PAD2 CALIGN TLSMODEL __attribute__(( unused )); // protect further false sharing
    373372
     
    443442                // 12K ~= 120K byte superblock.  Where 128-heap superblock handles a medium sized multi-processor server.
    444443                size_t remaining = heapManagersStorageEnd - heapManagersStorage; // remaining free heaps in superblock
    445                 if ( ! heapManagersStorage || remaining != 0 ) {
     444                if ( ! heapManagersStorage || remaining == 0 ) {
    446445                        // Each block of heaps is a multiple of the number of cores on the computer.
    447446                        int HeapDim = get_nprocs();                                     // get_nprocs_conf does not work
     
    562561                // allocUnfreed is set to 0 when a heap is created and it accumulates any unfreed storage during its multiple thread
    563562                // usages.  At the end, add up each heap allocUnfreed value across all heaps to get the total unfreed storage.
    564                 int64_t allocUnfreed = 0;
     563                ptrdiff_t allocUnfreed = 0;
    565564                for ( Heap * heap = heapMaster.heapManagersList; heap; heap = heap->nextHeapManager ) {
    566565                        allocUnfreed += heap->allocUnfreed;
     
    572571                        char helpText[512];
    573572                        __cfaabi_bits_print_buffer( STDERR_FILENO, helpText, sizeof(helpText),
    574                                                                                 "CFA warning (UNIX pid:%ld) : program terminating with %ju(0x%jx) bytes of storage allocated but not freed.\n"
     573                                                                                "CFA warning (UNIX pid:%ld) : program terminating with %td(%#tx) bytes of storage allocated but not freed.\n"
    575574                                                                                "Possible cause is unfreed storage allocated by the program or system/library routines called from the program.\n",
    576575                                                                                (long int)getpid(), allocUnfreed, allocUnfreed ); // always print the UNIX pid
     
    950949                block = freeHead->freeList;                                             // remove node from stack
    951950                if ( unlikely( block == 0p ) ) {                                // no free block ?
    952                         // Freelist for this size is empty, so check return list (OWNERSHIP), carve it out of the heap, if there
     951                        // Freelist for this size is empty, so check return list (OWNERSHIP), or carve it out of the heap if there
    953952                        // is enough left, or get some more heap storage and carve it off.
    954953                        #ifdef OWNERSHIP
     
    11151114                        while ( ! __atomic_compare_exchange_n( &freeHead->returnList, &header->kind.real.next, (Heap.Storage *)header,
    11161115                                                                                                   false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ) );
     1116
     1117                        #ifdef __STATISTICS__
     1118                        stats.return_pushes += 1;
     1119                        stats.return_storage_request += rsize;
     1120                        stats.return_storage_alloc += size;
     1121                        #endif // __STATISTICS__
    11171122                        #endif // RETURNSPIN
    11181123                } // if
     
    11251130                freeHead->freeList = (Heap.Storage *)header;
    11261131                #endif // ! OWNERSHIP
    1127 
    1128                 #ifdef __U_STATISTICS__
    1129                 stats.return_pushes += 1;
    1130                 stats.return_storage_request += rsize;
    1131                 stats.return_storage_alloc += size;
    1132                 #endif // __U_STATISTICS__
    11331132
    11341133                // OK TO BE PREEMPTED HERE AS heapManager IS NO LONGER ACCESSED.
     
    11801179
    11811180#ifdef __STATISTICS__
    1182 static void incCalls( intptr_t statName ) libcfa_nopreempt {
     1181static void incCalls( size_t statName ) libcfa_nopreempt {
    11831182        heapManager->stats.counters[statName].calls += 1;
    11841183} // incCalls
    11851184
    1186 static void incZeroCalls( intptr_t statName ) libcfa_nopreempt {
     1185static void incZeroCalls( size_t statName ) libcfa_nopreempt {
    11871186        heapManager->stats.counters[statName].calls_0 += 1;
    11881187} // incZeroCalls
     
    14561455        // 0p, no operation is performed.
    14571456        void free( void * addr ) libcfa_public {
    1458 //              verify( heapManager );
    1459 
    14601457          if ( unlikely( addr == 0p ) ) {                                       // special case
    14611458                        #ifdef __STATISTICS__
  • src/AST/Pass.hpp

    r0348fd8 rd99a716  
    8686        {
    8787                // After the pass is constructed, check if it wants the have a pointer to the wrapping visitor
    88                 type * const * visitor = __pass::visitor(core, 0);
    89                 if(visitor) {
     88                type * const * visitor = __pass::visitor( core, 0 );
     89                if ( visitor ) {
    9090                        *const_cast<type **>( visitor ) = this;
    9191                }
     
    9898
    9999        /// If the core defines a result, call it if possible, otherwise return it.
    100         inline auto get_result() -> decltype( __pass::get_result( core, '0' ) ) {
    101                 return __pass::get_result( core, '0' );
     100        inline auto get_result() -> decltype( __pass::result::get( core, '0' ) ) {
     101                return __pass::result::get( core, '0' );
    102102        }
    103103
  • src/AST/Pass.proto.hpp

    r0348fd8 rd99a716  
    489489                template<typename core_t>
    490490                static inline auto replace( core_t &, long, const ast::TypeInstType *& ) {}
    491 
    492491        } // namespace forall
    493492
     
    506505        }
    507506
    508         template<typename core_t>
    509         static inline auto get_result( core_t & core, char ) -> decltype( core.result() ) {
    510                 return core.result();
    511         }
    512 
    513         template<typename core_t>
    514         static inline auto get_result( core_t & core, int ) -> decltype( core.result ) {
    515                 return core.result;
    516         }
    517 
    518         template<typename core_t>
    519         static inline void get_result( core_t &, long ) {}
     507        // For passes, usually utility passes, that have a result.
     508        namespace result {
     509                template<typename core_t>
     510                static inline auto get( core_t & core, char ) -> decltype( core.result() ) {
     511                        return core.result();
     512                }
     513
     514                template<typename core_t>
     515                static inline auto get( core_t & core, int ) -> decltype( core.result ) {
     516                        return core.result;
     517                }
     518
     519                template<typename core_t>
     520                static inline void get( core_t &, long ) {}
     521        }
    520522} // namespace __pass
    521523} // namespace ast
  • src/CompilationState.cc

    r0348fd8 rd99a716  
    3333        useNewAST = true,
    3434        nomainp = false,
    35         parsep = false,
    3635        resolvep = false,
    3736        resolvprotop = false,
  • src/CompilationState.h

    r0348fd8 rd99a716  
    3232        useNewAST,
    3333        nomainp,
    34         parsep,
    3534        resolvep,
    3635        resolvprotop,
  • src/GenPoly/Box.cc

    r0348fd8 rd99a716  
    424424        namespace {
    425425                std::string makePolyMonoSuffix( FunctionType const * function, const TyVarMap &tyVars ) {
    426                         std::stringstream name;
    427 
    428426                        // NOTE: this function previously used isPolyObj, which failed to produce
    429427                        // the correct thing in some situations. It's not clear to me why this wasn't working.
     
    432430                        // to take those polymorphic types as pointers. Therefore, there can be two different functions
    433431                        // with the same mangled name, so we need to further mangle the names.
     432                        std::stringstream name;
    434433                        for ( DeclarationWithType const * const ret : function->returnVals ) {
    435                                 if ( isPolyType( ret->get_type(), tyVars ) ) {
    436                                         name << "P";
    437                                 } else {
    438                                         name << "M";
    439                                 }
    440                         }
    441                         name << "_";
     434                                name << ( isPolyType( ret->get_type(), tyVars ) ? 'P' : 'M' );
     435                        }
     436                        name << '_';
    442437                        for ( DeclarationWithType const * const arg : function->parameters ) {
    443                                 if ( isPolyType( arg->get_type(), tyVars ) ) {
    444                                         name << "P";
    445                                 } else {
    446                                         name << "M";
    447                                 }
    448                         } // for
     438                                name << ( isPolyType( arg->get_type(), tyVars ) ? 'P' : 'M' );
     439                        }
    449440                        return name.str();
    450441                }
     
    565556                        // even when converted to strings, sort in the original order.
    566557                        // (At least, that is the best explination I have.)
    567                         for ( std::pair<std::string, TypeDecl::Data> const & tyParam : exprTyVars ) {
     558                        for ( std::pair<const std::string, TypeDecl::Data> const & tyParam : exprTyVars ) {
    568559                                if ( !tyParam.second.isComplete ) continue;
    569560                                Type *concrete = env->lookup( tyParam.first );
  • src/GenPoly/ScrubTyVars.cc

    r0348fd8 rd99a716  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Oct  7 15:42:00 2022
    13 // Update Count     : 5
     12// Last Modified On : Wed Dec  7 17:01:00 2022
     13// Update Count     : 6
    1414//
    1515
     
    117117namespace {
    118118
    119 enum class ScrubMode {
    120         FromMap,
    121         DynamicFromMap,
    122         All,
    123 };
    124 
    125119struct ScrubTypeVars :
    126120        public ast::WithGuards,
     
    253247}
    254248
     249} // namespace
     250
    255251const ast::Node * scrubTypeVarsBase(
    256                 const ast::Node * target,
    257                 ScrubMode mode, const TypeVarMap * typeVars ) {
     252                const ast::Node * node, const TypeVarMap * typeVars, ScrubMode mode ) {
    258253        if ( ScrubMode::All == mode ) {
    259254                assert( nullptr == typeVars );
     
    262257        }
    263258        ast::Pass<ScrubTypeVars> visitor( mode, typeVars );
    264         return target->accept( visitor );
    265 }
    266 
    267 } // namespace
    268 
    269 template<>
    270 ast::Node const * scrubTypeVars<ast::Node>(
    271         const ast::Node * target, const TypeVarMap & typeVars ) {
    272         return scrubTypeVarsBase( target, ScrubMode::FromMap, &typeVars );
    273 }
    274 
    275 template<>
    276 ast::Node const * scrubTypeVarsDynamic<ast::Node>(
    277         ast::Node const * target, const TypeVarMap & typeVars ) {
    278         return scrubTypeVarsBase( target, ScrubMode::DynamicFromMap, &typeVars );
    279 }
    280 
    281 template<>
    282 ast::Node const * scrubAllTypeVars<ast::Node>( const ast::Node * target ) {
    283         return scrubTypeVarsBase( target, ScrubMode::All, nullptr );
     259        return node->accept( visitor );
    284260}
    285261
  • src/GenPoly/ScrubTyVars.h

    r0348fd8 rd99a716  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Oct  7 15:51:00 2022
    13 // Update Count     : 4
     12// Last Modified On : Wed Dec  7 16:57:00 2022
     13// Update Count     : 5
    1414//
    1515
     
    109109        }
    110110
     111// ScrubMode and scrubTypeVarsBase are internal.
     112enum class ScrubMode { FromMap, DynamicFromMap, All };
     113
     114const ast::Node * scrubTypeVarsBase(
     115        const ast::Node * target, const TypeVarMap * typeVars, ScrubMode mode );
     116
     117
    111118/// For all polymorphic types with type variables in `typeVars`,
    112119/// replaces generic types, dtypes, and ftypes with the appropriate void type,
     
    116123                node_t const * target, const TypeVarMap & typeVars ) {
    117124        return strict_dynamic_cast<node_t const *>(
    118                         scrubTypeVars<ast::Node>( target, typeVars ) );
     125                        scrubTypeVarsBase( target, &typeVars, ScrubMode::FromMap ) );
    119126}
    120127
     
    123130/// and sizeof/alignof expressions with the proper variable.
    124131template<typename node_t>
    125 ast::Node const * scrubTypeVarsDynamic(
     132node_t const * scrubTypeVarsDynamic(
    126133                node_t const * target, const TypeVarMap & typeVars ) {
    127134        return strict_dynamic_cast<node_t const *>(
    128                         scrubTypeVarsDynamic<ast::Node>( target, typeVars ) );
     135                        scrubTypeVarsBase( target, &typeVars, ScrubMode::DynamicFromMap ) );
    129136}
    130137
     
    134141node_t const * scrubAllTypeVars( node_t const * target ) {
    135142        return strict_dynamic_cast<node_t const *>(
    136                         scrubAllTypeVars<ast::Node>( target ) );
     143                        scrubTypeVarsBase( target, nullptr, ScrubMode::All ) );
    137144}
    138 
    139 // We specialize for Node as a base case.
    140 template<>
    141 ast::Node const * scrubTypeVars<ast::Node>(
    142                 const ast::Node * target, const TypeVarMap & typeVars );
    143 
    144 template<>
    145 ast::Node const * scrubTypeVarsDynamic<ast::Node>(
    146                 ast::Node const * target, const TypeVarMap & typeVars );
    147 
    148 template<>
    149 ast::Node const * scrubAllTypeVars<ast::Node>( const ast::Node * target );
    150145
    151146} // namespace GenPoly
  • src/Parser/RunParser.cpp

    r0348fd8 rd99a716  
    1010// Created On       : Mon Dec 19 11:00:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Dec 19 11:15:00 2022
    13 // Update Count     : 0
     12// Last Modified On : Thr Dec 22 10:18:00 2022
     13// Update Count     : 1
    1414//
    1515
    1616#include "RunParser.hpp"
    1717
     18#include "AST/Convert.hpp"                  // for convert
     19#include "AST/TranslationUnit.hpp"          // for TranslationUnit
     20#include "CodeTools/TrackLoc.h"             // for fillLocations
     21#include "Common/CodeLocationTools.hpp"     // for forceFillCodeLocations
    1822#include "Parser/ParseNode.h"               // for DeclarationNode, buildList
    1923#include "Parser/TypedefTable.h"            // for TypedefTable
     
    4145} // parse
    4246
    43 void dumpParseTree( std::ostream & out ) {
    44         parseTree->printList( out );
    45         delete parseTree;
    46         parseTree = nullptr;
    47 }
    48 
    49 std::list<Declaration *> buildUnit(void) {
     47ast::TranslationUnit buildUnit(void) {
    5048        std::list<Declaration *> translationUnit;
    5149        buildList( parseTree, translationUnit );
     
    5452        parseTree = nullptr;
    5553
    56         return translationUnit;
     54        // When the parse/buildList code is translated to the new ast, these
     55        // fill passes (and the one after 'Hoist Type Decls') should be redundent
     56        // because the code locations should already be filled.
     57        CodeTools::fillLocations( translationUnit );
     58        ast::TranslationUnit transUnit = convert( std::move( translationUnit ) );
     59        forceFillCodeLocations( transUnit );
     60        return transUnit;
    5761}
    5862
  • src/Parser/RunParser.hpp

    r0348fd8 rd99a716  
    1010// Created On       : Mon Dec 19 10:42:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Dec 19 11:15:00 2022
    13 // Update Count     : 0
     12// Last Modified On : Thr Dec 22 10:23:00 2022
     13// Update Count     : 1
    1414//
    1515
     
    1717
    1818#include <iosfwd>                           // for ostream
    19 #include <list>                             // for list
    2019
    2120#include "SynTree/LinkageSpec.h"            // for Spec
    22 class Declaration;
     21namespace ast {
     22        class TranslationUnit;
     23}
    2324
    2425// The Parser does not have an enclosing namespace.
     
    3031void parse( FILE * input, LinkageSpec::Spec linkage, bool alwaysExit = false );
    3132
    32 /// Drain the internal accumulator of parsed code and print it to the stream.
    33 void dumpParseTree( std::ostream & );
    34 
    3533/// Drain the internal accumulator of parsed code and build a translation
    3634/// unit from it.
    37 std::list<Declaration *> buildUnit(void);
     35ast::TranslationUnit buildUnit(void);
    3836
    3937// Local Variables: //
  • src/main.cc

    r0348fd8 rd99a716  
    228228        ostream * output = & cout;
    229229        list< Declaration * > translationUnit;
     230        ast::TranslationUnit transUnit;
    230231
    231232        Signal( SIGSEGV, sigSegvBusHandler, SA_SIGINFO );
     
    294295                parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, yydebug );
    295296
    296                 if ( parsep ) {
    297                         dumpParseTree( cout );
    298                         return EXIT_SUCCESS;
    299                 } // if
    300 
    301                 translationUnit = buildUnit();
     297                transUnit = buildUnit();
    302298
    303299                if ( astp ) {
    304                         dump( translationUnit );
    305                         return EXIT_SUCCESS;
    306                 } // if
    307 
    308                 // Temporary: fill locations after parsing so that every node has a location, for early error messages.
    309                 // Eventually we should pass the locations from the parser to every node, but this quick and dirty solution
    310                 // works okay for now.
    311                 CodeTools::fillLocations( translationUnit );
     300                        dump( std::move( transUnit ) );
     301                        return EXIT_SUCCESS;
     302                } // if
     303
    312304                Stats::Time::StopBlock();
    313305
     
    316308                        ast::pass_visitor_stats.max = Stats::Counters::build<Stats::Counters::MaxCounter<double>>("Max depth - New");
    317309                }
    318                 auto transUnit = convert( std::move( translationUnit ) );
    319 
    320                 forceFillCodeLocations( transUnit );
    321 
    322                 PASS( "Translate Exception Declarations", ControlStruct::translateExcept( transUnit ) );
    323                 if ( exdeclp ) {
    324                         dump( std::move( transUnit ) );
    325                         return EXIT_SUCCESS;
    326                 }
    327 
    328                 PASS( "Verify Ctor, Dtor & Assign", Validate::verifyCtorDtorAssign( transUnit ) );
     310
    329311                PASS( "Hoist Type Decls", Validate::hoistTypeDecls( transUnit ) );
    330312                // Hoist Type Decls pulls some declarations out of contexts where
     
    333315                forceFillCodeLocations( transUnit );
    334316
     317                PASS( "Translate Exception Declarations", ControlStruct::translateExcept( transUnit ) );
     318                if ( exdeclp ) {
     319                        dump( std::move( transUnit ) );
     320                        return EXIT_SUCCESS;
     321                }
     322
     323                PASS( "Verify Ctor, Dtor & Assign", Validate::verifyCtorDtorAssign( transUnit ) );
    335324                PASS( "Replace Typedefs", Validate::replaceTypedef( transUnit ) );
    336325                PASS( "Fix Return Types", Validate::fixReturnTypes( transUnit ) );
     
    474463                if ( errorp ) {
    475464                        cerr << "---AST at error:---" << endl;
    476                         dump( translationUnit, cerr );
     465                        // We check which section the errors came from without looking at
     466                        // transUnit because std::move means it could look like anything.
     467                        if ( !translationUnit.empty() ) {
     468                                dump( translationUnit, cerr );
     469                        } else {
     470                                dump( std::move( transUnit ), cerr );
     471                        }
    477472                        cerr << endl << "---End of AST, begin error message:---\n" << endl;
    478473                } // if
     
    578573        { "rproto", resolvprotop, true, "resolver-proto instance" },
    579574        { "rsteps", resolvep, true, "print resolver steps" },
    580         { "tree", parsep, true, "print parse tree" },
    581575        // code dumps
    582576        { "ast", astp, true, "print AST after parsing" },
  • tests/.expect/PRNG.x64.txt

    r0348fd8 rd99a716  
    11
    2        PRNG()   PRNG(5)    PRNG(0,5)
    3           861         3            0
    4 10137507171299805328         1            2
    5 12205946788447993741         4            0
    6 16222929371023265189         2            5
    7 11921944259646500358         1            1
    8 9511863719043198063         2            0
    9 18170109536749574203         0            1
    10 15896208456307578543         0            3
    11 4171113079117645375         1            4
    12 5535309872453329531         1            1
    13 13293369315461644140         2            2
    14 855811942427900360         1            1
    15 9125507373316195824         1            5
    16 6942856496042419510         1            5
    17 16774706561877323900         2            4
    18 17765436951300330249         4            0
    19 3766082030894719812         1            2
    20 15818141700523398820         3            5
    21 1244962761353699441         0            5
    22 4506898200126256218         1            2
     2                    PRNG()     PRNG(5)   PRNG(0,5)
     3                8464106481           4           4
     4       5215204710507639537           1           2
     5       1880401021892145483           0           4
     6      12503840966285181348           2           5
     7        801971300205459356           0           2
     8       6123812066052045228           3           1
     9       7691074772031490538           4           3
     10       4793575011534070065           0           0
     11      10647551928893428440           1           3
     12      10865128702974868079           0           3
     13        530720947131684825           3           0
     14      10520125295812061287           1           5
     15       7539957561855178679           4           4
     16      13739826796006269835           0           2
     17       4289714351582916365           3           2
     18      16911914987551424434           2           1
     19       5327155553462670435           4           0
     20      16251986870929071204           4           4
     21      13394433706240223001           0           3
     22       4814982023332666924           4           0
    2323seed 1009
    2424
    2525Sequential
    26 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
     26trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
    2727
    2828Concurrent
    29 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
    30 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
    31 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
    32 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
     29trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
     30trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
     31trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
     32trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
    3333
    34        prng()   prng(5)    prng(0,5)
    35           861         3            0
    36 10137507171299805328         1            2
    37 12205946788447993741         4            0
    38 16222929371023265189         2            5
    39 11921944259646500358         1            1
    40 9511863719043198063         2            0
    41 18170109536749574203         0            1
    42 15896208456307578543         0            3
    43 4171113079117645375         1            4
    44 5535309872453329531         1            1
    45 13293369315461644140         2            2
    46 855811942427900360         1            1
    47 9125507373316195824         1            5
    48 6942856496042419510         1            5
    49 16774706561877323900         2            4
    50 17765436951300330249         4            0
    51 3766082030894719812         1            2
    52 15818141700523398820         3            5
    53 1244962761353699441         0            5
    54 4506898200126256218         1            2
     34                    prng()     prng(5)   prng(0,5)
     35                8464106481           4           4
     36       5215204710507639537           1           2
     37       1880401021892145483           0           4
     38      12503840966285181348           2           5
     39        801971300205459356           0           2
     40       6123812066052045228           3           1
     41       7691074772031490538           4           3
     42       4793575011534070065           0           0
     43      10647551928893428440           1           3
     44      10865128702974868079           0           3
     45        530720947131684825           3           0
     46      10520125295812061287           1           5
     47       7539957561855178679           4           4
     48      13739826796006269835           0           2
     49       4289714351582916365           3           2
     50      16911914987551424434           2           1
     51       5327155553462670435           4           0
     52      16251986870929071204           4           4
     53      13394433706240223001           0           3
     54       4814982023332666924           4           0
    5555seed 1009
    5656
    5757Sequential
    58 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
     58trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
    5959
    6060Concurrent
    61 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
    62 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
    63 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
    64 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
     61trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
     62trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
     63trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
     64trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
    6565
    66       prng(t) prng(t,5) prng(t,0,5)
    67           861         3            0
    68 10137507171299805328         1            2
    69 12205946788447993741         4            0
    70 16222929371023265189         2            5
    71 11921944259646500358         1            1
    72 9511863719043198063         2            0
    73 18170109536749574203         0            1
    74 15896208456307578543         0            3
    75 4171113079117645375         1            4
    76 5535309872453329531         1            1
    77 13293369315461644140         2            2
    78 855811942427900360         1            1
    79 9125507373316195824         1            5
    80 6942856496042419510         1            5
    81 16774706561877323900         2            4
    82 17765436951300330249         4            0
    83 3766082030894719812         1            2
    84 15818141700523398820         3            5
    85 1244962761353699441         0            5
    86 4506898200126256218         1            2
     66                   prng(t)   prng(t,5) prng(t,0,5)
     67                8464106481           4           4
     68       5215204710507639537           1           2
     69       1880401021892145483           0           4
     70      12503840966285181348           2           5
     71        801971300205459356           0           2
     72       6123812066052045228           3           1
     73       7691074772031490538           4           3
     74       4793575011534070065           0           0
     75      10647551928893428440           1           3
     76      10865128702974868079           0           3
     77        530720947131684825           3           0
     78      10520125295812061287           1           5
     79       7539957561855178679           4           4
     80      13739826796006269835           0           2
     81       4289714351582916365           3           2
     82      16911914987551424434           2           1
     83       5327155553462670435           4           0
     84      16251986870929071204           4           4
     85      13394433706240223001           0           3
     86       4814982023332666924           4           0
    8787seed 1009
    8888
    8989Sequential
    90 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
     90trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
    9191
    9292Concurrent
    93 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
    94 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
    95 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
    96 trials 100000000 buckets 100000 min 875 max 1138 avg 1000.0 std 31.8 rstd 3.2%
     93trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
     94trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
     95trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
     96trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2%
  • tests/.expect/PRNG.x86.txt

    r0348fd8 rd99a716  
    11
    2        PRNG()   PRNG(5)    PRNG(0,5)
    3       8333105         1            2
    4    1989339636         4            5
    5     266970699         3            2
    6    1928130121         3            4
    7    1351003938         4            5
    8    1624164922         4            3
    9     363429604         1            2
    10    3355083174         1            1
    11     214422584         1            1
    12    2266729947         1            2
    13    3649702519         2            4
    14    2250875012         2            4
    15    4184653025         1            3
    16    2640851227         2            5
    17     206468178         2            3
    18    2600873108         1            3
    19    3007574582         3            3
    20     394476790         0            2
    21    1312145388         1            5
    22    2989081290         2            4
     2                    PRNG()     PRNG(5)   PRNG(0,5)
     3                    130161           1           1
     4                4074541490           0           0
     5                 927506267           0           3
     6                1991273445           1           3
     7                 669918146           2           3
     8                 519546860           1           1
     9                1136699882           4           3
     10                2130185384           3           1
     11                 992239050           0           5
     12                2250903111           0           1
     13                1544429724           3           2
     14                1591091660           3           3
     15                2511657707           2           4
     16                1065770984           2           4
     17                2412763405           4           4
     18                1834447239           4           2
     19                 360289337           0           4
     20                2449452027           1           1
     21                3370425396           2           1
     22                3109103043           0           3
    2323seed 1009
    2424
    2525Sequential
    26 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
     26trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
    2727
    2828Concurrent
    29 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
    30 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
    31 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
    32 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
     29trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
     30trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
     31trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
     32trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
    3333
    34        prng()   prng(5)    prng(0,5)
    35       8333105         1            2
    36    1989339636         4            5
    37     266970699         3            2
    38    1928130121         3            4
    39    1351003938         4            5
    40    1624164922         4            3
    41     363429604         1            2
    42    3355083174         1            1
    43     214422584         1            1
    44    2266729947         1            2
    45    3649702519         2            4
    46    2250875012         2            4
    47    4184653025         1            3
    48    2640851227         2            5
    49     206468178         2            3
    50    2600873108         1            3
    51    3007574582         3            3
    52     394476790         0            2
    53    1312145388         1            5
    54    2989081290         2            4
     34                    prng()     prng(5)   prng(0,5)
     35                    130161           1           1
     36                4074541490           0           0
     37                 927506267           0           3
     38                1991273445           1           3
     39                 669918146           2           3
     40                 519546860           1           1
     41                1136699882           4           3
     42                2130185384           3           1
     43                 992239050           0           5
     44                2250903111           0           1
     45                1544429724           3           2
     46                1591091660           3           3
     47                2511657707           2           4
     48                1065770984           2           4
     49                2412763405           4           4
     50                1834447239           4           2
     51                 360289337           0           4
     52                2449452027           1           1
     53                3370425396           2           1
     54                3109103043           0           3
    5555seed 1009
    5656
    5757Sequential
    58 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
     58trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
    5959
    6060Concurrent
    61 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
    62 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
    63 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
    64 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
     61trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
     62trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
     63trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
     64trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
    6565
    66       prng(t) prng(t,5) prng(t,0,5)
    67       8333105         1            2
    68    1989339636         4            5
    69     266970699         3            2
    70    1928130121         3            4
    71    1351003938         4            5
    72    1624164922         4            3
    73     363429604         1            2
    74    3355083174         1            1
    75     214422584         1            1
    76    2266729947         1            2
    77    3649702519         2            4
    78    2250875012         2            4
    79    4184653025         1            3
    80    2640851227         2            5
    81     206468178         2            3
    82    2600873108         1            3
    83    3007574582         3            3
    84     394476790         0            2
    85    1312145388         1            5
    86    2989081290         2            4
     66                   prng(t)   prng(t,5) prng(t,0,5)
     67                    130161           1           1
     68                4074541490           0           0
     69                 927506267           0           3
     70                1991273445           1           3
     71                 669918146           2           3
     72                 519546860           1           1
     73                1136699882           4           3
     74                2130185384           3           1
     75                 992239050           0           5
     76                2250903111           0           1
     77                1544429724           3           2
     78                1591091660           3           3
     79                2511657707           2           4
     80                1065770984           2           4
     81                2412763405           4           4
     82                1834447239           4           2
     83                 360289337           0           4
     84                2449452027           1           1
     85                3370425396           2           1
     86                3109103043           0           3
    8787seed 1009
    8888
    8989Sequential
    90 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
     90trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
    9191
    9292Concurrent
    93 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
    94 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
    95 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
    96 trials 100000000 buckets 100000 min 873 max 1140 avg 1000.0 std 31.3 rstd 3.1%
     93trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
     94trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
     95trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
     96trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2%
  • tests/.expect/nested_function.x64.txt

    r0348fd8 rd99a716  
    1 total 80
     1total 155
  • tests/.expect/nested_function.x86.txt

    r0348fd8 rd99a716  
    1 total 55
     1total 105
  • tests/PRNG.cfa

    r0348fd8 rd99a716  
    88// Created On       : Wed Dec 29 09:38:12 2021
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Tue Nov 22 22:51:12 2022
    11 // Update Count     : 381
     10// Last Modified On : Wed Dec 21 20:39:59 2022
     11// Update Count     : 406
    1212//
    1313
     
    6060
    6161
    62 unsigned int seed = 1009;
     62size_t seed = 1009;
    6363
    6464thread T1 {};
     
    116116} // dummy
    117117
     118
    118119int main() {
    119120        // causes leaked storage message
    120 //      setlocale( LC_NUMERIC, getenv( "LANG" ) );                      // print digit separator
     121        // setlocale( LC_NUMERIC, getenv( "LANG" ) );                   // print digit separator
     122        // locale_t loc = newlocale( LC_NUMERIC_MASK, getenv( "LANG" ), (locale_t)0p );
     123        // if ( loc == (locale_t)0p ) abort( "newlocale" );
     124        // uselocale( loc );
    121125
    122126        enum { TASKS = 4 };
     
    130134
    131135        sout | sepDisable;
    132         sout | wd(13, "rand()" ) | wd(10, "rand(5)") | wd(13, "rand(0,5)" );
    133         for ( 20 ) {
    134                 sout | wd(13, rand()) | nonl;
    135                 sout | wd(10, rand() % 5) | nonl;
    136                 sout | wd(13, rand() % (5 - 0 + 1) + 0);
     136        sout | wd(26, "rand()" ) | wd(12, "rand(5)") | wd(12, "rand(0,5)" );
     137        for ( 20 ) {
     138                sout | wd(26, rand()) | nonl;
     139                sout | wd(12, rand() % 5) | nonl;
     140                sout | wd(12, rand() % (5 - 0 + 1) + 0);
    137141        } // for
    138142        sout | sepEnable;
     
    168172
    169173        sout | sepDisable;
    170         sout | nl | wd(13, "PRNG()" ) | wd(10, "PRNG(5)") | wd(13, "PRNG(0,5)" );
    171         for ( 20 ) {
    172                 sout | wd(13, prng( prng )) | nonl;                             // cascading => side-effect functions called in arbitary order
    173                 sout | wd(10, prng( prng, 5 )) | nonl;
    174                 sout | wd(13, prng( prng, 0, 5 ));
     174        sout | nl | wd(26, "PRNG()" ) | wd(12, "PRNG(5)") | wd(12, "PRNG(0,5)" );
     175        for ( 20 ) {
     176                sout | wd(26, prng( prng )) | nonl;                             // cascading => side-effect functions called in arbitary order
     177                sout | wd(12, prng( prng, 5 )) | nonl;
     178                sout | wd(12, prng( prng, 0, 5 ));
    175179        } // for
    176180        sout | sepEnable;
     
    203207
    204208        sout | sepDisable;
    205         sout | nl | wd(13, "prng()" ) | wd(10, "prng(5)") | wd(13, "prng(0,5)" );
    206         for ( 20 ) {
    207                 sout | wd(13, prng()) | nonl;                                   // cascading => side-effect functions called in arbitary order
    208                 sout | wd(10, prng( 5 )) | nonl;
    209                 sout | wd(13, prng( 0, 5 ));
     209        sout | nl | wd(26, "prng()" ) | wd(12, "prng(5)") | wd(12, "prng(0,5)" );
     210        for ( 20 ) {
     211                sout | wd(26, prng()) | nonl;                                   // cascading => side-effect functions called in arbitary order
     212                sout | wd(12, prng( 5 )) | nonl;
     213                sout | wd(12, prng( 0, 5 ));
    210214        } // for
    211215        sout | sepEnable;
     
    239243
    240244        sout | sepDisable;
    241         sout | nl | wd(13, "prng(t)" ) | wd(10, "prng(t,5)") | wd(13, "prng(t,0,5)" );
    242         for ( 20 ) {
    243                 sout | wd(13, prng( th )) | nonl;                               // cascading => side-effect functions called in arbitary order
    244                 sout | wd(10, prng( th, 5 )) | nonl;
    245                 sout | wd(13, prng( th, 0, 5 ));
     245        sout | nl | wd(26, "prng(t)" ) | wd(12, "prng(t,5)") | wd(12, "prng(t,0,5)" );
     246        for ( 20 ) {
     247                sout | wd(26, prng( th )) | nonl;                               // cascading => side-effect functions called in arbitary order
     248                sout | wd(12, prng( th, 5 )) | nonl;
     249                sout | wd(12, prng( th, 0, 5 ));
    246250        } // for
    247251        sout | sepEnable;
     
    266270#endif // 0
    267271//      malloc_stats();
     272        // freelocale( loc );
    268273} // main
    269274
  • tests/concurrent/pthread/.expect/bounded_buffer.x64.txt

    r0348fd8 rd99a716  
    1 producer total value is 24150
    2 consumer total value is 24150
     1producer total value is 44280
     2consumer total value is 44280
  • tests/concurrent/pthread/.expect/bounded_buffer.x86.txt

    r0348fd8 rd99a716  
    1 producer total value is 5940
    2 consumer total value is 5940
     1producer total value is 45060
     2consumer total value is 45060
Note: See TracChangeset for help on using the changeset viewer.