Switch branches/tags
Find file History
vargaz and luhenry [wasm] Rename the cross targets so 'wasm-cross' builds the 64 bit com…
…piler, and 'wasm-cross-32' builds the old 32 bit version. (#11678)
Latest commit eddc1d3 Nov 14, 2018
Permalink
..
Failed to load latest commit information.
Mono.WebAssembly.DebuggerProxy [wasm] Unbreak the debugger and harden it against bad assemblies. (#1… Oct 8, 2018
ProxyDriver [wasm] Use latest Microsoft.AspNetCore.App in ProxyDriver.csproj Oct 16, 2018
docs [wasm] Wasm sample docs (#11347) Oct 29, 2018
.gitignore Add wasm gitignore (#8890) May 25, 2018
Makefile [wasm] Rename the cross targets so 'wasm-cross' builds the 64 bit com… Nov 14, 2018
README.md [wasm] Wasm sample docs (#11347) Oct 29, 2018
WasmHttpMessageHandler.cs [wasm] Make WasmHttpMessageHandler the default handler for WebAssembly ( Nov 12, 2018
WebAssembly.Framework.nuspec Add nuspec for generating the WebAssembly Framework NuGet package. (#… Sep 21, 2018
binding_support.js [wasm][bindings] Add support for strongly typed marshalling of C# enu… Oct 4, 2018
bindings-test.cs [wasm][bindings] Add support for strongly typed marshalling of C# enu… Oct 4, 2018
bindings.cs [wasm] Add bindings API documentation Oct 23, 2018
debug.html [wasm] Remove dead code and add fetch callback to mono_load_runtime_a… Jul 18, 2018
dependency.cs [wasm] Call the correct single step trampoline. Fixes some step-into … Aug 9, 2018
dotnet_support.js Add support for Blazor custom interop support. (#9713) Jul 31, 2018
driver.c Fix wasm mono showing print dialog twice on error (#11602) Nov 8, 2018
incrementalrunner.cs [WIP] [wasm] AOT work. (#11071) Oct 16, 2018
library_mono.js [wasm] WASM work. (#11314) Oct 25, 2018
main.cs [WIP] [wasm] AOT work. (#11071) Oct 16, 2018
mini-test-runner.cs [wasm] Add --regression suppport for wasm. (#10740) Sep 25, 2018
package.json [wasm] Small set of changes that are wasm specific. (#9305) Jun 27, 2018
packager.cs [wasm] Rename the cross targets so 'wasm-cross' builds the 64 bit com… Nov 14, 2018
runtime-tests.js [wasm] WASM work. (#11314) Oct 25, 2018
runtime.js [wasm] Fix Sample.html so sample will run (#11242) Oct 19, 2018
sample.cs [wasm] Update sample.cs usage and docs (#10847) Oct 2, 2018
sample.html [wasm] Fix Sample.html so sample will run (#11242) Oct 19, 2018
server.py [wasm] Add .wasm mime mapping for python3 in server.py too (#8592) May 6, 2018

README.md

Contents

  • bcl directory: Core libraries to be used with the runtime.
  • driver.c, libmonosgen-2.0.a, library_mono.js: Source / Binaries for custom building the runtime. See compilation instructions down.
  • debug, release directories: Pre-compiled runtimes using the above driver in release and debug configurations.
  • sample.html, sample.cs: Sample code, see sample details below.

Compiling mono

Mono requires the latest emscripten installed and built. Emscripten is not required if simply using the sample. The pre-built binaries are compiled using the following command line for the debug build:

emcc -g4 -Os -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s BINARYEN=1 -s "BINARYEN_TRAP_MODE='clamp'" -s TOTAL_MEMORY=134217728 -s ALIASING_FUNCTION_POINTERS=0 -s ASSERTIONS=2 --js-library library_mono.js driver.o $(TOP)/sdks/out/wasm-interp/lib/libmonosgen-2.0.a -o debug/mono.js -s NO_EXIT_RUNTIME=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall', 'FS_createPath', 'FS_createDataFile', 'cwrap', 'setValue', 'getValue', 'UTF8ToString']"

Sample

See Getting Started Guides

Debugging

The debugger requires dotnet core version 2.1.301 or greater installed.

To experiment with the debugger, do the following steps:

  • When calling packager.exe pass the -debug argument to it.
  • Start Chrome with remote debugging enabled (IE /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome\ Canary --remote-debugging-port=9222)
  • Run the proxy: dotnet dbg-proxy/ProxyDriver.dll
  • Connect to the remote debugged Chrome and pick the page which is running the wasm code
  • Rewrite the request URL (just the ws argument) to use the proxy port instead of the browser port
  • Refresh the debugged page and you should be set

Beware that the debugger is in active development so bugs and missing features will be present.

AOT development

AOT experimentation happens with the following steps:

  1. from sdks and configure it to disable all but WASM and BCL. (See sdks/Make.config.sample)
  2. from sdks/builds hit make package
  3. from sdks/wasm hit make build
  4. from sdks/wasm hit make build-aot-sample
  5. from sdks/wasm/aot hit ~/.jsvu/sm aot-driver.js

If you don't have jsvu installed, run make toolchain from sdks/wasm. It requires a recent version of node installed in your system.

Now you can experiment with the aot-sample and link-sample make targets to try the toolchain. The first invokes the AOT compiler and the second links the results.

To update the runtimes used use the following make target in sdks/build

package-wasm-interp for the interpreter-based runtime package-wasm-aot for the aot compiler package-wasm-aot-runtime for the wasm runtime that works with AOT'd code.

To update the aot compiler:

make -C sdks/builds package-wasm-aot-compiler
make -C sdks/wasm aot-sample
make -C sdks/wasm link-sample

To update the aot runtime:

make -C sdks/builds package-wasm-aot
make -C sdks/wasm aot-sample
make -C sdks/wasm link-sample

To build and run AOT test suites:

make -C sdks/wasm build-aot-<suite name>
make -C sdks/wasm check-aot-<suite name>

Notes