Specifically, I have tried boiling down the operations of a VM into the smallest possible standardized units and arrived at this:
allocate_stack(size)
fetch(offset_from_stack_pointer)
store(offset_from_stack_pointer)
call(index)
So you might have:
allocate_stack 6
fetch -2
store 0
fetch -1
store 1
call 72
Basically, the allocate_stack
would tell you how much space you are allocating for fields in the stack. Then the fetch
would queue up something relative to the stack to be stored (or fetch_a
would fetch an absolute address). Then store
would store the fetched value in the space relative to the stack (or store_a
for absolute position). And finally, call <index>
would call that specific function.
So basically these are 2-address codes instead of 3-address codes. Does anything like this exist out there where they've expanded upon the idea to find compiler optimizations and such, like 3-address-code and SSA form? If not like this, does anything else exist outside of 3-address-code and SSA form?