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