[HN Gopher] Gh-128563: A new tail-calling interpreter for Python...
___________________________________________________________________
Gh-128563: A new tail-calling interpreter for Python 3.14
Author : rurban
Score : 13 points
Date : 2025-02-08 19:08 UTC (3 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| UncleEntity wrote:
| Our AI overlords did a pretty good job of implementing this on
| the minischeme interpreter I like to poke at from time to time.
|
| Though, apparently, a SECD machine isn't as amenable to this as I
| originally thought. My intuition was you just pass the different
| SECDs as arguments between the action routines and let the
| compiler do it's magic but they were like "oh no, silly human, it
| doesn't work like that."
|
| It turns out doing it their way allowed scheme's mandatory tail-
| call optimization (TCO) to naturally fall out of the
| implementation which I thought was kind of special. Kudos,
| robots...
|
| Haven't looked at how python does its thing in quite a long time
| but I believe it doesn't have TCO so maybe this is a step in that
| direction?
| rurban wrote:
| It's unrelated to a python TCO. It's only about new
| optimizations now possible with the new clang 15 musttail
| attribute in the inner VM loop. while op { switch op case bla:
| ...} to reduce register pressure in the ops. This is possible
| for all other dynamic language VM's also (which didn't resort
| to luajit's assembly vm loop).
|
| Compilers register allocation can never better when they cannot
| prove TCO. With this they can skip that
___________________________________________________________________
(page generated 2025-02-08 23:01 UTC)