From: Aditya K <hiraditya@msn.com>
To: Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org>,
"jwakely.gcc@gmail.com" <jwakely.gcc@gmail.com>
Subject: Add cold attribute to one time construction APIs
Date: Thu, 13 Aug 2020 16:47:36 +0000 [thread overview]
Message-ID: <BYAPR08MB423235937D163AE584BD8E3CB6430@BYAPR08MB4232.namprd08.prod.outlook.com> (raw)
This would help compiler optimize local static objects.
```
commit e2f299679ddf56a6d6d71ea9d589cd76b2ca107b
Author: Aditya Kumar <1894981+hiraditya@users.noreply.github.com>
Date: Thu Aug 13 09:41:34 2020 -0700
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
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index b1fad59d4..359e955a7 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -39,20 +39,24 @@
// Macros for various attributes.
// _GLIBCXX_PURE
// _GLIBCXX_CONST
// _GLIBCXX_NORETURN
// _GLIBCXX_NOTHROW
// _GLIBCXX_VISIBILITY
#ifndef _GLIBCXX_PURE
# define _GLIBCXX_PURE __attribute__ ((__pure__))
#endif
+#ifndef _GLIBCXX_COLD
+# define _GLIBCXX_COLD __attribute__ ((cold))
+#endif
+
#ifndef _GLIBCXX_CONST
# define _GLIBCXX_CONST __attribute__ ((__const__))
#endif
#ifndef _GLIBCXX_NORETURN
# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__))
#endif
// See below for C++
#ifndef _GLIBCXX_NOTHROW
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
@@ -108,27 +108,27 @@ namespace __cxxabiv1
__cxa_vec_delete2(void* __array_address, size_t __element_size,
size_t __padding_size, __cxa_cdtor_type __destructor,
void (*__dealloc) (void*));
void
__cxa_vec_delete3(void* __array_address, size_t __element_size,
size_t __padding_size, __cxa_cdtor_type __destructor,
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
__cxa_atexit(void (*)(void*), void*, void*) _GLIBCXX_NOTHROW;
void
__cxa_finalize(void*);
// TLS destruction.
int
```
next reply other threads:[~2020-08-13 16:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 16:47 Aditya K [this message]
2020-08-13 16:51 ` Aditya K
2020-08-13 17:00 ` Aditya K
2020-08-13 17:13 ` Jonathan Wakely
2020-08-13 18:58 ` Aditya K
[not found] ` <BYAPR08MB42323E136D6F480F8B138633B65F0@BYAPR08MB4232.namprd08.prod.outlook.com>
2020-08-18 14:35 ` [PATCH] " 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BYAPR08MB423235937D163AE584BD8E3CB6430@BYAPR08MB4232.namprd08.prod.outlook.com \
--to=hiraditya@msn.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jwakely.gcc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).