Save/Load VM State


#1

Hello everyone,

I coming to you with a probably uncommon question. I wonder if there is a way, either for Ruby(YARV) or mruby, to dump the entire state of the virtual machine to a file and then at another time restore the state from that file.

I know that Ruby can dump objects into files using Marshal module but that is not what I am looking for.

Its more about the VM state including current stack memory, heap memory, instruction pointer, stack pointer, fiber states, etc. Basically like a snapshot but with the addition that it can be restored from that snapshot and continue to run as if nothing happened in between.

I guess the answer is no unless you know the Ruby source code so good that you could write your own VM which I am not. There is the RubyVM module which already offers a lot of things but it seems also not what I am looking for. Since I didn’t find anything using google or in the docs, I though before giving up I ask here just in case.

Thanks to everyone who is taking the time reading this.