Earlier quoted context omitted.
I don't know of any current physical stack machine CPUs.
Stacks are used extensively across the x86 family [0] [0] - https://en.wikipedia.org/wiki/X86_calling_conventions
Wasm3 – A high performance WebAssembly interpreter in C
61–70 of 79 posts
Re: Wasm3 – A high performance WebAssembly interpreter in C
#62This is pretty exciting if real: > Bytecode/opcodes are translated into more efficient "operations" during a compilation pass, generating pages of meta-machine code WASM compiled to a novel bytecode format aimed at efficient interpretation. > Commonly occurring sequences of operations can can also be optimized into a "fused" operation. Peephole optimizations producing fused opcodes, makes sense. > In M3/Wasm, the sta…
> "WASM translated to register-based bytecode. That's awesome!" 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?
Re: Wasm3 – A high performance WebAssembly interpreter in C
#63Re: Wasm3 – A high performance WebAssembly interpreter in C
#64Earlier quoted context omitted.
I don't know of any current physical stack machine CPUs.
Stacks are used extensively across the x86 family [0] [0] - https://en.wikipedia.org/wiki/X86_calling_conventions
https://en.wikipedia.org/wiki/Stack_machine#Commercial_stack...
Re: Wasm3 – A high performance WebAssembly interpreter in C
#65Earlier quoted context omitted.
> The necessity of doing coloring to assign registers efficiently is kind of unfortunate Register based VMs like Lua don't do this. The register allocation is incredibly simple https://github.com/LuaJIT/LuaJIT/blob/v2.1/src/lj_parse.c#L3...
But that's an allocator to virtual registers that don't try to correspond to (a valid number of) physical CPU registers. Sure it's easy to allocate to a large number of registers. It's harder to do it to a small number, like the project discussed here seems to claim to do.
Re: Wasm3 – A high performance WebAssembly interpreter in C
#66Re: Wasm3 – A high performance WebAssembly interpreter in C
#67Impressive list of constrained targets for embedded. The AtMega1284 microcontroller for example has only 16 KB of RAM. Which is a lot for an 8-bit micro, but pretty standard for a modern application processors.
Re: Wasm3 – A high performance WebAssembly interpreter in C
#68These are impressive performance numbers. > Because operations end with a call to the next function, the C compiler will tail-call optimize most operations. It appears that this relies on tail-call optimization to avoid overflowing the stack. Unfortunately this means you probably can't run it in debug mode.
It's not that bad even in debug mode (or without TCO). Just not optimal. Also, there is a way to rework this part, so it does not rely on compiler TCO.