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