rrthomas / mit

A simple stack-based VM
Other
10 stars 3 forks source link

Make a list of "must-have" language ecosystem features #118

Open rrthomas opened 5 years ago

rrthomas commented 5 years ago
apt1002 commented 4 years ago

In a recent email I wrote:

I've been Thinking about what properties a virtual machine should have in order to be usefully composable with other virtual machines. In The Future, it will be increasingly rare to run programs on bare metal. The default assumption, when optimizing, is that your virtual machine will be inside some other virtual machine. Therefore, there are features of the host that I think a virtual machine really ought to expose, because otherwise somewhere in the stack there will be a big efficiency penalty. My list is something like this:

  • Some sort of memory management
  • Concurrency, including timers and the concept of being idle
  • Parallelism
  • A way of  generating new host code (e.g. a JIT compiler)
  • A way of generating new  virtual code at runtime (for nested VMs)
  • Many "registers", i.e. unaliased storage locations
  • Dense arrays of primitive types (e.g. byte, int and float arrays)
  • A bunch of accelerators, e.g. memcpy, graphics, codecs, FFT, linpack
  • Maybe mmap/mprotect and associated signal handlers?

Admittedly this is a pretty tall order. I don't know of even one VM which supports all of these features. The JVM and e.g. VMWare get close.

My email has a narrower focus than this issue; it is about making virtual machines efficiently composable. Nonetheless, @rrthomas pointed out that the lists are similar. Some of the differences can even be explained as random omissions. Let's run through the latter list.

And now let's run through the former list. I can't speak for @rrthomas here so I'll keep my comments tentative.

The differences mostly come down to a difference of focus. For example, "semver", "unicode" and "ally" have no effect on the composability of virtual machines, so do not belong on my list, whereas "registers", "dense arrays" and "JIT compiler" are implementation details that do not belong on a list of language features.