public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
  • * [PATCH] Add cold attribute to one time construction APIs
           [not found] <BYAPR08MB423235937D163AE584BD8E3CB6430@BYAPR08MB4232.namprd08.prod.outlook.com>
           [not found] ` <BYAPR08MB423270DD470245D666E7FC04B6430@BYAPR08MB4232.namprd08.prod.outlook.com>
    @ 2020-08-17 18:15 ` Aditya K
      2020-08-18 14:35   ` Jonathan Wakely
      1 sibling, 1 reply; 9+ messages in thread
    From: Aditya K @ 2020-08-17 18:15 UTC (permalink / raw)
      To: libstdc++, jwakely.gcc
    
    This would help compiler optimize local static objects.
    
    Added changelog.
    
    ```
    From c6cba40e0434147db89d3af05b598782cde651e3 Mon Sep 17 00:00:00 2001
    From: Aditya Kumar <1894981+hiraditya@users.noreply.github.com>
    Date: Thu, 13 Aug 2020 09:41:34 -0700
    Subject: [PATCH] Add cold attribute to one time construction APIs
    
    __cxa_guard_acquire is used for only one purpose,
    namely guarding local static variable initialization,
    and since that purpose is definitionally cold, it should be attributed as cold.
    Similarly for __cxa_guard_release and __cxa_guard_abort
    ---
     libstdc++-v3/ChangeLog              | 5 +++++
     libstdc++-v3/include/bits/c++config | 5 +++++
     libstdc++-v3/libsupc++/cxxabi.h     | 6 +++---
     3 files changed, 13 insertions(+), 3 deletions(-)
    
    diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
    index fe6884bf3..86b707ac7 100644
    --- a/libstdc++-v3/ChangeLog
    +++ b/libstdc++-v3/ChangeLog
    @@ -1,3 +1,8 @@
    +2020-08-17  Aditya Kumar  <hiraditya@msn.com>
    +	* libstdc++-v3/include/bits/c++config: Add _GLIBCXX_NOTHROW attribute
    +	* libstdc++-v3/libsupc++/cxxabi.h (__cxa_guard_acquire, __cxa_guard_release,
    +	__cxa_guard_abort): Add _GLIBCXX_NOTHROW attribute.
    +
     2020-08-14  Lewis Hyatt  <lhyatt@gmail.com>
     
     	* testsuite/lib/libstdc++.exp: Use the new option
    diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
    index b1fad59d4..f6f954eef 100644
    --- a/libstdc++-v3/include/bits/c++config
    +++ b/libstdc++-v3/include/bits/c++config
    @@ -42,6 +42,7 @@
     //   _GLIBCXX_NORETURN
     //   _GLIBCXX_NOTHROW
     //   _GLIBCXX_VISIBILITY
    +//   _GLIBCXX_COLD
     #ifndef _GLIBCXX_PURE
     # define _GLIBCXX_PURE __attribute__ ((__pure__))
     #endif
    @@ -74,6 +75,10 @@
     # define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V)
     #endif
     
    +#ifndef _GLIBCXX_COLD
    +# define _GLIBCXX_COLD __attribute__ ((cold))
    +#endif
    +
     // Macros for deprecated attributes.
     //   _GLIBCXX_USE_DEPRECATED
     //   _GLIBCXX_DEPRECATED
    diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h
    index 000713ecd..24c1366e2 100644
    --- a/libstdc++-v3/libsupc++/cxxabi.h
    +++ b/libstdc++-v3/libsupc++/cxxabi.h
    @@ -115,13 +115,13 @@ namespace __cxxabiv1
     		    void (*__dealloc) (void*, size_t));
     
       int
    -  __cxa_guard_acquire(__guard*);
    +  __cxa_guard_acquire(__guard*) _GLIBCXX_COLD;
     
       void
    -  __cxa_guard_release(__guard*) _GLIBCXX_NOTHROW;
    +  __cxa_guard_release(__guard*) _GLIBCXX_NOTHROW _GLIBCXX_COLD;
     
       void
    -  __cxa_guard_abort(__guard*) _GLIBCXX_NOTHROW;
    +  __cxa_guard_abort(__guard*) _GLIBCXX_NOTHROW _GLIBCXX_COLD;
     
       // DSO destruction.
       int
    -- 
    2.13.5
    ```
    
    ^ permalink raw reply	[flat|nested] 9+ messages in thread

  • end of thread, other threads:[~2020-08-24  8:55 UTC | newest]
    
    Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
    -- links below jump to the message on this page --
         [not found] <BYAPR08MB423235937D163AE584BD8E3CB6430@BYAPR08MB4232.namprd08.prod.outlook.com>
         [not found] ` <BYAPR08MB423270DD470245D666E7FC04B6430@BYAPR08MB4232.namprd08.prod.outlook.com>
    2020-08-13 17:13   ` Add cold attribute to one time construction APIs Jonathan Wakely
    2020-08-13 18:58     ` Aditya K
    2020-08-17 18:15 ` [PATCH] " Aditya K
    2020-08-18 14:35   ` Jonathan Wakely
    2020-08-18 14:38     ` Jonathan Wakely
    2020-08-24  8:06     ` Richard Biener
    2020-08-24  8:09       ` Jan Hubicka
    2020-08-24  8:45         ` Jonathan Wakely
    2020-08-24  8:55           ` Jonathan Wakely
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox;
    as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).