There's an interesting concept of safe stack:
Could this be used with Swift?
There's an interesting concept of safe stack:
Could this be used with Swift?
I'm no expert in this area, but I think so, but only for Swift call frames. It's kind of similar to the Async Context, which stores the values of local variables that live across await
statements. (further reading)
Swift prioritizes fast interop with C, and that would only work if C stack frames were left intact. Contrast this with say, the Go approach, which uses a custom (resizable) stack per go-routine. It's great for their green thread scheduling, and frees you up to use any custom format you want (which doesn't have to match the C ABI at all, if you so wished) but it severely cripples performance when calling out to C functions (which is why you see their ecosystem "rewriting the world" in Go, including things like libc syscall wrappers, to avoid those calls to C).