The original implementation of the state machine support was pretty poor. In order to support NEXT,PUSH & POP a significant amount of boiler plate code was output. I’ve now changed the compiler significantly to optimise away much of this boiler plate code.
In essence the original state machine would maintain variables to track sub states seperately to the parent. This would result in problems when a PUSH needed to be compiled, since all the sub state variables would have to be fixed up. POP was even worse, this would need to work out which of the sub states we used to be in, in order to be able to restore the state.
States and sub states are now tracked by a single variable, this makes perfect sense as you could never be in more that one sub state simultaniously. The change does mean that the order of iterations through states and sub states has altered (but the prior implementation never made sense anyway). The docs have been updated to reflect this, and hopefully the new way makes more sense.
The original assembled i8080 pin accurate emulation would produce an llvm assembler file nearly 2Megabytes in length. After the state machine changes, this file is down to 700Kilobytes.
Written by Savoury SnaX, 20 Aug 2011