[Bug sanitizer/55488] New: Implement cold calls in tsan run-time

konstantin.s.serebryany at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 27 13:59:00 GMT 2012


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?



More information about the Gcc-bugs mailing list