- Timestamp:
- Sep 2, 2020, 5:56:59 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 406970b1
- Parents:
- f8acfc0 (diff), f76ff0b (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/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/heap.cfa
rf8acfc0 r3a4834b3 1239 1239 size_t odsize = dataStorage( bsize, oaddr, header ); // data storage available in bucket 1240 1240 1241 if ( oalign <= nalign && (uintptr_t)oaddr % nalign == 0 ) { // <= alignment and new alignment happens to match 1242 if ( oalign > libAlign() ) { // fake header ? 1243 headerAddr( oaddr )->kind.fake.alignment = nalign | 1; // update alignment (could be the same) 1244 } // if 1241 if ( oalign == nalign && size <= odsize && odsize <= size * 2 ) { // <= alignment and new alignment are same, allow 50% wasted storage for smaller size 1242 header->kind.real.blockSize &= -2; // turn off 0 fill 1243 header->kind.real.size = size; // reset allocation size 1244 return oaddr; 1245 } // if 1246 if ( oalign < nalign && (uintptr_t)oaddr % nalign == 0 && oalign > libAlign() ) { // <= alignment and new alignment happens to match, and oaddr has a fake header 1247 headerAddr( oaddr )->kind.fake.alignment = nalign | 1; // update alignment (could be the same) 1245 1248 if ( size <= odsize && odsize <= size * 2 ) { // allow 50% wasted storage for smaller size 1246 1249 header->kind.real.blockSize &= -2; // turn off 0 fill … … 1282 1285 headers( "realloc", oaddr, header, freeElem, bsize, oalign ); 1283 1286 1284 if ( oalign <= nalign && (uintptr_t)oaddr % nalign == 0 ) { // <= alignment and new alignment happens to match 1285 if ( oalign > libAlign() ) { // fake header ? 1286 headerAddr( oaddr )->kind.fake.alignment = nalign | 1; // update alignment (could be the same) 1287 } // if 1287 if ( oalign == nalign ) { // <= alignment and new alignment are same 1288 return realloc( oaddr, size ); 1289 } // if 1290 if ( oalign < nalign && (uintptr_t)oaddr % nalign == 0 && oalign > libAlign() ) { // <= alignment and new alignment happens to match, and oaddr has a fake header 1291 headerAddr( oaddr )->kind.fake.alignment = nalign | 1; // update alignment (could be the same) 1288 1292 return realloc( oaddr, size ); 1289 1293 } // if -
libcfa/src/stdlib.hfa
rf8acfc0 r3a4834b3 179 179 180 180 if ( Resize ) { 181 //printf("1. $alloc_internal got: %p %p %lu %lu\n", Resize, Realloc, Align, Dim); // these prints are temporary182 181 ptr = (T*) (void *) resize( (void *)Resize, Align, Dim * size ); 183 182 } else if ( Realloc ) { 184 183 if (Fill.tag != '0') copy_end = min(malloc_size( Realloc ), Dim * size); 185 //printf("2. $alloc_internal got: %p %p %lu %lu\n", Resize, Realloc, Align, Dim);186 184 ptr = (T*) (void *) realloc( (void *)Realloc, Align, Dim * size ); 187 185 } else { 188 //printf("3. $alloc_internal got: %p %p %lu %lu\n", Resize, Realloc, Align, Dim);189 186 ptr = (T*) (void *) memalign( Align, Dim * size ); 190 187 }
Note:
See TracChangeset
for help on using the changeset viewer.