1 /* mm_diff - Memory snapshooting and comparison */
3 /* Copyright (c) 2008-2012. The SimGrid Team. All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "xbt/ex_interface.h" /* internals of backtrace setup */
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mm_diff, xbt,
13 "Logging specific to mm_diff in mmalloc");
15 extern char *xbt_binary_name;
17 xbt_dynar_t mmalloc_ignore;
19 typedef struct s_heap_area_pair{
24 }s_heap_area_pair_t, *heap_area_pair_t;
26 static void heap_area_pair_free(heap_area_pair_t pair);
27 static void heap_area_pair_free_voidp(void *d);
28 static int add_heap_area_pair(xbt_dynar_t list, int block1, int fragment1, int block2, int fragment2);
29 static int is_new_heap_area_pair(xbt_dynar_t list, int block1, int fragment1, int block2, int fragment2);
31 static int compare_area(void *area1, void* area2, size_t size, xbt_dynar_t previous, int check_ignore);
32 static void match_equals(xbt_dynar_t list);
34 static int in_mmalloc_ignore(int block, int fragment);
35 static size_t heap_comparison_ignore(void *address);
37 void mmalloc_backtrace_block_display(void* heapinfo, int block){
41 if (((malloc_info *)heapinfo)[block].busy_block.bt_size == 0) {
42 XBT_DEBUG("No backtrace available for that block, sorry.");
46 memcpy(&e.bt,&(((malloc_info *)heapinfo)[block].busy_block.bt),sizeof(void*)*XBT_BACKTRACE_SIZE);
47 e.used = ((malloc_info *)heapinfo)[block].busy_block.bt_size;
49 xbt_ex_setup_backtrace(&e);
51 XBT_DEBUG("(backtrace not set)");
52 } else if (e.bt_strings == NULL) {
53 XBT_DEBUG("(backtrace not ready to be computed. %s)",xbt_binary_name?"Dunno why":"xbt_binary_name not setup yet");
57 XBT_DEBUG("Backtrace of where the block %d was malloced (%d frames):", block ,e.used);
58 for (i = 0; i < e.used; i++) /* no need to display "xbt_backtrace_display" */{
59 XBT_DEBUG("%d ---> %s",i, e.bt_strings[i] + 4);
65 void mmalloc_backtrace_fragment_display(void* heapinfo, int block, int frag){
69 memcpy(&e.bt,&(((malloc_info *)heapinfo)[block].busy_frag.bt[frag]),sizeof(void*)*XBT_BACKTRACE_SIZE);
70 e.used = XBT_BACKTRACE_SIZE;
72 xbt_ex_setup_backtrace(&e);
74 XBT_DEBUG("(backtrace not set)");
75 } else if (e.bt_strings == NULL) {
76 XBT_DEBUG("(backtrace not ready to be computed. %s)",xbt_binary_name?"Dunno why":"xbt_binary_name not setup yet");
80 XBT_DEBUG("Backtrace of where the fragment %d in block %d was malloced (%d frames):", frag, block ,e.used);
81 for (i = 0; i < e.used; i++) /* no need to display "xbt_backtrace_display" */{
82 XBT_DEBUG("%d ---> %s",i, e.bt_strings[i] + 4);
88 void *s_heap, *heapbase1, *heapbase2;
89 malloc_info *heapinfo1, *heapinfo2;
90 size_t heaplimit, heapsize1, heapsize2;
94 int mmalloc_compare_heap(xbt_mheap_t heap1, xbt_mheap_t heap2){
96 if(heap1 == NULL && heap1 == NULL){
97 XBT_DEBUG("Malloc descriptors null");
101 if(heap1->heaplimit != heap2->heaplimit){
102 XBT_DEBUG("Different limit of valid info table indices");
106 /* Heap information */
107 heaplimit = ((struct mdesc *)heap1)->heaplimit;
109 s_heap = (char *)mmalloc_get_current_heap() - STD_HEAP_SIZE - getpagesize();
111 heapbase1 = (char *)heap1 + BLOCKSIZE;
112 heapbase2 = (char *)heap2 + BLOCKSIZE;
114 heapinfo1 = (malloc_info *)((char *)heap1 + ((uintptr_t)((char *)heap1->heapinfo - (char *)s_heap)));
115 heapinfo2 = (malloc_info *)((char *)heap2 + ((uintptr_t)((char *)heap2->heapinfo - (char *)s_heap)));
117 heapsize1 = heap1->heapsize;
118 heapsize2 = heap2->heapsize;
120 /* Start comparison */
121 size_t i1, i2, j1, j2, k, current_block, current_fragment;
122 void *addr_block1, *addr_block2, *addr_frag1, *addr_frag2;
124 xbt_dynar_t previous = xbt_dynar_new(sizeof(heap_area_pair_t), heap_area_pair_free_voidp);
126 int equal, res_compare;
130 /* Init equal information */
133 while(i1<=heaplimit){
134 if(heapinfo1[i1].type == 0){
135 heapinfo1[i1].busy_block.equal_to = -1;
137 if(heapinfo1[i1].type > 0){
138 for(j1=0; j1 < MAX_FRAGMENT_PER_BLOCK; j1++){
139 heapinfo1[i1].busy_frag.equal_to[j1] = -1;
147 while(i2<=heaplimit){
148 if(heapinfo2[i2].type == 0){
149 heapinfo2[i2].busy_block.equal_to = -1;
151 if(heapinfo2[i2].type > 0){
152 for(j2=0; j2 < MAX_FRAGMENT_PER_BLOCK; j2++){
153 heapinfo2[i2].busy_frag.equal_to[j2] = -1;
159 /* Check busy blocks*/
163 while(i1 <= heaplimit){
167 if(heapinfo1[i1].type == -1){ /* Free block */
172 addr_block1 = ((void*) (((ADDR2UINT(i1)) - 1) * BLOCKSIZE + (char*)heapbase1));
174 if(heapinfo1[i1].type == 0){ /* Large block */
176 if(heapinfo1[i1].busy_block.busy_size == 0){
184 /* Try first to associate to same block in the other heap */
185 if(heapinfo2[current_block].type == heapinfo1[current_block].type){
187 if(heapinfo1[current_block].busy_block.busy_size == heapinfo2[current_block].busy_block.busy_size){
189 addr_block2 = ((void*) (((ADDR2UINT(current_block)) - 1) * BLOCKSIZE + (char*)heapbase2));
191 add_heap_area_pair(previous, current_block, -1, current_block, -1);
193 if(ignore_done < xbt_dynar_length(mmalloc_ignore)){
194 if(in_mmalloc_ignore((int)current_block, -1))
195 res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 1);
197 res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 0);
199 res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 0);
202 if(res_compare == 0){
203 for(k=1; k < heapinfo2[current_block].busy_block.size; k++)
204 heapinfo2[current_block+k].busy_block.equal_to = 1 ;
205 for(k=1; k < heapinfo1[current_block].busy_block.size; k++)
206 heapinfo1[current_block+k].busy_block.equal_to = 1 ;
208 match_equals(previous);
209 i1 = i1 + heapinfo1[i1].busy_block.size;
212 xbt_dynar_reset(previous);
218 while(i2 <= heaplimit && !equal){
220 if(i2 == current_block){
225 if(heapinfo2[i2].type != 0){
230 if(heapinfo2[i2].busy_block.equal_to == 1){
235 if(heapinfo1[i1].busy_block.size != heapinfo2[i2].busy_block.size){
240 if(heapinfo1[i1].busy_block.busy_size != heapinfo2[i2].busy_block.busy_size){
245 addr_block2 = ((void*) (((ADDR2UINT(i2)) - 1) * BLOCKSIZE + (char*)heapbase2));
248 add_heap_area_pair(previous, i1, -1, i2, -1);
250 if(ignore_done < xbt_dynar_length(mmalloc_ignore)){
251 if(in_mmalloc_ignore((int)i1, -1))
252 res_compare = compare_area(addr_block1, addr_block2, heapinfo1[i1].busy_block.busy_size, previous, 1);
254 res_compare = compare_area(addr_block1, addr_block2, heapinfo1[i1].busy_block.busy_size, previous, 0);
256 res_compare = compare_area(addr_block1, addr_block2, heapinfo1[i1].busy_block.busy_size, previous, 0);
260 for(k=1; k < heapinfo2[i2].busy_block.size; k++)
261 heapinfo2[i2+k].busy_block.equal_to = 1;
262 for(k=1; k < heapinfo1[i1].busy_block.size; k++)
263 heapinfo1[i1+k].busy_block.equal_to = 1;
265 match_equals(previous);
268 xbt_dynar_reset(previous);
277 }else{ /* Fragmented block */
279 for(j1=0; j1 < (size_t) (BLOCKSIZE >> heapinfo1[i1].type); j1++){
281 current_fragment = j1;
283 if(heapinfo1[i1].busy_frag.frag_size[j1] == 0) /* Free fragment */
286 addr_frag1 = (void*) ((char *)addr_block1 + (j1 << heapinfo1[i1].type));
291 /* Try first to associate to same fragment in the other heap */
292 if(heapinfo2[current_block].type == heapinfo1[current_block].type){
294 if(heapinfo1[current_block].busy_frag.frag_size[current_fragment] == heapinfo2[current_block].busy_frag.frag_size[current_fragment]){
296 addr_block2 = ((void*) (((ADDR2UINT(current_block)) - 1) * BLOCKSIZE + (char*)heapbase2));
297 addr_frag2 = (void*) ((char *)addr_block2 + (current_fragment << heapinfo2[current_block].type));
299 add_heap_area_pair(previous, current_block, current_fragment, current_block, current_fragment);
301 if(ignore_done < xbt_dynar_length(mmalloc_ignore)){
302 if(in_mmalloc_ignore((int)current_block, (int)current_fragment))
303 res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 1);
305 res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 0);
307 res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 0);
310 if(res_compare == 0){
312 match_equals(previous);
315 xbt_dynar_reset(previous);
322 while(i2 <= heaplimit && !equal){
324 if(heapinfo2[i2].type <= 0){
329 for(j2=0; j2 < (size_t) (BLOCKSIZE >> heapinfo2[i2].type); j2++){
331 if(heapinfo2[i2].type == heapinfo1[i1].type && i2 == current_block && j2 == current_fragment)
334 if(heapinfo2[i2].busy_frag.equal_to[j2] == 1)
337 if(heapinfo1[i1].busy_frag.frag_size[j1] != heapinfo2[i2].busy_frag.frag_size[j2]) /* Different size_used */
340 addr_block2 = ((void*) (((ADDR2UINT(i2)) - 1) * BLOCKSIZE + (char*)heapbase2));
341 addr_frag2 = (void*) ((char *)addr_block2 + (j2 << heapinfo2[i2].type));
344 add_heap_area_pair(previous, i1, j1, i2, j2);
346 if(ignore_done < xbt_dynar_length(mmalloc_ignore)){
347 if(in_mmalloc_ignore((int)i1, (int)j1))
348 res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[i1].busy_frag.frag_size[j1], previous, 1);
350 res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[i1].busy_frag.frag_size[j1], previous, 0);
352 res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[i1].busy_frag.frag_size[j1], previous, 0);
357 match_equals(previous);
358 xbt_dynar_reset(previous);
362 xbt_dynar_reset(previous);
378 /* All blocks/fragments are equal to another block/fragment ? */
380 int nb_diff1 = 0, nb_diff2 = 0;
383 if(heapinfo1[i].type == 0){
384 if(heapinfo1[i].busy_block.busy_size > 0){
385 if(heapinfo1[i].busy_block.equal_to == -1){
386 if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
387 addr_block1 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase1));
388 XBT_DEBUG("Block %zu (%p) not found (size used = %zu)", i, addr_block1, heapinfo1[i].busy_block.busy_size);
389 mmalloc_backtrace_block_display((void*)heapinfo1, i);
395 if(heapinfo1[i].type > 0){
396 for(j=0; j < (size_t) (BLOCKSIZE >> heapinfo1[i].type); j++){
397 if(heapinfo1[i].busy_frag.frag_size[j] > 0){
398 if(heapinfo1[i].busy_frag.equal_to[j] == -1){
399 if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
400 addr_block1 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase1));
401 addr_frag1 = (void*) ((char *)addr_block1 + (j << heapinfo1[i].type));
402 XBT_DEBUG("Block %zu, Fragment %zu (%p) not found (size used = %d)", i, j, addr_frag1, heapinfo1[i].busy_frag.frag_size[j]);
403 mmalloc_backtrace_fragment_display((void*)heapinfo1, i, j);
414 XBT_DEBUG("Different blocks or fragments in heap1 : %d\n", nb_diff1);
419 if(heapinfo2[i].type == 0){
420 if(heapinfo2[i].busy_block.busy_size > 0){
421 if(heapinfo2[i].busy_block.equal_to == -1){
422 if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
423 addr_block2 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase2));
424 XBT_DEBUG("Block %zu (%p) not found (size used = %zu)", i, addr_block2, heapinfo2[i].busy_block.busy_size);
425 mmalloc_backtrace_block_display((void*)heapinfo2, i);
431 if(heapinfo2[i].type > 0){
432 for(j=0; j < (size_t) (BLOCKSIZE >> heapinfo2[i].type); j++){
433 if(heapinfo2[i].busy_frag.frag_size[j] > 0){
434 if(heapinfo2[i].busy_frag.equal_to[j] == -1){
435 if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
436 addr_block2 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase2));
437 addr_frag2 = (void*) ((char *)addr_block2 + (j << heapinfo2[i].type));
438 XBT_DEBUG( "Block %zu, Fragment %zu (%p) not found (size used = %d)", i, j, addr_frag2, heapinfo2[i].busy_frag.frag_size[j]);
439 mmalloc_backtrace_fragment_display((void*)heapinfo2, i, j);
449 XBT_DEBUG("Different blocks or fragments in heap2 : %d\n", nb_diff2);
451 xbt_dynar_free(&previous);
453 return ((nb_diff1 > 0) || (nb_diff2 > 0));
457 static int in_mmalloc_ignore(int block, int fragment){
459 unsigned int cursor = 0;
461 int end = xbt_dynar_length(mmalloc_ignore) - 1;
462 mc_ignore_region_t region;
465 cursor = (start + end) / 2;
466 region = (mc_ignore_region_t)xbt_dynar_get_as(mmalloc_ignore, cursor, mc_ignore_region_t);
467 if(region->block == block){
468 if(region->fragment == fragment)
470 if(region->fragment < fragment)
472 if(region->fragment > fragment)
475 if(region->block < block)
477 if(region->block > block)
484 static size_t heap_comparison_ignore(void *address){
485 unsigned int cursor = 0;
487 int end = xbt_dynar_length(mmalloc_ignore) - 1;
488 mc_ignore_region_t region;
491 cursor = (start + end) / 2;
492 region = (mc_ignore_region_t)xbt_dynar_get_as(mmalloc_ignore, cursor, mc_ignore_region_t);
493 if(region->address == address)
495 if(region->address < address)
497 if(region->address > address)
505 static int compare_area(void *area1, void* area2, size_t size, xbt_dynar_t previous, int check_ignore){
507 size_t i = 0, pointer_align = 0, ignore1 = 0, ignore2 = 0;
508 void *address_pointed1, *address_pointed2, *addr_block_pointed1, *addr_block_pointed2, *addr_frag_pointed1, *addr_frag_pointed2;
509 size_t block_pointed1, block_pointed2, frag_pointed1, frag_pointed2;
511 void *current_area1, *current_area2;
517 current_area1 = (char*)((xbt_mheap_t)s_heap)->heapbase + ((((char *)area1) + i) - (char *)heapbase1);
518 if((ignore1 = heap_comparison_ignore(current_area1)) > 0){
519 current_area2 = (char*)((xbt_mheap_t)s_heap)->heapbase + ((((char *)area2) + i) - (char *)heapbase2);
520 if((ignore2 = heap_comparison_ignore(current_area2)) == ignore1){
529 if(memcmp(((char *)area1) + i, ((char *)area2) + i, 1) != 0){
531 /* Check pointer difference */
532 pointer_align = (i / sizeof(void*)) * sizeof(void*);
533 address_pointed1 = *((void **)((char *)area1 + pointer_align));
534 address_pointed2 = *((void **)((char *)area2 + pointer_align));
536 /* Get pointed blocks number */
537 block_pointed1 = ((char*)address_pointed1 - (char*)((xbt_mheap_t)s_heap)->heapbase) / BLOCKSIZE + 1;
538 block_pointed2 = ((char*)address_pointed2 - (char*)((xbt_mheap_t)s_heap)->heapbase) / BLOCKSIZE + 1;
540 /* Check if valid blocks number */
541 if((char *)address_pointed1 < (char*)((xbt_mheap_t)s_heap)->heapbase || block_pointed1 > heapsize1 || block_pointed1 < 1 || (char *)address_pointed2 < (char*)((xbt_mheap_t)s_heap)->heapbase || block_pointed2 > heapsize2 || block_pointed2 < 1)
544 if(heapinfo1[block_pointed1].type == heapinfo2[block_pointed2].type){ /* Same type of block (large or fragmented) */
546 addr_block_pointed1 = ((void*) (((ADDR2UINT(block_pointed1)) - 1) * BLOCKSIZE + (char*)heapbase1));
547 addr_block_pointed2 = ((void*) (((ADDR2UINT(block_pointed2)) - 1) * BLOCKSIZE + (char*)heapbase2));
549 if(heapinfo1[block_pointed1].type == 0){ /* Large block */
551 if(heapinfo1[block_pointed1].busy_block.size != heapinfo2[block_pointed2].busy_block.size){
555 if(heapinfo1[block_pointed1].busy_block.busy_size != heapinfo2[block_pointed2].busy_block.busy_size){
559 if(add_heap_area_pair(previous, block_pointed1, -1, block_pointed2, -1)){
561 if(ignore_done < xbt_dynar_length(mmalloc_ignore)){
562 if(in_mmalloc_ignore(block_pointed1, -1))
563 res_compare = compare_area(addr_block_pointed1, addr_block_pointed2, heapinfo1[block_pointed1].busy_block.busy_size, previous, 1);
565 res_compare = compare_area(addr_block_pointed1, addr_block_pointed2, heapinfo1[block_pointed1].busy_block.busy_size, previous, 0);
567 res_compare = compare_area(addr_block_pointed1, addr_block_pointed2, heapinfo1[block_pointed1].busy_block.busy_size, previous, 0);
575 }else{ /* Fragmented block */
577 /* Get pointed fragments number */
578 frag_pointed1 = ((uintptr_t) (ADDR2UINT (address_pointed1) % (BLOCKSIZE))) >> heapinfo1[block_pointed1].type;
579 frag_pointed2 = ((uintptr_t) (ADDR2UINT (address_pointed2) % (BLOCKSIZE))) >> heapinfo2[block_pointed2].type;
581 if(heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1] != heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]) /* Different size_used */
584 addr_frag_pointed1 = (void*) ((char *)addr_block_pointed1 + (frag_pointed1 << heapinfo1[block_pointed1].type));
585 addr_frag_pointed2 = (void*) ((char *)addr_block_pointed2 + (frag_pointed2 << heapinfo2[block_pointed2].type));
587 if(add_heap_area_pair(previous, block_pointed1, frag_pointed1, block_pointed2, frag_pointed2)){
589 if(ignore_done < xbt_dynar_length(mmalloc_ignore)){
590 if(in_mmalloc_ignore(block_pointed1, frag_pointed1))
591 res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 1);
593 res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);
595 res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);
607 if((heapinfo1[block_pointed1].type > 0) && (heapinfo2[block_pointed2].type > 0)){
609 addr_block_pointed1 = ((void*) (((ADDR2UINT(block_pointed1)) - 1) * BLOCKSIZE + (char*)heapbase1));
610 addr_block_pointed2 = ((void*) (((ADDR2UINT(block_pointed2)) - 1) * BLOCKSIZE + (char*)heapbase2));
612 frag_pointed1 = ((uintptr_t) (ADDR2UINT (address_pointed1) % (BLOCKSIZE))) >> heapinfo1[block_pointed1].type;
613 frag_pointed2 = ((uintptr_t) (ADDR2UINT (address_pointed2) % (BLOCKSIZE))) >> heapinfo2[block_pointed2].type;
615 if(heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1] != heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]) /* Different size_used */
618 addr_frag_pointed1 = (void*) ((char *)addr_block_pointed1 + (frag_pointed1 << heapinfo1[block_pointed1].type));
619 addr_frag_pointed2 = (void*) ((char *)addr_block_pointed2 + (frag_pointed2 << heapinfo2[block_pointed2].type));
621 if(add_heap_area_pair(previous, block_pointed1, frag_pointed1, block_pointed2, frag_pointed2)){
623 if(ignore_done < xbt_dynar_length(mmalloc_ignore)){
624 if(in_mmalloc_ignore(block_pointed1, frag_pointed1))
625 res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 1);
627 res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);
629 res_compare = compare_area(addr_frag_pointed1, addr_frag_pointed2, heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1], previous, 0);
643 i = pointer_align + sizeof(void *);
657 static void heap_area_pair_free(heap_area_pair_t pair){
664 static void heap_area_pair_free_voidp(void *d)
666 heap_area_pair_free((heap_area_pair_t) * (void **) d);
669 static int add_heap_area_pair(xbt_dynar_t list, int block1, int fragment1, int block2, int fragment2){
671 if(is_new_heap_area_pair(list, block1, fragment1, block2, fragment2)){
672 heap_area_pair_t pair = NULL;
673 pair = xbt_new0(s_heap_area_pair_t, 1);
674 pair->block1 = block1;
675 pair->fragment1 = fragment1;
676 pair->block2 = block2;
677 pair->fragment2 = fragment2;
679 xbt_dynar_push(list, &pair);
687 static int is_new_heap_area_pair(xbt_dynar_t list, int block1, int fragment1, int block2, int fragment2){
689 unsigned int cursor = 0;
690 heap_area_pair_t current_pair;
692 xbt_dynar_foreach(list, cursor, current_pair){
693 if(current_pair->block1 == block1 && current_pair->block2 == block2 && current_pair->fragment1 == fragment1 && current_pair->fragment2 == fragment2)
700 static void match_equals(xbt_dynar_t list){
702 unsigned int cursor = 0;
703 heap_area_pair_t current_pair;
705 xbt_dynar_foreach(list, cursor, current_pair){
706 if(current_pair->fragment1 != -1){
707 heapinfo1[current_pair->block1].busy_frag.equal_to[current_pair->fragment1] = 1;
708 heapinfo2[current_pair->block2].busy_frag.equal_to[current_pair->fragment2] = 1;
710 heapinfo1[current_pair->block1].busy_block.equal_to = 1;
711 heapinfo2[current_pair->block2].busy_block.equal_to = 1;