- Timestamp:
- Jul 31, 2019, 3:26:06 PM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 61cfae2
- Parents:
- c60a664 (diff), 40287c8 (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:
-
- 3 edited
-
prelude/prelude-gen.cc (modified) (4 diffs)
-
src/heap.cfa (modified) (3 diffs)
-
src/stdlib.hfa (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/prelude/prelude-gen.cc
rc60a664 r99cadc60 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // prelude-gen.cc -- 8 // 6 // 7 // prelude-gen.cc -- 8 // 9 9 // Author : Rob Schluntz and Thierry Delisle 10 10 // Created On : Sat Feb 16 08:44:58 2019 … … 12 12 // Last Modified On : Tue Apr 2 17:18:24 2019 13 13 // Update Count : 37 14 // 14 // 15 15 16 16 #include <algorithm> … … 264 264 for (auto cvq : qualifiersPair) { 265 265 for (auto is_vol : { " ", "volatile" }) { 266 cout << "forall(dtype DT) void ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;266 cout << "forall(dtype DT) void ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl; 267 267 } 268 268 } 269 for (auto cvq : qualifiersSingle) { 270 for (auto is_vol : { " ", "volatile" }) { 271 cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl; 272 } 273 for (auto is_vol : { " ", "volatile" }) { 274 cout << "forall(dtype DT) void ^?{}(" << cvq << type << " * " << is_vol << " &);" << endl; 275 } 269 } 270 for (auto cvq : qualifiersSingle) { 271 for (auto is_vol : { " ", "volatile" }) { 272 cout << "void ?{}(" << cvq << "void" << " * " << is_vol << " &);" << endl; 273 } 274 for (auto is_vol : { " ", "volatile" }) { 275 cout << "void ^?{}(" << cvq << "void" << " * " << is_vol << " &);" << endl; 276 } 277 } 278 279 for (auto cvq : qualifiersSingle) { 280 for (auto is_vol : { " ", "volatile" }) { 281 cout << "forall(dtype DT) void ?{}(" << cvq << " DT" << " * " << is_vol << " &);" << endl; 282 } 283 for (auto is_vol : { " ", "volatile" }) { 284 cout << "forall(dtype DT) void ^?{}(" << cvq << " DT" << " * " << is_vol << " &);" << endl; 276 285 } 277 286 } … … 288 297 cout << endl; 289 298 290 cout << "forall(ftype FT) void ?{}( FT * &, zero_t ); " << endl;299 cout << "forall(ftype FT) void ?{}( FT * &, zero_t );" << endl; 291 300 cout << "forall(ftype FT) FT * ?=?( FT * &, zero_t );" << endl; 292 301 cout << "forall(ftype FT) FT * ?=?( FT * volatile &, zero_t );" << endl; -
libcfa/src/heap.cfa
rc60a664 r99cadc60 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 19 16:07:46201913 // Update Count : 5 4812 // Last Modified On : Wed Jul 24 13:12:45 2019 13 // Update Count : 550 14 14 // 15 15 … … 248 248 249 249 #ifdef FASTLOOKUP 250 static_assert( 16 == sizeof(HeapManager.Storage), "size of HeapManager Storage wrong" ); // FIX ME 251 enum { LookupSizes = 65_536 + 16 }; // number of fast lookup sizes 250 enum { LookupSizes = 65_536 + sizeof(HeapManager.Storage) }; // number of fast lookup sizes 252 251 static unsigned char lookup[LookupSizes]; // O(1) lookup for small sizes 253 252 #endif // FASTLOOKUP … … 869 868 void * area; 870 869 if ( unlikely( alignment != 0 ) ) { // previous request memalign? 871 area = memalign( alignment, size ); // create new a rea870 area = memalign( alignment, size ); // create new aligned area 872 871 } else { 873 872 area = mallocNoStats( size ); // create new area -
libcfa/src/stdlib.hfa
rc60a664 r99cadc60 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Apr 24 17:35:43201913 // Update Count : 3 5212 // Last Modified On : Tue Jul 23 14:14:59 2019 13 // Update Count : 373 14 14 // 15 15 … … 17 17 18 18 #include "bits/defs.hfa" 19 #include "bits/align.hfa" 19 20 20 21 #include <stdlib.h> // *alloc, strto*, ato* 22 21 23 extern "C" { 22 24 void * memalign( size_t align, size_t size ); // malloc.h … … 39 41 40 42 T * malloc( void ) { 41 return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc 43 if ( _Alignof(T) <= libAlign() ) return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc 44 else return (T *)memalign( _Alignof(T), sizeof(T) ); 42 45 } // malloc 43 46 44 47 T * calloc( size_t dim ) { 45 return (T *)(void *)calloc( dim, sizeof(T) ); // C calloc 48 if ( _Alignof(T) <= libAlign() )return (T *)(void *)calloc( dim, sizeof(T) ); // C calloc 49 else return (T *)cmemalign( _Alignof(T), dim, sizeof(T) ); 46 50 } // calloc 47 51 48 52 T * realloc( T * ptr, size_t size ) { 53 if ( unlikely( ptr == 0 ) ) return malloc(); 49 54 return (T *)(void *)realloc( (void *)ptr, size ); 50 55 } // realloc … … 66 71 67 72 T * alloc( void ) { 68 return (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc73 return malloc(); 69 74 } // alloc 70 75 71 76 T * alloc( char fill ) { 72 T * ptr = (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc 77 T * ptr; 78 if ( _Alignof(T) <= libAlign() ) ptr = (T *)(void *)malloc( (size_t)sizeof(T) ); // C malloc 79 else ptr = (T *)memalign( _Alignof(T), sizeof(T) ); 73 80 return (T *)memset( ptr, (int)fill, sizeof(T) ); // initialize with fill value 74 81 } // alloc 75 82 76 83 T * alloc( size_t dim ) { 77 return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc 84 if ( _Alignof(T) <= libAlign() ) return (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C malloc 85 else return (T *)memalign( _Alignof(T), dim * sizeof(T) ); 78 86 } // alloc 79 87 80 88 T * alloc( size_t dim, char fill ) { 81 T * ptr = (T *)(void *)malloc( dim * (size_t)sizeof(T) ); // C calloc 82 return (T *)memset( ptr, (int)fill, dim * sizeof(T) ); // initialize with fill value 89 return (T *)memset( (T *)alloc( dim ), (int)fill, dim * sizeof(T) ); // initialize with fill value 83 90 } // alloc 84 91 85 92 T * alloc( T ptr[], size_t dim ) { 86 return (T *)(void *)realloc( (void *)ptr, dim * (size_t)sizeof(T) ); // C realloc 87 } // alloc 88 } // distribution 89 90 91 forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill ); 93 return realloc( ptr, dim * sizeof(T) ); 94 } // alloc 95 } // distribution 92 96 93 97 … … 107 111 108 112 T * align_alloc( size_t align, size_t dim, char fill ) { 109 T * ptr;110 113 if ( fill == '\0' ) { 111 ptr =(T *)cmemalign( align, dim, sizeof(T) );114 return (T *)cmemalign( align, dim, sizeof(T) ); 112 115 } else { 113 ptr = (T *)memalign( align, dim * sizeof(T) ); 114 return (T *)memset( ptr, (int)fill, dim * sizeof(T) ); 116 return (T *)memset( (T *)memalign( align, dim * sizeof(T) ), (int)fill, dim * sizeof(T) ); 115 117 } // if 116 return ptr; 117 } // align_alloc 118 } // distribution 118 } // align_alloc 119 } // distribution 120 121 forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill ); 119 122 120 123
Note:
See TracChangeset
for help on using the changeset viewer.