|
|
fe1059 |
--- valgrind-3.8.1/cachegrind/cg_sim.c.jj 2011-10-26 23:24:32.000000000 +0200
|
|
|
fe1059 |
+++ valgrind-3.8.1/cachegrind/cg_sim.c 2011-12-09 17:31:19.256023683 +0100
|
|
|
fe1059 |
@@ -42,27 +42,30 @@ typedef struct {
|
|
|
fe1059 |
Int size; /* bytes */
|
|
|
fe1059 |
Int assoc;
|
|
|
fe1059 |
Int line_size; /* bytes */
|
|
|
fe1059 |
- Int sets;
|
|
|
fe1059 |
Int sets_min_1;
|
|
|
fe1059 |
Int line_size_bits;
|
|
|
fe1059 |
Int tag_shift;
|
|
|
fe1059 |
- HChar desc_line[128]; /* large enough */
|
|
|
fe1059 |
UWord* tags;
|
|
|
fe1059 |
-} cache_t2;
|
|
|
fe1059 |
+ HChar desc_line[128];
|
|
|
fe1059 |
+} cache_t2
|
|
|
fe1059 |
+#ifdef __GNUC__
|
|
|
fe1059 |
+__attribute__ ((aligned (8 * sizeof (Int))))
|
|
|
fe1059 |
+#endif
|
|
|
fe1059 |
+;
|
|
|
fe1059 |
|
|
|
fe1059 |
/* By this point, the size/assoc/line_size has been checked. */
|
|
|
fe1059 |
static void cachesim_initcache(cache_t config, cache_t2* c)
|
|
|
fe1059 |
{
|
|
|
fe1059 |
- Int i;
|
|
|
fe1059 |
+ Int sets;
|
|
|
fe1059 |
|
|
|
fe1059 |
c->size = config.size;
|
|
|
fe1059 |
c->assoc = config.assoc;
|
|
|
fe1059 |
c->line_size = config.line_size;
|
|
|
fe1059 |
|
|
|
fe1059 |
- c->sets = (c->size / c->line_size) / c->assoc;
|
|
|
fe1059 |
- c->sets_min_1 = c->sets - 1;
|
|
|
fe1059 |
+ sets = (c->size / c->line_size) / c->assoc;
|
|
|
fe1059 |
+ c->sets_min_1 = sets - 1;
|
|
|
fe1059 |
c->line_size_bits = VG_(log2)(c->line_size);
|
|
|
fe1059 |
- c->tag_shift = c->line_size_bits + VG_(log2)(c->sets);
|
|
|
fe1059 |
+ c->tag_shift = c->line_size_bits + VG_(log2)(sets);
|
|
|
fe1059 |
|
|
|
fe1059 |
if (c->assoc == 1) {
|
|
|
fe1059 |
VG_(sprintf)(c->desc_line, "%d B, %d B, direct-mapped",
|
|
|
fe1059 |
@@ -72,11 +75,8 @@ static void cachesim_initcache(cache_t c
|
|
|
fe1059 |
c->size, c->line_size, c->assoc);
|
|
|
fe1059 |
}
|
|
|
fe1059 |
|
|
|
fe1059 |
- c->tags = VG_(malloc)("cg.sim.ci.1",
|
|
|
fe1059 |
- sizeof(UWord) * c->sets * c->assoc);
|
|
|
fe1059 |
-
|
|
|
fe1059 |
- for (i = 0; i < c->sets * c->assoc; i++)
|
|
|
fe1059 |
- c->tags[i] = 0;
|
|
|
fe1059 |
+ c->tags = VG_(calloc)("cg.sim.ci.1",
|
|
|
fe1059 |
+ sizeof(UWord), sets * c->assoc);
|
|
|
fe1059 |
}
|
|
|
fe1059 |
|
|
|
fe1059 |
/* This attribute forces GCC to inline the function, getting rid of a
|