3 ms·
I've developed a few VMs and each was always tied to a specific language or one of its close relatives. The advantages of having a VM is that it's a lot easie
by DonaldFisk 9y ago
I've developed a few VMs and each was always tied to a specific language or one of its close relatives. The advantages of having a VM is that it's a lot easier to compile to than native code, you can run it on any hardware for which an interpreter has been written, and its object code is a lot smaller. The disadvantage is that the compiled code runs slower.
The exception is when someone wants their language to run on an existing VM, e.g. for Java or to run in a web browser, so they compile it to the VM's instruction set. Various languages are compiled onto the JVM, and the same WebAssembly code has to run on any hardware onto which the containing web page has been downloaded, and will run faster than the equivalent JavaScript.