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

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