yeah, i think i know what you mean, there are two ways:
1) explicit top of stack elements (e.g. the a-stack architecture of ocaml always keeps the TOS element in a register)
2) implicit top of stack element handling; the technique is called "stack caching" and the paper to read there is from ertl in 1995.
PS: by jit compiling this code can be easily eliminated.
PPS: the points i mentioned are only "easily" implementable when your host programming language supports primitive types (such as ints, longs, floats, etc.). whenever you are dealing with "objects" (i.e. pointers to structs) you have to do (un-)boxing which lessens the advantage of stack caching...
Comments
yeah, i think i know what you mean, there are two ways: 1) explicit top of stack elements (e.g. the a-stack architecture of ocaml always keeps the TOS element in a register) 2) implicit top of stack element handling; the technique is called "stack caching" and the paper to read there is from ertl in 1995.
PS: by jit compiling this code can be easily eliminated. PPS: the points i mentioned are only "easily" implementable when your host programming language supports primitive types (such as ints, longs, floats, etc.). whenever you are dealing with "objects" (i.e. pointers to structs) you have to do (un-)boxing which lessens the advantage of stack caching...