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