Blame SOURCES/valgrind-3.9.0-cachegrind-improvements.patch

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