From: Jonathan Wakely <jwakely@redhat.com>
To: "libstdc++" <libstdc++@gcc.gnu.org>
Cc: David Edelsohn <dje.gcc@gmail.com>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] libstdc++: Allow emergency EH alloc pool size to be tuned [PR68606]
Date: Tue, 11 Oct 2022 20:41:40 +0100 [thread overview]
Message-ID: <CACb0b4kdb33TtgrGHFvPJ1xR+JWpFi_7=_BmRr+dZTDBi3THVA@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdTnS_pMNocwxcd_egHvs=KT9nuTBAxOoUb8aE-U2_FeXQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 852 bytes --]
On Tue, 11 Oct 2022 at 19:58, Jonathan Wakely wrote:
>
>
>
> On Tue, 11 Oct 2022, 19:38 David Edelsohn via Libstdc++, <libstdc++@gcc.gnu.org> wrote:
>>
>> This patch seems to have broken bootstrap on AIX. It seems to assume
>> methods that aren't guaranteed to be defined.
>
>
>
> It doesn't use anything that wasn't already used by that file.
>
> I have no idea how it ever compiled if it doesn't now, but I'll take a look.
The problem was inconsistent namespace qualification. The
__scoped_lock type is always present on AIX even for the
single-threaded multilib, but the code wasn't referring to the correct
__scoped_lock type consistently.
Fixed like so. Bootstrapped on x86_64-linux with --disable-threads
(I'm still waiting for the AIX build, but the symptom and cure are the
same as for --disable-threads on other targets).
Pushed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1845 bytes --]
commit 23c3cbaed36f6d2f3a7a64f6ebda69329723514b
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Oct 11 20:19:08 2022
libstdc++: Fix bootstrap for --disable-threads build [PR107221]
The __scoped_lock type should be used unqualified so that we always
refer to pool::__scoped_lock, which might be the dummy fallback
implementation.
The __mutex and __scoped_lock types in <ext/concurrence.h> already work
fine without __GTHREADS being defined, but that header isn't included at
all unless _GLIBCXX_HOSTED != 0. The fallback implementation should be
used for ! _GLIBCXX_HOSTED instead of for !defined __GTHREADS.
libstdc++-v3/ChangeLog:
PR bootstrap/107221
* libsupc++/eh_alloc.cc (pool): Change preprocessor condition
for using __mutex from __GTHREADS to _GLIBCXX_HOSTED.
(pool::allocate): Remove namespace qualification to use
pool::__scoped_lock instead of __gnu_cxx::__scoped_lock.
diff --git a/libstdc++-v3/libsupc++/eh_alloc.cc b/libstdc++-v3/libsupc++/eh_alloc.cc
index 50dc37c0d9c..81b8a1548c6 100644
--- a/libstdc++-v3/libsupc++/eh_alloc.cc
+++ b/libstdc++-v3/libsupc++/eh_alloc.cc
@@ -145,7 +145,7 @@ namespace
char data[] __attribute__((aligned));
};
-#ifdef __GTHREADS
+#if _GLIBCXX_HOSTED
// A single mutex controlling emergency allocations.
__gnu_cxx::__mutex emergency_mutex;
using __scoped_lock = __gnu_cxx::__scoped_lock;
@@ -236,7 +236,7 @@ namespace
void *pool::allocate (std::size_t size) noexcept
{
- __gnu_cxx::__scoped_lock sentry(emergency_mutex);
+ __scoped_lock sentry(emergency_mutex);
// We need an additional size_t member plus the padding to
// ensure proper alignment of data.
size += offsetof (allocated_entry, data);
next prev parent reply other threads:[~2022-10-11 19:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 18:36 David Edelsohn
2022-10-11 18:57 ` Jonathan Wakely
2022-10-11 19:41 ` Jonathan Wakely [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-10-07 15:54 Jonathan Wakely
2022-10-10 6:17 ` Richard Biener
2022-10-10 11:17 ` Jonathan Wakely
2022-10-10 15:10 ` Jonathan Wakely
2022-10-11 6:41 ` Richard Biener
2022-10-11 11:05 ` Jonathan Wakely
2022-10-11 11:34 ` Richard Biener
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='CACb0b4kdb33TtgrGHFvPJ1xR+JWpFi_7=_BmRr+dZTDBi3THVA@mail.gmail.com' \
--to=jwakely@redhat.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/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).