The hottest functions in tsan run-time make two cold calls: __tsan_report_race and __tsan_trace_switch If these calls are implemented via regular calling convention, they ruin the performance since the compiler creates too many spills. So, we've manually implemented a cold-call calling convention using a separate assembly file, libsanitizer/tsan/tsan_rtl_amd64.S Currently, this hack is disabled in GCC causing the tsan run-time to be slower than it could be: libsanitizer/tsan/tsan_rtl.h: #if 0 && TSAN_DEBUG == 0 ... #define HACKY_CALL(f) \ We need to enable building/linking the file libsanitizer/tsan/tsan_rtl_amd64.S and enable the HACKY_CALL in libsanitizer/tsan/tsan_rtl.h. This will eliminate the only difference left between the gcc version and upstream. Or maybe gcc has another way to implement a cold call?
Author: wmi Date: Thu Jan 10 17:57:34 2013 New Revision: 195092 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195092 Log: 2013-01-10 Wei Mi <wmi@google.com> libsanitizer/ PR sanitizer/55488 * tsan/Makefile.am: Add tsan_rtl_amd64.S. * tsan/Makefile.in: Regenerated. * tsan/tsan_rtl.h: Enable HACKY_CALL. Modified: trunk/libsanitizer/ChangeLog trunk/libsanitizer/tsan/Makefile.am trunk/libsanitizer/tsan/Makefile.in trunk/libsanitizer/tsan/tsan_rtl.h
Great, thanks! I guess we need to close this bug now.
thanks! I confirmed the fix.