I reversed the stack direction in my #SubSky #ISA and VM. The original stack order had pushes go towards the high end; the current direction has pushes go towards the low end (like #x86 and many other architectures*). It simplified a number of things, such as accessing variables in the stack frame ("lvalues" are now positive and start at 0 rather than -4 [the word size is 32 bits] ). The heap structuring will be easier to do now, as well.

https://gitlab.com/golemwire/subsky/-/tree/reverse-stack?ref_type=heads

#CPU

Files · reverse-stack · Ethan Black / SubSky · GitLab

A simple, minimalist, and easy-to-use RISC ISA and computing environment intending to strike a reasonable balance between elegant simplicity and practical power.

GitLab

*I'm curious about whether any real-world architectures have a stack where pushes go towards the high end.

One of the advantages of having a stack where pushes go to the high end is that if you push the fields of a data structure, from its first field to its last field, where each field is one word, then the stack will have a copy of the data structure. Compare this to a "reverse" stack, where you'll end up with a copy of the struct with the fields reversed.

I had to adjust the #SlangLang compiler for this. It's an annoying side effect of the "reverse" stack, but I'd say it is worth it.