- Timestamp:
- May 8, 2020, 2:42:45 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 5c581cc
- Parents:
- dd4e2d7 (diff), 0dedf027 (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. - Location:
- libcfa
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/configure
rdd4e2d7 r6c12fd28 790 790 enable_distcc 791 791 with_cfa_name 792 enable_static 792 793 enable_shared 793 enable_static794 794 with_pic 795 795 enable_fast_install … … 1452 1452 --disable-silent-rules verbose build output (undo: "make V=0") 1453 1453 --enable-distcc whether or not to enable distributed compilation 1454 --enable-static[=PKGS] build static libraries [default=no] 1454 1455 --enable-shared[=PKGS] build shared libraries [default=yes] 1455 --enable-static[=PKGS] build static libraries [default=yes]1456 1456 --enable-fast-install[=PKGS] 1457 1457 optimize for fast installation [default=yes] … … 8030 8030 8031 8031 # Set options 8032 # Check whether --enable-static was given. 8033 if test "${enable_static+set}" = set; then : 8034 enableval=$enable_static; p=${PACKAGE-default} 8035 case $enableval in 8036 yes) enable_static=yes ;; 8037 no) enable_static=no ;; 8038 *) 8039 enable_static=no 8040 # Look at the argument we got. We use all the common list separators. 8041 lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, 8042 for pkg in $enableval; do 8043 IFS=$lt_save_ifs 8044 if test "X$pkg" = "X$p"; then 8045 enable_static=yes 8046 fi 8047 done 8048 IFS=$lt_save_ifs 8049 ;; 8050 esac 8051 else 8052 enable_static=no 8053 fi 8054 8055 8056 8057 8058 8059 8060 8032 8061 8033 8062 … … 8062 8091 fi 8063 8092 8064 8065 8066 8067 8068 8069 8070 8071 8072 # Check whether --enable-static was given.8073 if test "${enable_static+set}" = set; then :8074 enableval=$enable_static; p=${PACKAGE-default}8075 case $enableval in8076 yes) enable_static=yes ;;8077 no) enable_static=no ;;8078 *)8079 enable_static=no8080 # Look at the argument we got. We use all the common list separators.8081 lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,8082 for pkg in $enableval; do8083 IFS=$lt_save_ifs8084 if test "X$pkg" = "X$p"; then8085 enable_static=yes8086 fi8087 done8088 IFS=$lt_save_ifs8089 ;;8090 esac8091 else8092 enable_static=yes8093 fi8094 8093 8095 8094 … … 17728 17727 macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' 17729 17728 macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' 17729 enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' 17730 17730 enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' 17731 enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'17732 17731 pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' 17733 17732 enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' … … 18857 18856 macro_revision=$macro_revision 18858 18857 18858 # Whether or not to build static libraries. 18859 build_old_libs=$enable_static 18860 18859 18861 # Whether or not to build shared libraries. 18860 18862 build_libtool_libs=$enable_shared 18861 18862 # Whether or not to build static libraries.18863 build_old_libs=$enable_static18864 18863 18865 18864 # What type of objects to build. -
libcfa/configure.ac
rdd4e2d7 r6c12fd28 109 109 110 110 # Checks for programs. 111 LT_INIT 111 LT_INIT([disable-static]) 112 112 113 113 AC_PROG_CXX -
libcfa/src/bits/locks.hfa
rdd4e2d7 r6c12fd28 115 115 char * strerror(int); 116 116 } 117 #define CHECKED(x) { int err = x; if( err != 0 ) abort("KERNEL ERROR: %s\n", strerror(err)); }117 #define CHECKED(x) { int err = x; if( err != 0 ) abort("KERNEL ERROR: Operation \"" #x "\" return error %d - %s\n", err, strerror(err)); } 118 118 119 119 struct __bin_sem_t { -
libcfa/src/concurrency/kernel.cfa
rdd4e2d7 r6c12fd28 901 901 // Wake them up 902 902 __cfadbg_print_safe(runtime_core, "Kernel : waking Processor %p\n", this->idles.head); 903 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 903 904 post( this->idles.head->idle ); 904 905 … … 911 912 static bool __wake_proc(processor * this) { 912 913 __cfadbg_print_safe(runtime_core, "Kernel : waking Processor %p\n", this); 913 return post( this->idle ); 914 915 disable_interrupts(); 916 /* paranoid */ verify( ! kernelTLS.preemption_state.enabled ); 917 bool ret = post( this->idle ); 918 enable_interrupts( __cfaabi_dbg_ctx ); 919 920 return ret; 914 921 } 915 922 -
libcfa/src/heap.cfa
rdd4e2d7 r6c12fd28 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Apr 18 17:43:15202013 // Update Count : 7 1812 // Last Modified On : Wed May 6 17:29:26 2020 13 // Update Count : 727 14 14 // 15 15 … … 19 19 #include <errno.h> // errno 20 20 #include <string.h> // memset, memcpy 21 #include <limits.h> // ULONG_MAX 21 22 extern "C" { 22 23 #include <sys/mman.h> // mmap, munmap 23 24 } // extern "C" 24 25 25 // #comment TD : Many of these should be merged into math I believe26 26 #include "bits/align.hfa" // libPow2 27 27 #include "bits/defs.hfa" // likely, unlikely … … 30 30 //#include "stdlib.hfa" // bsearchl 31 31 #include "malloc.h" 32 #include "bitmanip.hfa" // ceiling 32 33 33 34 #define MIN(x, y) (y > x ? x : y) … … 81 82 }; 82 83 84 size_t default_heap_expansion() __attribute__(( weak )) { 85 return __CFA_DEFAULT_HEAP_EXPANSION__; 86 } // default_heap_expansion 87 83 88 size_t default_mmap_start() __attribute__(( weak )) { 84 89 return __CFA_DEFAULT_MMAP_START__; 85 90 } // default_mmap_start 86 87 size_t default_heap_expansion() __attribute__(( weak )) {88 return __CFA_DEFAULT_HEAP_EXPANSION__;89 } // default_heap_expansion90 91 91 92 … … 360 361 361 362 362 static inline bool setHeapExpand( size_t value ) {363 if ( heapExpand < pageSize ) return true;364 heapExpand = value;365 return false;366 } // setHeapExpand367 368 369 363 // thunk problem 370 364 size_t Bsearchl( unsigned int key, const unsigned int * vals, size_t dim ) { … … 383 377 384 378 static inline bool setMmapStart( size_t value ) { // true => mmapped, false => sbrk 385 if ( value < pageSize || bucketSizes[NoBucketSizes - 1] < value ) return true;379 if ( value < pageSize || bucketSizes[NoBucketSizes - 1] < value ) return false; 386 380 mmapStart = value; // set global 387 381 … … 390 384 assert( maxBucketsUsed < NoBucketSizes ); // subscript failure ? 391 385 assert( mmapStart <= bucketSizes[maxBucketsUsed] ); // search failure ? 392 return false;386 return true; 393 387 } // setMmapStart 394 388 … … 449 443 450 444 #ifdef __CFA_DEBUG__ 451 checkHeader( addr < heapBegin || header < (HeapManager.Storage.Header *)heapBegin, name, addr );// bad low address ?445 checkHeader( addr < heapBegin, name, addr ); // bad low address ? 452 446 #endif // __CFA_DEBUG__ 453 447 … … 508 502 // along with the block and is a multiple of the alignment size. 509 503 510 if ( unlikely( size > ~0ul- sizeof(HeapManager.Storage) ) ) return 0p;504 if ( unlikely( size > ULONG_MAX - sizeof(HeapManager.Storage) ) ) return 0p; 511 505 size_t tsize = size + sizeof(HeapManager.Storage); 512 506 if ( likely( tsize < mmapStart ) ) { // small size => sbrk … … 560 554 block->header.kind.real.home = freeElem; // pointer back to free list of apropriate size 561 555 } else { // large size => mmap 562 if ( unlikely( size > ~0ul- pageSize ) ) return 0p;556 if ( unlikely( size > ULONG_MAX - pageSize ) ) return 0p; 563 557 tsize = libCeiling( tsize, pageSize ); // must be multiple of page size 564 558 #ifdef __STATISTICS__ … … 702 696 #endif // FASTLOOKUP 703 697 704 if ( setMmapStart( default_mmap_start() ) ) {698 if ( ! setMmapStart( default_mmap_start() ) ) { 705 699 abort( "HeapManager : internal error, mmap start initialization failure." ); 706 700 } // if … … 708 702 709 703 char * end = (char *)sbrk( 0 ); 710 sbrk( (char *)libCeiling( (long unsigned int)end, libAlign() ) - end ); // move start of heap to multiple of alignment 711 heapBegin = heapEnd = sbrk( 0 ); // get new start point 704 heapBegin = heapEnd = sbrk( (char *)libCeiling( (long unsigned int)end, libAlign() ) - end ); // move start of heap to multiple of alignment 712 705 } // HeapManager 713 706 … … 735 728 //assert( heapManager.heapBegin != 0 ); 736 729 //heapManager{}; 737 if ( heapManager.heapBegin == 0p ) heapManager{}; 730 if ( heapManager.heapBegin == 0p ) heapManager{}; // sanity check 738 731 } // memory_startup 739 732 … … 863 856 #endif // __STATISTICS__ 864 857 865 size_t size = dim * elemSize; 866 char * addr = (char *)mallocNoStats( size ); 867 if ( unlikely( addr == 0p ) ) return 0p; 868 869 HeapManager.Storage.Header * header; 870 HeapManager.FreeHeader * freeElem; 871 size_t bsize, alignment; 872 headers( "aalloc", addr, header, freeElem, bsize, alignment ); 873 874 header->kind.real.blockSize |= 2; // mark as zero filled 875 return addr; 858 return mallocNoStats( dim * elemSize ); 876 859 } // aalloc 877 860 … … 914 897 915 898 // change size, DO NOT preserve STICKY PROPERTIES. 899 free( oaddr ); 916 900 void * naddr = mallocNoStats( size ); // create new area 917 free( oaddr );918 901 return naddr; 919 902 } // resize … … 988 971 #endif // __STATISTICS__ 989 972 990 size_t size = dim * elemSize; 991 char * addr = (char *)memalignNoStats( alignment, size ); 992 if ( unlikely( addr == 0p ) ) return 0p; 993 HeapManager.Storage.Header * header; 994 HeapManager.FreeHeader * freeElem; 995 size_t bsize; 996 headers( "amemalign", addr, header, freeElem, bsize, alignment ); 997 998 header->kind.real.blockSize |= 2; // mark as zero filled 999 return addr; 973 return memalignNoStats( alignment, dim * elemSize ); 1000 974 } // amemalign 1001 975 … … 1043 1017 1044 1018 // Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() 1045 // or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behavio r occurs. If ptr is1019 // or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behaviour occurs. If ptr is 1046 1020 // 0p, no operation is performed. 1047 1021 void free( void * addr ) { … … 1170 1144 1171 1145 1172 // Adjusts parameters that control the behavio r of the memory-allocation functions (see malloc). The param argument1146 // Adjusts parameters that control the behaviour of the memory-allocation functions (see malloc). The param argument 1173 1147 // specifies the parameter to be modified, and value specifies the new value for that parameter. 1174 1148 int mallopt( int option, int value ) { 1175 1149 choose( option ) { 1176 1150 case M_TOP_PAD: 1177 if ( setHeapExpand( value ) )return 1;1151 heapExpand = ceiling( value, pageSize ); return 1; 1178 1152 case M_MMAP_THRESHOLD: 1179 1153 if ( setMmapStart( value ) ) return 1; 1154 break; 1180 1155 } // switch 1181 1156 return 0; // error, unsupported -
libcfa/src/iostream.cfa
rdd4e2d7 r6c12fd28 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Apr 30 10:50:31202013 // Update Count : 10 0112 // Last Modified On : Sat May 2 18:30:25 2020 13 // Update Count : 1017 14 14 // 15 15 … … 583 583 if ( fmt.flags.pc && fmt.pc > 64 ) fmt.pc -= 64; else { fmt.flags.pc = false; fmt.pc = 0; } \ 584 584 if ( fmt.flags.left ) { \ 585 fmt2.wd = fmt.wd; \ 586 if ( fmt2.wd <= 64 ) { \ 587 fmt2.wd = 64; \ 588 } else { \ 589 if ( fmt.pc > 0 ) { \ 590 fmt2.wd -= fmt.pc; \ 591 } else { \ 592 fmt2.wd = fmt.wd - high1( msig ); \ 593 } /* if */ \ 594 if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \ 595 if ( fmt2.wd < 0 ) fmt2.wd = 0; \ 596 fmt2.flags.left = true; \ 597 fmt.wd = 0; \ 598 } /* if */ \ 599 printf( "left %d %d %x\n", f.wd, f.pc, f.all ); \ 600 printf( "left %d %d %x\n", fmt.wd, fmt.pc, fmt.all ); \ 585 fmt.flags.left = false; \ 586 fmt.wd = 0; \ 587 /* printf( "L %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \ 588 fmt2.flags.left = true; \ 589 int msigd = high1( msig ); \ 590 fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd); \ 591 if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; /* compensate for 0b base specifier */ \ 592 if ( (int)fmt2.wd < 64 ) fmt2.wd = 64; /* cast deals with negative value */ \ 593 fmt2.flags.pc = true; fmt2.pc = 64; \ 601 594 } else { \ 602 595 if ( fmt.wd > 64 ) fmt.wd -= 64; \ 603 /* if ( ! fmt.flags.nobsdp && fmt.pc < fmt.wd ) fmt.wd -= 1; */ \ 596 else fmt.wd = 1; \ 597 /* printf( "R %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \ 604 598 fmt2.wd = 64; \ 605 /* printf( "R %llo %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt2.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \606 599 } /* if */ \ 607 /* printf( " \nC %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \600 /* printf( "C %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \ 608 601 (ostype &)(os | fmt | "" | fmt2); \ 609 602 } else if ( f.base == 'o' ) { \ … … 614 607 fmt.flags.left = false; \ 615 608 fmt.wd = 0; \ 616 /* if ( fmt2.val > 1 && fmt.flags.pc && fmt.pc > 0 ) fmt.pc -= 1; */ \617 609 /* printf( "L %llo %llo %llo %d %d '%c' %x %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all, fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \ 618 610 (ostype &)(os | fmt | "" | fmt2); \ 619 611 sepOff( os ); \ 620 612 fmt2.flags.left = true; \ 621 int msigd = ceiling( high1( fmt.val ), 3 ) + 1; \ 622 fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd) - 1; \ 613 int msigd = ceiling( high1( fmt.val ), 3 ); \ 614 fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd); \ 615 if ( ! fmt.flags.nobsdp ) fmt2.wd -= 1; /* compensate for 0 base specifier */ \ 623 616 if ( (int)fmt2.wd < 21 ) fmt2.wd = 21; /* cast deals with negative value */ \ 624 617 fmt2.flags.pc = true; fmt2.pc = 21; \ 625 618 } else { \ 626 619 if ( fmt.wd > 22 ) fmt.wd -= 22; \ 627 /* compensate for leading 0 */ \ 628 /*if ( ! fmt.flags.nobsdp && fmt.pc < fmt.wd ) fmt.wd -= 1;*/ \ 629 fmt2.wd = 1; \ 620 else fmt.wd = 1; \ 630 621 /* printf( "R %llo %llo %llo %d %d '%c' %x %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all, fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \ 631 622 (ostype &)(os | fmt | "" | fmt2); \ … … 636 627 /* printf( "\nC %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \ 637 628 (ostype &)(os | fmt2); \ 638 } else { \639 if ( fmt.flags.pc && fmt.pc > 16 ) fmt.pc -= 16; \629 } else { /* f.base == 'x' | f.base == 'X' */ \ 630 if ( fmt.flags.pc && fmt.pc > 16 ) fmt.pc -= 16; else { fmt.flags.pc = false; fmt.pc = 0; } \ 640 631 if ( fmt.flags.left ) { \ 641 fmt2.wd = fmt.wd; \ 642 if ( fmt2.wd <= 16 ) { \ 643 fmt2.wd = 16; \ 644 } else { \ 645 if ( fmt.pc > 0 ) { \ 646 fmt2.wd -= fmt.pc; \ 647 } else { \ 648 fmt2.wd = fmt.wd - ceiling2( high1( msig ), 4 ) / 4; \ 649 } /* if */ \ 650 if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \ 651 if ( fmt2.wd < 0 ) fmt2.wd = 0; \ 652 fmt2.flags.left = true; \ 653 fmt.wd = 0; \ 654 } /* if */ \ 632 fmt.flags.left = false; \ 633 fmt.wd = 0; \ 634 /* printf( "L %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \ 635 fmt2.flags.left = true; \ 636 int msigd = high1( msig ); \ 637 fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd); \ 638 if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; /* compensate for 0x base specifier */ \ 639 if ( (int)fmt2.wd < 16 ) fmt2.wd = 16; /* cast deals with negative value */ \ 640 fmt2.flags.pc = true; fmt2.pc = 16; \ 655 641 } else { \ 642 if ( fmt.wd > 16 ) fmt.wd -= 16; \ 643 else fmt.wd = 1; \ 644 /* printf( "R %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \ 656 645 fmt2.wd = 16; \ 657 if ( fmt.wd > 16 ) fmt.wd -= 16; \658 646 } /* if */ \ 659 fmt2.pc = 16; fmt2.flags.pc = true;\647 /* printf( "C %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \ 660 648 (ostype &)(os | fmt | "" | fmt2); \ 661 649 } /* if */ \
Note:
See TracChangeset
for help on using the changeset viewer.