[Vm-dev] image format suggestion

Bert Freudenberg bert at freudenbergs.de
Fri Sep 13 08:48:28 UTC 2013

On 2013-09-13, at 02:03, "Jecel Assumpcao Jr." <jecel at merlintec.com> wrote:

> I wanted
> to be able to load the same image into a 16 bit, a 32 bit and a 36 bit
> processor. The encoding was based on a compact representation for
> "infinite" lenght integers.
> [...]
> Object pointers were encoded as the number indicating how many object
> back to look in the object table.
> [...]
> These details don't matter - the important thing is that if it is
> possible to have a single image file format for Spur that works in both
> 32 and 64 bit VMs it would be nice to do it.
> -- Jecel

Very nice idea! I'd love to have a single image format.

There is, however, one big advantage to a straight memory dump: paging. With a few little tweaks, it's possible to avoid reading the full image on startup. It can just be memory-mapped, which tells the OS to load a page into memory only when it is accessed the first time. I experimented with this back in the days of the first OLPC machine which had a very slow CPU and a rather slow flash drive, but we did not deploy that. John made it work for his iOS stuff though and he reported quite a bit of startup time improvement.

A slightly related idea is "perm space" à la VisualWorks, which makes a part of the object memory read-only. With that even a full GC might avoid having to page in everything. This might also help with multi-threading, because after forking with copy-on-write semantics the majority of pages would still be shared between threads.

Looking forward these optimizations might not be worth it, but we should still discuss them.

- Bert -

More information about the Vm-dev mailing list