Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : comment backtrace and add ignore mechanism in mmalloc metadata
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Mon, 7 Jan 2013 12:56:08 +0000 (13:56 +0100)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Mon, 7 Jan 2013 12:56:08 +0000 (13:56 +0100)
src/mc/mc_global.c
src/xbt/mmalloc/mfree.c
src/xbt/mmalloc/mm_diff.c
src/xbt/mmalloc/mmalloc.c
src/xbt/mmalloc/mmprivate.h

index cdc4cd1..6cd26b8 100644 (file)
@@ -752,8 +752,10 @@ void MC_ignore_heap(void *address, size_t size){
     
     if(((xbt_mheap_t)std_heap)->heapinfo[region->block].type == 0){
       region->fragment = -1;
     
     if(((xbt_mheap_t)std_heap)->heapinfo[region->block].type == 0){
       region->fragment = -1;
+      ((xbt_mheap_t)std_heap)->heapinfo[region->block].busy_block.ignore = 1;
     }else{
       region->fragment = ((uintptr_t) (ADDR2UINT (address) % (BLOCKSIZE))) >> ((xbt_mheap_t)std_heap)->heapinfo[region->block].type;
     }else{
       region->fragment = ((uintptr_t) (ADDR2UINT (address) % (BLOCKSIZE))) >> ((xbt_mheap_t)std_heap)->heapinfo[region->block].type;
+      ((xbt_mheap_t)std_heap)->heapinfo[region->block].busy_frag.ignore[region->fragment] = 1;
     }
     
   }
     }
     
   }
index b11e21e..e9031eb 100644 (file)
@@ -157,7 +157,8 @@ void mfree(struct mdesc *mdp, void *ptr)
 
     /* Set size used in the fragment to -1 */
     mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = -1;
 
     /* Set size used in the fragment to -1 */
     mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = -1;
-
+    mdp->heapinfo[block].busy_frag.ignore[frag_nb] = 0;
+    
 //    fprintf(stderr,"nfree:%zu capa:%d\n", mdp->heapinfo[block].busy_frag.nfree,(BLOCKSIZE >> type));
     if (mdp->heapinfo[block].busy_frag.nfree ==
         (BLOCKSIZE >> type) - 1) {
 //    fprintf(stderr,"nfree:%zu capa:%d\n", mdp->heapinfo[block].busy_frag.nfree,(BLOCKSIZE >> type));
     if (mdp->heapinfo[block].busy_frag.nfree ==
         (BLOCKSIZE >> type) - 1) {
@@ -168,7 +169,8 @@ void mfree(struct mdesc *mdp, void *ptr)
       mdp->heapinfo[block].type = 0;
       mdp->heapinfo[block].busy_block.size = 1;
       mdp->heapinfo[block].busy_block.busy_size = 0;
       mdp->heapinfo[block].type = 0;
       mdp->heapinfo[block].busy_block.size = 1;
       mdp->heapinfo[block].busy_block.busy_size = 0;
-      
+      mdp->heapinfo[block].busy_block.ignore = 0;
+            
       /* Keep the statistics accurate.  */
       mdp -> heapstats.chunks_used++;
       mdp -> heapstats.bytes_used += BLOCKSIZE;
       /* Keep the statistics accurate.  */
       mdp -> heapstats.chunks_used++;
       mdp -> heapstats.bytes_used += BLOCKSIZE;
index e19bd95..6dda1cc 100644 (file)
@@ -34,82 +34,82 @@ static char* is_stack(void *address);
 
 void mmalloc_backtrace_block_display(void* heapinfo, int block){
 
 
 void mmalloc_backtrace_block_display(void* heapinfo, int block){
 
-  xbt_ex_t e;
-
-  if (((malloc_info *)heapinfo)[block].busy_block.bt_size == 0) {
-    fprintf(stderr, "No backtrace available for that block, sorry.\n");
-    return;
-  }
-
-  memcpy(&e.bt,&(((malloc_info *)heapinfo)[block].busy_block.bt),sizeof(void*)*XBT_BACKTRACE_SIZE);
-  e.used = ((malloc_info *)heapinfo)[block].busy_block.bt_size;
-
-  xbt_ex_setup_backtrace(&e);
-  if (e.used == 0) {
-    fprintf(stderr, "(backtrace not set)\n");
-  } else if (e.bt_strings == NULL) {
-    fprintf(stderr, "(backtrace not ready to be computed. %s)\n",xbt_binary_name?"Dunno why":"xbt_binary_name not setup yet");
-  } else {
-    int i;
-
-    fprintf(stderr, "Backtrace of where the block %d was malloced (%d frames):\n", block ,e.used);
-    for (i = 0; i < e.used; i++)       /* no need to display "xbt_backtrace_display" */{
-      fprintf(stderr, "%d ---> %s\n",i, e.bt_strings[i] + 4);
-    }
-  }
+  /* xbt_ex_t e; */
+
+  /* if (((malloc_info *)heapinfo)[block].busy_block.bt_size == 0) { */
+  /*   fprintf(stderr, "No backtrace available for that block, sorry.\n"); */
+  /*   return; */
+  /* } */
+
+  /* memcpy(&e.bt,&(((malloc_info *)heapinfo)[block].busy_block.bt),sizeof(void*)*XBT_BACKTRACE_SIZE); */
+  /* e.used = ((malloc_info *)heapinfo)[block].busy_block.bt_size; */
+
+  /* xbt_ex_setup_backtrace(&e); */
+  /* if (e.used == 0) { */
+  /*   fprintf(stderr, "(backtrace not set)\n"); */
+  /* } else if (e.bt_strings == NULL) { */
+  /*   fprintf(stderr, "(backtrace not ready to be computed. %s)\n",xbt_binary_name?"Dunno why":"xbt_binary_name not setup yet"); */
+  /* } else { */
+  /*   int i; */
+
+  /*   fprintf(stderr, "Backtrace of where the block %d was malloced (%d frames):\n", block ,e.used); */
+  /*   for (i = 0; i < e.used; i++)       /\* no need to display "xbt_backtrace_display" *\/{ */
+  /*     fprintf(stderr, "%d ---> %s\n",i, e.bt_strings[i] + 4); */
+  /*   } */
+  /* } */
 }
 
 void mmalloc_backtrace_fragment_display(void* heapinfo, int block, int frag){
 
 }
 
 void mmalloc_backtrace_fragment_display(void* heapinfo, int block, int frag){
 
-  xbt_ex_t e;
+  /* xbt_ex_t e; */
 
 
-  memcpy(&e.bt,&(((malloc_info *)heapinfo)[block].busy_frag.bt[frag]),sizeof(void*)*XBT_BACKTRACE_SIZE);
-  e.used = XBT_BACKTRACE_SIZE;
+  /* memcpy(&e.bt,&(((malloc_info *)heapinfo)[block].busy_frag.bt[frag]),sizeof(void*)*XBT_BACKTRACE_SIZE); */
+  /* e.used = XBT_BACKTRACE_SIZE; */
 
 
-  xbt_ex_setup_backtrace(&e);
-  if (e.used == 0) {
-    fprintf(stderr, "(backtrace not set)\n");
-  } else if (e.bt_strings == NULL) {
-    fprintf(stderr, "(backtrace not ready to be computed. %s)\n",xbt_binary_name?"Dunno why":"xbt_binary_name not setup yet");
-  } else {
-    int i;
+  /* xbt_ex_setup_backtrace(&e); */
+  /* if (e.used == 0) { */
+  /*   fprintf(stderr, "(backtrace not set)\n"); */
+  /* } else if (e.bt_strings == NULL) { */
+  /*   fprintf(stderr, "(backtrace not ready to be computed. %s)\n",xbt_binary_name?"Dunno why":"xbt_binary_name not setup yet"); */
+  /* } else { */
+  /*   int i; */
 
 
-    fprintf(stderr, "Backtrace of where the fragment %d in block %d was malloced (%d frames):\n", frag, block ,e.used);
-    for (i = 0; i < e.used; i++)       /* no need to display "xbt_backtrace_display" */{
-      fprintf(stderr, "%d ---> %s\n",i, e.bt_strings[i] + 4);
-    }
-  }
+  /*   fprintf(stderr, "Backtrace of where the fragment %d in block %d was malloced (%d frames):\n", frag, block ,e.used); */
+  /*   for (i = 0; i < e.used; i++)       /\* no need to display "xbt_backtrace_display" *\/{ */
+  /*     fprintf(stderr, "%d ---> %s\n",i, e.bt_strings[i] + 4); */
+  /*   } */
+  /* } */
 
 }
 
 void mmalloc_backtrace_display(void *addr){
 
 
 }
 
 void mmalloc_backtrace_display(void *addr){
 
-  size_t block, frag_nb;
-  int type;
+  /* size_t block, frag_nb; */
+  /* int type; */
   
   
-  xbt_mheap_t heap = __mmalloc_current_heap ?: (xbt_mheap_t) mmalloc_preinit();
-
-  block = (((char*) (addr) - (char*) heap -> heapbase) / BLOCKSIZE + 1);
-
-  type = heap->heapinfo[block].type;
-
-  switch(type){
-  case -1 : /* Free block */
-    fprintf(stderr, "Asked to display the backtrace of a block that is free. I'm puzzled\n");
-    xbt_abort();
-    break; 
-  case 0: /* Large block */
-    mmalloc_backtrace_block_display(heap->heapinfo, block);
-    break;
-  default: /* Fragmented block */
-    frag_nb = RESIDUAL(addr, BLOCKSIZE) >> type;
-    if(heap->heapinfo[block].busy_frag.frag_size[frag_nb] == -1){
-      fprintf(stderr , "Asked to display the backtrace of a fragment that is free. I'm puzzled\n");
-      xbt_abort();
-    }
-    mmalloc_backtrace_fragment_display(heap->heapinfo, block, frag_nb);
-    break;
-  }
+  /* xbt_mheap_t heap = __mmalloc_current_heap ?: (xbt_mheap_t) mmalloc_preinit(); */
+
+  /* block = (((char*) (addr) - (char*) heap -> heapbase) / BLOCKSIZE + 1); */
+
+  /* type = heap->heapinfo[block].type; */
+
+  /* switch(type){ */
+  /* case -1 : /\* Free block *\/ */
+  /*   fprintf(stderr, "Asked to display the backtrace of a block that is free. I'm puzzled\n"); */
+  /*   xbt_abort(); */
+  /*   break;  */
+  /* case 0: /\* Large block *\/ */
+  /*   mmalloc_backtrace_block_display(heap->heapinfo, block); */
+  /*   break; */
+  /* default: /\* Fragmented block *\/ */
+  /*   frag_nb = RESIDUAL(addr, BLOCKSIZE) >> type; */
+  /*   if(heap->heapinfo[block].busy_frag.frag_size[frag_nb] == -1){ */
+  /*     fprintf(stderr , "Asked to display the backtrace of a fragment that is free. I'm puzzled\n"); */
+  /*     xbt_abort(); */
+  /*   } */
+  /*   mmalloc_backtrace_fragment_display(heap->heapinfo, block, frag_nb); */
+  /*   break; */
+  /* } */
 }
 
 
 }
 
 
@@ -247,11 +247,8 @@ int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t *stac
             add_heap_area_pair(previous, current_block, -1, current_block, -1);
         
             if(res_compare != -1){
             add_heap_area_pair(previous, current_block, -1, current_block, -1);
         
             if(res_compare != -1){
-              if(ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)){
-                if(in_mc_comparison_ignore((int)current_block, -1))
-                  res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 1);
-                else
-                  res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 0);
+              if((ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)) && heapinfo1[current_block].busy_block.ignore == 1){
+                res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 1);
               }else{
                 res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 0);
               }
               }else{
                 res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 0);
               }
@@ -318,11 +315,8 @@ int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t *stac
         add_heap_area_pair(previous, i1, -1, i2, -1);
         
         if(res_compare != -1){
         add_heap_area_pair(previous, i1, -1, i2, -1);
         
         if(res_compare != -1){
-          if(ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)){
-            if(in_mc_comparison_ignore((int)i1, -1))
-              res_compare = compare_area(addr_block1, addr_block2, heapinfo1[i1].busy_block.busy_size, previous, 1);
-            else
-              res_compare = compare_area(addr_block1, addr_block2, heapinfo1[i1].busy_block.busy_size, previous, 0);
+          if((ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)) && heapinfo1[i1].busy_block.ignore == 1){
+            res_compare = compare_area(addr_block1, addr_block2, heapinfo1[i1].busy_block.busy_size, previous, 1);
           }else{
             res_compare = compare_area(addr_block1, addr_block2, heapinfo1[i1].busy_block.busy_size, previous, 0);
           }
           }else{
             res_compare = compare_area(addr_block1, addr_block2, heapinfo1[i1].busy_block.busy_size, previous, 0);
           }
@@ -376,11 +370,8 @@ int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t *stac
                
                 add_heap_area_pair(previous, current_block, current_fragment, current_block, current_fragment);
             
                
                 add_heap_area_pair(previous, current_block, current_fragment, current_block, current_fragment);
             
-                if(ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)){
-                  if(in_mc_comparison_ignore((int)current_block, (int)current_fragment))
-                    res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 1);
-                  else
-                    res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 0);
+                if((ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)) && (heapinfo1[current_block].busy_frag.ignore[current_fragment] == 1)){
+                  res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 1);
                 }else{
                   res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 0);
                 }
                 }else{
                   res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 0);
                 }
@@ -422,11 +413,8 @@ int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t *stac
             /* Comparison */
             add_heap_area_pair(previous, i1, j1, i2, j2);
             
             /* Comparison */
             add_heap_area_pair(previous, i1, j1, i2, j2);
             
-            if(ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)){
-              if(in_mc_comparison_ignore((int)i1, (int)j1))
-                res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[i1].busy_frag.frag_size[j1], previous, 1);
-              else
-                res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[i1].busy_frag.frag_size[j1], previous, 0);
+            if((ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)) && (heapinfo1[i1].busy_frag.ignore[j1] == 1)){
+              res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[i1].busy_frag.frag_size[j1], previous, 1);
             }else{
               res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[i1].busy_frag.frag_size[j1], previous, 0);
             }
             }else{
               res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[i1].busy_frag.frag_size[j1], previous, 0);
             }
@@ -464,7 +452,7 @@ int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t *stac
           if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
             addr_block1 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase1));
             XBT_DEBUG("Block %zu (%p) not found (size used = %zu)", i, addr_block1, heapinfo1[i].busy_block.busy_size);
           if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
             addr_block1 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase1));
             XBT_DEBUG("Block %zu (%p) not found (size used = %zu)", i, addr_block1, heapinfo1[i].busy_block.busy_size);
-            mmalloc_backtrace_block_display((void*)heapinfo1, i);
+            //mmalloc_backtrace_block_display((void*)heapinfo1, i);
           }
           nb_diff1++;
         }else{
           }
           nb_diff1++;
         }else{
@@ -480,7 +468,7 @@ int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t *stac
             if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
               addr_frag1 = (void*) ((char *)addr_block1 + (j << heapinfo1[i].type));
               XBT_DEBUG("Block %zu, Fragment %zu (%p) not found (size used = %d)", i, j, addr_frag1, heapinfo1[i].busy_frag.frag_size[j]);
             if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
               addr_frag1 = (void*) ((char *)addr_block1 + (j << heapinfo1[i].type));
               XBT_DEBUG("Block %zu, Fragment %zu (%p) not found (size used = %d)", i, j, addr_frag1, heapinfo1[i].busy_frag.frag_size[j]);
-              mmalloc_backtrace_fragment_display((void*)heapinfo1, i, j);
+              //mmalloc_backtrace_fragment_display((void*)heapinfo1, i, j);
             }
             nb_diff1++;
           }else{
             }
             nb_diff1++;
           }else{
@@ -504,7 +492,7 @@ int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t *stac
           if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
             addr_block2 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase2));
             XBT_DEBUG("Block %zu (%p) not found (size used = %zu)", i, addr_block2, heapinfo2[i].busy_block.busy_size);
           if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
             addr_block2 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase2));
             XBT_DEBUG("Block %zu (%p) not found (size used = %zu)", i, addr_block2, heapinfo2[i].busy_block.busy_size);
-            mmalloc_backtrace_block_display((void*)heapinfo2, i);
+            //mmalloc_backtrace_block_display((void*)heapinfo2, i);
           }
           nb_diff2++;
         }else{
           }
           nb_diff2++;
         }else{
@@ -520,7 +508,7 @@ int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2, xbt_dynar_t *stac
             if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
               addr_frag2 = (void*) ((char *)addr_block2 + (j << heapinfo2[i].type));
               XBT_DEBUG( "Block %zu, Fragment %zu (%p) not found (size used = %d)", i, j, addr_frag2, heapinfo2[i].busy_frag.frag_size[j]);
             if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
               addr_frag2 = (void*) ((char *)addr_block2 + (j << heapinfo2[i].type));
               XBT_DEBUG( "Block %zu, Fragment %zu (%p) not found (size used = %d)", i, j, addr_frag2, heapinfo2[i].busy_frag.frag_size[j]);
-              mmalloc_backtrace_fragment_display((void*)heapinfo2, i, j);
+              //mmalloc_backtrace_fragment_display((void*)heapinfo2, i, j);
             }
             nb_diff2++;
           }else{
             }
             nb_diff2++;
           }else{
@@ -655,11 +643,8 @@ static int compare_area(void *area1, void* area2, size_t size, xbt_dynar_t previ
 
           if(add_heap_area_pair(previous, block_pointed1, -1, block_pointed2, -1)){
 
 
           if(add_heap_area_pair(previous, block_pointed1, -1, block_pointed2, -1)){
 
-            if(ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)){
-              if(in_mc_comparison_ignore(block_pointed1, -1))
-                res_compare = compare_area(addr_block_pointed1, addr_block_pointed2, heapinfo1[block_pointed1].busy_block.busy_size, previous, 1);
-              else
-                res_compare = compare_area(addr_block_pointed1, addr_block_pointed2, heapinfo1[block_pointed1].busy_block.busy_size, previous, 0);
+            if((ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)) && (heapinfo1[block_pointed1].busy_block.ignore == 1)){
+              res_compare = compare_area(addr_block_pointed1, addr_block_pointed2, heapinfo1[block_pointed1].busy_block.busy_size, previous, 1);
             }else{
               res_compare = compare_area(addr_block_pointed1, addr_block_pointed2, heapinfo1[block_pointed1].busy_block.busy_size, previous, 0);
             }
             }else{
               res_compare = compare_area(addr_block_pointed1, addr_block_pointed2, heapinfo1[block_pointed1].busy_block.busy_size, previous, 0);
             }
@@ -683,11 +668,11 @@ static int compare_area(void *area1, void* area2, size_t size, xbt_dynar_t previ
 
           if(add_heap_area_pair(previous, block_pointed1, frag_pointed1, block_pointed2, frag_pointed2)){
 
 
           if(add_heap_area_pair(previous, block_pointed1, frag_pointed1, block_pointed2, frag_pointed2)){
 
-            if(ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)){
-              if(in_mc_comparison_ignore(block_pointed1, frag_pointed1))
+            if((ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)) && (heapinfo1[block_pointed1].busy_frag.ignore[frag_pointed1] == 1)){
+              //if(in_mc_comparison_ignore(block_pointed1, frag_pointed1))
                 res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 1);
                 res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 1);
-              else
-                res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);
+                /*else
+                  res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);*/
             }else{
               res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);
             }
             }else{
               res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);
             }
@@ -717,11 +702,8 @@ static int compare_area(void *area1, void* area2, size_t size, xbt_dynar_t previ
 
           if(add_heap_area_pair(previous, block_pointed1, frag_pointed1, block_pointed2, frag_pointed2)){
 
 
           if(add_heap_area_pair(previous, block_pointed1, frag_pointed1, block_pointed2, frag_pointed2)){
 
-            if(ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)){
-              if(in_mc_comparison_ignore(block_pointed1, frag_pointed1))
-                res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 1);
-              else
-                res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);
+            if((ignore_done < xbt_dynar_length(mc_heap_comparison_ignore)) && (heapinfo1[block_pointed1].busy_frag.ignore[frag_pointed1] == 1)){
+              res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 1);
             }else{
               res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);
             }
             }else{
               res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);
             }
index 89d1ec6..726842f 100644 (file)
@@ -122,7 +122,8 @@ static void *register_morecore(struct mdesc *mdp, size_t size)
 
     newinfo[BLOCK(oldinfo)].busy_block.size = BLOCKIFY(mdp->heapsize * sizeof(malloc_info));
     newinfo[BLOCK(oldinfo)].busy_block.busy_size = size;
 
     newinfo[BLOCK(oldinfo)].busy_block.size = BLOCKIFY(mdp->heapsize * sizeof(malloc_info));
     newinfo[BLOCK(oldinfo)].busy_block.busy_size = size;
-    newinfo[BLOCK(oldinfo)].busy_block.bt_size = 0;// FIXME setup the backtrace
+    newinfo[BLOCK(oldinfo)].busy_block.ignore = 0;
+    //newinfo[BLOCK(oldinfo)].busy_block.bt_size = 0;// FIXME setup the backtrace
     mfree(mdp, (void *) oldinfo);
     mdp->heapsize = newsize;
   }
     mfree(mdp, (void *) oldinfo);
     mdp->heapsize = newsize;
   }
@@ -201,7 +202,8 @@ void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size)
 
       /* Update our metadata about this fragment */
       candidate_info->busy_frag.frag_size[candidate_frag] = requested_size;
 
       /* Update our metadata about this fragment */
       candidate_info->busy_frag.frag_size[candidate_frag] = requested_size;
-      xbt_backtrace_no_malloc(candidate_info->busy_frag.bt[candidate_frag],XBT_BACKTRACE_SIZE);
+      candidate_info->busy_frag.ignore[candidate_frag] = 0;
+      //xbt_backtrace_no_malloc(candidate_info->busy_frag.bt[candidate_frag],XBT_BACKTRACE_SIZE);
 
       /* Update the statistics.  */
       mdp -> heapstats.chunks_used++;
 
       /* Update the statistics.  */
       mdp -> heapstats.chunks_used++;
@@ -220,6 +222,7 @@ void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size)
       /* Link all fragments but the first as free, and add the block to the swag of blocks containing free frags  */
       for (i = 1; i < (size_t) (BLOCKSIZE >> log); ++i) {
         mdp->heapinfo[block].busy_frag.frag_size[i] = -1;
       /* Link all fragments but the first as free, and add the block to the swag of blocks containing free frags  */
       for (i = 1; i < (size_t) (BLOCKSIZE >> log); ++i) {
         mdp->heapinfo[block].busy_frag.frag_size[i] = -1;
+        mdp->heapinfo[block].busy_frag.ignore[i] = 0;
       }
       mdp->heapinfo[block].busy_frag.nfree = i - 1;
       mdp->heapinfo[block].freehook.prev = NULL;
       }
       mdp->heapinfo[block].busy_frag.nfree = i - 1;
       mdp->heapinfo[block].freehook.prev = NULL;
@@ -229,7 +232,8 @@ void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size)
 
       /* mark the fragment returned as busy */
       mdp->heapinfo[block].busy_frag.frag_size[0] = requested_size;
 
       /* mark the fragment returned as busy */
       mdp->heapinfo[block].busy_frag.frag_size[0] = requested_size;
-      xbt_backtrace_no_malloc(mdp->heapinfo[block].busy_frag.bt[0],XBT_BACKTRACE_SIZE);
+      mdp->heapinfo[block].busy_frag.ignore[0] = 0;
+      //xbt_backtrace_no_malloc(mdp->heapinfo[block].busy_frag.bt[0],XBT_BACKTRACE_SIZE);
       
       /* update stats */
       mdp -> heapstats.chunks_free += (BLOCKSIZE >> log) - 1;
       
       /* update stats */
       mdp -> heapstats.chunks_free += (BLOCKSIZE >> log) - 1;
@@ -276,7 +280,8 @@ void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size)
         }
         mdp->heapinfo[block].busy_block.size = blocks;
         mdp->heapinfo[block].busy_block.busy_size = requested_size;
         }
         mdp->heapinfo[block].busy_block.size = blocks;
         mdp->heapinfo[block].busy_block.busy_size = requested_size;
-        mdp->heapinfo[block].busy_block.bt_size=xbt_backtrace_no_malloc(mdp->heapinfo[block].busy_block.bt,XBT_BACKTRACE_SIZE);
+        //mdp->heapinfo[block].busy_block.bt_size=xbt_backtrace_no_malloc(mdp->heapinfo[block].busy_block.bt,XBT_BACKTRACE_SIZE);
+        mdp->heapinfo[block].busy_block.ignore = 0;
         mdp -> heapstats.chunks_used++;
         mdp -> heapstats.bytes_used += blocks * BLOCKSIZE;
 
         mdp -> heapstats.chunks_used++;
         mdp -> heapstats.bytes_used += blocks * BLOCKSIZE;
 
@@ -314,8 +319,9 @@ void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size)
     }
     mdp->heapinfo[block].busy_block.size = blocks;
     mdp->heapinfo[block].busy_block.busy_size = requested_size;
     }
     mdp->heapinfo[block].busy_block.size = blocks;
     mdp->heapinfo[block].busy_block.busy_size = requested_size;
+    mdp->heapinfo[block].busy_block.ignore = 0;
     //mdp->heapinfo[block].busy_block.bt_size = 0;
     //mdp->heapinfo[block].busy_block.bt_size = 0;
-    mdp->heapinfo[block].busy_block.bt_size = xbt_backtrace_no_malloc(mdp->heapinfo[block].busy_block.bt,XBT_BACKTRACE_SIZE);
+    //mdp->heapinfo[block].busy_block.bt_size = xbt_backtrace_no_malloc(mdp->heapinfo[block].busy_block.bt,XBT_BACKTRACE_SIZE);
 
     mdp -> heapstats.chunks_used++;
     mdp -> heapstats.bytes_used += blocks * BLOCKSIZE;
 
     mdp -> heapstats.chunks_used++;
     mdp -> heapstats.bytes_used += blocks * BLOCKSIZE;
index 26feb7d..8eeadaa 100644 (file)
@@ -155,14 +155,16 @@ typedef struct {
     struct {
       size_t nfree;               /* Free fragments in a fragmented block.  */
       short frag_size[MAX_FRAGMENT_PER_BLOCK];
     struct {
       size_t nfree;               /* Free fragments in a fragmented block.  */
       short frag_size[MAX_FRAGMENT_PER_BLOCK];
-      void *bt[MAX_FRAGMENT_PER_BLOCK][XBT_BACKTRACE_SIZE]; /* Where it was malloced (or realloced lastly) */
+      //void *bt[MAX_FRAGMENT_PER_BLOCK][XBT_BACKTRACE_SIZE]; /* Where it was malloced (or realloced lastly) */
+      int ignore[MAX_FRAGMENT_PER_BLOCK];
       heap_area_t equal_to[MAX_FRAGMENT_PER_BLOCK];
     } busy_frag;
     struct {
       size_t size; /* Size (in blocks) of a large cluster.  */
       size_t busy_size; /* Actually used space, in bytes */
       heap_area_t equal_to[MAX_FRAGMENT_PER_BLOCK];
     } busy_frag;
     struct {
       size_t size; /* Size (in blocks) of a large cluster.  */
       size_t busy_size; /* Actually used space, in bytes */
-      void *bt[XBT_BACKTRACE_SIZE]; /* Where it was malloced (or realloced lastly) */
-      int bt_size;
+      //void *bt[XBT_BACKTRACE_SIZE]; /* Where it was malloced (or realloced lastly) */
+      //int bt_size;
+      int ignore;
       heap_area_t equal_to;
     } busy_block;
     /* Heap information for a free block (that may be the first of a free cluster).  */
       heap_area_t equal_to;
     } busy_block;
     /* Heap information for a free block (that may be the first of a free cluster).  */