]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
VG_(discard_translations):
authorJulian Seward <jseward@acm.org>
Mon, 21 Mar 2016 20:04:05 +0000 (20:04 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 21 Mar 2016 20:04:05 +0000 (20:04 +0000)
* fix off-by-one error that forced use of the slow case unnecessarily

* change ECLASS_SHIFT from 11 to 13 so that ranges up to 8KB can fall
  within an equivalence class, and increase ECLASS_WIDTH by 1 so as to
    double the number of hash buckets (effectively).

These measures noticably improve the performance of modern Firefoxes,
since they do a lot of 4KB and 8KB discards as a result of mprotect
trickery used to implement W^X protection on JIT code pages.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15833

coregrind/m_transtab.c

index c1822eeca802d49814d197dc4c28420b72b18e2c..73e384f6a3c183002aea0450824fa0c70393b74f 100644 (file)
@@ -94,8 +94,8 @@ typedef UShort HTTno;
    address range which does not fall cleanly within any specific bin.
    Note that ECLASS_SHIFT + ECLASS_WIDTH must be < 32.
    ECLASS_N must fit in a EclassNo. */
-#define ECLASS_SHIFT 11
-#define ECLASS_WIDTH 8
+#define ECLASS_SHIFT 13
+#define ECLASS_WIDTH 9
 #define ECLASS_MISC  (1 << ECLASS_WIDTH)
 #define ECLASS_N     (1 + ECLASS_MISC)
 STATIC_ASSERT(ECLASS_SHIFT + ECLASS_WIDTH < 32);
@@ -2052,7 +2052,7 @@ void VG_(discard_translations) ( Addr guest_start, ULong range,
       and if so which one. */
 
    ec = ECLASS_MISC;
-   if (range < (1ULL << ECLASS_SHIFT))
+   if (range <= (1ULL << ECLASS_SHIFT))
       ec = range_to_eclass( guest_start, (UInt)range );
 
    /* if ec is ECLASS_MISC then we aren't looking at just a single