Nicholas Nethercote wrote:
> On Mon, 15 Dec 2008 [email protected] wrote:
> 
>> Lets say that all of the difficulties we discussed until now have been
>> resolved. Is there any other reason for valgrind not to do eager
>> checking for this?
> 
> A big slow-down -- instead of having to check memory accesses, syscalls, 
> conditional branches, and a few other places for undefined values, it would 
> have to check just about every instruction.

When I did eager checking for undef bits in my own tool [not a member of
the valgrind suite], the slowdown was about the same as memcheck.
Just examine the Valid bits after every fetch from memory, and do enough
data flow analysis to recognize "over fetching" by the compiler.  Especially
on x86, GCC may fetch 4 bytes when the member (particularly a bitfield)
occupies only 2, etc.  Incidentally, detecting undef is somewhat fast.
The slowness comes from identifying and suppressing the second and
subsequent reports of the "same" error.

Eager checking is prone to "false positive" complaints of undefined bits.
One of memcheck's advantages is a low rate of false positive reports.
I don't like false positive reports either.  However, my goal was closer
to "the software never fetched undefined bits", which is more strict than
"the results did not depend on undefined bits."  A few customers paid
real money for the extra property.  Pointing out the location of actual
holes did identify a few important cases of wasteful layout, and of
grossly suboptimal code to deal with adjacent bitfields.

In my opinion, memcheck should have a runtime option for eager checking.
I would use it at least sometimes on every project.  The maintainers of
memcheck disagree with me on the usefulness and costs of eager checking.
I have considered implementing the option myself, but so far other work
is more important to me.  I did clean up glibc:
   http://bitwagon.com/glibc-audit/glibc-audit.html

-- 

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to