malloc_info heapinfo_temp1, heapinfo_temp2;
malloc_info heapinfo_temp2b;
+ mc_mem_region_t heap_region1 = snapshot1->regions[0];
+ mc_mem_region_t heap_region2 = snapshot2->regions[0];
+
// This is in snapshot do not use them directly:
malloc_info* heapinfos1 = mc_snapshot_read_pointer(&((xbt_mheap_t)std_heap)->heapinfo, snapshot1);
malloc_info* heapinfos2 = mc_snapshot_read_pointer(&((xbt_mheap_t)std_heap)->heapinfo, snapshot2);
while (i1 <= state->heaplimit) {
// TODO, lookup in the correct region in order to speed it up:
- malloc_info* heapinfo1 = mc_snapshot_read(&heapinfos1[i1], snapshot1, &heapinfo_temp1, sizeof(malloc_info));
- malloc_info* heapinfo2 = mc_snapshot_read(&heapinfos2[i1], snapshot2, &heapinfo_temp2, sizeof(malloc_info));
+ malloc_info* heapinfo1 = mc_snapshot_read_region(&heapinfos1[i1], heap_region1, &heapinfo_temp1, sizeof(malloc_info));
+ malloc_info* heapinfo2 = mc_snapshot_read_region(&heapinfos2[i1], heap_region2, &heapinfo_temp2, sizeof(malloc_info));
if (heapinfo1->type == -1) { /* Free block */
i1++;
continue;
}
- malloc_info* heapinfo2b = mc_snapshot_read(&heapinfos2[i2], snapshot2, &heapinfo_temp2b, sizeof(malloc_info));
+ malloc_info* heapinfo2b = mc_snapshot_read_region(&heapinfos2[i2], heap_region2, &heapinfo_temp2b, sizeof(malloc_info));
if (heapinfo2b->type != 0) {
i2++;
while (i2 <= state->heaplimit && !equal) {
- malloc_info* heapinfo2b = mc_snapshot_read(&heapinfos2[i2], snapshot2, &heapinfo_temp2b, sizeof(malloc_info));
+ malloc_info* heapinfo2b = mc_snapshot_read_region(&heapinfos2[i2], heap_region2, &heapinfo_temp2b, sizeof(malloc_info));
if (heapinfo2b->type <= 0) {
i2++;
continue;
size_t i = 1, j = 0;
for(i = 1; i <= state->heaplimit; i++) {
- malloc_info* heapinfo1 = mc_snapshot_read(&heapinfos1[i], snapshot1, &heapinfo_temp1, sizeof(malloc_info));
+ malloc_info* heapinfo1 = mc_snapshot_read_region(&heapinfos1[i], heap_region1, &heapinfo_temp1, sizeof(malloc_info));
if (heapinfo1->type == 0) {
if (i1 == state->heaplimit) {
if (heapinfo1->busy_block.busy_size > 0) {
XBT_DEBUG("Number of blocks/fragments not found in heap1 : %d", nb_diff1);
for (i=1; i <= state->heaplimit; i++) {
- malloc_info* heapinfo2 = mc_snapshot_read(&heapinfos2[i], snapshot2, &heapinfo_temp2, sizeof(malloc_info));
+ malloc_info* heapinfo2 = mc_snapshot_read_region(&heapinfos2[i], heap_region2, &heapinfo_temp2, sizeof(malloc_info));
if (heapinfo2->type == 0) {
if (i1 == state->heaplimit) {
if (heapinfo2->busy_block.busy_size > 0) {
int pointer_align, res_compare;
ssize_t ignore1, ignore2;
+ mc_mem_region_t heap_region1 = snapshot1->regions[0];
+ mc_mem_region_t heap_region2 = snapshot2->regions[0];
+
while (i < size) {
if (check_ignore > 0) {
}
}
- if (mc_snapshot_memcp(((char *) real_area1) + i, snapshot1, ((char *) real_area2) + i, snapshot2, 1) != 0) {
+ if (mc_snapshot_region_memcp(((char *) real_area1) + i, heap_region1, ((char *) real_area2) + i, heap_region2, 1) != 0) {
pointer_align = (i / sizeof(void *)) * sizeof(void *);
addr_pointed1 = mc_snapshot_read_pointer((char *) real_area1 + pointer_align, snapshot1);
int area_size, int check_ignore,
int pointer_level)
{
-
+top:
if (is_stack(real_area1) && is_stack(real_area2))
return 0;
dw_type_t member;
void *addr_pointed1, *addr_pointed2;;
+ mc_mem_region_t heap_region1 = snapshot1->regions[0];
+ mc_mem_region_t heap_region2 = snapshot2->regions[0];
+
switch (type->type) {
case DW_TAG_unspecified_type:
return 1;
if (real_area1 == real_area2)
return -1;
else
- return (mc_snapshot_memcp(real_area1, snapshot1, real_area2, snapshot2, area_size) != 0);
+ return (mc_snapshot_region_memcp(real_area1, heap_region1, real_area2, heap_region2, area_size) != 0);
} else {
if (area_size != -1 && type->byte_size != area_size)
return -1;
else {
- return (mc_snapshot_memcp(real_area1, snapshot1, real_area2, snapshot2, type->byte_size) != 0);
+ return (mc_snapshot_region_memcp(real_area1, heap_region1, real_area2, heap_region2, type->byte_size) != 0);
}
}
break;
if (area_size != -1 && type->byte_size != area_size)
return -1;
else
- return (mc_snapshot_memcp(real_area1, snapshot1, real_area2, snapshot2, type->byte_size) != 0);
+ return (mc_snapshot_region_memcp(real_area1, heap_region1, real_area2, heap_region2, type->byte_size) != 0);
break;
case DW_TAG_typedef:
case DW_TAG_const_type:
case DW_TAG_volatile_type:
- return compare_heap_area_with_type(state, real_area1, real_area2,
- snapshot1, snapshot2, previous,
- type->subtype, area_size, check_ignore,
- pointer_level);
+ // Poor man's TCO:
+ type = type->subtype;
+ goto top;
break;
case DW_TAG_array_type:
subtype = type->subtype;
}
- malloc_info* heapinfo1 = mc_snapshot_read(&heapinfos1[block1], snapshot1, &heapinfo_temp1, sizeof(malloc_info));
- malloc_info* heapinfo2 = mc_snapshot_read(&heapinfos2[block2], snapshot2, &heapinfo_temp2, sizeof(malloc_info));
+ mc_mem_region_t heap_region1 = snapshot1->regions[0];
+ mc_mem_region_t heap_region2 = snapshot2->regions[0];
+
+ malloc_info* heapinfo1 = mc_snapshot_read_region(&heapinfos1[block1], heap_region1, &heapinfo_temp1, sizeof(malloc_info));
+ malloc_info* heapinfo2 = mc_snapshot_read_region(&heapinfos2[block2], heap_region2, &heapinfo_temp2, sizeof(malloc_info));
if ((heapinfo1->type == -1) && (heapinfo2->type == -1)) { /* Free block */