Changeset a00bc5b
- Timestamp:
- Jan 13, 2021, 3:43:14 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 270bdc8, 402658b1, bb58825
- Parents:
- 97748ee (diff), 101cc3a (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. - Files:
-
- 3 added
- 2 deleted
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/bibliography/pl.bib
r97748ee ra00bc5b 990 990 } 991 991 992 @techreport{cfa-cc, 993 keywords = {Cforall, cfa-cc, transpiler}, 994 contributer = {pabuhr@plg}, 995 title = {{\textsf{cfa-cc}} Developer's Reference Manual}, 996 author = {Fangren Yu}, 997 institution = {School of Computer Science}, 998 address = {University of Waterloo, Waterloo, Ontario, Canada}, 999 month = aug, 1000 year = {2020}, 1001 note = {\href{https://cforall.uwaterloo.ca/doc/Fangren_Yu_Report_S20.pdf}{https://\-cforall.uwaterloo.ca/\-doc/\-Fangren\_Yu\_Report\_S20.pdf}}, 1002 } 1003 992 1004 @article{Moss18, 993 1005 keywords = {type systems, polymorphism, tuples, Cforall}, … … 1040 1052 keywords = {type system, generic type, resolution algorithm, type environment, Cforall}, 1041 1053 author = {Aaron Moss}, 1042 title = {\textsf{C} $\mathbf{\forall}$ Type System Implementation},1054 title = {\textsf{C}\,$\mathbf{\forall}$ Type System Implementation}, 1043 1055 school = {School of Computer Science, University of Waterloo}, 1044 1056 year = 2019, … … 1161 1173 keywords = {ctrie, concurrent map}, 1162 1174 contributer = {a3moss@uwaterloo.ca}, 1163 title = {Cache-aware lock-free concurrent hash tries},1164 author = {Prokopec, Aleksandar and Bagwell, Phil and Odersky, Martin},1165 institution = {EPFL},1166 year = {2011}1175 title = {Cache-aware lock-free concurrent hash tries}, 1176 author = {Prokopec, Aleksandar and Bagwell, Phil and Odersky, Martin}, 1177 institution = {EPFL}, 1178 year = {2011} 1167 1179 } 1168 1180 … … 3928 3940 school = {School of Computer Science, University of Waterloo}, 3929 3941 year = 2003, 3930 address = {Waterloo, Ontario, Canada, N2L 3G1},3942 optaddress = {Waterloo, Ontario, Canada, N2L 3G1}, 3931 3943 note = {\href{http://plg.uwaterloo.ca/theses/BilsonThesis.pdf}{http://\-plg.uwaterloo.ca/\-theses/\-BilsonThesis.pdf}}, 3932 3944 } … … 5210 5222 } 5211 5223 5224 @manual{gcc-nested-func, 5225 keywords = {gcc nested functions}, 5226 contributer = {pabuhr@plg}, 5227 key = {gcc nested functions}, 5228 title = {Nested Functions}, 5229 organization= {{gcc} 9.3 Manual}, 5230 year = 2019, 5231 note = {\href{https://gcc.gnu.org/onlinedocs/gcc-9.3.0/gcc/Nested-Functions.html}{https://\-gcc.gnu.org/\-onlinedocs/\-gcc-9.3.0/\-gcc/\-Nested-Functions.html}}, 5232 } 5233 5212 5234 @article{Haddon77, 5213 5235 keywords = {monitors, nested monitor calls}, -
doc/theses/andrew_beach_MMath/existing.tex
r97748ee ra00bc5b 83 83 the the call site. 84 84 85 As an example, even if no function named \codeCFA{do \_once} is not defined86 near the definition of \codeCFA{do \_twice} the following code will work.85 As an example, even if no function named \codeCFA{do_once} is not defined 86 near the definition of \codeCFA{do_twice} the following code will work. 87 87 \begin{lstlisting} 88 88 int quadruple(int x) { … … 95 95 \end{lstlisting} 96 96 This is not the recommended way to implement a quadruple function but it 97 does work. The complier will deduce that \codeCFA{do \_twice}'s T is an97 does work. The complier will deduce that \codeCFA{do_twice}'s T is an 98 98 integer from the argument. It will then look for a definition matching the 99 assertion which is the \codeCFA{do \_once} defined within the function. That100 function will be passed in as a function pointer to \codeCFA{do \_twice} and99 assertion which is the \codeCFA{do_once} defined within the function. That 100 function will be passed in as a function pointer to \codeCFA{do_twice} and 101 101 called within it. 102 102 … … 156 156 In \CFA coroutines are created using the \codeCFA{coroutine} keyword which 157 157 works just like \codeCFA{struct} except that the created structure will be 158 modified by the compiler to satify the \codeCFA{is \_coroutine} trait.158 modified by the compiler to satify the \codeCFA{is_coroutine} trait. 159 159 160 160 These structures act as the interface between callers and the coroutine, -
doc/theses/fangren_yu_COOP_S20/Report.tex
r97748ee ra00bc5b 56 56 57 57 \title{\Huge 58 cfa-ccDeveloper's Reference58 \lstinline|cfa-cc| Developer's Reference 59 59 }% title 60 60 … … 728 728 The \CFA compiler sets a limit on assertion depth and reports an error if assertion resolution does not terminate within the limit (as for \lstinline[language=C++]@templates@ in \CC). 729 729 730 \addcontentsline{toc}{section}{\refname} 730 731 \bibliographystyle{plain} 731 732 \bibliography{pl} -
libcfa/src/heap.cfa
r97748ee ra00bc5b 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 16 12:28:25 202013 // Update Count : 10 2312 // Last Modified On : Sun Jan 10 11:20:49 2021 13 // Update Count : 1031 14 14 // 15 15 … … 262 262 #ifdef __STATISTICS__ 263 263 // Heap statistics counters. 264 static unsigned int malloc_ calls;264 static unsigned int malloc_zero_calls, malloc_calls; 265 265 static unsigned long long int malloc_storage; 266 static unsigned int aalloc_ calls;266 static unsigned int aalloc_zero_calls, aalloc_calls; 267 267 static unsigned long long int aalloc_storage; 268 static unsigned int calloc_ calls;268 static unsigned int calloc_zero_calls, calloc_calls; 269 269 static unsigned long long int calloc_storage; 270 static unsigned int memalign_ calls;270 static unsigned int memalign_zero_calls, memalign_calls; 271 271 static unsigned long long int memalign_storage; 272 static unsigned int amemalign_ calls;272 static unsigned int amemalign_zero_calls, amemalign_calls; 273 273 static unsigned long long int amemalign_storage; 274 static unsigned int cmemalign_ calls;274 static unsigned int cmemalign_zero_calls, cmemalign_calls; 275 275 static unsigned long long int cmemalign_storage; 276 static unsigned int resize_ calls;276 static unsigned int resize_zero_calls, resize_calls; 277 277 static unsigned long long int resize_storage; 278 static unsigned int realloc_ calls;278 static unsigned int realloc_zero_calls, realloc_calls; 279 279 static unsigned long long int realloc_storage; 280 static unsigned int free_ calls;280 static unsigned int free_zero_calls, free_calls; 281 281 static unsigned long long int free_storage; 282 282 static unsigned int mmap_calls; … … 287 287 static unsigned long long int sbrk_storage; 288 288 // Statistics file descriptor (changed by malloc_stats_fd). 289 static int stat _fd = STDERR_FILENO;// default stderr289 static int stats_fd = STDERR_FILENO; // default stderr 290 290 291 291 // Use "write" because streams may be shutdown when calls are made. … … 293 293 char helpText[1024]; 294 294 __cfaabi_bits_print_buffer( STDERR_FILENO, helpText, sizeof(helpText), 295 296 " malloc: calls %u / storage %llu\n"297 " aalloc: calls %u / storage %llu\n"298 " calloc: calls %u / storage %llu\n"299 " memalign: calls %u / storage %llu\n"300 " amemalign: calls %u / storage %llu\n"301 " cmemalign: calls %u / storage %llu\n"302 " resize: calls %u / storage %llu\n"303 " realloc: calls %u / storage %llu\n"304 " free: calls %u / storage %llu\n"305 " mmap: calls %u / storage %llu\n"306 " munmap: calls %u / storage %llu\n"307 " sbrk: calls %u / storage %llu\n",308 309 310 311 312 313 314 315 316 317 318 319 295 "\nHeap statistics:\n" 296 " malloc 0-calls %'u; >0-calls %'u; storage %'llu bytes\n" 297 " aalloc 0-calls %'u; >0-calls %'u; storage %'llu bytes\n" 298 " calloc 0-calls %'u; >0-calls %'u; storage %'llu bytes\n" 299 " memalign 0-calls %'u; >0-calls %'u; storage %'llu bytes\n" 300 " amemalign 0-calls %'u; >0-calls %'u; storage %'llu bytes\n" 301 " cmemalign 0-calls %'u; >0-calls %'u; storage %'llu bytes\n" 302 " resize 0-calls %'u; >0-calls %'u; storage %'llu bytes\n" 303 " realloc 0-calls %'u; >0-calls %'u; storage %'llu bytes\n" 304 " free 0-calls %'u; >0-calls %'u; storage %'llu bytes\n" 305 " mmap calls %'u; storage %'llu bytes\n" 306 " munmap calls %'u; storage %'llu bytes\n" 307 " sbrk calls %'u; storage %'llu bytes\n", 308 malloc_zero_calls, malloc_calls, malloc_storage, 309 aalloc_zero_calls, aalloc_calls, aalloc_storage, 310 calloc_zero_calls, calloc_calls, calloc_storage, 311 memalign_zero_calls, memalign_calls, memalign_storage, 312 amemalign_zero_calls, amemalign_calls, amemalign_storage, 313 cmemalign_zero_calls, cmemalign_calls, cmemalign_storage, 314 resize_zero_calls, resize_calls, resize_storage, 315 realloc_zero_calls, realloc_calls, realloc_storage, 316 free_zero_calls, free_calls, free_storage, 317 mmap_calls, mmap_storage, 318 munmap_calls, munmap_storage, 319 sbrk_calls, sbrk_storage 320 320 ); 321 321 } // printStats … … 328 328 "<sizes>\n" 329 329 "</sizes>\n" 330 "<total type=\"malloc\" count=\"%u\" size=\"%llu\"/>\n"331 "<total type=\"aalloc\" count=\"%u\" size=\"%llu\"/>\n"332 "<total type=\"calloc\" count=\"%u\" size=\"%llu\"/>\n"333 "<total type=\"memalign\" count=\"%u\" size=\"%llu\"/>\n"334 "<total type=\"amemalign\" count=\"%u\" size=\"%llu\"/>\n"335 "<total type=\"cmemalign\" count=\"%u\" size=\"%llu\"/>\n"336 "<total type=\"resize\" count=\"%u\" size=\"%llu\"/>\n"337 "<total type=\"realloc\" count=\"%u\" size=\"%llu\"/>\n"338 "<total type=\"free\" count=\"%u\" size=\"%llu\"/>\n"339 "<total type=\"mmap\" count=\"% u\" size=\"%llu\"/>\n"340 "<total type=\"munmap\" count=\"% u\" size=\"%llu\"/>\n"341 "<total type=\"sbrk\" count=\"% u\" size=\"%llu\"/>\n"330 "<total type=\"malloc\" 0 count=\"%'u;\" >0 count=\"%'u;\" size=\"%'llu\"/> bytes\n" 331 "<total type=\"aalloc\" 0 count=\"%'u;\" >0 count=\"%'u;\" size=\"%'llu\"/> bytes\n" 332 "<total type=\"calloc\" 0 count=\"%'u;\" >0 count=\"%'u;\" size=\"%'llu\"/> bytes\n" 333 "<total type=\"memalign\" 0 count=\"%'u;\" >0 count=\"%'u;\" size=\"%'llu\"/> bytes\n" 334 "<total type=\"amemalign\" 0 count=\"%'u;\" >0 count=\"%'u;\" size=\"%'llu\"/> bytes\n" 335 "<total type=\"cmemalign\" 0 count=\"%'u;\" >0 count=\"%'u;\" size=\"%'llu\"/> bytes\n" 336 "<total type=\"resize\" 0 count=\"%'u;\" >0 count=\"%'u;\" size=\"%'llu\"/> bytes\n" 337 "<total type=\"realloc\" 0 count=\"%'u;\" >0 count=\"%'u;\" size=\"%'llu\"/> bytes\n" 338 "<total type=\"free\" 0 count=\"%'u;\" >0 count=\"%'u;\" size=\"%'llu\"/> bytes\n" 339 "<total type=\"mmap\" count=\"%'u;\" size=\"%'llu\"/> bytes\n" 340 "<total type=\"munmap\" count=\"%'u;\" size=\"%'llu\"/> bytes\n" 341 "<total type=\"sbrk\" count=\"%'u;\" size=\"%'llu\"/> bytes\n" 342 342 "</malloc>", 343 malloc_ calls, malloc_storage,344 aalloc_ calls, aalloc_storage,345 calloc_ calls, calloc_storage,346 memalign_ calls, memalign_storage,347 amemalign_ calls, amemalign_storage,348 cmemalign_ calls, cmemalign_storage,349 resize_ calls, resize_storage,350 realloc_ calls, realloc_storage,351 free_ calls, free_storage,343 malloc_zero_calls, malloc_calls, malloc_storage, 344 aalloc_zero_calls, aalloc_calls, aalloc_storage, 345 calloc_zero_calls, calloc_calls, calloc_storage, 346 memalign_zero_calls, memalign_calls, memalign_storage, 347 amemalign_zero_calls, amemalign_calls, amemalign_storage, 348 cmemalign_zero_calls, cmemalign_calls, cmemalign_storage, 349 resize_zero_calls, resize_calls, resize_storage, 350 realloc_zero_calls, realloc_calls, realloc_storage, 351 free_zero_calls, free_calls, free_storage, 352 352 mmap_calls, mmap_storage, 353 353 munmap_calls, munmap_storage, … … 466 466 } // headers 467 467 468 #ifdef __CFA_DEBUG__469 #if __SIZEOF_POINTER__ == 4470 #define MASK 0xdeadbeef471 #else472 #define MASK 0xdeadbeefdeadbeef473 #endif474 #define STRIDE size_t475 476 static void * Memset( void * addr, STRIDE size ) { // debug only477 if ( size % sizeof(STRIDE) != 0 ) abort( "Memset() : internal error, size %zd not multiple of %zd.", size, sizeof(STRIDE) );478 if ( (STRIDE)addr % sizeof(STRIDE) != 0 ) abort( "Memset() : internal error, addr %p not multiple of %zd.", addr, sizeof(STRIDE) );479 480 STRIDE * end = (STRIDE *)addr + size / sizeof(STRIDE);481 for ( STRIDE * p = (STRIDE *)addr; p < end; p += 1 ) *p = MASK;482 return addr;483 } // Memset484 #endif // __CFA_DEBUG__468 // #ifdef __CFA_DEBUG__ 469 // #if __SIZEOF_POINTER__ == 4 470 // #define MASK 0xdeadbeef 471 // #else 472 // #define MASK 0xdeadbeefdeadbeef 473 // #endif 474 // #define STRIDE size_t 475 476 // static void * Memset( void * addr, STRIDE size ) { // debug only 477 // if ( size % sizeof(STRIDE) != 0 ) abort( "Memset() : internal error, size %zd not multiple of %zd.", size, sizeof(STRIDE) ); 478 // if ( (STRIDE)addr % sizeof(STRIDE) != 0 ) abort( "Memset() : internal error, addr %p not multiple of %zd.", addr, sizeof(STRIDE) ); 479 480 // STRIDE * end = (STRIDE *)addr + size / sizeof(STRIDE); 481 // for ( STRIDE * p = (STRIDE *)addr; p < end; p += 1 ) *p = MASK; 482 // return addr; 483 // } // Memset 484 // #endif // __CFA_DEBUG__ 485 485 486 486 … … 498 498 unlock( extlock ); 499 499 __cfaabi_bits_print_nolock( STDERR_FILENO, NO_MEMORY_MSG, size ); 500 _exit( EXIT_FAILURE ); 501 } // if 500 _exit( EXIT_FAILURE ); // give up 501 } // if 502 // Make storage executable for thunks. 502 503 if ( mprotect( (char *)heapEnd + heapRemaining, increase, __map_prot ) ) { 503 504 unlock( extlock ); … … 770 771 771 772 772 static inline void * callocNoStats( size_t dim, size_t elemSize ) {773 size_t size = dim * elemSize;774 if ( unlikely( size ) == 0 ) return 0p; // 0 BYTE ALLOCATION RETURNS NULL POINTER775 char * addr = (char *)mallocNoStats( size );776 777 HeapManager.Storage.Header * header;778 HeapManager.FreeHeader * freeElem;779 size_t bsize, alignment;780 #ifndef __CFA_DEBUG__781 bool mapped =782 #endif // __CFA_DEBUG__783 headers( "calloc", addr, header, freeElem, bsize, alignment );784 #ifndef __CFA_DEBUG__785 786 // Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero.787 if ( ! mapped )788 #endif // __CFA_DEBUG__789 // <-------0000000000000000000000000000UUUUUUUUUUUUUUUUUUUUUUUUU> bsize (bucket size) U => undefined790 // `-header`-addr `-size791 memset( addr, '\0', size ); // set to zeros792 793 header->kind.real.blockSize |= 2; // mark as zero filled794 return addr;795 } // callocNoStats796 797 798 773 static inline void * memalignNoStats( size_t alignment, size_t size ) { 799 774 if ( unlikely( size ) == 0 ) return 0p; // 0 BYTE ALLOCATION RETURNS NULL POINTER … … 834 809 835 810 836 static inline void * cmemalignNoStats( size_t alignment, size_t dim, size_t elemSize ) {837 size_t size = dim * elemSize;838 if ( unlikely( size ) == 0 ) return 0p; // 0 BYTE ALLOCATION RETURNS NULL POINTER839 char * addr = (char *)memalignNoStats( alignment, size );840 841 HeapManager.Storage.Header * header;842 HeapManager.FreeHeader * freeElem;843 size_t bsize;844 #ifndef __CFA_DEBUG__845 bool mapped =846 #endif // __CFA_DEBUG__847 headers( "cmemalign", addr, header, freeElem, bsize, alignment );848 849 // Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero.850 #ifndef __CFA_DEBUG__851 if ( ! mapped )852 #endif // __CFA_DEBUG__853 // <-------0000000000000000000000000000UUUUUUUUUUUUUUUUUUUUUUUUU> bsize (bucket size) U => undefined854 // `-header`-addr `-size855 memset( addr, '\0', size ); // set to zeros856 857 header->kind.real.blockSize |= 2; // mark as zero filled858 return addr;859 } // cmemalignNoStats860 861 862 811 extern "C" { 863 812 // Allocates size bytes and returns a pointer to the allocated memory. The contents are undefined. If size is 0, … … 865 814 void * malloc( size_t size ) { 866 815 #ifdef __STATISTICS__ 867 __atomic_add_fetch( &malloc_calls, 1, __ATOMIC_SEQ_CST ); 868 __atomic_add_fetch( &malloc_storage, size, __ATOMIC_SEQ_CST ); 816 if ( likely( size > 0 ) ) { 817 __atomic_add_fetch( &malloc_calls, 1, __ATOMIC_SEQ_CST ); 818 __atomic_add_fetch( &malloc_storage, size, __ATOMIC_SEQ_CST ); 819 } else { 820 __atomic_add_fetch( &malloc_zero_calls, 1, __ATOMIC_SEQ_CST ); 821 } // if 869 822 #endif // __STATISTICS__ 870 823 … … 877 830 size_t size = dim * elemSize; 878 831 #ifdef __STATISTICS__ 879 __atomic_add_fetch( &aalloc_calls, 1, __ATOMIC_SEQ_CST ); 880 __atomic_add_fetch( &aalloc_storage, size, __ATOMIC_SEQ_CST ); 832 if ( likely( size > 0 ) ) { 833 __atomic_add_fetch( &aalloc_calls, 1, __ATOMIC_SEQ_CST ); 834 __atomic_add_fetch( &aalloc_storage, size, __ATOMIC_SEQ_CST ); 835 } else { 836 __atomic_add_fetch( &aalloc_zero_calls, 1, __ATOMIC_SEQ_CST ); 837 } // if 881 838 #endif // __STATISTICS__ 882 839 … … 887 844 // Same as aalloc() with memory set to zero. 888 845 void * calloc( size_t dim, size_t elemSize ) { 846 size_t size = dim * elemSize; 847 if ( unlikely( size ) == 0 ) { // 0 BYTE ALLOCATION RETURNS NULL POINTER 848 #ifdef __STATISTICS__ 849 __atomic_add_fetch( &calloc_zero_calls, 1, __ATOMIC_SEQ_CST ); 850 #endif // __STATISTICS__ 851 return 0p; 852 } // if 889 853 #ifdef __STATISTICS__ 890 854 __atomic_add_fetch( &calloc_calls, 1, __ATOMIC_SEQ_CST ); … … 892 856 #endif // __STATISTICS__ 893 857 894 return callocNoStats( dim, elemSize ); 858 char * addr = (char *)mallocNoStats( size ); 859 860 HeapManager.Storage.Header * header; 861 HeapManager.FreeHeader * freeElem; 862 size_t bsize, alignment; 863 864 #ifndef __CFA_DEBUG__ 865 bool mapped = 866 #endif // __CFA_DEBUG__ 867 headers( "calloc", addr, header, freeElem, bsize, alignment ); 868 869 #ifndef __CFA_DEBUG__ 870 // Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero. 871 if ( ! mapped ) 872 #endif // __CFA_DEBUG__ 873 // <-------0000000000000000000000000000UUUUUUUUUUUUUUUUUUUUUUUUU> bsize (bucket size) U => undefined 874 // `-header`-addr `-size 875 memset( addr, '\0', size ); // set to zeros 876 877 header->kind.real.blockSize |= 2; // mark as zero filled 878 return addr; 895 879 } // calloc 896 880 … … 901 885 // call to malloc(), alloc(), calloc() or realloc(). If the area pointed to was moved, a free(oaddr) is done. 902 886 void * resize( void * oaddr, size_t size ) { 887 // If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned. 888 if ( unlikely( size == 0 ) ) { // special cases 889 #ifdef __STATISTICS__ 890 __atomic_add_fetch( &resize_zero_calls, 1, __ATOMIC_SEQ_CST ); 891 #endif // __STATISTICS__ 892 free( oaddr ); 893 return 0p; 894 } // if 903 895 #ifdef __STATISTICS__ 904 896 __atomic_add_fetch( &resize_calls, 1, __ATOMIC_SEQ_CST ); 905 897 #endif // __STATISTICS__ 906 898 907 // If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned.908 if ( unlikely( size == 0 ) ) { free( oaddr ); return 0p; } // special cases909 899 if ( unlikely( oaddr == 0p ) ) { 910 900 #ifdef __STATISTICS__ … … 918 908 size_t bsize, oalign; 919 909 headers( "resize", oaddr, header, freeElem, bsize, oalign ); 910 920 911 size_t odsize = dataStorage( bsize, oaddr, header ); // data storage available in bucket 921 922 912 // same size, DO NOT preserve STICKY PROPERTIES. 923 913 if ( oalign == libAlign() && size <= odsize && odsize <= size * 2 ) { // allow 50% wasted storage for smaller size … … 940 930 // the old and new sizes. 941 931 void * realloc( void * oaddr, size_t size ) { 932 // If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned. 933 if ( unlikely( size == 0 ) ) { // special cases 934 #ifdef __STATISTICS__ 935 __atomic_add_fetch( &realloc_zero_calls, 1, __ATOMIC_SEQ_CST ); 936 #endif // __STATISTICS__ 937 free( oaddr ); 938 return 0p; 939 } // if 942 940 #ifdef __STATISTICS__ 943 941 __atomic_add_fetch( &realloc_calls, 1, __ATOMIC_SEQ_CST ); 944 942 #endif // __STATISTICS__ 945 943 946 // If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned.947 if ( unlikely( size == 0 ) ) { free( oaddr ); return 0p; } // special cases948 944 if ( unlikely( oaddr == 0p ) ) { 949 945 #ifdef __STATISTICS__ … … 999 995 void * memalign( size_t alignment, size_t size ) { 1000 996 #ifdef __STATISTICS__ 1001 __atomic_add_fetch( &memalign_calls, 1, __ATOMIC_SEQ_CST ); 1002 __atomic_add_fetch( &memalign_storage, size, __ATOMIC_SEQ_CST ); 997 if ( likely( size > 0 ) ) { 998 __atomic_add_fetch( &memalign_calls, 1, __ATOMIC_SEQ_CST ); 999 __atomic_add_fetch( &memalign_storage, size, __ATOMIC_SEQ_CST ); 1000 } else { 1001 __atomic_add_fetch( &memalign_zero_calls, 1, __ATOMIC_SEQ_CST ); 1002 } // if 1003 1003 #endif // __STATISTICS__ 1004 1004 … … 1011 1011 size_t size = dim * elemSize; 1012 1012 #ifdef __STATISTICS__ 1013 __atomic_add_fetch( &cmemalign_calls, 1, __ATOMIC_SEQ_CST ); 1014 __atomic_add_fetch( &cmemalign_storage, size, __ATOMIC_SEQ_CST ); 1013 if ( likely( size > 0 ) ) { 1014 __atomic_add_fetch( &cmemalign_calls, 1, __ATOMIC_SEQ_CST ); 1015 __atomic_add_fetch( &cmemalign_storage, size, __ATOMIC_SEQ_CST ); 1016 } else { 1017 __atomic_add_fetch( &cmemalign_zero_calls, 1, __ATOMIC_SEQ_CST ); 1018 } // if 1015 1019 #endif // __STATISTICS__ 1016 1020 … … 1021 1025 // Same as calloc() with memory alignment. 1022 1026 void * cmemalign( size_t alignment, size_t dim, size_t elemSize ) { 1027 size_t size = dim * elemSize; 1028 if ( unlikely( size ) == 0 ) { // 0 BYTE ALLOCATION RETURNS NULL POINTER 1029 #ifdef __STATISTICS__ 1030 __atomic_add_fetch( &cmemalign_zero_calls, 1, __ATOMIC_SEQ_CST ); 1031 #endif // __STATISTICS__ 1032 return 0p; 1033 } // if 1023 1034 #ifdef __STATISTICS__ 1024 1035 __atomic_add_fetch( &cmemalign_calls, 1, __ATOMIC_SEQ_CST ); … … 1026 1037 #endif // __STATISTICS__ 1027 1038 1028 return cmemalignNoStats( alignment, dim, elemSize ); 1039 char * addr = (char *)memalignNoStats( alignment, size ); 1040 1041 HeapManager.Storage.Header * header; 1042 HeapManager.FreeHeader * freeElem; 1043 size_t bsize; 1044 1045 #ifndef __CFA_DEBUG__ 1046 bool mapped = 1047 #endif // __CFA_DEBUG__ 1048 headers( "cmemalign", addr, header, freeElem, bsize, alignment ); 1049 1050 // Mapped storage is zero filled, but in debug mode mapped memory is scrubbed in doMalloc, so it has to be reset to zero. 1051 #ifndef __CFA_DEBUG__ 1052 if ( ! mapped ) 1053 #endif // __CFA_DEBUG__ 1054 // <-------0000000000000000000000000000UUUUUUUUUUUUUUUUUUUUUUUUU> bsize (bucket size) U => undefined 1055 // `-header`-addr `-size 1056 memset( addr, '\0', size ); // set to zeros 1057 1058 header->kind.real.blockSize |= 2; // mark as zero filled 1059 return addr; 1029 1060 } // cmemalign 1030 1061 … … 1065 1096 // 0p, no operation is performed. 1066 1097 void free( void * addr ) { 1067 #ifdef __STATISTICS__1068 __atomic_add_fetch( &free_calls, 1, __ATOMIC_SEQ_CST );1069 #endif // __STATISTICS__1070 1071 1098 if ( unlikely( addr == 0p ) ) { // special case 1099 #ifdef __STATISTICS__ 1100 __atomic_add_fetch( &free_zero_calls, 1, __ATOMIC_SEQ_CST ); 1101 #endif // __STATISTICS__ 1102 1072 1103 // #ifdef __CFA_DEBUG__ 1073 1104 // if ( traceHeap() ) { … … 1182 1213 int malloc_stats_fd( int fd __attribute__(( unused )) ) { 1183 1214 #ifdef __STATISTICS__ 1184 int temp = stat _fd;1185 stat _fd = fd;1215 int temp = stats_fd; 1216 stats_fd = fd; 1186 1217 return temp; 1187 1218 #else … … 1214 1245 // The string is printed on the file stream stream. The exported string includes information about all arenas (see 1215 1246 // malloc). 1216 int malloc_info( int options, FILE * stream ) {1247 int malloc_info( int options, FILE * stream __attribute__(( unused )) ) { 1217 1248 if ( options != 0 ) { errno = EINVAL; return -1; } 1218 1249 #ifdef __STATISTICS__ … … 1243 1274 // Must have CFA linkage to overload with C linkage realloc. 1244 1275 void * resize( void * oaddr, size_t nalign, size_t size ) { 1245 #ifdef __STATISTICS__ 1246 __atomic_add_fetch( &resize_calls, 1, __ATOMIC_SEQ_CST ); 1247 #endif // __STATISTICS__ 1276 // If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned. 1277 if ( unlikely( size == 0 ) ) { // special cases 1278 #ifdef __STATISTICS__ 1279 __atomic_add_fetch( &resize_zero_calls, 1, __ATOMIC_SEQ_CST ); 1280 #endif // __STATISTICS__ 1281 free( oaddr ); 1282 return 0p; 1283 } // if 1248 1284 1249 1285 if ( unlikely( nalign < libAlign() ) ) nalign = libAlign(); // reset alignment to minimum 1250 1286 #ifdef __CFA_DEBUG__ 1251 else 1252 checkAlign( nalign ); // check alignment 1287 else checkAlign( nalign ); // check alignment 1253 1288 #endif // __CFA_DEBUG__ 1254 1289 1255 // If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned.1256 if ( unlikely( size == 0 ) ) { free( oaddr ); return 0p; } // special cases1257 1290 if ( unlikely( oaddr == 0p ) ) { 1258 1291 #ifdef __STATISTICS__ 1292 __atomic_add_fetch( &resize_calls, 1, __ATOMIC_SEQ_CST ); 1259 1293 __atomic_add_fetch( &resize_storage, size, __ATOMIC_SEQ_CST ); 1260 1294 #endif // __STATISTICS__ … … 1302 1336 1303 1337 void * realloc( void * oaddr, size_t nalign, size_t size ) { 1338 // If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned. 1339 if ( unlikely( size == 0 ) ) { // special cases 1340 #ifdef __STATISTICS__ 1341 __atomic_add_fetch( &realloc_zero_calls, 1, __ATOMIC_SEQ_CST ); 1342 #endif // __STATISTICS__ 1343 free( oaddr ); 1344 return 0p; 1345 } // if 1346 1304 1347 if ( unlikely( nalign < libAlign() ) ) nalign = libAlign(); // reset alignment to minimum 1305 1348 #ifdef __CFA_DEBUG__ 1306 else 1307 checkAlign( nalign ); // check alignment 1349 else checkAlign( nalign ); // check alignment 1308 1350 #endif // __CFA_DEBUG__ 1309 1351 1310 // If size is equal to 0, either NULL or a pointer suitable to be passed to free() is returned.1311 if ( unlikely( size == 0 ) ) { free( oaddr ); return 0p; } // special cases1312 1352 if ( unlikely( oaddr == 0p ) ) { 1313 1353 #ifdef __STATISTICS__ -
libcfa/src/startup.cfa
r97748ee ra00bc5b 10 10 // Created On : Tue Jul 24 16:21:57 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 4 13:03:18 202013 // Update Count : 3 012 // Last Modified On : Sat Jan 9 23:18:23 2021 13 // Update Count : 34 14 14 // 15 15 16 #include <time.h> // tzset 17 #include <locale.h> // setlocale 16 #include <time.h> // tzset 17 #include <locale.h> // setlocale 18 #include <stdlib.h> // getenv 18 19 #include "startup.hfa" 19 20 … … 22 23 void __cfaabi_appready_startup( void ) { 23 24 tzset(); // initialize time global variables 24 setlocale( LC_NUMERIC, "");25 setlocale( LC_NUMERIC, getenv("LANG") ); 25 26 #ifdef __CFA_DEBUG__ 26 27 extern void heapAppStart(); -
src/AST/Decl.cpp
r97748ee ra00bc5b 10 10 // Created On : Thu May 9 10:00:00 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 16:23:15 201913 // Update Count : 2 012 // Last Modified On : Tue Jan 12 16:54:55 2021 13 // Update Count : 23 14 14 // 15 15 … … 78 78 79 79 const char * TypeDecl::typeString() const { 80 static const char * kindNames[] = { "sized data type", "sized object type", "sized function type", "sized tupletype" };81 static_assert( sizeof(kindNames) /sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." );80 static const char * kindNames[] = { "sized data type", "sized data type", "sized object type", "sized function type", "sized tuple type", "sized array length type" }; 81 static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." ); 82 82 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); 83 83 return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0' … … 85 85 86 86 const char * TypeDecl::genTypeString() const { 87 static const char * kindNames[] = { " dtype", "otype", "ftype", "ttype" };88 static_assert( sizeof(kindNames) /sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "genTypeString: kindNames is out of sync." );87 static const char * kindNames[] = { "T &", "T *", "T", "(*)", "T ...", "[T]" }; 88 static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "genTypeString: kindNames is out of sync." ); 89 89 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); 90 90 return kindNames[ kind ]; -
src/AST/Decl.hpp
r97748ee ra00bc5b 10 10 // Created On : Thu May 9 10:00:00 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 17:38:33 201913 // Update Count : 2912 // Last Modified On : Mon Jan 11 20:48:38 2021 13 // Update Count : 30 14 14 // 15 15 … … 175 175 class TypeDecl final : public NamedTypeDecl { 176 176 public: 177 enum Kind { Dtype, Otype, Ftype, Ttype, NUMBER_OF_KINDS };177 enum Kind { Dtype, DStype, Otype, Ftype, Ttype, ALtype, NUMBER_OF_KINDS }; 178 178 179 179 Kind kind; -
src/Parser/DeclarationNode.cc
r97748ee ra00bc5b 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Oct 8 08:03:38 202013 // Update Count : 113 512 // Last Modified On : Mon Jan 11 20:58:07 2021 13 // Update Count : 1137 14 14 // 15 15 … … 1075 1075 if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) { 1076 1076 // otype is internally converted to dtype + otype parameters 1077 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::D type, TypeDecl::Ftype, TypeDecl::Ttype };1078 static_assert( sizeof(kindMap) /sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." );1077 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::DStype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype, TypeDecl::ALtype }; 1078 static_assert( sizeof(kindMap) / sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." ); 1079 1079 assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." ); 1080 1080 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype, variable.initializer ? variable.initializer->buildType() : nullptr ); -
src/Parser/ParseNode.h
r97748ee ra00bc5b 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Oct 24 03:53:54 202013 // Update Count : 89 512 // Last Modified On : Sun Jan 3 18:23:01 2021 13 // Update Count : 896 14 14 // 15 15 … … 39 39 struct DeclarationNode; 40 40 class DeclarationWithType; 41 class Initializer; 41 42 class ExpressionNode; 42 class Initializer;43 43 struct StatementNode; 44 44 -
src/Parser/parser.yy
r97748ee ra00bc5b 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Oct 24 08:21:14 202013 // Update Count : 46 2412 // Last Modified On : Mon Jan 11 21:32:10 2021 13 // Update Count : 4633 14 14 // 15 15 … … 329 329 %type<en> conditional_expression constant_expression assignment_expression assignment_expression_opt 330 330 %type<en> comma_expression comma_expression_opt 331 %type<en> argument_expression_list_opt argument_expression default_initialize _opt331 %type<en> argument_expression_list_opt argument_expression default_initializer_opt 332 332 %type<ifctl> if_control_expression 333 333 %type<fctl> for_control_expression for_control_expression_list … … 424 424 %type<decl> sue_declaration_specifier sue_declaration_specifier_nobody sue_type_specifier sue_type_specifier_nobody 425 425 426 %type<tclass> type_class 426 %type<tclass> type_class new_type_class 427 427 %type<decl> type_declarator type_declarator_name type_declaring_list 428 428 … … 1545 1545 | cfa_function_declaration 1546 1546 | type_declaring_list 1547 { SemanticError( yylloc, "otype declaration is currently unimplemented." ); $$ = nullptr; } 1547 1548 | trait_specifier 1548 1549 ; … … 2223 2224 ; 2224 2225 2225 cfa_parameter_ellipsis_list_opt: 2226 cfa_parameter_ellipsis_list_opt: // CFA, abstract + real 2226 2227 // empty 2227 2228 { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); } … … 2280 2281 cfa_parameter_declaration: // CFA, new & old style parameter declaration 2281 2282 parameter_declaration 2282 | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize _opt2283 | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initializer_opt 2283 2284 { $$ = $1->addName( $2 ); } 2284 | cfa_abstract_tuple identifier_or_type_name default_initialize _opt2285 | cfa_abstract_tuple identifier_or_type_name default_initializer_opt 2285 2286 // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator). 2286 2287 { $$ = $1->addName( $2 ); } 2287 | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize _opt2288 | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initializer_opt 2288 2289 { $$ = $2->addName( $3 )->addQualifiers( $1 ); } 2289 2290 | cfa_function_specifier … … 2302 2303 parameter_declaration: 2303 2304 // No SUE declaration in parameter list. 2304 declaration_specifier_nobody identifier_parameter_declarator default_initialize _opt2305 declaration_specifier_nobody identifier_parameter_declarator default_initializer_opt 2305 2306 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); } 2306 | declaration_specifier_nobody type_parameter_redeclarator default_initialize _opt2307 | declaration_specifier_nobody type_parameter_redeclarator default_initializer_opt 2307 2308 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); } 2308 2309 ; 2309 2310 2310 2311 abstract_parameter_declaration: 2311 declaration_specifier_nobody default_initialize _opt2312 declaration_specifier_nobody default_initializer_opt 2312 2313 { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); } 2313 | declaration_specifier_nobody abstract_parameter_declarator default_initialize _opt2314 | declaration_specifier_nobody abstract_parameter_declarator default_initializer_opt 2314 2315 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); } 2315 2316 ; … … 2441 2442 type_class identifier_or_type_name 2442 2443 { typedefTable.addToScope( *$2, TYPEDEFname, "9" ); } 2443 type_initializer_opt assertion_list_opt2444 type_initializer_opt assertion_list_opt 2444 2445 { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 2445 | type_specifier identifier_parameter_declarator 2446 | identifier_or_type_name new_type_class 2447 { typedefTable.addToScope( *$1, TYPEDEFname, "9" ); } 2448 type_initializer_opt assertion_list_opt 2449 { $$ = DeclarationNode::newTypeParam( $2, $1 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 2450 | '[' identifier_or_type_name ']' 2451 { 2452 typedefTable.addToScope( *$2, TYPEDEFname, "9" ); 2453 $$ = DeclarationNode::newTypeParam( TypeDecl::ALtype, $2 ); 2454 } 2455 // | type_specifier identifier_parameter_declarator 2446 2456 | assertion_list 2447 2457 { $$ = DeclarationNode::newTypeParam( TypeDecl::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); } 2458 ; 2459 2460 new_type_class: // CFA 2461 // empty 2462 { $$ = TypeDecl::Otype; } 2463 | '&' 2464 { $$ = TypeDecl::Dtype; } 2465 | '*' 2466 { $$ = TypeDecl::DStype; } // dtype + sized 2467 | ELLIPSIS 2468 { $$ = TypeDecl::Ttype; } 2448 2469 ; 2449 2470 … … 3476 3497 ; 3477 3498 3478 default_initialize _opt:3499 default_initializer_opt: 3479 3500 // empty 3480 3501 { $$ = nullptr; } -
src/SymTab/Demangle.cc
r97748ee ra00bc5b 10 10 // Created On : Thu Jul 19 12:52:41 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 11 15:09:18 202013 // Update Count : 1 012 // Last Modified On : Mon Jan 11 21:28:27 2021 13 // Update Count : 11 14 14 // 15 15 … … 367 367 // type variable types 368 368 for (size_t k = 0; k < TypeDecl::NUMBER_OF_KINDS; ++k) { 369 static const std::string typeVariableNames[] = { "DT", " OT", "FT", "TT", };369 static const std::string typeVariableNames[] = { "DT", "DST", "OT", "FT", "TT", "ALT", }; 370 370 static_assert( 371 371 sizeof(typeVariableNames)/sizeof(typeVariableNames[0]) == TypeDecl::NUMBER_OF_KINDS, -
src/SymTab/Mangler.cc
r97748ee ra00bc5b 10 10 // Created On : Sun May 17 21:40:29 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Nov 18 12:01:38 202013 // Update Count : 6412 // Last Modified On : Mon Jan 11 21:56:06 2021 13 // Update Count : 74 14 14 // 15 15 #include "Mangler.h" … … 313 313 // and the case has not yet come up in practice. Alternatively, if not then this code can be removed 314 314 // aside from the assert false. 315 assertf( false, "Mangler_old should not visit typedecl: %s", toCString(decl));315 assertf( false, "Mangler_old should not visit typedecl: %s", toCString(decl)); 316 316 assertf( decl->kind < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", decl->kind ); 317 317 mangleName += Encoding::typeVariables[ decl->kind ] + std::to_string( decl->name.length() ) + decl->name; … … 343 343 break; 344 344 default: 345 assert ( false);345 assertf( false, "unimplemented kind for type variable %s", SymTab::Mangler::Encoding::typeVariables[i->kind].c_str() ); 346 346 } // switch 347 347 varNums[ i->name ] = std::make_pair( nextVarNum, (int)i->kind ); … … 673 673 for ( auto & decl : ptype->forall ) { 674 674 switch ( decl->kind ) { 675 case ast::TypeDecl::Kind::Dtype:675 case ast::TypeDecl::Kind::Dtype: 676 676 dcount++; 677 677 break; 678 case ast::TypeDecl::Kind::Ftype:678 case ast::TypeDecl::Kind::Ftype: 679 679 fcount++; 680 680 break; 681 case ast::TypeDecl::Kind::Ttype:681 case ast::TypeDecl::Kind::Ttype: 682 682 vcount++; 683 683 break; 684 default:685 assert ( false);684 default: 685 assertf( false, "unimplemented kind for type variable %s", SymTab::Mangler::Encoding::typeVariables[decl->kind].c_str() ); 686 686 } // switch 687 687 varNums[ decl->name ] = std::make_pair( nextVarNum, (int)decl->kind ); -
src/SymTab/ManglerCommon.cc
r97748ee ra00bc5b 10 10 // Created On : Sun May 17 21:44:03 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 14:54:38 201913 // Update Count : 2 812 // Last Modified On : Mon Jan 11 21:23:10 2021 13 // Update Count : 29 14 14 // 15 15 … … 104 104 const std::string typeVariables[] = { 105 105 "BD", // dtype 106 "BDS", // dtype + sized 106 107 "BO", // otype 107 108 "BF", // ftype 108 109 "BT", // ttype 110 "BAL", // array length type 109 111 }; 110 112 static_assert( 111 sizeof(typeVariables) /sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS,113 sizeof(typeVariables) / sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS, 112 114 "Each type variable kind should have a corresponding mangler prefix" 113 115 ); -
src/SynTree/Declaration.h
r97748ee ra00bc5b 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 23:11:22 201913 // Update Count : 15 712 // Last Modified On : Mon Jan 11 20:48:39 2021 13 // Update Count : 158 14 14 // 15 15 … … 201 201 typedef NamedTypeDecl Parent; 202 202 public: 203 enum Kind { Dtype, Otype, Ftype, Ttype, NUMBER_OF_KINDS };203 enum Kind { Dtype, DStype, Otype, Ftype, Ttype, ALtype, NUMBER_OF_KINDS }; 204 204 205 205 Kind kind; -
src/SynTree/TypeDecl.cc
r97748ee ra00bc5b 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Oct 8 18:18:55 202013 // Update Count : 2 212 // Last Modified On : Tue Jan 12 16:07:33 2021 13 // Update Count : 26 14 14 // 15 15 … … 33 33 34 34 const char * TypeDecl::typeString() const { 35 static const char * kindNames[] = { "sized data type", "sized object type", "sized function type", "sized tupletype" };36 static_assert( sizeof(kindNames) /sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." );35 static const char * kindNames[] = { "sized data type", "sized data type", "sized object type", "sized function type", "sized tuple type", "sized array length type" }; 36 static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." ); 37 37 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); 38 38 return isComplete() ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0' … … 40 40 41 41 const char * TypeDecl::genTypeString() const { 42 static const char * kindNames[] = { " dtype", "otype", "ftype", "ttype" };43 static_assert( sizeof(kindNames) /sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "genTypeString: kindNames is out of sync." );42 static const char * kindNames[] = { "T &", "T *", "T", "(*)", "T ...", "[T]" }; 43 static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "genTypeString: kindNames is out of sync." ); 44 44 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); 45 45 return kindNames[ kind ];
Note: See TracChangeset
for help on using the changeset viewer.