Re:Wasm3 – A high performance WebAssembly interpreter in C
by tom_mellior on Monday January 13, 2020 @08:49AM
(#22034400)
You seem to be asking something like "if we always hit the algorithm's slow path, isn't the algorithm slow?". The answer is "yes, but we will (hopefully) almost never hit the slow path". On x64-64 you will typically be able to pass 6 integer/pointer values and 8 floating-point values in registers. That should be enough for most function calls in real-world code.
Re:Wasm3 – A high performance WebAssembly interpreter in C
by tyingq on Monday January 13, 2020 @06:22AM
(#22033480)
I don't know of any current physical stack machine CPUs.
Re:Wasm3 – A high performance WebAssembly interpreter in C
by uasm on Monday January 13, 2020 @08:29AM
(#22034259)
Stacks are used extensively across the x86 family [0]
Re:Wasm3 – A high performance WebAssembly interpreter in C
by tyingq on Monday January 13, 2020 @08:45AM
(#22034376)
"Has a stack" isn't the same as "Has a stack based ISA".
Re:Wasm3 – A high performance WebAssembly interpreter in C
by colejohnson66 on Monday January 13, 2020 @06:10PM
(#22039796)
To expand: a Forth machine or similar would be a stack based ISA. Using a stack is a different matters; Pretty much every ISA uses stacks.
Re:Wasm3 – A high performance WebAssembly interpreter in C
by jeltz on Monday January 13, 2020 @09:57AM
(#22034941)
No, stack machine CPUs are pretty obscure things, especially today. See the link below for some examples. All or virtually all modern commercial CPUs are register based.
https://en.wikipedia.org/wiki/Stack_machine#Commercial_stack...
Re:Wasm3 – A high performance WebAssembly interpreter in C
by AlEinstein on Monday January 13, 2020 @06:24AM
(#22033489)
What proportion of machines running web assembly are stack-based, would you say?
I would guess negligible.
If the hardware executing this code is "stack-based" (or, does not offer enough general purpose registers to accomodate the funtion call) - this will need to be converted back to a stack-based function call (either at runtime, or beforehand). Wouldn't this intermediate WASM-to-register-based-bytecode translation be redundant then?