On 4/11/20 10:46 AM, Iain Sandoe wrote:
Hi Folks,
sorry for the long CC list - please feel free to ignore if you don’t care :)

I propose that this PR should be re-categorized as a “C++” one.

The reason is that this is not an oversight in the GCC implementation,
but a problem present in the general case.  Library implementors feel
strongly that absence of symmetric transfer on important targets is a
Bad Thing.

=======   possibilities to resolve this …..

We have, in the case of coroutine tail-calls, a useful factor in that all
such calls pass a single pointer, to the coroutine state frame.  That
frame is initially set up in the DSO that spawns a given coroutine actor
function.  Thus, at the point the frame is built, we have access to the
TOC, GOT, PLT for the relevant DSO.

It would seem excessive to resort to some kind of trampoline when we
already have somewhere to put the data we need to restore.

So .. what I’d like to do is to prototype a solution (probably on PPC) and
then take the necessary (coroutine) ABI amendments to the “coroutines
ABI group” (I am the editor of the current doc - which doesn’t have any
ps-component).

======= band-aid to fix the PR for stage 4.

tested on x86_64-linux, darwin (no loss of tail-call)
powerpc64-linux-gnu (tail call is OK on m32, and bypassed on m64)
solaris2.11 (tail call is bypassed on m32 and 64).

OK for master?
thanks
Iain

======= this is the commit message.

For symmetric transfers to work with C++20 coroutines, it is
currently necessary to tail call the callee coroutine from resume
method of the caller coroutine.  The current codegen marks these
resume calls as "MUST_TAIL_CALL" to indicate that the tail call is
required for correctness.

Unfortunately, several targets have ABI constraints that prevent
an indirect tail-call, which results in the PRs compile error.

The change here tests the target sibcall hook for the resume
expression and only marks it as requiring a tail call if that's
supported.

This doesn't fix the underlying problem; that really a solution is
needed to allow the tail-calls (or equivalent) to take place - but
that will be deferred until next stage 1.

This is fine from my PoV for gcc 10.

nathan

--
Nathan Sidwell

Reply via email to