At some point we need to stop inventing VMs. VMs like Java, .Net, etc, are already good enough. What is the point of yet another VM? The same people who designed web assembly could have taken java bytecode and added new APIs on top. Instead, they invented yet another machine encoding that has to be targeted, except this time we get to re-invent all the tooling.

Look... I hate the Java language with a burning passion, but the Java VM core technology is perfectly acceptable. So is .Net. There is no reason for webassembly, other than that mozilla wanted to invent something.

We're biased towards additive solutions [0], but sometimes subtraction is the right answer to a design problem. The problems that WA aims to solve from existing VMs like JVM/.NET are caused by the old APIs themselves, adding more API surface would not help.

[0]: Adding is favoured over subtracting in problem solving https://news.ycombinator.com/item?id=26727878

Okay then define a subset of java opcodes supported and then modify the open source hotspot.

Look I'm trying to implement a wasm backend into an existing language right now and it could be a lot easier by either making wasm into a real architecture (with registers) or using an existing stack based vm isa.

WA can be transformed into native machine code in linear time, directly executed at (near) native speed, while retaining the VM memory protection barrier. No other VM can come close in these three properties at once.

If you're trying to integrate WA into a host language the easiest, fastest, and safest way would be to pick up one of the established well-polished compilers or interpreters and calling into it with a standard FFI interface.

Firstly... Any stock vm isa can be linearly compiled if you give up certain optimization.

For example, if wa wanted to use a coloring allocator it wouldn't be linear time anymore. That's not a fundamental part of it, just an implenebtation choice.

Firefox's WA backend does streaming compilation (i.e. compiling bytecode directly to machine code while it's still coming off the wire) for Tier 1, right now, by default, today. Afaik, WA is the first mainstream vm isa that it's even possible to do this. Do you know of any other VM that can compile its bytecode in one pass that is on by default? I'm genuinely interested. https://wingolog.org/archives/2020/03/25/firefoxs-low-latenc...

But this whole discussion is out of scope for your use-case. If it's For Fun (tm) that's one thing, but (presumably) this is a practical integration into an existing language. Why are you implementing a VM instead of integrating an existing implementation? Certainly you wouldn't even consider implementing a custom from-scratch implementation of the JVM, the fact that it's even possible to attempt such a thing for WA is already telling about which VM has a better design.

Take your pick: https://github.com/appcypher/awesome-wasm-runtimes