+ }else if((heapinfo1[block1].type == 0) && (heapinfo2[block2].type == 0)){ /* Complete block */
+
+ if(equals_to1[block1][0] != NULL && equals_to2[block2][0] != NULL){
+ if(equal_blocks(block1, block2)){
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return 0;
+ }
+ }
+
+ if(type_size != -1){
+ if(type_size != heapinfo1[block1].busy_block.busy_size && type_size != heapinfo2[block2].busy_block.busy_size && !strcmp(type->name, "s_smx_context")){
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return -1;
+ }
+ }
+
+ if(heapinfo1[block1].busy_block.size != heapinfo2[block2].busy_block.size){
+ if(match_pairs){
+ xbt_dynar_free(&previous);
+ }
+ return 1;
+ }
+
+ if(heapinfo1[block1].busy_block.busy_size != heapinfo2[block2].busy_block.busy_size){
+ if(match_pairs){
+ xbt_dynar_free(&previous);
+ }
+ return 1;
+ }
+
+ if(!add_heap_area_pair(previous, block1, -1, block2, -1)){
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return 0;
+ }
+
+ size = heapinfo1[block1].busy_block.busy_size;
+
+ if(type_id != NULL){
+ xbt_free(types1[block1][0]);
+ xbt_free(types2[block2][0]);
+ types1[block1][0] = strdup(type_id);
+ types2[block2][0] = strdup(type_id);
+ }
+
+ if(size <= 0){
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return 0;
+ }
+
+ frag1 = -1;
+ frag2 = -1;
+
+ area1_to_compare = addr_block1;
+ area2_to_compare = addr_block2;
+
+ if((heapinfo1[block1].busy_block.ignore > 0) && (heapinfo2[block2].busy_block.ignore == heapinfo1[block1].busy_block.ignore))
+ check_ignore = heapinfo1[block1].busy_block.ignore;
+
+ }else if((heapinfo1[block1].type > 0) && (heapinfo2[block2].type > 0)){ /* Fragmented block */
+
+ frag1 = ((uintptr_t) (ADDR2UINT (area1) % (BLOCKSIZE))) >> heapinfo1[block1].type;
+ frag2 = ((uintptr_t) (ADDR2UINT (area2) % (BLOCKSIZE))) >> heapinfo2[block2].type;
+
+ addr_frag1 = (void*) ((char *)addr_block1 + (frag1 << heapinfo1[block1].type));
+ addr_frag2 = (void*) ((char *)addr_block2 + (frag2 << heapinfo2[block2].type));
+
+ real_addr_frag1 = (void*) ((char *)real_addr_block1 + (frag1 << ((xbt_mheap_t)s_heap)->heapinfo[block1].type));
+ real_addr_frag2 = (void*) ((char *)real_addr_block2 + (frag2 << ((xbt_mheap_t)s_heap)->heapinfo[block2].type));
+
+ if(type_size != -1){
+ if(heapinfo1[block1].busy_frag.frag_size[frag1] == -1 || heapinfo2[block2].busy_frag.frag_size[frag2] == -1){
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return -1;
+ }
+ if(type_size != heapinfo1[block1].busy_frag.frag_size[frag1] || type_size != heapinfo2[block2].busy_frag.frag_size[frag2]){
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return -1;
+ }
+ }
+
+ if(equals_to1[block1][frag1] != NULL && equals_to2[block2][frag2] != NULL){
+ if(equal_fragments(block1, frag1, block2, frag2)){
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return 0;
+ }
+ }
+
+ if(heapinfo1[block1].busy_frag.frag_size[frag1] != heapinfo2[block2].busy_frag.frag_size[frag2]){
+ if(type_size == -1){
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return -1;
+ }else{
+ if(match_pairs){
+ xbt_dynar_free(&previous);
+ }
+ return 1;
+ }
+ }
+
+ size = heapinfo1[block1].busy_frag.frag_size[frag1];
+
+ if(type_id != NULL){
+ xbt_free(types1[block1][frag1]);
+ xbt_free(types2[block2][frag2]);
+ types1[block1][frag1] = strdup(type_id);
+ types2[block2][frag2] = strdup(type_id);
+ }
+
+ if(real_addr_frag1 != area1 || real_addr_frag2 != area2){
+ offset1 = (char *)area1 - (char *)real_addr_frag1;
+ offset2 = (char *)area2 - (char *)real_addr_frag2;
+ if(types1[block1][frag1] != NULL && types2[block2][frag2] != NULL){
+ new_type_id1 = get_offset_type(types1[block1][frag1], offset1, all_types, other_types, size, &switch_type);
+ new_type_id2 = get_offset_type(types2[block2][frag2], offset1, all_types, other_types, size, &switch_type);
+ }else if(types1[block1][frag1] != NULL){
+ new_type_id1 = get_offset_type(types1[block1][frag1], offset1, all_types, other_types, size, &switch_type);
+ new_type_id2 = get_offset_type(types1[block1][frag1], offset2, all_types, other_types, size, &switch_type);
+ }else if(types2[block2][frag2] != NULL){
+ new_type_id1 = get_offset_type(types2[block2][frag2], offset1, all_types, other_types, size, &switch_type);
+ new_type_id2 = get_offset_type(types2[block2][frag2], offset2, all_types, other_types, size, &switch_type);
+ }else{
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return -1;
+ }
+
+ if(new_type_id1 != NULL && new_type_id2 != NULL && !strcmp(new_type_id1, new_type_id2)){
+ if(switch_type){
+ type = xbt_dict_get_or_null(other_types, new_type_id1);
+ while(type->size == 0 && type->dw_type_id != NULL)
+ type = xbt_dict_get_or_null(other_types, type->dw_type_id);
+ new_size1 = type->size;
+ type = xbt_dict_get_or_null(other_types, new_type_id2);
+ while(type->size == 0 && type->dw_type_id != NULL)
+ type = xbt_dict_get_or_null(other_types, type->dw_type_id);
+ new_size2 = type->size;
+ }else{
+ type = xbt_dict_get_or_null(all_types, new_type_id1);
+ while(type->size == 0 && type->dw_type_id != NULL)
+ type = xbt_dict_get_or_null(all_types, type->dw_type_id);
+ new_size1 = type->size;
+ type = xbt_dict_get_or_null(all_types, new_type_id2);
+ while(type->size == 0 && type->dw_type_id != NULL)
+ type = xbt_dict_get_or_null(all_types, type->dw_type_id);
+ new_size2 = type->size;
+ }
+ }else{
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return -1;
+ }
+ }
+
+ area1_to_compare = (char *)addr_frag1 + offset1;
+ area2_to_compare = (char *)addr_frag2 + offset2;
+
+ if(new_size1 > 0 && new_size1 == new_size2){
+ type_id = new_type_id1;
+ size = new_size1;
+ }
+
+ if(offset1 == 0 && offset2 == 0){
+ if(!add_heap_area_pair(previous, block1, frag1, block2, frag2)){
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return 0;
+ }
+ }
+
+ if(size <= 0){
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+ return 0;
+ }
+
+ if((heapinfo1[block1].busy_frag.ignore[frag1] > 0) && ( heapinfo2[block2].busy_frag.ignore[frag2] == heapinfo1[block1].busy_frag.ignore[frag1]))
+ check_ignore = heapinfo1[block1].busy_frag.ignore[frag1];
+
+ }else{
+
+ if(match_pairs){
+ xbt_dynar_free(&previous);
+ }
+ return 1;
+
+ }
+
+
+ /* Start comparison*/
+ if(type_id != NULL){
+ if(switch_type)
+ res_compare = compare_heap_area_with_type(area1, area2, area1_to_compare, area2_to_compare, previous, other_types, all_types, type_id, size, check_ignore, pointer_level);
+ else
+ res_compare = compare_heap_area_with_type(area1, area2, area1_to_compare, area2_to_compare, previous, all_types, other_types, type_id, size, check_ignore, pointer_level);
+ if(res_compare == 1){
+ if(match_pairs)
+ xbt_dynar_free(&previous);
+ return res_compare;
+ }
+ }else{
+ if(switch_type)
+ res_compare = compare_heap_area_without_type(area1, area2, area1_to_compare, area2_to_compare, previous, other_types, all_types, size, check_ignore);
+ else
+ res_compare = compare_heap_area_without_type(area1, area2, area1_to_compare, area2_to_compare, previous, all_types, other_types, size, check_ignore);
+ if(res_compare == 1){
+ if(match_pairs)
+ xbt_dynar_free(&previous);
+ return res_compare;
+ }
+ }
+
+ if(match_pairs){
+ match_equals(previous);
+ xbt_dynar_free(&previous);
+ }
+
+ return 0;