Ignore:
Timestamp:
Sep 2, 2020, 5:56:59 PM (15 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc into master

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/heap.cfa

    rf8acfc0 r3a4834b3  
    12391239        size_t odsize = dataStorage( bsize, oaddr, header ); // data storage available in bucket
    12401240
    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)
    12451248                if ( size <= odsize && odsize <= size * 2 ) {   // allow 50% wasted storage for smaller size
    12461249                        header->kind.real.blockSize &= -2;                      // turn off 0 fill
     
    12821285        headers( "realloc", oaddr, header, freeElem, bsize, oalign );
    12831286
    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)
    12881292                return realloc( oaddr, size );
    12891293        } // if
Note: See TracChangeset for help on using the changeset viewer.