Changes in / [0348fd8:d99a716]
- Files:
-
- 1 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/random.hfa
r0348fd8 rd99a716 10 10 // Created On : Fri Jan 14 07:18:11 2022 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Dec 11 18:43:58202213 // Update Count : 17 112 // Last Modified On : Thu Dec 22 20:54:22 2022 13 // Update Count : 178 14 14 // 15 15 16 16 #pragma once 17 17 18 #include <stdint.h> 18 #include <stdint.h> // uintXX_t 19 19 20 20 #define GLUE2( x, y ) x##y … … 24 24 #ifdef __x86_64__ // 64-bit architecture 25 25 // 64-bit generators 26 #define LEHMER6426 //#define LEHMER64 27 27 //#define XORSHIFT_12_25_27 28 //#define XOSHIRO256PP28 #define XOSHIRO256PP 29 29 //#define KISS_64 30 30 31 31 // 32-bit generators 32 #define XORSHIFT_6_21_733 //#define XOSHIRO128PP32 //#define XORSHIFT_6_21_7 33 #define XOSHIRO128PP 34 34 #else // 32-bit architecture 35 35 // 64-bit generators 36 #define XORSHIFT_13_7_17 36 //#define XORSHIFT_13_7_17 37 #define XOSHIRO256PP 37 38 38 39 // 32-bit generators 39 #define XORSHIFT_6_21_7 40 //#define XORSHIFT_6_21_7 41 #define XOSHIRO128PP 40 42 #endif // __x86_64__ 41 43 … … 47 49 #define PRNG_NAME_64 xoshiro256pp 48 50 #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;51 typedef struct PRNG_STATE_64_T { uint64_t s0, s1, s2, s3; } PRNG_STATE_64_T; 50 52 #endif // XOSHIRO256PP 51 53 … … 53 55 #define PRNG_NAME_32 xoshiro128pp 54 56 #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;57 typedef struct PRNG_STATE_32_T { uint32_t s0, s1, s2, s3; } PRNG_STATE_32_T; 56 58 #endif // XOSHIRO128PP 57 59 … … 110 112 111 113 // 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 114 118 115 119 #ifdef __cforall // don't include in C code (invoke.h) … … 126 130 127 131 #ifndef XOSHIRO256PP 128 typedef struct xoshiro256pp_t { uint64_t s [4]; } xoshiro256pp_t;132 typedef struct xoshiro256pp_t { uint64_t s0, s1, s2, s3; } xoshiro256pp_t; 129 133 #endif // ! XOSHIRO256PP 130 134 131 135 static 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 ) { 133 137 return (x << k) | (x >> (64 - k)); 134 138 } // rotl 135 139 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 ); 145 149 return result; 146 150 } // xoshiro256pp 147 151 148 static inline void xoshiro256pp_set_seed( xoshiro256pp_t & state, 149 state = (xoshiro256pp_t){ {seed, seed, seed, seed}};152 static inline void xoshiro256pp_set_seed( xoshiro256pp_t & state, uint64_t seed ) { 153 state = (xoshiro256pp_t){ seed, seed, seed, seed }; 150 154 xoshiro256pp( state ); 151 155 } // xoshiro256pp_set_seed … … 161 165 162 166 #ifndef XOSHIRO128PP 163 typedef struct xoshiro128pp_t { uint32_t s [4]; } xoshiro128pp_t;167 typedef struct xoshiro128pp_t { uint32_t s0, s1, s2, s3; } xoshiro128pp_t; 164 168 #endif // ! XOSHIRO128PP 165 169 … … 169 173 } // rotl 170 174 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 ); 180 184 return result; 181 185 } // xoshiro128pp 182 186 183 187 static 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 }; 185 189 xoshiro128pp( state ); // prime 186 190 } // xoshiro128pp_set_seed 187 191 188 192 #ifdef __SIZEOF_INT128__ 189 // Pipelined to allow out-of-order overlap with reduced dependencies. Critically, the current random state is190 // returned (copied), and then compute and store the next random value.191 193 //-------------------------------------------------- 192 194 static inline uint64_t lehmer64( __uint128_t & state ) { 193 195 __uint128_t ret = state; 194 state *= 0x da942042e4dd58b5;196 state *= 0x_da94_2042_e4dd_58b5; 195 197 return ret >> 64; 196 198 } // lehmer64 197 199 198 200 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. 199 202 state = seed; 200 lehmer64( state ); 203 lehmer64( state ); // prime 201 204 } // lehmer64_set_seed 202 205 … … 272 275 #endif // ! KISS_64 273 276 274 static inline uint64_t kiss_64( kiss_64_t & state ) with(state) {275 kiss_64_t ret = state;277 static inline uint64_t kiss_64( kiss_64_t & rs ) with(rs) { 278 kiss_64_t ret = rs; 276 279 z = 36969 * (z & 65535) + (z >> 16); 277 280 w = 18000 * (w & 65535) + (w >> 16); 278 jsr ^= (jsr << 17);279 281 jsr ^= (jsr << 13); 282 jsr ^= (jsr >> 17); 280 283 jsr ^= (jsr << 5); 281 284 jcong = 69069 * jcong + 1234567; … … 283 286 } // kiss_64 284 287 285 static inline void kiss_64_set_seed( kiss_64_t & state, uint64_t seed ) with(state) {288 static inline void kiss_64_set_seed( kiss_64_t & rs, uint64_t seed ) with(rs) { 286 289 z = 1; w = 1; jsr = 4; jcong = seed; 287 kiss_64( state );// prime290 kiss_64( rs ); // prime 288 291 } // kiss_64_set_seed 289 292 … … 294 297 #endif // ! XORWOW 295 298 296 static inline uint32_t xorwow( xorwow_t & state ) with(state) {299 static inline uint32_t xorwow( xorwow_t & rs ) with(rs) { 297 300 // Algorithm "xorwow" from p. 5 of Marsaglia, "Xorshift RNGs". 298 301 uint32_t ret = a + counter; … … 312 315 } // xorwow 313 316 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 );// prime317 static inline void xorwow_set_seed( xorwow_t & rs, uint32_t seed ) { 318 rs = (xorwow_t){ seed, seed, seed, seed, 0 }; 319 xorwow( rs ); // prime 317 320 } // xorwow_set_seed 318 321 … … 326 329 327 330 // 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;331 static inline uint32_t LCGBI_fwd( uint64_t & rs ) { 332 rs = (A * rs + C) & (M - 1); 333 return rs >> D; 331 334 } // LCGBI_fwd 332 335 333 static inline uint32_t LCGBI_bck( uint64_t & state) {334 unsigned int r = state>> D;335 state = AI * (state- C) & (M - 1);336 static inline uint32_t LCGBI_bck( uint64_t & rs ) { 337 unsigned int r = rs >> D; 338 rs = AI * (rs - C) & (M - 1); 336 339 return r; 337 340 } // LCGBI_bck -
libcfa/src/heap.cfa
r0348fd8 rd99a716 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Oct 30 20:56:20202213 // Update Count : 15 8412 // Last Modified On : Wed Dec 28 12:37:38 2022 13 // Update Count : 1597 14 14 // 15 15 … … 17 17 #include <string.h> // memset, memcpy 18 18 #include <limits.h> // ULONG_MAX 19 #include <stdlib.h> // EXIT_FAILURE20 19 #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 23 21 #include <sys/mman.h> // mmap, munmap 24 22 extern "C" { … … 26 24 } // extern "C" 27 25 26 #include "heap.hfa" 28 27 #include "bits/align.hfa" // libAlign 29 28 #include "bits/defs.hfa" // likely, unlikely … … 140 139 #endif 141 140 142 typedef volatile uintptr_t SpinLock_t CALIGN; // aligned addressable word-size141 typedef volatile uintptr_t SpinLock_t; 143 142 144 143 static inline __attribute__((always_inline)) void lock( volatile SpinLock_t & slock ) { … … 147 146 148 147 for ( unsigned int i = 1;; i += 1 ) { 149 if ( slock == 0 && __atomic_test_and_set( &slock, __ATOMIC_ SEQ_CST) == 0 ) break; // Fence148 if ( slock == 0 && __atomic_test_and_set( &slock, __ATOMIC_ACQUIRE ) == 0 ) break; // Fence 150 149 for ( volatile unsigned int s = 0; s < spin; s += 1 ) Pause(); // exponential spin 151 150 spin += spin; // powers of 2 … … 156 155 157 156 static inline __attribute__((always_inline)) void unlock( volatile SpinLock_t & slock ) { 158 __atomic_clear( &slock, __ATOMIC_ SEQ_CST); // Fence157 __atomic_clear( &slock, __ATOMIC_RELEASE ); // Fence 159 158 } // spin_unlock 160 159 … … 261 260 static_assert( libAlign() >= sizeof( Storage ), "minimum alignment < sizeof( Storage )" ); 262 261 263 struct __attribute__(( aligned (8) ))FreeHeader {264 size_t blockSize __attribute__(( aligned(8) ));// size of allocations on this list262 struct CALIGN FreeHeader { 263 size_t blockSize CALIGN; // size of allocations on this list 265 264 #ifdef OWNERSHIP 266 265 #ifdef RETURNSPIN … … 284 283 285 284 #ifdef __CFA_DEBUG__ 286 int64_t allocUnfreed; // running total of allocations minus frees; can be negative285 ptrdiff_t allocUnfreed; // running total of allocations minus frees; can be negative 287 286 #endif // __CFA_DEBUG__ 288 287 … … 369 368 // Thread-local storage is allocated lazily when the storage is accessed. 370 369 static __thread size_t PAD1 CALIGN TLSMODEL __attribute__(( unused )); // protect false sharing 371 static __thread Heap * volatileheapManager CALIGN TLSMODEL;370 static __thread Heap * heapManager CALIGN TLSMODEL; 372 371 static __thread size_t PAD2 CALIGN TLSMODEL __attribute__(( unused )); // protect further false sharing 373 372 … … 443 442 // 12K ~= 120K byte superblock. Where 128-heap superblock handles a medium sized multi-processor server. 444 443 size_t remaining = heapManagersStorageEnd - heapManagersStorage; // remaining free heaps in superblock 445 if ( ! heapManagersStorage || remaining != 0 ) {444 if ( ! heapManagersStorage || remaining == 0 ) { 446 445 // Each block of heaps is a multiple of the number of cores on the computer. 447 446 int HeapDim = get_nprocs(); // get_nprocs_conf does not work … … 562 561 // allocUnfreed is set to 0 when a heap is created and it accumulates any unfreed storage during its multiple thread 563 562 // 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; 565 564 for ( Heap * heap = heapMaster.heapManagersList; heap; heap = heap->nextHeapManager ) { 566 565 allocUnfreed += heap->allocUnfreed; … … 572 571 char helpText[512]; 573 572 __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" 575 574 "Possible cause is unfreed storage allocated by the program or system/library routines called from the program.\n", 576 575 (long int)getpid(), allocUnfreed, allocUnfreed ); // always print the UNIX pid … … 950 949 block = freeHead->freeList; // remove node from stack 951 950 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 there951 // Freelist for this size is empty, so check return list (OWNERSHIP), or carve it out of the heap if there 953 952 // is enough left, or get some more heap storage and carve it off. 954 953 #ifdef OWNERSHIP … … 1115 1114 while ( ! __atomic_compare_exchange_n( &freeHead->returnList, &header->kind.real.next, (Heap.Storage *)header, 1116 1115 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__ 1117 1122 #endif // RETURNSPIN 1118 1123 } // if … … 1125 1130 freeHead->freeList = (Heap.Storage *)header; 1126 1131 #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__1133 1132 1134 1133 // OK TO BE PREEMPTED HERE AS heapManager IS NO LONGER ACCESSED. … … 1180 1179 1181 1180 #ifdef __STATISTICS__ 1182 static void incCalls( intptr_t statName ) libcfa_nopreempt {1181 static void incCalls( size_t statName ) libcfa_nopreempt { 1183 1182 heapManager->stats.counters[statName].calls += 1; 1184 1183 } // incCalls 1185 1184 1186 static void incZeroCalls( intptr_t statName ) libcfa_nopreempt {1185 static void incZeroCalls( size_t statName ) libcfa_nopreempt { 1187 1186 heapManager->stats.counters[statName].calls_0 += 1; 1188 1187 } // incZeroCalls … … 1456 1455 // 0p, no operation is performed. 1457 1456 void free( void * addr ) libcfa_public { 1458 // verify( heapManager );1459 1460 1457 if ( unlikely( addr == 0p ) ) { // special case 1461 1458 #ifdef __STATISTICS__ -
src/AST/Pass.hpp
r0348fd8 rd99a716 86 86 { 87 87 // 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 ) { 90 90 *const_cast<type **>( visitor ) = this; 91 91 } … … 98 98 99 99 /// 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' ); 102 102 } 103 103 -
src/AST/Pass.proto.hpp
r0348fd8 rd99a716 489 489 template<typename core_t> 490 490 static inline auto replace( core_t &, long, const ast::TypeInstType *& ) {} 491 492 491 } // namespace forall 493 492 … … 506 505 } 507 506 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 } 520 522 } // namespace __pass 521 523 } // namespace ast -
src/CompilationState.cc
r0348fd8 rd99a716 33 33 useNewAST = true, 34 34 nomainp = false, 35 parsep = false,36 35 resolvep = false, 37 36 resolvprotop = false, -
src/CompilationState.h
r0348fd8 rd99a716 32 32 useNewAST, 33 33 nomainp, 34 parsep,35 34 resolvep, 36 35 resolvprotop, -
src/GenPoly/Box.cc
r0348fd8 rd99a716 424 424 namespace { 425 425 std::string makePolyMonoSuffix( FunctionType const * function, const TyVarMap &tyVars ) { 426 std::stringstream name;427 428 426 // NOTE: this function previously used isPolyObj, which failed to produce 429 427 // the correct thing in some situations. It's not clear to me why this wasn't working. … … 432 430 // to take those polymorphic types as pointers. Therefore, there can be two different functions 433 431 // with the same mangled name, so we need to further mangle the names. 432 std::stringstream name; 434 433 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 << '_'; 442 437 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 } 449 440 return name.str(); 450 441 } … … 565 556 // even when converted to strings, sort in the original order. 566 557 // (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 ) { 568 559 if ( !tyParam.second.isComplete ) continue; 569 560 Type *concrete = env->lookup( tyParam.first ); -
src/GenPoly/ScrubTyVars.cc
r0348fd8 rd99a716 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Oct 7 15:42:00 202213 // Update Count : 512 // Last Modified On : Wed Dec 7 17:01:00 2022 13 // Update Count : 6 14 14 // 15 15 … … 117 117 namespace { 118 118 119 enum class ScrubMode {120 FromMap,121 DynamicFromMap,122 All,123 };124 125 119 struct ScrubTypeVars : 126 120 public ast::WithGuards, … … 253 247 } 254 248 249 } // namespace 250 255 251 const ast::Node * scrubTypeVarsBase( 256 const ast::Node * target, 257 ScrubMode mode, const TypeVarMap * typeVars ) { 252 const ast::Node * node, const TypeVarMap * typeVars, ScrubMode mode ) { 258 253 if ( ScrubMode::All == mode ) { 259 254 assert( nullptr == typeVars ); … … 262 257 } 263 258 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 ); 284 260 } 285 261 -
src/GenPoly/ScrubTyVars.h
r0348fd8 rd99a716 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Oct 7 15:51:00 202213 // Update Count : 412 // Last Modified On : Wed Dec 7 16:57:00 2022 13 // Update Count : 5 14 14 // 15 15 … … 109 109 } 110 110 111 // ScrubMode and scrubTypeVarsBase are internal. 112 enum class ScrubMode { FromMap, DynamicFromMap, All }; 113 114 const ast::Node * scrubTypeVarsBase( 115 const ast::Node * target, const TypeVarMap * typeVars, ScrubMode mode ); 116 117 111 118 /// For all polymorphic types with type variables in `typeVars`, 112 119 /// replaces generic types, dtypes, and ftypes with the appropriate void type, … … 116 123 node_t const * target, const TypeVarMap & typeVars ) { 117 124 return strict_dynamic_cast<node_t const *>( 118 scrubTypeVars <ast::Node>( target, typeVars) );125 scrubTypeVarsBase( target, &typeVars, ScrubMode::FromMap ) ); 119 126 } 120 127 … … 123 130 /// and sizeof/alignof expressions with the proper variable. 124 131 template<typename node_t> 125 ast::Nodeconst * scrubTypeVarsDynamic(132 node_t const * scrubTypeVarsDynamic( 126 133 node_t const * target, const TypeVarMap & typeVars ) { 127 134 return strict_dynamic_cast<node_t const *>( 128 scrubTypeVars Dynamic<ast::Node>( target, typeVars) );135 scrubTypeVarsBase( target, &typeVars, ScrubMode::DynamicFromMap ) ); 129 136 } 130 137 … … 134 141 node_t const * scrubAllTypeVars( node_t const * target ) { 135 142 return strict_dynamic_cast<node_t const *>( 136 scrub AllTypeVars<ast::Node>( target) );143 scrubTypeVarsBase( target, nullptr, ScrubMode::All ) ); 137 144 } 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 );150 145 151 146 } // namespace GenPoly -
src/Parser/RunParser.cpp
r0348fd8 rd99a716 10 10 // Created On : Mon Dec 19 11:00:00 2022 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Dec 19 11:15:00 202213 // Update Count : 012 // Last Modified On : Thr Dec 22 10:18:00 2022 13 // Update Count : 1 14 14 // 15 15 16 16 #include "RunParser.hpp" 17 17 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 18 22 #include "Parser/ParseNode.h" // for DeclarationNode, buildList 19 23 #include "Parser/TypedefTable.h" // for TypedefTable … … 41 45 } // parse 42 46 43 void dumpParseTree( std::ostream & out ) { 44 parseTree->printList( out ); 45 delete parseTree; 46 parseTree = nullptr; 47 } 48 49 std::list<Declaration *> buildUnit(void) { 47 ast::TranslationUnit buildUnit(void) { 50 48 std::list<Declaration *> translationUnit; 51 49 buildList( parseTree, translationUnit ); … … 54 52 parseTree = nullptr; 55 53 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; 57 61 } 58 62 -
src/Parser/RunParser.hpp
r0348fd8 rd99a716 10 10 // Created On : Mon Dec 19 10:42:00 2022 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Dec 19 11:15:00 202213 // Update Count : 012 // Last Modified On : Thr Dec 22 10:23:00 2022 13 // Update Count : 1 14 14 // 15 15 … … 17 17 18 18 #include <iosfwd> // for ostream 19 #include <list> // for list20 19 21 20 #include "SynTree/LinkageSpec.h" // for Spec 22 class Declaration; 21 namespace ast { 22 class TranslationUnit; 23 } 23 24 24 25 // The Parser does not have an enclosing namespace. … … 30 31 void parse( FILE * input, LinkageSpec::Spec linkage, bool alwaysExit = false ); 31 32 32 /// Drain the internal accumulator of parsed code and print it to the stream.33 void dumpParseTree( std::ostream & );34 35 33 /// Drain the internal accumulator of parsed code and build a translation 36 34 /// unit from it. 37 std::list<Declaration *>buildUnit(void);35 ast::TranslationUnit buildUnit(void); 38 36 39 37 // Local Variables: // -
src/main.cc
r0348fd8 rd99a716 228 228 ostream * output = & cout; 229 229 list< Declaration * > translationUnit; 230 ast::TranslationUnit transUnit; 230 231 231 232 Signal( SIGSEGV, sigSegvBusHandler, SA_SIGINFO ); … … 294 295 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, yydebug ); 295 296 296 if ( parsep ) { 297 dumpParseTree( cout ); 298 return EXIT_SUCCESS; 299 } // if 300 301 translationUnit = buildUnit(); 297 transUnit = buildUnit(); 302 298 303 299 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 312 304 Stats::Time::StopBlock(); 313 305 … … 316 308 ast::pass_visitor_stats.max = Stats::Counters::build<Stats::Counters::MaxCounter<double>>("Max depth - New"); 317 309 } 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 329 311 PASS( "Hoist Type Decls", Validate::hoistTypeDecls( transUnit ) ); 330 312 // Hoist Type Decls pulls some declarations out of contexts where … … 333 315 forceFillCodeLocations( transUnit ); 334 316 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 ) ); 335 324 PASS( "Replace Typedefs", Validate::replaceTypedef( transUnit ) ); 336 325 PASS( "Fix Return Types", Validate::fixReturnTypes( transUnit ) ); … … 474 463 if ( errorp ) { 475 464 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 } 477 472 cerr << endl << "---End of AST, begin error message:---\n" << endl; 478 473 } // if … … 578 573 { "rproto", resolvprotop, true, "resolver-proto instance" }, 579 574 { "rsteps", resolvep, true, "print resolver steps" }, 580 { "tree", parsep, true, "print parse tree" },581 575 // code dumps 582 576 { "ast", astp, true, "print AST after parsing" }, -
tests/.expect/PRNG.x64.txt
r0348fd8 rd99a716 1 1 2 PRNG() PRNG(5)PRNG(0,5)3 861 3 04 10137507171299805328 125 12205946788447993741 4 0 6 16222929371023265189 257 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 23 23 seed 1009 24 24 25 25 Sequential 26 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%26 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 27 27 28 28 Concurrent 29 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%30 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%31 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%32 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%29 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 30 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 31 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 32 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 33 33 34 prng() prng(5)prng(0,5)35 861 3 036 10137507171299805328 1237 12205946788447993741 4 0 38 16222929371023265189 2539 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 55 55 seed 1009 56 56 57 57 Sequential 58 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%58 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 59 59 60 60 Concurrent 61 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%62 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%63 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%64 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%61 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 62 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 63 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 64 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 65 65 66 prng(t) prng(t,5)prng(t,0,5)67 861 3 068 10137507171299805328 1269 12205946788447993741 4 0 70 16222929371023265189 2571 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 87 87 seed 1009 88 88 89 89 Sequential 90 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%90 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 91 91 92 92 Concurrent 93 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%94 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%95 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%96 trials 100000000 buckets 100000 min 87 5 max 1138 avg 1000.0 std 31.8rstd 3.2%93 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 94 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 95 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% 96 trials 100000000 buckets 100000 min 871 max 1144 avg 1000.0 std 31.6 rstd 3.2% -
tests/.expect/PRNG.x86.txt
r0348fd8 rd99a716 1 1 2 PRNG() PRNG(5)PRNG(0,5)3 8333105 1 24 1989339636 4 55 266970699 3 26 1928130121 3 47 1351003938 4 58 1624164922 4 39 363429604 1 210 3355083174 1111 214422584 1 112 2266729947 1 213 3649702519 2 414 2250875012 2 415 4184653025 1 316 2640851227 2 517 206468178 2 318 2600873108 1 319 3007574582 3 320 394476790 0 221 1312145388 1 522 2989081290 2 42 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 23 23 seed 1009 24 24 25 25 Sequential 26 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%26 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 27 27 28 28 Concurrent 29 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%30 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%31 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%32 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%29 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 30 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 31 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 32 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 33 33 34 prng() prng(5)prng(0,5)35 8333105 1 236 1989339636 4 537 266970699 3 238 1928130121 3 439 1351003938 4 540 1624164922 4 341 363429604 1 242 3355083174 1143 214422584 1 144 2266729947 1 245 3649702519 2 446 2250875012 2 447 4184653025 1 348 2640851227 2 549 206468178 2 350 2600873108 1 351 3007574582 3 352 394476790 0 253 1312145388 1 554 2989081290 2 434 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 55 55 seed 1009 56 56 57 57 Sequential 58 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%58 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 59 59 60 60 Concurrent 61 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%62 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%63 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%64 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%61 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 62 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 63 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 64 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 65 65 66 prng(t) prng(t,5)prng(t,0,5)67 8333105 1 268 1989339636 4 569 266970699 3 270 1928130121 3 471 1351003938 4 572 1624164922 4 373 363429604 1 274 3355083174 1175 214422584 1 176 2266729947 1 277 3649702519 2 478 2250875012 2 479 4184653025 1 380 2640851227 2 581 206468178 2 382 2600873108 1 383 3007574582 3 384 394476790 0 285 1312145388 1 586 2989081290 2 466 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 87 87 seed 1009 88 88 89 89 Sequential 90 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%90 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 91 91 92 92 Concurrent 93 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%94 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%95 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%96 trials 100000000 buckets 100000 min 8 73 max 1140 avg 1000.0 std 31.3 rstd 3.1%93 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 94 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 95 trials 100000000 buckets 100000 min 867 max 1135 avg 1000.0 std 31.7 rstd 3.2% 96 trials 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 801 total 155 -
tests/.expect/nested_function.x86.txt
r0348fd8 rd99a716 1 total 551 total 105 -
tests/PRNG.cfa
r0348fd8 rd99a716 8 8 // Created On : Wed Dec 29 09:38:12 2021 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Tue Nov 22 22:51:12202211 // Update Count : 38110 // Last Modified On : Wed Dec 21 20:39:59 2022 11 // Update Count : 406 12 12 // 13 13 … … 60 60 61 61 62 unsigned int seed = 1009;62 size_t seed = 1009; 63 63 64 64 thread T1 {}; … … 116 116 } // dummy 117 117 118 118 119 int main() { 119 120 // 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 ); 121 125 122 126 enum { TASKS = 4 }; … … 130 134 131 135 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(1 0, rand() % 5) | nonl;136 sout | wd(1 3, 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); 137 141 } // for 138 142 sout | sepEnable; … … 168 172 169 173 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 order173 sout | wd(1 0, prng( prng, 5 )) | nonl;174 sout | wd(1 3, 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 )); 175 179 } // for 176 180 sout | sepEnable; … … 203 207 204 208 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 order208 sout | wd(1 0, prng( 5 )) | nonl;209 sout | wd(1 3, 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 )); 210 214 } // for 211 215 sout | sepEnable; … … 239 243 240 244 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 order244 sout | wd(1 0, prng( th, 5 )) | nonl;245 sout | wd(1 3, 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 )); 246 250 } // for 247 251 sout | sepEnable; … … 266 270 #endif // 0 267 271 // malloc_stats(); 272 // freelocale( loc ); 268 273 } // main 269 274 -
tests/concurrent/pthread/.expect/bounded_buffer.x64.txt
r0348fd8 rd99a716 1 producer total value is 241502 consumer total value is 241501 producer total value is 44280 2 consumer total value is 44280 -
tests/concurrent/pthread/.expect/bounded_buffer.x86.txt
r0348fd8 rd99a716 1 producer total value is 59402 consumer total value is 59401 producer total value is 45060 2 consumer total value is 45060
Note: See TracChangeset
for help on using the changeset viewer.