valgrind/valgrind-3.5.0-cachegrind-improvements.patch

65 lines
2.5 KiB
Diff
Raw Normal View History

2009-02-07 11:51:28 +00:00
--- valgrind-3.4.0/cachegrind/cg_sim.c.jj 2007-01-08 02:43:10.000000000 -0500
+++ valgrind-3.4.0/cachegrind/cg_sim.c 2007-02-13 07:15:46.000000000 -0500
2009-03-09 12:50:44 +00:00
@@ -42,27 +42,30 @@ typedef struct {
2007-02-13 12:24:25 +00:00
Int size; /* bytes */
Int assoc;
Int line_size; /* bytes */
- Int sets;
Int sets_min_1;
Int line_size_bits;
Int tag_shift;
- Char desc_line[128];
UWord* tags;
-} cache_t2;
+ Char desc_line[128];
+} cache_t2
+#ifdef __GNUC__
+__attribute__ ((aligned (8 * sizeof (Int))))
+#endif
+;
/* By this point, the size/assoc/line_size has been checked. */
static void cachesim_initcache(cache_t config, cache_t2* c)
{
- Int i;
+ Int sets;
c->size = config.size;
c->assoc = config.assoc;
c->line_size = config.line_size;
- c->sets = (c->size / c->line_size) / c->assoc;
- c->sets_min_1 = c->sets - 1;
+ sets = (c->size / c->line_size) / c->assoc;
+ c->sets_min_1 = sets - 1;
c->line_size_bits = VG_(log2)(c->line_size);
- c->tag_shift = c->line_size_bits + VG_(log2)(c->sets);
+ c->tag_shift = c->line_size_bits + VG_(log2)(sets);
if (c->assoc == 1) {
VG_(sprintf)(c->desc_line, "%d B, %d B, direct-mapped",
2009-03-09 12:50:44 +00:00
@@ -72,11 +75,8 @@ static void cachesim_initcache(cache_t c
2007-02-13 12:24:25 +00:00
c->size, c->line_size, c->assoc);
}
2009-02-07 11:51:28 +00:00
- c->tags = VG_(malloc)("cg.sim.ci.1",
- sizeof(UWord) * c->sets * c->assoc);
2007-02-13 12:24:25 +00:00
-
- for (i = 0; i < c->sets * c->assoc; i++)
- c->tags[i] = 0;
2009-02-07 11:51:28 +00:00
+ c->tags = VG_(calloc)("cg.sim.ci.1",
2009-02-10 16:51:53 +00:00
+ sizeof(UWord), sets * c->assoc);
2007-02-13 12:24:25 +00:00
}
/* This is done as a macro rather than by passing in the cache_t2 as an
2009-03-09 12:50:44 +00:00
@@ -138,8 +138,7 @@ void cachesim_##L##_doref(Addr a, UChar
2007-02-13 12:24:25 +00:00
return; \
\
/* Second case: word straddles two lines. */ \
- /* Nb: this is a fast way of doing ((set1+1) % L.sets) */ \
- } else if (((set1 + 1) & (L.sets-1)) == set2) { \
+ } else if (((set1 + 1) & (L.sets_min_1)) == set2) { \
2009-03-09 12:50:44 +00:00
set = &(L.tags[set1 * L.assoc]); \
2007-02-13 12:24:25 +00:00
if (tag == set[0]) { \
goto block2; \