www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Must tail call attribute in D?

reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
https://blog.reverberate.org/2021/04/21/musttail-efficient-interpreters.html

This returns me back to threaded code VM for std.regex, AFAICT it 
was blocked because I only could get tail calls in optimized 
build. Otherwise it was going to blow up the stack, particularly 
if it was small fiber stack.

What do you think is it feasible to enable in D?

——
Dmitry Olshansky
CEO   [Glow Labs](https://glow-labs.pro)
https://olshansky.me/about/
Aug 21
next sibling parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 22/08/2024 12:22 AM, Dmitry Olshansky wrote:
 https://blog.reverberate.org/2021/04/21/musttail-efficient-interpreters.html
 
 This returns me back to threaded code VM for std.regex, AFAICT it was 
 blocked because I only could get tail calls in optimized build. 
 Otherwise it was going to blow up the stack, particularly if it was 
 small fiber stack.
 
 What do you think is it feasible to enable in D?
 
 ——
 Dmitry Olshansky
 CEO   [Glow Labs](https://glow-labs.pro)
 https://olshansky.me/about/
Likely. https://llvm.org/docs/LangRef.html#id331 ``musttail``
Aug 21
prev sibling parent MrSmith <mrsmith33 yandex.ru> writes:
On Wednesday, 21 August 2024 at 12:22:43 UTC, Dmitry Olshansky 
wrote:
 https://blog.reverberate.org/2021/04/21/musttail-efficient-interpreters.html

 This returns me back to threaded code VM for std.regex, AFAICT 
 it was blocked because I only could get tail calls in optimized 
 build. Otherwise it was going to blow up the stack, 
 particularly if it was small fiber stack.

 What do you think is it feasible to enable in D?

 ——
 Dmitry Olshansky
 CEO   [Glow Labs](https://glow-labs.pro)
 https://olshansky.me/about/
I did partial implementation for LDC. If anyone wants they can continue the process
Aug 22