From: Julian Seward Date: Mon, 21 Mar 2016 20:04:05 +0000 (+0000) Subject: VG_(discard_translations): X-Git-Tag: svn/VALGRIND_3_12_0~190 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=566759979a523025659c47f10aaf99b672b33ee1;p=thirdparty%2Fvalgrind.git VG_(discard_translations): * 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 --- diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index c1822eeca8..73e384f6a3 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -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