Changes in libcfa/src/heap.cfa [07b59ec:a7662b8]
- File:
-
- 1 edited
-
libcfa/src/heap.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/heap.cfa
r07b59ec ra7662b8 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 28 18:27:53 202313 // Update Count : 16 1212 // Last Modified On : Fri Dec 30 08:37:37 2022 13 // Update Count : 1605 14 14 // 15 15 … … 369 369 static __thread size_t PAD1 CALIGN TLSMODEL __attribute__(( unused )); // protect false sharing 370 370 static __thread Heap * heapManager CALIGN TLSMODEL; 371 static __thread bool heapManagerBootFlag CALIGN TLSMODEL = false;372 371 static __thread size_t PAD2 CALIGN TLSMODEL __attribute__(( unused )); // protect further false sharing 373 372 … … 489 488 allocUnfreed = 0; 490 489 #endif // __CFA_DEBUG__ 491 heapManagerBootFlag = true;492 490 } // with 493 491 } // if … … 501 499 502 500 lock( heapMaster.mgrLock ); // protect heapMaster counters 503 504 assert( ! heapManagerBootFlag );505 501 506 502 // get storage for heap manager … … 518 514 519 515 void heapManagerDtor() libcfa_public { 520 if ( unlikely( ! heapManagerBootFlag ) ) return; // thread never used ?521 522 516 lock( heapMaster.mgrLock ); 523 517 … … 532 526 // Do not set heapManager to NULL because it is used after Cforall is shutdown but before the program shuts down. 533 527 534 heapManagerBootFlag = false;535 528 unlock( heapMaster.mgrLock ); 536 529 } // heapManagerDtor … … 542 535 extern int cfa_main_returned; // from interpose.cfa 543 536 extern "C" { 544 void memory_startup( void ) { // singleton => called once at start of program537 void memory_startup( void ) { 545 538 if ( ! heapMasterBootFlag ) heapManagerCtor(); // sanity check 546 539 } // memory_startup … … 902 895 #endif // __STATISTICS__ 903 896 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 #else909 #define __NULL_0_ALLOC__910 #endif // __NONNULL_0_ALLOC__911 912 897 #define PROLOG( counter, ... ) \ 913 898 BOOT_HEAP_MANAGER; \ 914 if ( \ 915 __NULL_0_ALLOC__ \ 899 if ( unlikely( size == 0 ) || /* 0 BYTE ALLOCATION RETURNS NULL POINTER */ \ 916 900 unlikely( size > ULONG_MAX - sizeof(Heap.Storage) ) ) { /* error check */ \ 917 901 STAT_0_CNT( counter ); \
Note:
See TracChangeset
for help on using the changeset viewer.