int padding = (addr % sizeof (unsigned64));
unsigned long bytes = (modulo == 0 ? nr_bytes : modulo) + padding;
- free_buffer = zalloc (bytes);
+ /* If filling with non-zero value, do not use clearing allocator. */
+
+ if (fill_byte_flag && fill_byte_value != 0)
+ free_buffer = xmalloc (bytes); /* don't clear */
+ else
+ free_buffer = zalloc (bytes); /* clear */
+
aligned_buffer = (char*) free_buffer + padding;
sim_core_attach (sd, NULL,
fill_buffer = aligned_buffer;
fill_length = (modulo == 0) ? nr_bytes : modulo;
+
+ /* If we just used a clearing allocator, and are about to fill with
+ zero, truncate the redundant fill operation. */
+
+ if (fill_byte_flag && fill_byte_value == 0)
+ fill_length = 1; /* avoid boundary length=0 case */
}
if (fill_byte_flag)
/* delete it and its aliases */
alias = *entry;
+
+ /* next victim */
+ *entry = (*entry)->next;
+
while (alias != NULL)
{
sim_memopt *dead = alias;
sim_core_detach (sd, NULL, dead->level, dead->space, dead->addr);
zfree (dead);
}
-
- /* next victim */
- *entry = (*entry)->next;
}
}