On Mon, Jun 22, 2026 at 6:36 AM Gennaro Prota <gennaro.prota@gmail.com> wrote:
- Automatic frame-allocator propagation: I'm concerned about the method (thread-local pointer that is saved and restored). IIUC, it only works if every place that resumes a coroutine remembers to save and restore the pointer. Nothing forces this, and one mistake means a frame is allocated from the wrong allocator with no error reported. Is my understanding correct?
Thank you so much for your review, and I think this is worth expanding on. You are correct that an implementation mistake means the wrong allocator is used. However, it is important to recognize there are three cohorts of implementors (described in P4172). Ordinary users are not the ones implementing the coroutine machinery (where the TLS save/restore code lives). It is experts implementing this, and they only have to get it right once in the component and then it works forever. Mistakes here are unlikely, and when they surface they will be fixed promptly. Compare this with the approach that passes the allocator as a parameter to every function which returns a task. That places the burden on every ordinary user, at every function in the call chain. Mistakes here are practically guaranteed. And they will go unnoticed because failing to get the allocator right usually only results in performance loss. Thanks