5 ms·
I have seen at least three projects to run WebAssembly in the kernel, but not a single strong attempt at a good userland binary format for WebAssembly: I don't
by saurik 8y ago
I have seen at least three projects to run WebAssembly in the kernel, but not a single strong attempt at a good userland binary format for WebAssembly: I don't want to run WebAssembly in my kernel, I just want an architecture agnostic binary format for Linux executables.
- comesee 8y agoEmscripten seems like a good start, the tooling already exists.
- AnIdiotOnTheNet 8y agoActually, you kinda already have it via QEMU, which is capable of doing syscall translation. Just compile your code for linux on any of the supported target archs and use QEMU User Mode Emulation to launch it.
- nwmcsween 8y agoI don't even think ELF can be architecture agnostic without doing some hideous hacks (aka 'fat' binaries).
- IshKebab 8y agoIt can because you'd just add Wasm as a new machine type. That would be intrinsically architecture-independent because... it is.
- JoshTriplett 8y ago> I just want an architecture agnostic binary format for Linux executables. What would you use that for, if you had it?
- IshKebab 8y agoSo you don't have to make different binaries for different architectures? Pretty obvious I would have thought.
- pjmlp 8y agoI guess like IBM i, IBM z and Unisys ClearPath, have a computer system that you can change whatever you feel like at CPU level and have only the kernel take care of the underlying changes. Universities should teach more about mainframe architectures.
- exDM69 8y agoThis is a shortcoming in general. There should be a binary format targeted for JIT-able intermediate representations. Or just a specification on how to put IR code inside ELF files. Now we have (at least) three different IR formats that are very similar but have slight differences: 1. LLVM IR. Created for LLVM internal use and may only work with specific LLVM version(s) (correct me if I'm wrong here), is not portable across HW architectures. 2. WebAssembly. Made for web browsers. 3. SPIR-V. Made for OpenCL and Vulkan shaders/kernels. All of the above have a specification, a binary representation, a text representation and associated tooling. Some (or most?) of the tools seem to operate by doing a source level translation from WASM or SPIR-V into LLVM, then doing optimizations or JIT and possibly converting the resulting LLVM IR back to WASM or SPIR-V. In my experience, the tooling with WASM and SPIR-V is inferior to LLVM IR tools or native code tools (binutils etc). There's a lot of duplicate work going on here, but I understand that it's difficult to get the stakeholders of Web browsers, GPU APIs and compiler infrastructure to even discuss what could/should be done. Compiler IR's suitable for AOT compilation (ie. the whole code is compiled before it's executed, although it might be done at runtime) are a game changer on how we deal with programming languages and runtimes and a huge improvement on Java-like bytecode+JIT which never quite delivered what it promised.
- pjmlp 8y agoA game changer started in 1961.