public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
@ 2021-12-04 16:14 ` pietro.gcc at sociotechnical dot xyz
  2023-11-16  4:41 ` pinskia at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pietro.gcc at sociotechnical dot xyz @ 2021-12-04 16:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

pietro <pietro.gcc at sociotechnical dot xyz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pietro.gcc at sociotechnical dot x
                   |                            |yz

--- Comment #2 from pietro <pietro.gcc at sociotechnical dot xyz> ---
I created a plugin that lets you annotate a whole function as musttail:
https://github.com/pietro/gcc-musttail-plugin/

I think that in order to add an attribute to the return statement like clang
has done the parser for the C frontend needs to be modified.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
  2021-12-04 16:14 ` [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls pietro.gcc at sociotechnical dot xyz
@ 2023-11-16  4:41 ` pinskia at gcc dot gnu.org
  2023-11-16  4:49 ` dje at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-16  4:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at gcc dot gnu.org

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 112558 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
  2021-12-04 16:14 ` [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls pietro.gcc at sociotechnical dot xyz
  2023-11-16  4:41 ` pinskia at gcc dot gnu.org
@ 2023-11-16  4:49 ` dje at gcc dot gnu.org
  2023-11-16 17:27 ` mikpelinux at gmail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: dje at gcc dot gnu.org @ 2023-11-16  4:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-11-16
             Status|UNCONFIRMED                 |NEW

--- Comment #4 from David Edelsohn <dje at gcc dot gnu.org> ---
https://gcc.gnu.org/pipermail/gcc/2021-April/235882.html

https://blog.reverberate.org/2021/04/21/musttail-efficient-interpreters.html

The lack of this feature is motivating CPython to rely on LLVM for its JIT in
future releases.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-11-16  4:49 ` dje at gcc dot gnu.org
@ 2023-11-16 17:27 ` mikpelinux at gmail dot com
  2023-11-16 17:34 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: mikpelinux at gmail dot com @ 2023-11-16 17:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

--- Comment #5 from Mikael Pettersson <mikpelinux at gmail dot com> ---
To get guaranteed tail-calls to work you need to adjust the calling convention
for the caller as well as the callee. Things are trivial as long as parameters
always fit in registers. With parameters on the stack you need, in general, to
shift the responsibility for their deallocation from caller to callee, and this
results in a non-standard calling convention.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2023-11-16 17:27 ` mikpelinux at gmail dot com
@ 2023-11-16 17:34 ` pinskia at gcc dot gnu.org
  2023-11-19 17:19 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-16 17:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to David Edelsohn from comment #4)
> The lack of this feature is motivating CPython to rely on LLVM for its JIT
> in future releases.

Which is interesting because GCC JIT supports this already. Just not exposed to
C. That was mentioned in the gcc mailing list archive that you pointed to too.

e.g.
https://gcc.gnu.org/onlinedocs/jit/topics/expressions.html#c.gcc_jit_rvalue_set_bool_require_tail_call

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2023-11-16 17:34 ` pinskia at gcc dot gnu.org
@ 2023-11-19 17:19 ` pinskia at gcc dot gnu.org
  2023-11-19 17:23 ` sjames at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-19 17:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://github.com/llvm/llv
                   |                            |m-project/issues/72555

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://github.com/llvm/llvm-project/issues/72555

Hmmm

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2023-11-19 17:19 ` pinskia at gcc dot gnu.org
@ 2023-11-19 17:23 ` sjames at gcc dot gnu.org
  2023-11-20  1:07 ` dje at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-19 17:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

--- Comment #8 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to David Edelsohn from comment #4)
> The lack of this feature is motivating CPython to rely on LLVM for its JIT
> in future releases.

Do you have something I can read up on for this part? It's the first I've heard
it.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2023-11-19 17:23 ` sjames at gcc dot gnu.org
@ 2023-11-20  1:07 ` dje at gcc dot gnu.org
  2023-11-20  1:21 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: dje at gcc dot gnu.org @ 2023-11-20  1:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

--- Comment #9 from David Edelsohn <dje at gcc dot gnu.org> ---
Brandt Bucher: A JIT compiler for CPython
https://www.youtube.com/watch?v=HxSHIpEQRjs
https://github.com/brandtbucher/cpython/tree/justin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2023-11-20  1:07 ` dje at gcc dot gnu.org
@ 2023-11-20  1:21 ` pinskia at gcc dot gnu.org
  2023-11-20 14:34 ` dje at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-20  1:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to David Edelsohn from comment #9)
> Brandt Bucher: A JIT compiler for CPython
> https://www.youtube.com/watch?v=HxSHIpEQRjs
> https://github.com/brandtbucher/cpython/tree/justin

But must tail is there for the gcc jit interface already. Maybe it is not
exposed to c/c++ attribute but it is there already. So maybe this is just not
noticing that point.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2023-11-20  1:21 ` pinskia at gcc dot gnu.org
@ 2023-11-20 14:34 ` dje at gcc dot gnu.org
  2023-12-25 11:06 ` sjames at gcc dot gnu.org
  2024-01-24 11:13 ` sjames at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: dje at gcc dot gnu.org @ 2023-11-20 14:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

--- Comment #11 from David Edelsohn <dje at gcc dot gnu.org> ---
GIMPLE supports must_tail, but it is not exposed at the sources level /
attributes in GCC.

CPython is not adding the LLVM JIT at runtime.  The proposal is to utilize LLVM
at build time to generate code templates that can be copied into the CPython
binary and patched with relocations.

CALL_EXPR_MUST_TAIL_CALL and libgccjit are not sufficient for the CPython plan.
 The plan does not propose connecting CPython to an existing JIT in LLVM (or
GCC).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2023-11-20 14:34 ` dje at gcc dot gnu.org
@ 2023-12-25 11:06 ` sjames at gcc dot gnu.org
  2024-01-24 11:13 ` sjames at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-12-25 11:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arsen at gcc dot gnu.org,
                   |                            |dmalcolm at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=110899

--- Comment #12 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to David Edelsohn from comment #11)
> GIMPLE supports must_tail, but it is not exposed at the sources level /
> attributes in GCC.
> 
> CPython is not adding the LLVM JIT at runtime.  The proposal is to utilize
> LLVM at build time to generate code templates that can be copied into the
> CPython binary and patched with relocations.

This is now up as https://github.com/python/cpython/pull/113465 and
https://github.com/python/cpython/issues/113464.

See also PR110899 and
https://discourse.llvm.org/t/rfc-exposing-ghccc-calling-convention-as-preserve-none-to-clang/74233
(which is linked from the CPython PR for adding the JIT).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls
       [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2023-12-25 11:06 ` sjames at gcc dot gnu.org
@ 2024-01-24 11:13 ` sjames at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-01-24 11:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83324

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andi-gcc at firstfloor dot org

--- Comment #13 from Sam James <sjames at gcc dot gnu.org> ---
Patches posted by Andi Kleen:
https://inbox.sourceware.org/gcc-patches/20240124110800.3154093-2-ak@linux.intel.com/.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-01-24 11:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-83324-4@http.gcc.gnu.org/bugzilla/>
2021-12-04 16:14 ` [Bug c/83324] [feature request] Pragma or special syntax for guaranteed tail calls pietro.gcc at sociotechnical dot xyz
2023-11-16  4:41 ` pinskia at gcc dot gnu.org
2023-11-16  4:49 ` dje at gcc dot gnu.org
2023-11-16 17:27 ` mikpelinux at gmail dot com
2023-11-16 17:34 ` pinskia at gcc dot gnu.org
2023-11-19 17:19 ` pinskia at gcc dot gnu.org
2023-11-19 17:23 ` sjames at gcc dot gnu.org
2023-11-20  1:07 ` dje at gcc dot gnu.org
2023-11-20  1:21 ` pinskia at gcc dot gnu.org
2023-11-20 14:34 ` dje at gcc dot gnu.org
2023-12-25 11:06 ` sjames at gcc dot gnu.org
2024-01-24 11:13 ` sjames at gcc dot gnu.org

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).