/uwvm

Ultimate WebAssembly Virtual Machine

Primary LanguageC++Apache License 2.0Apache-2.0

logo

Ultimate WebAssembly Virtual Machine

github-ci License QQ Discord KOOK

|简体中文|

Contact Us

Introduce

Ultimate WebAssembly Virtual Machine

Commandline interface

  • Get version information
$ uwvm --version
  • Get a list of commands
$ uwvm --help
  • Running uwvm virtual machine
$ uwvm <param1> <param2> ... --run <file> <argv1> <argv2> ...
  • Running mode
--mode [objdump, int(default), ucint]
# int: interpreter, wasm data stack and local data stack can be expanded and checked; Memory operation check; and so on
# ucint: Some do not check the interpreter, and the size of the wasm data stack is fixed without checking. Virtual machine security is protected by setting the leftmost and rightmost pages of the data stack with no read/write execution permissions; The local data stack uses the thread's own stack; Memory operation check; And so on; 125% faster performance than interpreter
  • Loading WASM ABI (default auto detection)
--abi [bare|emscripten|wasi]

Features

Feature Extensions

Standardized features parameters
MVP V1.0.0
JS BigInt to Wasm i64 integration N/A
Bulk memory operations V1.0.1
Extended constant expressions
Garbage collection
Multiple memories --enable-multi-memory
Multi-value V1.0.1
Mutable globals V1.0.1
Reference types V1.0.1
Relaxed SIMD --enable-relaxed-simd
Non-trapping float-to-int conversions V1.0.1
Sign-extension operations
Fixed-width SIMD --enable-fixed-width-simd
Extended constant expressions
Tail calls
Threads and atomics --enable-thread
Exception handling --enable-exception-handling
JS Promise Integration N/A
Memory64 --enable-memory64
Custom Page Sizes --enable-custom-page-sizes
Type reflection
Sign-extension operators V1.0.1
WASI V1.0.1
WASI Preview 2
WASIX

Supports multiple platforms

  • (x86_64, i386, aarch64, arm)-windows-(gnu, msvc) (support UCRT and MSVCRT)
  • (x86_64, i386, aarch64, arm, loongarch64, riscv64, mips64, powerpc64, etc.)-linux-(gnu, musl, llvm, mlibc, uclibc, avrlibc, etc.)
  • (x86_64, i386, aarch64, arm)-linux-android
  • (x86_64, i386, aarch64, arm, powerpc, powerpc64, powerpc64le, powerpcspe, riscv64)-freebsd
  • unknown-dragonflybsd
  • unknown-netbsd
  • unknown-openbsd
  • unknown-bsd
  • unknown-sun
  • unknwon-apple-darwin
  • i386-msdosdjgpp
  • wasm32-wasip1, wasm32-wasip2, wasm64-wasip1, wasm64-wasip2, wasm32-wasip1-threads, wasm32-wasip2-threads, wasm64-wasip1-threads, wasm64-wasip2-threads (bootstrap)
  • etc.

How to build

  1. Install [xmake]
$ sudo apt install xmake
  1. Install [gcc13+] or [llvm17+]
$ sudo apt install gcc g++
  1. Build
$ xmake 
$ xmake install -o OutputPath 
  1. Build parameters
$ xmake f -m [release|releasedbg|debug] -p [windows|mingw|macosx|linux|iphoneos ..] -a [x86_64|i386|arm|aarch64 ..] --cppstdlib=[default|libstdc++|libc++] ..
  • Currently, only MSVC 14.30+ GCC 14+ and LLVM 18+ are supported.

  • It is recommended to use llvm or msvc on Windows. The results of gcc's libgcc have problems with the implementation of tls, resulting in 10 times slower efficiency.

  • Please add the parameter --static=n when compiling on Android. Android cannot statically link libc。

  • To compile systems compatible with Win10 (default) or below, please add parameters

--min-win32-sys=[WIN10|WINBLUE|WIN8|WIN7|WS08|VISTA|WS03|WINXP|WIN2K] 
  • For Windows 9x (i386-windows-gnu)
--min-win32-sys=[WINME|WIN98|WIN95]
  • Using the llvm toolchain (This option must be added to some platforms that use gcc soft connection to clang, such as macos and android)
--use-llvm=y|n(default)
  • Use ucint (c++ exceptions will be automatically disabled at the same time)
--uwvm-enable-ucint=y|n(default)
  • Compile using local instruction sets
--native=y|n(default)
  • Select toolchain
--sdk=ToolchainPath
  • Static linking
--static=y(defalut)|n
  • Set sysroot
--sysroot=<path>
  • Record the time of each step
--timer=y|n(default)
  • Use mimalloc as the default allocator
--use-mimalloc=y|n(default)
  • Disable c++ exceptions (some WASIs cannot be used)
--fno-exceptions=y|n(default)
  • Enable Sanitizer
--policies=build.sanitizer.address --policies=build.sanitizer.leak