From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22063 invoked by alias); 27 Nov 2012 13:59:26 -0000 Received: (qmail 21613 invoked by uid 48); 27 Nov 2012 13:58:53 -0000 From: "konstantin.s.serebryany at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/55488] New: Implement cold calls in tsan run-time Date: Tue, 27 Nov 2012 13:59:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: konstantin.s.serebryany at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg02530.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55488 Bug #: 55488 Summary: Implement cold calls in tsan run-time Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer AssignedTo: unassigned@gcc.gnu.org ReportedBy: konstantin.s.serebryany@gmail.com CC: dodji@gcc.gnu.org, dvyukov@gcc.gnu.org, jakub@gcc.gnu.org, kcc@gcc.gnu.org, wmi@gcc.gnu.org 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?