[Webkit-unassigned] [Bug 73300] New: ExecutableAllocator::cacheFlush() should flush valgrind's caches

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 29 02:57:27 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=73300

           Summary: ExecutableAllocator::cacheFlush() should flush
                    valgrind's caches
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: wingo at igalia.com


You probably know valgrind.  It is helpful to run on release binaries to get backtraces, detect errors, and other such things.  Like most real CPUs, valgrind caches program text.  It has an option not to cache the text -- or rather, to detect self-modifying code.  This --smc-check option works, but it's easy to forget it (as in bug 72883 comment 0), and it is very, very slow.

We can make valgrind work though by adding some strange noop instructions that valgrind detects and uses to flush its caches:

    http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq

Quoting:

    The macros in these header files have the magical property that they generate code in-line which Valgrind can spot. However, the code does nothing when not run on Valgrind, so you are not forced to run your program under Valgrind just because you use the macros in this file. Also, you are not required to link your program with any extra supporting libraries.

    The code added to your binary has negligible performance impact: on x86, amd64, ppc32, ppc64 and ARM, the overhead is 6 simple integer instructions and is probably undetectable except in tight loops. However, if you really wish to compile out the client requests, you can compile with -DNVALGRIND (analogous to -DNDEBUG's effect on assert).

    You are encouraged to copy the valgrind/*.h headers into your project's include directory, so your program doesn't have a compile-time dependency on Valgrind being installed. The Valgrind headers, unlike most of the rest of the code, are under a BSD-style license so you may include them without worrying about license incompatibility.

So this patch does just that, adding the valgrind.h header file to wtf.  V8 does the same, so there shouldn't be a significant performance impact.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list