As of 3.18, Mindcode supports an internal and an external stack. With Mindustry Build 160, the external stack can store any value, and recursive programs using external stack are fully functional without any limitations placed on values stored on stack. Performance-wise, internal and external stacks are very similar, but with just a single memory bank, an external stack already has more capacity than an internal stack could ever have (each variable put on stack requires at least two instructions per stack frame with internal stack).
A natural extension is to use an array of memory cells/memory banks for an external stack. Switching between storage blocks would be done at the beginnings and ends of recursive functions instead of at every push/pop instruction.
All the required infrastructure is already there (ability to declare arrays of linked blocks, plus instrumentation of bodies of recursive functions). This could probably be done quite easily, and is planned for Mindcode 3.20.
As of 3.18, Mindcode supports an internal and an external stack. With Mindustry Build 160, the external stack can store any value, and recursive programs using external stack are fully functional without any limitations placed on values stored on stack. Performance-wise, internal and external stacks are very similar, but with just a single memory bank, an external stack already has more capacity than an internal stack could ever have (each variable put on stack requires at least two instructions per stack frame with internal stack).
A natural extension is to use an array of memory cells/memory banks for an external stack. Switching between storage blocks would be done at the beginnings and ends of recursive functions instead of at every push/pop instruction.
All the required infrastructure is already there (ability to declare arrays of linked blocks, plus instrumentation of bodies of recursive functions). This could probably be done quite easily, and is planned for Mindcode 3.20.