public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <iain@sandoe.co.uk>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: libstdc++@gcc.gnu.org
Subject: Re: [RFA/C] Reimplementation of std::call_once.
Date: Wed, 9 Aug 2023 14:12:43 +0100	[thread overview]
Message-ID: <6B6C385F-6E6A-4EC2-92CC-FD7EB8E553D7@sandoe.co.uk> (raw)
In-Reply-To: <CAH6eHdTtpYKNWqNtHpfSiGEFFb=vG2grkwxe56d6EJ+yBfggJQ@mail.gmail.com>



> On 9 Aug 2023, at 13:53, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> 
> On Wed, 9 Aug 2023 at 13:51, Iain Sandoe <iain@sandoe.co.uk> wrote:
>> 
>>> On 9 Aug 2023, at 13:38, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>>> 
>>> On Wed, 9 Aug 2023 at 13:22, Iain Sandoe <iain@sandoe.co.uk> wrote:
>>>> =====
>>>> the implementation in mutex.cc can sit togethe with the old version so that the symbols for that remain available (or, for versioned libraries, the old code can be deleted).
>>> 
>>> If you have old and new code sharing a std::once_flag object you're dead.
>> 
>> indeed - I was only considering the case where existing binaries needed to run with the new lib, not the case where code compiled with two different impls was combined.
>> 
>>> Something like the abi_tag transition for std::string in GCC 5 would be needed.
>> 
>> That sounds quite complicated and likely to produce similar pain?
> 
> Not nearly as complicated (since we don't use std::call_once
> throughout the entire library) but it would still cause pain for the
> ecosystem.

I was, at one stage, considering the idea of [the new impl] copying the trampoline lambda address to the (old) => __once_call and the closure address to (old) __once_callable and then amending __once_proxy to handle this.

It would still be broken w.r.t. nested call_once cases, but no more broken than existing.

However, that means lying about the signature of the old __once_call.

.. and it does not solve the issue that the size of the once_flag has changed.

>> ====
>> 
>> Presumably an alternative is that I just have to accept that Darwin needs to use a versioned library (which is a direction I am close to heading in because of co-existence of mulitple c++ runtimes anyway).
> 
> We do need to fix PR 99341 somehow, I just don't know how.

yeah, tricky.

that PR shows as closed, FWIW - but as noted at the start I think x86_64-linux-gnu is also broken w.r.t once-called fns throwing

Iain


  reply	other threads:[~2023-08-09 13:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 12:21 Iain Sandoe
2023-08-09 12:38 ` Jonathan Wakely
2023-08-09 12:51   ` Iain Sandoe
2023-08-09 12:53     ` Jonathan Wakely
2023-08-09 13:12       ` Iain Sandoe [this message]
2023-08-09 14:10         ` 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=6B6C385F-6E6A-4EC2-92CC-FD7EB8E553D7@sandoe.co.uk \
    --to=iain@sandoe.co.uk \
    --cc=jwakely.gcc@gmail.com \
    --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).