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