Changeset 1b55756


Ignore:
Timestamp:
Sep 7, 2020, 7:52:02 PM (4 years ago)
Author:
m3zulfiq <m3zulfiq@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
113d785
Parents:
943a079
Message:

heap.cfa: removed bug in resize with alignment by adding return before call to resize. alloc2.cfa: added debug prints.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/heap.cfa

    r943a079 r1b55756  
    12571257        } else if ( ! isFakeHeader                                                      // old real header (aligned on libAlign) ?
    12581258                                && nalign == libAlign() ) {                             // new alignment also on libAlign => no fake header needed
    1259                 resize( oaddr, size );                                                  // duplicate special case checks
     1259                return resize( oaddr, size );                                                   // duplicate special case checks
    12601260        } // if
    12611261
  • tests/alloc2.cfa

    r943a079 r1b55756  
    1313void test_base( void * ip, size_t size, size_t align) {
    1414        tests_total += 1;
     15//      printf("DEBUG: starting test %d\n", tests_total);
    1516        bool passed = (malloc_size(ip) == size) && (malloc_usable_size(ip) >= size) && (malloc_alignment(ip) == align) && ((uintptr_t)ip % align  == 0);
    1617        if (!passed) {
     
    1819                tests_failed += 1;
    1920        }
     21//      printf("DEBUG: done test %d\n", tests_total);
    2022}
    2123
    2224void test_fill( void * ip_, size_t start, size_t end, char fill) {
    2325        tests_total += 1;
     26//      printf("DEBUG: starting test %d\n", tests_total);
    2427        bool passed = true;
    2528        char * ip = (char *) ip_;
     
    2932                tests_failed += 1;
    3033        }
     34//      printf("DEBUG: done test %d\n", tests_total);
    3135}
    3236
    3337void test_fill( void * ip_, size_t start, size_t end, int fill) {
    3438        tests_total += 1;
     39//      printf("DEBUG: starting test %d\n", tests_total);
    3540        bool passed = true;
    3641        int * ip = (int *) ip_;
     
    4045                tests_failed += 1;
    4146        }
     47//      printf("DEBUG: done test %d\n", tests_total);
    4248}
    4349
    4450void test_fill( void * ip_, size_t start, size_t end, int * fill) {
    4551        tests_total += 1;
     52//      printf("DEBUG: starting test %d\n", tests_total);
    4653        bool passed = (memcmp((void*)((uintptr_t)ip_ + start), (void*)fill, end) == 0);
    4754        if (!passed) {
     
    4956                tests_failed += 1;
    5057        }
     58//      printf("DEBUG: done test %d\n", tests_total);
    5159}
    5260
    5361void test_fill( void * ip_, size_t start, size_t end, T1 fill) {
    5462        tests_total += 1;
     63//      printf("DEBUG: starting test %d\n", tests_total);
    5564        bool passed = true;
    5665        T1 * ip = (T1 *) ip_;
     
    6069                tests_failed += 1;
    6170        }
     71//      printf("DEBUG: done test %d\n", tests_total);
    6272}
    6373
    6474void test_fill( void * ip_, size_t start, size_t end, T1 * fill) {
    6575        tests_total += 1;
     76//      printf("DEBUG: starting test %d\n", tests_total);
    6677        bool passed = (memcmp((void*)((uintptr_t)ip_ + start), (void*)fill, end) == 0);
    6778        if (!passed) {
     
    6980                tests_failed += 1;
    7081        }
     82//      printf("DEBUG: done test %d\n", tests_total);
    7183}
    7284
    7385void test_use( int * ip, size_t dim) {
    7486        tests_total += 1;
     87//      printf("DEBUG: starting test %d\n", tests_total);
    7588        bool passed = true;
    7689        for (i; 0 ~ dim) ip[i] = 0xdeadbeef;
     
    8093                tests_failed += 1;
    8194        }
     95//      printf("DEBUG: done test %d\n", tests_total);
    8296}
    8397
    8498void test_use( T1 * ip, size_t dim) {
    8599        tests_total += 1;
     100//      printf("DEBUG: starting test %d\n", tests_total);
    86101        bool passed = true;
    87102        for (i; 0 ~ dim) ip[i].data = 0xdeadbeef;
     
    91106                tests_failed += 1;
    92107        }
     108//      printf("DEBUG: done test %d\n", tests_total);
    93109}
    94110
Note: See TracChangeset for help on using the changeset viewer.