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

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