mirror of
https://github.com/intel/llvm.git
synced 2026-01-15 12:25:46 +08:00
This PR adds a platform for WebAssembly. Heavily inspired by Pavel's QemuUser, the platform lets you configure a WebAssembly runtime to run a Wasm binary. For example, the following configuration can be used to launch binaries under the WebAssembly Micro Runtime (WARM): ``` settings set -- platform.plugin.wasm.runtime-args --heap-size=1048576 settings set -- platform.plugin.wasm.port-arg -g=127.0.0.1: settings set -- platform.plugin.wasm.runtime-path /path/to/iwasm-2.4.0 ``` With the settings above, you can now launch a binary directly under WAMR: ``` ❯ lldb simple.wasm (lldb) target create "/Users/jonas/wasm-micro-runtime/product-mini/platforms/darwin/build/simple.wasm" Current executable set to '/Users/jonas/wasm-micro-runtime/product-mini/platforms/darwin/build/simple.wasm' (wasm32). (lldb) b main Breakpoint 1: 2 locations. (lldb) r Process 1 launched: '/Users/jonas/wasm-micro-runtime/product-mini/platforms/darwin/build/simple.wasm' (wasm32) 2 locations added to breakpoint 1 [22:28:05:124 - 16FE27000]: control thread of debug object 0x1005e9020 start [22:28:05:124 - 16FE27000]: Debug server listening on 127.0.0.1:49170 the module name is /Users/jonas/wasm-micro-runtime/product-mini/platforms/darwin/build/simple.wasm Process 1 stopped * thread #1, name = 'nobody', stop reason = breakpoint 1.3 frame #0: 0x40000000000001d3 simple.wasm`main at simple.c:8:7 5 } 6 7 int main() { -> 8 int i = 1; 9 int j = 2; 10 return add(i, j); 11 } (lldb) ```