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