This is a question about writing a Glulx interpreter, but I suppose it is relevant for other VMs, too.
Various opcodes have to save or load the VM state (
saveundo, and so on).
The easy way to implement them is to keep full copies of the main memory, the stack and the registers, but I find it quite wasteful. I mean, imagine the required memory for doing that with a 4 GB game (the theoretical maximum size of a Glulx file).
So is there a more efficient way of saving the VM state? I thought about saving only the diffs between consecutive save states, but it seems a bit more complicated.