Since GNAT is directly built on top of GCC, couldn’t a minicoro like library be written in pure Ada, and emit GCC intrinsics or IR? The only issue I see is if an fiber/coroutine somehow exhausted the stack, which means we would need some way to raise an compiler error if/when that happens.
A followup question: if I do have to resort to writing assembly anyways, is there a way I can formally prove that assembly does what I think it does using SPARK or some other tool?
(Especially to check if our fiber has too many stack allocated variables saved to it)
The last paper in my post here might be useful, take that paper and pop it into scholar.google.com and see if there’s anything there.
However, you could also combine that with the “using high level language as a cross assembler” (SPARK annotating the ‘assembly’ subprograms), and proving that.
Alright here’s my attempt at doing stackful SPARK proven coroutines (Note that a lot of this code is AI Generated so take this with a hefty grain of salt)