public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <iain@sandoe.co.uk>
To: Richard Biener <richard.guenther@gmail.com>
Cc: FX Coudert <fxcoudert@gmail.com>,
	Jeff Law <jeffreyalaw@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	Maxim Blinov <maxim.blinov@embecosm.com>,
	Eric Botcazou <ebotcazou@adacore.com>
Subject: Re: [PATCH] core: Support heap-based trampolines
Date: Sat, 16 Sep 2023 20:10:57 +0100	[thread overview]
Message-ID: <91E7404E-E536-4230-A8E1-F20D419E74FE@sandoe.co.uk> (raw)
In-Reply-To: <CAFiYyc0LwAd2qOoAUL2O8nFg3g5sw-9Yfb59TA7J7EoGX32Rjw@mail.gmail.com>

Hi Richard,

> On 14 Sep 2023, at 11:18, Richard Biener <richard.guenther@gmail.com> wrote:
> 
> On Wed, Sep 6, 2023 at 5:44 PM FX Coudert <fxcoudert@gmail.com> wrote:
>> 

>> ping**2 on the revised patch, for Richard or another global reviewer. So far all review feedback is that it’s a step forward, and it’s been widely used for both aarch64-darwin and x86_64-darwin distributions for almost three years now.
>> 
>> OK to commit?
> 
> I just noticed that ftrampoline-impl isn't Optimize, thus it's not
> streamed with LTO.

I think this is fine, the nested pass runs before LTO streaming and lowers to the relevant built-ins for the chosen impl.
The builtins are distinct and can co-exist in the linked exe,

>  How does mixing different -ftrampoline-impl for different LTO TUs behave?

Assuming that a target can support multiple implementations, then each is applied local to a single TU.  The nested functions are scoped within their parent and thus should not be candidates for merging by LTO.

For a target that cannot support both, then one or more of the TUs should be rejected before we even get to LTO.

>  How does mis-specifying -ftrampoline-impl at LTO link time compared to compile-time behave?

The flag should be a  NOP at LTO link time (but I do not think we want to reject it, that would probably create other issues?)

>  Is the state fully reflected during pre-IPA compilation and the flag not needed after that?  

yes, that is my understanding, nested runs very early.

> It appears so, but did you check?

I actually checked on x86_64-darwin (which does support both) and we see…
here with two tus with nested fns and a third with the main().

$ nm -mapv ./nn.ltrans0.ltrans.o

as expected, two instances of the nested “bar”.

00000000000001a8 (__TEXT,__cstring) non-external lC0
000000000000001f (__TEXT,__text) non-external _bar.0.lto_priv.0 
00000000000001d0 (__TEXT,__cstring) non-external lC1
00000000000000ec (__TEXT,__text) non-external _bar.0.lto_priv.1
000000000000007c (__TEXT,__text) external _foo_1
0000000000000149 (__TEXT,__text) external _foo_2
0000000000000000 (__TEXT,__text) external _main

>>> these for heap-based:
                 (undefined) external ___builtin_nested_func_ptr_created 
                 (undefined) external ___builtin_nested_func_ptr_deleted

>>> this for stack-based.
                 (undefined) external ___enable_execute_stack

(and the code executes as expected).

> OK if that's a non-issue.

thanks, we'll wait a day or two in case of any follow-on comments,
Iain

P.S. I was investigating some unrelated unwinder issues a couple of weeks ago, but that did highlight that we have a possibility to avoid the leaks from longjump if we hang on the forced_unwind() machinery [TODO, tho, not part of this initial patch]


> 
> Thanks,
> Richard.
> 
>> FX
>> 
>> 
>> 
>>> Le 5 août 2023 à 16:20, FX Coudert <fxcoudert@gmail.com> a écrit :
>>> 
>>> Hi Richard,
>>> 
>>> Thanks for your feedback. Here is an amended version of the patch, taking into consideration your requests and the following discussion. There is no configure option for the libgcc part, and the documentation is amended. The patch is split into three commits for core, target and libgcc.
>>> 
>>> Currently regtesting on x86_64 linux and darwin (it was fine before I split up into three commits, so I’m re-testing to make sure I didn’t screw anything up).
>>> 
>>> OK to commit?
>>> FX
>> 


      reply	other threads:[~2023-09-16 19:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-16 10:38 FX Coudert
2023-07-17  6:31 ` Richard Biener
2023-07-17  6:43   ` FX Coudert
2023-07-17  6:58     ` Iain Sandoe
2023-07-17  7:16       ` Iain Sandoe
2023-07-19  9:04         ` Martin Uecker
2023-07-19  9:29           ` Iain Sandoe
2023-07-19 10:43             ` Martin Uecker
2023-07-19 14:23               ` Iain Sandoe
2023-07-19 15:18                 ` Martin Uecker
2023-08-05 14:20   ` FX Coudert
2023-08-20  9:43     ` FX Coudert
2023-09-06 15:44     ` FX Coudert
2023-09-14 10:18       ` Richard Biener
2023-09-16 19:10         ` Iain Sandoe [this message]

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=91E7404E-E536-4230-A8E1-F20D419E74FE@sandoe.co.uk \
    --to=iain@sandoe.co.uk \
    --cc=ebotcazou@adacore.com \
    --cc=fxcoudert@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=maxim.blinov@embecosm.com \
    --cc=richard.guenther@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).