1*03ce13f7SAndroid Build Coastguard Worker# Wasm Prototype Experiment Notes 2*03ce13f7SAndroid Build Coastguard Worker 3*03ce13f7SAndroid Build Coastguard WorkerHere's the command I use to test: 4*03ce13f7SAndroid Build Coastguard Worker 5*03ce13f7SAndroid Build Coastguard Worker``` 6*03ce13f7SAndroid Build Coastguard WorkerLD_LIBRARY_PATH=~/nacl/v8/out/native/lib.target make -j48 \ 7*03ce13f7SAndroid Build Coastguard Worker -f Makefile.standalone WASM=1 && \ 8*03ce13f7SAndroid Build Coastguard WorkerLD_LIBRARY_PATH=~/nacl/v8/out/native/lib.target ./pnacl-sz -O2 -filetype=asm \ 9*03ce13f7SAndroid Build Coastguard Worker -target=arm32 ./torture-s2wasm-sexpr-wasm/20000112-1.c.s.wast.wasm 10*03ce13f7SAndroid Build Coastguard Worker``` 11*03ce13f7SAndroid Build Coastguard Worker 12*03ce13f7SAndroid Build Coastguard WorkerYou'll probably need to adjust your `LD_LIBRARY_PATH` to point to where your v8 13*03ce13f7SAndroid Build Coastguard Workerlibraries are. 14*03ce13f7SAndroid Build Coastguard Worker 15*03ce13f7SAndroid Build Coastguard WorkerYou'll need to build v8 as a shared library. Build it like this: 16*03ce13f7SAndroid Build Coastguard Worker 17*03ce13f7SAndroid Build Coastguard Worker``` 18*03ce13f7SAndroid Build Coastguard Workermake -j48 native component=shared_library 19*03ce13f7SAndroid Build Coastguard Worker``` 20*03ce13f7SAndroid Build Coastguard Worker 21*03ce13f7SAndroid Build Coastguard Worker`wasm-run-torture-tests.py` can be used to run all the tests, or some 22*03ce13f7SAndroid Build Coastguard Workersubset. Running a subset will enable verbose output. You can download the 23*03ce13f7SAndroid Build Coastguard Workertorture tests from the [WebAssembly waterfall](https://wasm-stat.us/console) or 24*03ce13f7SAndroid Build Coastguard Workerby running `./fetch-torture-tests.sh`. 25*03ce13f7SAndroid Build Coastguard Worker 26*03ce13f7SAndroid Build Coastguard Worker 27*03ce13f7SAndroid Build Coastguard WorkerTo compile and run an executable, do the following from the subzero directory. 28*03ce13f7SAndroid Build Coastguard Worker 29*03ce13f7SAndroid Build Coastguard Worker``` 30*03ce13f7SAndroid Build Coastguard Worker./pnacl-sz -filetype=obj -o foo.o foo.wasm 31*03ce13f7SAndroid Build Coastguard Workerclang -m32 foo.o src/wasm-runtime.c 32*03ce13f7SAndroid Build Coastguard Worker./a.out 33*03ce13f7SAndroid Build Coastguard Worker``` 34*03ce13f7SAndroid Build Coastguard Worker 35*03ce13f7SAndroid Build Coastguard WorkerOther useful commands: 36*03ce13f7SAndroid Build Coastguard Worker 37*03ce13f7SAndroid Build Coastguard WorkerCompile a C file to a .wasm 38*03ce13f7SAndroid Build Coastguard Worker``` 39*03ce13f7SAndroid Build Coastguard Worker./wasm-install/bin/emscripten/emcc hello-wasm.c -s BINARYEN=1 40*03ce13f7SAndroid Build Coastguard Worker./wasm-install/bin/sexpr-wasm a.out.wast -o a.out.wasm 41*03ce13f7SAndroid Build Coastguard Worker``` 42