Changeset 210c737 for libcfa/src


Ignore:
Timestamp:
Aug 1, 2023, 10:26:10 PM (2 years ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
2cb15b0, d5f5eb7
Parents:
4852232 (diff), afb3d68 (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

Location:
libcfa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/heap.cfa

    r4852232 r210c737  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Dec 30 08:37:37 2022
    13 // Update Count     : 1605
     12// Last Modified On : Fri Jul 28 18:27:53 2023
     13// Update Count     : 1612
    1414//
    1515
     
    369369static __thread size_t PAD1 CALIGN TLSMODEL __attribute__(( unused )); // protect false sharing
    370370static __thread Heap * heapManager CALIGN TLSMODEL;
     371static  __thread bool heapManagerBootFlag CALIGN TLSMODEL = false;
    371372static __thread size_t PAD2 CALIGN TLSMODEL __attribute__(( unused )); // protect further false sharing
    372373
     
    488489                        allocUnfreed = 0;
    489490                        #endif // __CFA_DEBUG__
     491                        heapManagerBootFlag = true;
    490492                } // with
    491493        } // if
     
    499501
    500502        lock( heapMaster.mgrLock );                                                     // protect heapMaster counters
     503
     504        assert( ! heapManagerBootFlag );
    501505
    502506        // get storage for heap manager
     
    514518
    515519void heapManagerDtor() libcfa_public {
     520  if ( unlikely( ! heapManagerBootFlag ) ) return;              // thread never used ?
     521
    516522        lock( heapMaster.mgrLock );
    517523
     
    526532        // Do not set heapManager to NULL because it is used after Cforall is shutdown but before the program shuts down.
    527533
     534        heapManagerBootFlag = false;
    528535        unlock( heapMaster.mgrLock );
    529536} // heapManagerDtor
     
    535542extern int cfa_main_returned;                                                   // from interpose.cfa
    536543extern "C" {
    537         void memory_startup( void ) {
     544        void memory_startup( void ) {                                           // singleton => called once at start of program
    538545                if ( ! heapMasterBootFlag ) heapManagerCtor();  // sanity check
    539546        } // memory_startup
     
    895902#endif // __STATISTICS__
    896903
     904// Uncomment to get allocation addresses for a 0-sized allocation rather than a null pointer.
     905//#define __NONNULL_0_ALLOC__
     906#if ! defined( __NONNULL_0_ALLOC__ )
     907#define __NULL_0_ALLOC__ unlikely( size == 0 ) ||               /* 0 BYTE ALLOCATION RETURNS NULL POINTER */
     908#else
     909#define __NULL_0_ALLOC__
     910#endif // __NONNULL_0_ALLOC__
     911
    897912#define PROLOG( counter, ... ) \
    898913        BOOT_HEAP_MANAGER; \
    899         if ( unlikely( size == 0 ) ||                                           /* 0 BYTE ALLOCATION RETURNS NULL POINTER */ \
     914        if ( \
     915                __NULL_0_ALLOC__ \
    900916                unlikely( size > ULONG_MAX - sizeof(Heap.Storage) ) ) { /* error check */ \
    901917                STAT_0_CNT( counter ); \
  • libcfa/src/iostream.cfa

    r4852232 r210c737  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 18 13:56:01 2023
    13 // Update Count     : 1403
     12// Last Modified On : Sun Jul 30 23:01:00 2023
     13// Update Count     : 1406
    1414//
    1515
     
    230230        ostype & ?|?( ostype & os, const char s[] ) {
    231231                enum { Open = 1, Close, OpenClose };
    232                 static const unsigned char mask[256] @= {
     232                static const unsigned char mask[256] @= {               // 256 covers all Latin-1 characters
    233233                        // opening delimiters, no space after
    234234                        ['('] : Open, ['['] : Open, ['{'] : Open,
Note: See TracChangeset for help on using the changeset viewer.