This project aims to provide a lightweight WebAssembly runtime engine. It now fully supports WebAssembly specs with an simple interpreter, but we plan to optimize interpreting as well as adopting JIT compiler for better performance.
Clone as normal, but don't forget to get the submodules as well:
$ git clone --recursive https://github.com/Samsung/walrus
$ cd walrus
$ git submodule update --initThis will fetch the testsuite and gtest repos, which are needed for some tests.
You'll need CMake. You can then run CMake, the normal way:
Note: Due to the need for supporting old targets only supporting cmake 2.8, the defined cmake version is 2.8, however due to many environments shipping newer cmake versions which do not support cmake versions below 3.5, you may need to override the minimum version using
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
$ cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -H. -Bout/release/x64 -DWALRUS_ARCH=x64 -DWALRUS_HOST=linux -DWALRUS_MODE=release -DWALRUS_OUTPUT=shell -GNinja
$ ninja -Cout/release/x64
$ ./out/release/x64/walrus test.wasm // run walrus executableThis will produce build files using CMake's default build generator. Read the CMake documentation for more information.
You'll need Perf.
-
To compile with perf support, use
-DWALRUS_JITPERF=1 -
Set the path where temporary files are created with
WALRUS_PERF_DIRenvironment variable. Run Walrus with:sudo perf record -k 1 walrus --jit WALRUS_PARAMETERSThe-k 1option sets the monotonic clock,-k monois also correct.Three files are generated:
- perf.data - it is generated by perf
- jit-XXXXXX.dump - The dump of jit generated functions, XXXXXX is the PID of process
- jit-XXXXXX-codedump.txt - Walrus ByteCode dump, XXXXXX is the PID of process
-
You should chown perf.data, because you don't need
sudoafter that. -
Inject JITDump file into
perf.datawithperf inject --jit -i perf.data -o perf.data.jittedIt'll generate many shared object files, and
perf.data.jitted -
View the report with
perf report -i perf.data.jitted