|
From: <sv...@va...> - 2007-01-13 06:55:00
|
Author: njn
Date: 2007-01-13 06:54:57 +0000 (Sat, 13 Jan 2007)
New Revision: 6518
Log:
Get the edge cases right for stack-painting.
Modified:
branches/ORIGIN_TRACKING/memcheck/mc_main.c
Modified: branches/ORIGIN_TRACKING/memcheck/mc_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ORIGIN_TRACKING/memcheck/mc_main.c 2007-01-13 00:25:23 UTC (=
rev 6517)
+++ branches/ORIGIN_TRACKING/memcheck/mc_main.c 2007-01-13 06:54:57 UTC (=
rev 6518)
@@ -34,8 +34,9 @@
// - try recording ExeContexts for stack allocation sites, alter the
// new_mem_stack* events to allow the origin_low32 to be passed in.
// - do timings:
-// - to work out how much slow-down it causes. =20
-// - Specialise the helperc functions some if possible.
+// - work out how much slow-down it causes (2-4% mostly, up to 13% for
+// real progs, about 25% for sarp)
+// - Specialise the helperc functions some if possible [done]
// - Work out if checking clo_undef_origins frequently slows things do=
wn
// much. [seemingly not]
=20
@@ -1593,8 +1594,15 @@
if (MC_(clo_undef_origins)) {
// Initialise it with obfuscated copies of the lower 32 bits of th=
e
// ExeContext pointer for the undefined-value origin-tracking.
- a =3D VG_ROUNDUP(a, 4);
- for (i =3D 0; i < VG_ROUNDDN(len, 4); i +=3D 4) {
+
+ // Round up 'a' to the start of a 4-byte boundary. Reduce 'len'
+ // accordingly. =20
+ UWord a_roundup_amount =3D VG_ROUNDUP(a, 4) - a;
+ a +=3D a_roundup_amount;
+ len -=3D a_roundup_amount;
+
+ // Now we can start painting 4-byte values.
+ for ( ; i < VG_ROUNDDN(len, 4); i +=3D 4) {
*(UInt*)(a + i) =3D obfusc_ec_low32;
}
}
|