Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/heap.cfa

    r07b59ec ra7662b8  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 28 18:27:53 2023
    13 // Update Count     : 1612
     12// Last Modified On : Fri Dec 30 08:37:37 2022
     13// Update Count     : 1605
    1414//
    1515
     
    369369static __thread size_t PAD1 CALIGN TLSMODEL __attribute__(( unused )); // protect false sharing
    370370static __thread Heap * heapManager CALIGN TLSMODEL;
    371 static  __thread bool heapManagerBootFlag CALIGN TLSMODEL = false;
    372371static __thread size_t PAD2 CALIGN TLSMODEL __attribute__(( unused )); // protect further false sharing
    373372
     
    489488                        allocUnfreed = 0;
    490489                        #endif // __CFA_DEBUG__
    491                         heapManagerBootFlag = true;
    492490                } // with
    493491        } // if
     
    501499
    502500        lock( heapMaster.mgrLock );                                                     // protect heapMaster counters
    503 
    504         assert( ! heapManagerBootFlag );
    505501
    506502        // get storage for heap manager
     
    518514
    519515void heapManagerDtor() libcfa_public {
    520   if ( unlikely( ! heapManagerBootFlag ) ) return;              // thread never used ?
    521 
    522516        lock( heapMaster.mgrLock );
    523517
     
    532526        // Do not set heapManager to NULL because it is used after Cforall is shutdown but before the program shuts down.
    533527
    534         heapManagerBootFlag = false;
    535528        unlock( heapMaster.mgrLock );
    536529} // heapManagerDtor
     
    542535extern int cfa_main_returned;                                                   // from interpose.cfa
    543536extern "C" {
    544         void memory_startup( void ) {                                           // singleton => called once at start of program
     537        void memory_startup( void ) {
    545538                if ( ! heapMasterBootFlag ) heapManagerCtor();  // sanity check
    546539        } // memory_startup
     
    902895#endif // __STATISTICS__
    903896
    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 
    912897#define PROLOG( counter, ... ) \
    913898        BOOT_HEAP_MANAGER; \
    914         if ( \
    915                 __NULL_0_ALLOC__ \
     899        if ( unlikely( size == 0 ) ||                                           /* 0 BYTE ALLOCATION RETURNS NULL POINTER */ \
    916900                unlikely( size > ULONG_MAX - sizeof(Heap.Storage) ) ) { /* error check */ \
    917901                STAT_0_CNT( counter ); \
Note: See TracChangeset for help on using the changeset viewer.