Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sdks
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2019-11-22 14:42:55 +0300
committerGitHub <noreply@github.com>2019-11-22 14:42:55 +0300
commitecd67a91c4bbeef046f8521da93f106da8fc0191 (patch)
tree4d14aeb2ba065386afa31443ece5cba04b4359d2 /sdks
parent6a5c44b15e65782cac21673cd33138a92a6b6207 (diff)
[wasm] Add aot+netcore support. (#17798)
* [wasm] Compile corelib as 32 bit. * [wasm] Add a netcore cross compiler. * [wasm] Add netcore+aot support. * [aot] Load the dedup module lazily instead of at startup. The previous version didn't work on netcore because it couldn't resolve references to corlib etc. since they were not yet registered in the root domain at the time of loading. * Add more icall trampoline signatures. * Add more netcore pinvokes. * Fix the build. * Add more icall trampoline signatures. * Add an --embed-file option to the packager. * Add more netcore pinvokes. * [interp] Return FALSE for IsDynamicCodeCompiled. * Add a netcore project and targets for running BenchmarkDotNet. * Fix pinvoke tables. * Add missing files. * Fix make clean. * Add a comment. * Revert "Fix pinvoke tables." This reverts commit 998065e77614b7e621d2873510aabc3930669ca9. * Make xunit-runner into a dotnet project. Add a netcore version.
Diffstat (limited to 'sdks')
-rw-r--r--sdks/builds/wasm.mk34
-rw-r--r--sdks/wasm/Makefile84
-rw-r--r--sdks/wasm/bench-runner/WasmRunner.cs173
-rw-r--r--sdks/wasm/bench-runner/bench.csproj12
-rw-r--r--sdks/wasm/packager.cs64
-rw-r--r--sdks/wasm/src/driver.c19
-rw-r--r--sdks/wasm/src/pinvoke-tables-default-netcore.h96
-rw-r--r--sdks/wasm/xunit-runner/xunit-runner.cs (renamed from sdks/wasm/xunit-runner.cs)0
-rw-r--r--sdks/wasm/xunit-runner/xunit-runner.csproj14
9 files changed, 444 insertions, 52 deletions
diff --git a/sdks/builds/wasm.mk b/sdks/builds/wasm.mk
index 67d87d9f5f3..e89013727f1 100644
--- a/sdks/builds/wasm.mk
+++ b/sdks/builds/wasm.mk
@@ -165,6 +165,19 @@ ifdef ENABLE_WASM_NETCORE
$(eval $(call WasmRuntimeTemplate,runtime-netcore))
endif
+WASM_CROSS_BASE_CONFIGURE_FLAGS= \
+ --disable-boehm \
+ --disable-btls \
+ --disable-mcs-build \
+ --disable-nls \
+ --disable-support-build \
+ --enable-maintainer-mode \
+ --enable-minimal=appdomains,com,remoting \
+ --enable-icall-symbol-map \
+ --with-cooperative-gc=no \
+ --enable-hybrid-suspend=no \
+ --with-cross-offsets=wasm32-unknown-none.h
+
##
# Parameters
# $(1): target
@@ -178,24 +191,19 @@ define WasmCrossTemplate
_wasm-$(1)_OFFSETS_DUMPER_ARGS=--emscripten-sdk="$$(EMSCRIPTEN_SDK_DIR)/upstream/emscripten" --libclang="$$(WASM_LIBCLANG)"
_wasm-$(1)_CONFIGURE_FLAGS= \
- --disable-boehm \
- --disable-btls \
- --disable-mcs-build \
- --disable-nls \
- --disable-support-build \
- --enable-maintainer-mode \
- --enable-minimal=appdomains,com,remoting \
- --enable-icall-symbol-map \
- --with-cooperative-gc=no \
- --enable-hybrid-suspend=no \
- --with-cross-offsets=wasm32-unknown-none.h
+ $(WASM_CROSS_BASE_CONFIGURE_FLAGS) \
+ $$(wasm_$(1)_CONFIGURE_FLAGS)
$$(eval $$(call CrossRuntimeTemplate,wasm,$(1),$$(if $$(filter $$(UNAME),Darwin),$(2)-apple-darwin10,$$(if $$(filter $$(UNAME),Linux),$(2)-linux-gnu,$(2)-unknown)),$(3)-unknown-none,$(4),$(5),$(6)))
endef
-# 64 bit cross compiler
+wasm_cross-netcore_CONFIGURE_FLAGS=--with-core=only
+
$(eval $(call WasmCrossTemplate,cross,x86_64,wasm32,runtime,llvm-llvm64,wasm32-unknown-unknown))
+ifdef ENABLE_WASM_NETCORE
+$(eval $(call WasmCrossTemplate,cross-netcore,x86_64,wasm32,runtime,llvm-llvm64,wasm32-unknown-unknown))
+endif
##
# Parameters
@@ -269,6 +277,6 @@ build-wasm-bcl-netcore: build-wasm-runtime-netcore
package-wasm-bcl-netcore: build-wasm-bcl-netcore
mkdir -p ../out/wasm-bcl/netcore
- cp ../../netcore/System.Private.CoreLib/bin/x64/System.Private.CoreLib.{dll,pdb} ../out/wasm-bcl/netcore/
+ cp ../../netcore/System.Private.CoreLib/bin/wasm32/System.Private.CoreLib.{dll,pdb} ../out/wasm-bcl/netcore/
endif
diff --git a/sdks/wasm/Makefile b/sdks/wasm/Makefile
index acf9492d1cb..350433a1792 100644
--- a/sdks/wasm/Makefile
+++ b/sdks/wasm/Makefile
@@ -137,19 +137,21 @@ EMCC_THREADS_FLAGS=-s ALLOW_MEMORY_GROWTH=0 -s USE_PTHREADS=1 -s TOTAL_MEMORY=53
#
MONO_LIBS = $(TOP)/sdks/out/wasm-runtime-release/lib/{libmono-ee-interp.a,libmono-native.a,libmonosgen-2.0.a,libmono-ilgen.a,libmono-icall-table.a}
-MONO_NETCORE_LIBS=$(TOP)/sdks/out/wasm-runtime-netcore-release/lib/{libmono-ee-interp.a,libmonosgen-2.0.a,libmono-ilgen.a,libmono-icall-table.a} netcore-System.Native.bc
+MONO_NETCORE_LIBS=$(TOP)/sdks/out/wasm-runtime-netcore-release/lib/{libmono-ee-interp.a,libmonosgen-2.0.a,libmono-ilgen.a,libmono-icall-table.a,System.Native.bc}
+MONO_NETCORE_DEPS=$(TOP)/sdks/out/wasm-runtime-netcore-release/lib/System.Native.bc
NETCORE_CFLAGS=-DENABLE_NETCORE
# $(1) - name
# $(2) - runtime dir
# $(3) - EMCC_FLAGS
# $(4) - libs
+# $(5) - extra deps
define InterpBuildTemplate
builds/$(1)/:
mkdir -p $$@
-builds/$(1)/mono.js: builds/$(1)/driver.o builds/$(1)/corebindings.o builds/$(1)/zlib-helper.o src/library_mono.js src/binding_support.js src/dotnet_support.js $(TOP)/sdks/out/$(2)/lib/libmonosgen-2.0.a | builds/$(1)/ emsdk_env.sh
+builds/$(1)/mono.js: builds/$(1)/driver.o builds/$(1)/corebindings.o builds/$(1)/zlib-helper.o src/library_mono.js src/binding_support.js src/dotnet_support.js $(TOP)/sdks/out/$(2)/lib/libmonosgen-2.0.a | builds/$(1)/ emsdk_env.sh $(5)
$(EMCC) $(EMCC_FLAGS) $(3) --js-library src/library_mono.js --js-library src/binding_support.js --js-library src/dotnet_support.js builds/$(1)/driver.o builds/$(1)/corebindings.o builds/$(1)/zlib-helper.o $(4) -o builds/$(1)/mono.js
builds/$(1)/driver.o: src/driver.c src/corebindings.c src/pinvoke-tables-default.h | builds/$(1)/ emsdk_env.sh
@@ -175,10 +177,8 @@ ifdef ENABLE_WASM_DYNAMIC_RUNTIME
$(eval $(call InterpBuildTemplate,release-dynamic,wasm-runtime-dynamic-release,$(EMCC_RELEASE_DYNAMIC_FLAGS),$(MONO_DYNAMIC_LIBS)))
endif
ifdef ENABLE_WASM_NETCORE
-$(eval $(call InterpBuildTemplate,netcore-debug,wasm-runtime-netcore-release,$(EMCC_DEBUG_FLAGS) $(NETCORE_CFLAGS),$(MONO_NETCORE_LIBS)))
-$(eval $(call InterpBuildTemplate,netcore-release,wasm-runtime-netcore-release,$(EMCC_RELEASE_FLAGS) $(NETCORE_CFLAGS),$(MONO_NETCORE_LIBS)))
-
-builds/netcore-debug/mono.js builds/netcore-release/mono.js: netcore-System.Native.bc
+$(eval $(call InterpBuildTemplate,netcore-debug,wasm-runtime-netcore-release,$(EMCC_DEBUG_FLAGS) $(NETCORE_CFLAGS),$(MONO_NETCORE_LIBS),$(MONO_NETCORE_DEPS)))
+$(eval $(call InterpBuildTemplate,netcore-release,wasm-runtime-netcore-release,$(EMCC_RELEASE_FLAGS) $(NETCORE_CFLAGS),$(MONO_NETCORE_LIBS),$(MONO_NETCORE_DEPS)))
endif
runtime:
@@ -190,6 +190,10 @@ cross:
bcl:
$(MAKE) -C ../builds package-wasm-bcl
+#
+# NETCORE TARGETS
+#
+
ifdef ENABLE_WASM_NETCORE
#NETCOREAPP_VERSION := $(shell cat ../../eng/Versions.props | sed -n 's/.*MicrosoftNETCoreAppVersion>\(.*\)<\/MicrosoftNETCoreAppVersion.*/\1/p' )
@@ -201,7 +205,7 @@ NETCOREAPP_DIR=$(NETCOREAPP_NAME).$(NETCOREAPP_VERSION)
$(NETCOREAPP_DIR):
nuget install $(NETCOREAPP_NAME) -Version $(NETCOREAPP_VERSION) -Source $(NETCOREAPP_FEED)
-netcore-System.Native.bc: $(NETCOREAPP_DIR)
+$(TOP)/sdks/out/wasm-runtime-netcore-release/lib/System.Native.bc: $(NETCOREAPP_DIR)
cp $(NETCOREAPP_DIR)/runtimes/webassembly-wasm/native/System.Native.bc $@
.PHONY: runtime-netcore
@@ -212,10 +216,13 @@ runtime-netcore:
bcl-netcore:
$(MAKE) -C ../builds package-wasm-bcl-netcore
+cross-netcore:
+ $(MAKE) -C ../builds package-wasm-cross-netcore
+
build-managed: bcl-netcore
src/pinvoke-tables-default-netcore.h:
- mono ../../mcs/class/lib/wasm_tools/wasm-tuner.exe --gen-pinvoke-table System.Native $(NETCOREAPP_DIR)/System.Private.CoreLib.dll $(NETCOREAPP_DIR)/System.Console.dll > $@
+ mono ../../mcs/class/lib/wasm_tools/wasm-tuner.exe --gen-pinvoke-table System.Native $(TOP)/sdks/out/wasm-bcl/netcore/System.Private.CoreLib.dll $(NETCOREAPP_DIR)/runtimes/webassembly-wasm/lib/netcoreapp3.0/{System.Console.dll,System.IO.FileSystem.dll,System.Runtime.InteropServices.RuntimeInformation.dll,System.IO.MemoryMappedFiles.dll} > $@
samples/hello/bin/Debug/netcoreapp3.0/hello.dll:
dotnet build samples/hello -f netcoreapp3.0
@@ -224,11 +231,60 @@ build-hello-netcore: packager.exe samples/hello/bin/Debug/netcoreapp3.0/hello.dl
$(PACKAGER) --debugrt --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --mono-sdkdir=$(TOP)/sdks/out -appdir=bin/hello-netcore --nobinding --builddir=obj/hello-netcore --framework=netcoreapp3.0 --netcore-sdkdir=$(NETCOREAPP_DIR)/runtimes/webassembly-wasm/lib/netcoreapp3.0 --template=runtime-tests.js --linker samples/hello/bin/Debug/netcoreapp3.0/hello.dll
ninja -v -C obj/hello-netcore
-bin/hello-netcore/bin/mono.js: build-hello-netcore
+bin/hello-netcore/mono.js: build-hello-netcore
-run-hello-netcore: bin/hello-netcore/bin/mono.js
+run-hello-netcore: bin/hello-netcore/mono.js
(cd bin/hello-netcore && $(SM) runtime.js --run hello.dll)
+build-aot-hello-netcore: packager.exe samples/hello/bin/Debug/netcoreapp3.0/hello.dll $(NETCOREAPP_DIR)
+ $(PACKAGER) --debugrt --no-native-strip --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --mono-sdkdir=$(TOP)/sdks/out -appdir=bin/aot-hello-netcore --nobinding --builddir=obj/aot-hello-netcore --framework=netcoreapp3.0 --netcore-sdkdir=$(NETCOREAPP_DIR)/runtimes/webassembly-wasm/lib/netcoreapp3.0 --template=runtime-tests.js --aot --linker samples/hello/bin/Debug/netcoreapp3.0/hello.dll
+ ninja -v -C obj/aot-hello-netcore
+
+bin/aot-hello-netcore/mono.js: build-aot-hello-netcore
+
+run-aot-hello-netcore: bin/aot-hello-netcore/mono.js
+ (cd bin/aot-hello-netcore && $(SM) runtime.js --run hello.dll)
+
+# Path to <mono repo>/netcore/netcore/corefx/tests/extracted
+COREFX_TESTS_DIR=
+
+##
+# Parameters:
+# $(1) - make target suffix
+# $(2) - directory name
+# $(3) - test directory
+# $(4) - test assembly
+# $(5) - command line arguments
+define NetcoreTestTemplate
+
+bin/$(2)/mono.js: packager.exe runtime-tests.js
+ @if test -z "$(COREFX_TESTS_DIR)"; then echo "COREFX_TESTS_DIR is not set"; exit 1; fi
+ $(PACKAGER) --debugrt --search-path=$(COREFX_TESTS_DIR)/$(3) --template=runtime-tests.js --appdir=bin/$(2) --builddir=obj/$(2) --framework=netcoreapp3.0 --netcore-sdkdir=$(NETCOREAPP_DIR)/runtimes/webassembly-wasm/lib/netcoreapp3.0 --search-path=$(COREFX_TESTS_DIR)/$(3) xunit-runner/bin/Debug/netcoreapp3.0/xunit-runner.dll $(COREFX_TESTS_DIR)/$(3)/$(4)
+ ninja -v -C obj/$(2)
+# $(PACKAGER) --debugrt --search-path=$(WASM_BCL_DIR)/tests --search-path=$(XUNIT_DIR) --template=runtime-tests.js --appdir=bin/$(2) --builddir=obj/$(2) --asset=xunit-exclusions.rsp xunit-runner.exe $(WASM_BCL_DIR)/tests/xunit.execution.dotnet.dll $(WASM_BCL_DIR)/tests/$(3) $(WASM_BCL_DIR)/tests/Xunit.NetCore.Extensions.dll
+
+build-$(1): bin/$(2)/mono.js
+
+run-$(1): bin/$(2)/mono.js
+ (cd bin/$(2) && $$(SM) runtime.js --enable-gc --run xunit-runner.dll $(4))
+
+endef
+
+$(eval $(call NetcoreTestTemplate,Common-netcore,Common-netcore,Common.Tests,Common.Tests.dll))
+
+# Path to a fully built https://github.com/dotnet/performance
+PERF_REPO_ROOT=
+
+# Need to embed corelib because BenchmarkDotNet reads version info from it
+build-bench: packager.exe $(NETCOREAPP_DIR) bench-runner/WasmRunner.cs
+ @if test -z "$(PERF_REPO_ROOT)"; then echo "PERF_REPO_ROOT is not set"; exit 1; fi
+ cd bench-runner && dotnet build /nologo /p:Configuration=Release
+ $(PACKAGER) --debugrt --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --mono-sdkdir=$(TOP)/sdks/out -appdir=bin/bench --nobinding --builddir=obj/bench --framework=netcoreapp3.0 --netcore-sdkdir=$(NETCOREAPP_DIR)/runtimes/webassembly-wasm/lib/netcoreapp3.0 --template=runtime-tests.js --search-path=bench-runner/bin/Release/netcoreapp3.0 --embed-file System.Private.CoreLib.dll@System.Private.CoreLib.dll --embed-file System.Text.RegularExpressions.dll --search-path=$(PERF_REPO_ROOT)/artifacts/bin/MicroBenchmarks/Release/netcoreapp5.0 --search-path=$(PERF_REPO_ROOT)/artifacts/bin/MicroBenchmarks/Release/netcoreapp5.0/runtimes/unix/lib/netstandard2.0 bench-runner/bin/Release/netcoreapp3.0/bench.dll MicroBenchmarks.dll
+ ninja -v -C obj/bench
+
+run-bench: build-bench
+ (cd bin/bench && $(SM) runtime.js --enable-gc --setenv=MONO_LOG_MASK= --run bench.dll MicroBenchmarks.dll Perf_HashCode)
+
endif
runtime-threads:
@@ -289,8 +345,8 @@ build-test-suite: packager.exe $(WASM_FRAMEWORK)/.stamp-framework binding_tests.
XUNIT_DIR = $(TOP)/external/xunit-binaries
-xunit-runner.exe: xunit-runner.cs
- csc /out:$@ /r:$(XUNIT_DIR)/xunit.abstractions.dll /r:$(XUNIT_DIR)/xunit.core.dll /r:$(XUNIT_DIR)/xunit.console.exe /r:$(WASM_BCL_DIR)/Facades/System.Runtime.dll /r:$(WASM_BCL_DIR)/Facades/System.Reflection.dll /r:$(WASM_BCL_DIR)/Facades/System.Collections.dll /r:$(XUNIT_DIR)/xunit.execution.dotnet.dll /r:$(XUNIT_DIR)/xunit.runner.utility.net452.dll xunit-runner.cs
+xunit-runner.exe: xunit-runner/xunit-runner.cs
+ csc /out:$@ /r:$(XUNIT_DIR)/xunit.abstractions.dll /r:$(XUNIT_DIR)/xunit.core.dll /r:$(XUNIT_DIR)/xunit.console.exe /r:$(WASM_BCL_DIR)/Facades/System.Runtime.dll /r:$(WASM_BCL_DIR)/Facades/System.Reflection.dll /r:$(WASM_BCL_DIR)/Facades/System.Collections.dll /r:$(XUNIT_DIR)/xunit.execution.dotnet.dll /r:$(XUNIT_DIR)/xunit.runner.utility.net452.dll xunit-runner/xunit-runner.cs
#
# Targets for running xunit tests
@@ -395,7 +451,7 @@ run-aot-sample-profiled: build-aot-sample-profiled
(cd bin/aot-sample-profiled && $(SM) runtime.js --run hello.exe)
build-interp-sample: packager.exe hello.exe
- $(PACKAGER) --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --mono-sdkdir=$(TOP)/sdks/out -appdir=bin/interp-sample --nobinding --builddir=obj/interp-sample --template=runtime-tests.js hello.exe --linker --link-icalls
+ $(PACKAGER) --emscripten-sdkdir=$(EMSCRIPTEN_SDK_DIR) --mono-sdkdir=$(TOP)/sdks/out -appdir=bin/interp-sample --nobinding --builddir=obj/interp-sample --template=runtime-tests.js hello.exe
ninja -v -C obj/interp-sample
build-io-sample: packager.exe hello-io.exe
@@ -571,7 +627,7 @@ clean: clean-browser-tests
$(RM) $(WASM_FRAMEWORK)/WebAssembly.*.dll
$(RM) $(WASM_FRAMEWORK)/WebAssembly.*.pdb
$(RM) $(WASM_FRAMEWORK)/WebAssembly.*.xml
- $(RM) netcore-System.Native.bc
+ $(RM) -r $(NETCOREAPP_DIR)
$(RM) -r builds
$(RM) emsdk_env.sh
$(RM) .configured
diff --git a/sdks/wasm/bench-runner/WasmRunner.cs b/sdks/wasm/bench-runner/WasmRunner.cs
new file mode 100644
index 00000000000..91884aacc5e
--- /dev/null
+++ b/sdks/wasm/bench-runner/WasmRunner.cs
@@ -0,0 +1,173 @@
+using System;
+using System.Linq;
+using System.Globalization;
+using System.Text;
+using System.Reflection;
+using System.Collections.Generic;
+using BenchmarkDotNet.Attributes;
+using BenchmarkDotNet.Running;
+using BenchmarkDotNet.Configs;
+using BenchmarkDotNet.Loggers;
+using BenchmarkDotNet.Jobs;
+using BenchmarkDotNet.Engines;
+using BenchmarkDotNet.Reports;
+using BenchmarkDotNet.Environments;
+using BenchmarkDotNet.Exporters;
+using BenchmarkDotNet.Toolchains;
+using BenchmarkDotNet.Toolchains.Parameters;
+using BenchmarkDotNet.Toolchains.Results;
+using BenchmarkDotNet.Toolchains.InProcess;
+using BenchmarkDotNet.Toolchains.InProcess.NoEmit;
+using BenchmarkDotNet.Characteristics;
+
+//
+// WebAssembly runner for BenchmarkDotNet
+//
+
+//
+// The normal runner doesn't work on wasm for the following reasons:
+// - InProcessNoEmitExecutor uses a thread
+// - BenchmarkSwitcher -> HostEnvironmentInfo -> DotNetCliCommandExecutor spawns a process
+//
+
+// Same as InProcessNoEmitExecutor, but no threads are used
+public class WasmExecutor : IExecutor
+{
+ private static readonly TimeSpan UnderDebuggerTimeout = TimeSpan.FromDays(1);
+
+ public static readonly TimeSpan DefaultTimeout = TimeSpan.FromMinutes(5);
+
+ public WasmExecutor (TimeSpan timeout, bool logOutput) {
+ if (timeout == TimeSpan.Zero)
+ timeout = DefaultTimeout;
+
+ ExecutionTimeout = timeout;
+ LogOutput = logOutput;
+ }
+
+ public TimeSpan ExecutionTimeout { get; }
+
+ public bool LogOutput { get; }
+
+ public ExecuteResult Execute(ExecuteParameters executeParameters) {
+ var hostLogger = LogOutput ? executeParameters.Logger : NullLogger.Instance;
+ var host = new InProcessHost(executeParameters.BenchmarkCase, hostLogger, executeParameters.Diagnoser);
+
+ int exitCode = 0;
+
+ // The class is internal
+ typeof (InProcessNoEmitToolchain).Assembly.GetType ("BenchmarkDotNet.Toolchains.InProcess.NoEmit.InProcessNoEmitRunner").GetMethod ("Run").Invoke (null, new object [] { host, executeParameters.BenchmarkCase });
+
+ return GetExecutionResult(host.RunResults, exitCode, executeParameters.Logger, executeParameters.BenchmarkCase.Config.Encoding);
+ }
+
+ private ExecuteResult GetExecutionResult(RunResults runResults, int exitCode, ILogger logger, Encoding encoding) {
+ if (exitCode != 0)
+ return new ExecuteResult(true, exitCode, default, Array.Empty<string>(), Array.Empty<string>());
+
+ var lines = runResults.GetMeasurements().Select(measurement => measurement.ToOutputLine()).ToList();
+ if (!runResults.GCStats.Equals(GcStats.Empty))
+ lines.Add(runResults.GCStats.ToOutputLine());
+ if (!runResults.ThreadingStats.Equals(ThreadingStats.Empty))
+ lines.Add(runResults.ThreadingStats.ToOutputLine());
+
+ return new ExecuteResult(true, 0, default, lines.ToArray(), Array.Empty<string>());
+ }
+}
+
+public sealed class WasmToolchain : IToolchain
+{
+ public static readonly IToolchain Instance = new WasmToolchain (true);
+
+ public WasmToolchain(bool logOutput) : this (
+ WasmExecutor.DefaultTimeout,
+ logOutput) {
+ }
+
+ public WasmToolchain(TimeSpan timeout, bool logOutput) {
+ Generator = new InProcessNoEmitGenerator();
+ Builder = new InProcessNoEmitBuilder();
+ Executor = new WasmExecutor(timeout, logOutput);
+ }
+
+ public bool IsSupported(BenchmarkCase benchmarkCase, ILogger logger, IResolver resolver) => true;
+
+ public string Name => nameof(WasmToolchain);
+
+ public IGenerator Generator { get; }
+
+ public IBuilder Builder { get; }
+
+ public IExecutor Executor { get; }
+
+ public bool IsInProcess => true;
+}
+
+public class WasmLogger : ILogger
+{
+ public WasmLogger() {
+ }
+
+ public void Write(LogKind logKind, string text) {
+ Console.Write (text);
+ }
+
+ public void WriteLine() {
+ Console.WriteLine ();
+ }
+
+ public void WriteLine(LogKind logKind, string text) {
+ Console.WriteLine (text);
+ }
+
+ public void Flush() {
+ }
+}
+
+public class Program
+{
+ static int Main(string[] args) {
+ var assembly = Assembly.LoadFrom (args [0]);
+
+ string filter = null;
+ if (args.Length < 2) {
+ Console.Error.WriteLine ("Usage: runner <benchmark assembly> <filter string>.");
+ return 1;
+ }
+ filter = args [1];
+
+ var logger = new WasmLogger ();
+ var config = ManualConfig.CreateEmpty ();
+ config.Add (Job.ShortRun.With (WasmToolchain.Instance));
+ config.Add (logger);
+ config.Add (DefaultExporters.Plain);
+
+ var env_info = HostEnvironmentInfo.GetCurrent ();
+ var sdk_version = new Lazy<string> (() => "WASM");
+ env_info.GetType ().GetMethod ("set_DotNetSdkVersion", BindingFlags.Instance|BindingFlags.NonPublic).Invoke (env_info, new object [] { sdk_version });
+
+ var benchmarks = new List<BenchmarkRunInfo> ();
+ Console.WriteLine ("Collecting benchmarks...");
+ var types = assembly.GetTypes ();
+ int count = 0;
+ foreach (var type in types) {
+ count ++;
+ if (count == types.Length / 10) {
+ Console.WriteLine (".");
+ count = 0;
+ }
+ if (type.IsGenericTypeDefinition)
+ continue;
+ if (!type.FullName.Contains (filter))
+ continue;
+ try {
+ benchmarks.Add (BenchmarkConverter.TypeToBenchmarks (type, config));
+ //Console.WriteLine ("" + type.FullName + " " + benchmarks.Count);
+ } catch {
+ }
+ }
+
+ BenchmarkRunner.Run (benchmarks.ToArray ());
+ return 0;
+ }
+}
diff --git a/sdks/wasm/bench-runner/bench.csproj b/sdks/wasm/bench-runner/bench.csproj
new file mode 100644
index 00000000000..d0836b1da9b
--- /dev/null
+++ b/sdks/wasm/bench-runner/bench.csproj
@@ -0,0 +1,12 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>netcoreapp3.0</TargetFramework>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
+ </ItemGroup>
+
+</Project>
diff --git a/sdks/wasm/packager.cs b/sdks/wasm/packager.cs
index 8996cf589f0..865b40aff42 100644
--- a/sdks/wasm/packager.cs
+++ b/sdks/wasm/packager.cs
@@ -140,6 +140,7 @@ class Driver {
Console.WriteLine ("\t--pinvoke-libs=x DllImport libraries used.");
Console.WriteLine ("\t--native-lib=x Link the native library 'x' into the final executable.");
Console.WriteLine ("\t--preload-file=x Preloads the file or directory 'x' into the virtual filesystem.");
+ Console.WriteLine ("\t--embed-file=x Embeds the file or directory 'x' into the virtual filesystem.");
Console.WriteLine ("foo.dll Include foo.dll as one of the root assemblies");
Console.WriteLine ();
@@ -400,6 +401,7 @@ class Driver {
var profilers = new List<string> ();
var native_libs = new List<string> ();
var preload_files = new List<string> ();
+ var embed_files = new List<string> ();
var pinvoke_libs = "";
var copyTypeParm = "default";
var copyType = CopyType.Default;
@@ -449,6 +451,7 @@ class Driver {
{ "pinvoke-libs=", s => pinvoke_libs = s },
{ "native-lib=", s => native_libs.Add (s) },
{ "preload-file=", s => preload_files.Add (s) },
+ { "embed-file=", s => embed_files.Add (s) },
{ "framework=", s => framework = s },
{ "help", s => print_usage = true },
};
@@ -507,7 +510,7 @@ class Driver {
link_icalls = true;
if (!enable_linker || !enable_aot)
enable_dedup = false;
- if (enable_aot || link_icalls || gen_pinvoke || profilers.Count > 0 || native_libs.Count > 0 || preload_files.Count > 0)
+ if (enable_aot || link_icalls || gen_pinvoke || profilers.Count > 0 || native_libs.Count > 0 || preload_files.Count > 0 || embed_files.Count > 0)
build_wasm = true;
if (!enable_aot && link_icalls)
enable_lto = true;
@@ -589,7 +592,10 @@ class Driver {
if (enable_aot) {
var to_aot = new Dictionary<string, bool> ();
- to_aot ["mscorlib"] = true;
+ if (is_netcore)
+ to_aot ["System.Private.CoreLib"] = true;
+ else
+ to_aot ["mscorlib"] = true;
if (aot_assemblies != "") {
foreach (var s in aot_assemblies.Split (','))
to_aot [s] = true;
@@ -688,13 +694,13 @@ class Driver {
File.Delete (config_js);
File.WriteAllText (config_js, config);
- string runtime_dir;
+ string wasm_runtime_dir;
if (is_netcore)
- runtime_dir = Path.Combine (tool_prefix, use_release_runtime ? "builds/netcore-release" : "builds/netcore-debug");
+ wasm_runtime_dir = Path.Combine (tool_prefix, use_release_runtime ? "builds/netcore-release" : "builds/netcore-debug");
else if (enable_threads)
- runtime_dir = Path.Combine (tool_prefix, use_release_runtime ? "builds/threads-release" : "builds/threads-debug");
+ wasm_runtime_dir = Path.Combine (tool_prefix, use_release_runtime ? "builds/threads-release" : "builds/threads-debug");
else
- runtime_dir = Path.Combine (tool_prefix, use_release_runtime ? "builds/release" : "builds/debug");
+ wasm_runtime_dir = Path.Combine (tool_prefix, use_release_runtime ? "builds/release" : "builds/debug");
if (!emit_ninja) {
var interp_files = new List<string> { "mono.js", "mono.wasm" };
if (enable_threads) {
@@ -703,7 +709,7 @@ class Driver {
foreach (var fname in interp_files) {
File.Delete (Path.Combine (out_prefix, fname));
File.Copy (
- Path.Combine (runtime_dir, fname),
+ Path.Combine (wasm_runtime_dir, fname),
Path.Combine (out_prefix, fname));
}
@@ -741,20 +747,27 @@ class Driver {
GenDriver (builddir, profilers, ee_mode, link_icalls);
}
+ string runtime_dir = is_netcore ? "$mono_sdkdir/wasm-runtime-netcore-release" : "$mono_sdkdir/wasm-runtime-release";
+ string runtime_libdir = $"{runtime_dir}/lib";
+
string runtime_libs = "";
if (ee_mode == ExecMode.Interp || ee_mode == ExecMode.AotInterp || link_icalls) {
- runtime_libs += "$mono_sdkdir/wasm-runtime-release/lib/libmono-ee-interp.a $mono_sdkdir/wasm-runtime-release/lib/libmono-ilgen.a ";
+ runtime_libs += $"$runtime_libdir/libmono-ee-interp.a $runtime_libdir/libmono-ilgen.a ";
// We need to link the icall table because the interpreter uses it to lookup icalls even if the aot-ed icall wrappers are available
if (!link_icalls)
- runtime_libs += "$mono_sdkdir/wasm-runtime-release/lib/libmono-icall-table.a ";
+ runtime_libs += $"$runtime_libdir/libmono-icall-table.a ";
}
- runtime_libs += "$mono_sdkdir/wasm-runtime-release/lib/libmonosgen-2.0.a";
+ runtime_libs += $"$runtime_libdir/libmonosgen-2.0.a ";
+ if (is_netcore)
+ runtime_libs += $"$runtime_libdir/System.Native.bc";
+ else
+ runtime_libs += $"$runtime_libdir/libmono-native.a";
string aot_args = "llvm-path=$emscripten_sdkdir/upstream/bin,";
string profiler_libs = "";
string profiler_aot_args = "";
foreach (var profiler in profilers) {
- profiler_libs += $"$mono_sdkdir/wasm-runtime-release/lib/libmono-profiler-{profiler}-static.a ";
+ profiler_libs += $"$runtime_libdir/libmono-profiler-{profiler}-static.a ";
if (profiler_aot_args != "")
profiler_aot_args += " ";
profiler_aot_args += $"--profile={profiler}";
@@ -771,7 +784,7 @@ class Driver {
if (build_wasm)
enable_zlib = true;
- runtime_dir = Path.GetFullPath (runtime_dir);
+ wasm_runtime_dir = Path.GetFullPath (wasm_runtime_dir);
sdkdir = Path.GetFullPath (sdkdir);
out_prefix = Path.GetFullPath (out_prefix);
@@ -789,6 +802,8 @@ class Driver {
emcc_flags += "-s FORCE_FILESYSTEM=1 ";
foreach (var pf in preload_files)
emcc_flags += "--preload-file " + pf + " ";
+ foreach (var f in embed_files)
+ emcc_flags += "--embed-file " + f + " ";
string emcc_link_flags = "";
if (enable_debug)
emcc_link_flags += "-O0 ";
@@ -805,7 +820,8 @@ class Driver {
ninja.WriteLine ($"tool_prefix = {tool_prefix}");
ninja.WriteLine ($"appdir = {out_prefix}");
ninja.WriteLine ($"builddir = .");
- ninja.WriteLine ($"wasm_runtime_dir = {runtime_dir}");
+ ninja.WriteLine ($"wasm_runtime_dir = {wasm_runtime_dir}");
+ ninja.WriteLine ($"runtime_libdir = {runtime_libdir}");
ninja.WriteLine ($"deploy_prefix = {deploy_prefix}");
ninja.WriteLine ($"bcl_dir = {bcl_prefix}");
ninja.WriteLine ($"bcl_facades_dir = {bcl_facades_prefix}");
@@ -820,7 +836,10 @@ class Driver {
ninja.WriteLine ("wasm_core_support =");
ninja.WriteLine ("wasm_core_support_library =");
}
- ninja.WriteLine ("cross = $mono_sdkdir/wasm-cross-release/bin/wasm32-unknown-none-mono-sgen");
+ if (is_netcore)
+ ninja.WriteLine ("cross = $mono_sdkdir/wasm-cross-netcore-release/bin/wasm32-unknown-none-mono-sgen");
+ else
+ ninja.WriteLine ("cross = $mono_sdkdir/wasm-cross-release/bin/wasm32-unknown-none-mono-sgen");
ninja.WriteLine ("emcc = source $emsdk_env && emcc");
ninja.WriteLine ("wasm_strip = $emscripten_sdkdir/upstream/bin/wasm-strip");
// -s ASSERTIONS=2 is very slow
@@ -876,9 +895,10 @@ class Driver {
ninja.WriteLine ($"build $builddir/driver.c: cpifdiff {source_file}");
ninja.WriteLine ($"build $builddir/driver-gen.c: cpifdiff $builddir/driver-gen.c.in");
- var pinvoke_file = Path.GetFullPath (Path.Combine (tool_prefix, "src", "pinvoke-tables-default.h"));
- ninja.WriteLine ($"build $builddir/pinvoke-tables-default.h: cpifdiff {pinvoke_file}");
- driver_deps += $" $builddir/pinvoke-tables-default.h";
+ var pinvoke_file_name = is_netcore ? "pinvoke-tables-default-netcore.h" : "pinvoke-tables-default.h";
+ var pinvoke_file = Path.GetFullPath (Path.Combine (tool_prefix, "src", pinvoke_file_name));
+ ninja.WriteLine ($"build $builddir/{pinvoke_file_name}: cpifdiff {pinvoke_file}");
+ driver_deps += $" $builddir/{pinvoke_file_name}";
var driver_cflags = enable_aot ? "-DENABLE_AOT=1" : "";
@@ -887,22 +907,24 @@ class Driver {
ninja.WriteLine ($"build $builddir/corebindings.c: cpifdiff {bindings_source_file}");
ninja.WriteLine ($"build $builddir/corebindings.o: emcc $builddir/corebindings.c | $emsdk_env");
- ninja.WriteLine ($" flags = -I$mono_sdkdir/wasm-runtime-release/include/mono-2.0");
+ ninja.WriteLine ($" flags = -I{runtime_dir}/include/mono-2.0");
driver_cflags += " -DCORE_BINDINGS ";
}
if (gen_pinvoke)
driver_cflags += " -DGEN_PINVOKE ";
+ if (is_netcore)
+ driver_cflags += " -DENABLE_NETCORE ";
ninja.WriteLine ("build $emsdk_env: create-emsdk-env");
ninja.WriteLine ($"build $builddir/driver.o: emcc $builddir/driver.c | $emsdk_env $builddir/driver-gen.c {driver_deps}");
- ninja.WriteLine ($" flags = {driver_cflags} -DDRIVER_GEN=1 -I$mono_sdkdir/wasm-runtime-release/include/mono-2.0");
+ ninja.WriteLine ($" flags = {driver_cflags} -DDRIVER_GEN=1 -I{runtime_dir}/include/mono-2.0");
if (enable_zlib) {
var zlib_source_file = Path.GetFullPath (Path.Combine (tool_prefix, "src", "zlib-helper.c"));
ninja.WriteLine ($"build $builddir/zlib-helper.c: cpifdiff {zlib_source_file}");
ninja.WriteLine ($"build $builddir/zlib-helper.o: emcc $builddir/zlib-helper.c | $emsdk_env");
- ninja.WriteLine ($" flags = -I$mono_sdkdir/wasm-runtime-release/include/mono-2.0 -I$mono_sdkdir/wasm-runtime-release/include/support");
+ ninja.WriteLine ($" flags = -I{runtime_dir}/include/mono-2.0 -I{runtime_dir}/include/support");
}
} else {
ninja.WriteLine ("build $appdir/mono.js: cpifdiff $wasm_runtime_dir/mono.js");
@@ -1033,7 +1055,7 @@ class Driver {
}
if (build_wasm) {
string zlibhelper = enable_zlib ? "$builddir/zlib-helper.o" : "";
- ninja.WriteLine ($"build $appdir/mono.js $appdir/mono.wasm: emcc-link $builddir/driver.o {zlibhelper} {wasm_core_bindings} {ofiles} {profiler_libs} {extra_link_libs} {runtime_libs} $mono_sdkdir/wasm-runtime-release/lib/libmono-native.a | $tool_prefix/src/library_mono.js $tool_prefix/src/dotnet_support.js {wasm_core_support} $emsdk_env");
+ ninja.WriteLine ($"build $appdir/mono.js $appdir/mono.wasm: emcc-link $builddir/driver.o {zlibhelper} {wasm_core_bindings} {ofiles} {profiler_libs} {extra_link_libs} {runtime_libs} | $tool_prefix/src/library_mono.js $tool_prefix/src/dotnet_support.js {wasm_core_support} $emsdk_env");
ninja.WriteLine (" out_js=$appdir/mono.js");
ninja.WriteLine (" out_wasm=$appdir/mono.wasm");
}
diff --git a/sdks/wasm/src/driver.c b/sdks/wasm/src/driver.c
index 2fad7d83fd5..72b1fb8c962 100644
--- a/sdks/wasm/src/driver.c
+++ b/sdks/wasm/src/driver.c
@@ -171,6 +171,10 @@ mono_wasm_setenv (const char *name, const char *value)
monoeg_g_setenv (strdup (name), strdup (value), 1);
}
+#ifdef ENABLE_NETCORE
+static void *sysglobal_native_handle;
+#endif
+
static void*
wasm_dl_load (const char *name, int flags, char **err, void *user_data)
{
@@ -179,6 +183,11 @@ wasm_dl_load (const char *name, int flags, char **err, void *user_data)
return pinvoke_tables [i];
}
+#ifdef ENABLE_NETCORE
+ if (!strcmp (name, "System.Globalization.Native"))
+ return sysglobal_native_handle;
+#endif
+
#if WASM_SUPPORTS_DLOPEN
return dlopen(name, flags);
#endif
@@ -187,7 +196,8 @@ wasm_dl_load (const char *name, int flags, char **err, void *user_data)
}
static mono_bool
-wasm_dl_is_pinvoke_tables (void* handle) {
+wasm_dl_is_pinvoke_tables (void* handle)
+{
for (int i = 0; i < sizeof (pinvoke_tables) / sizeof (void*); ++i) {
if (pinvoke_tables [i] == handle) {
return 1;
@@ -199,6 +209,11 @@ wasm_dl_is_pinvoke_tables (void* handle) {
static void*
wasm_dl_symbol (void *handle, const char *name, char **err, void *user_data)
{
+#ifdef ENABLE_NETCORE
+ if (handle == sysglobal_native_handle)
+ assert (0);
+#endif
+
#if WASM_SUPPORTS_DLOPEN
if (!wasm_dl_is_pinvoke_tables (handle)) {
return dlsym (handle, name);
@@ -249,7 +264,7 @@ icall_table_lookup (MonoMethod *method, char *classname, char *methodname, char
const char *image_name = mono_image_get_name (mono_class_get_image (mono_method_get_class (method)));
#ifdef ICALL_TABLE_mscorlib
- if (!strcmp (image_name, "mscorlib")) {
+ if (!strcmp (image_name, "mscorlib") || !strcmp (image_name, "System.Private.CoreLib")) {
indexes = mscorlib_icall_indexes;
indexes_size = sizeof (mscorlib_icall_indexes) / 4;
handles = mscorlib_icall_handles;
diff --git a/sdks/wasm/src/pinvoke-tables-default-netcore.h b/sdks/wasm/src/pinvoke-tables-default-netcore.h
index 1be6712d55e..f1a170e0005 100644
--- a/sdks/wasm/src/pinvoke-tables-default-netcore.h
+++ b/sdks/wasm/src/pinvoke-tables-default-netcore.h
@@ -20,12 +20,19 @@ int SystemNative_GetEUid ();
int SystemNative_GetHostName (int,int);
int SystemNative_GetPid ();
int SystemNative_GetPwUidR (int,int,int,int);
+int SystemNative_GetPwNamR (int,int,int,int);
void SystemNative_GetNonCryptographicallySecureRandomBytes (int,int);
+int64_t SystemNative_GetSystemTimeAsTicks ();
+uint64_t SystemNative_GetTimestampResolution ();
+uint64_t SystemNative_GetTimestamp ();
+int SystemNative_GetUnixName ();
int SystemNative_GetUnixRelease ();
+int SystemNative_LockFileRegion (int,int64_t,int64_t,int);
int64_t SystemNative_LSeek (int,int64_t,int);
int SystemNative_MksTemps (int,int);
int SystemNative_GetAllMountPoints (int);
int SystemNative_Open (int,int,int);
+int SystemNative_PathConf (int,int);
int SystemNative_PosixFAdvise (int,int64_t,int64_t,int);
int SystemNative_Read (int,int,int);
int SystemNative_OpenDir (int);
@@ -60,7 +67,6 @@ int SystemNative_GetSignalForBreak ();
int SystemNative_SetSignalForBreak (int);
int SystemNative_SNPrintF (int,int,int,int);
int SystemNative_SNPrintF (int,int,int,int);
-int SystemNative_FStat (int,int);
int SystemNative_Read (int,int,int);
int SystemNative_Write (int,int,int);
int SystemNative_GetWindowSize (int);
@@ -70,6 +76,46 @@ int SystemNative_ReadStdin (int,int);
void SystemNative_InitializeConsoleBeforeRead (int,int);
void SystemNative_UninitializeConsoleAfterRead ();
int SystemNative_StdinReady ();
+int SystemNative_ConvertErrorPlatformToPal (int);
+int SystemNative_ConvertErrorPalToPlatform (int);
+int SystemNative_StrErrorR (int,int,int);
+int SystemNative_GetEUid ();
+int SystemNative_GetAllMountPoints (int);
+int SystemNative_OpenDir (int);
+int SystemNative_GetReadDirRBufferSize ();
+int SystemNative_ReadDirR (int,int,int,int);
+int SystemNative_CloseDir (int);
+int SystemNative_Stat (int,int);
+int SystemNative_LStat (int,int);
+int SystemNative_Unlink (int);
+int SystemNative_ChMod (int,int);
+int SystemNative_CopyFile (int,int,int,int);
+int SystemNative_GetEGid ();
+int SystemNative_LChflags (int,int);
+int SystemNative_LChflagsCanSetHiddenFlag ();
+int SystemNative_Link (int,int);
+int SystemNative_MkDir (int,int);
+int SystemNative_Rename (int,int);
+int SystemNative_RmDir (int);
+int SystemNative_Stat (int,int);
+int SystemNative_LStat (int,int);
+int SystemNative_UTimensat (int,int);
+int SystemNative_GetUnixName ();
+int SystemNative_GetUnixVersion (int,int);
+int SystemNative_GetOSArchitecture ();
+int SystemNative_GetProcessArchitecture ();
+int SystemNative_ConvertErrorPlatformToPal (int);
+int SystemNative_ConvertErrorPalToPlatform (int);
+int SystemNative_StrErrorR (int,int,int);
+int SystemNative_MMap (int,uint64_t,int,int,int,int64_t);
+int SystemNative_MUnmap (int,uint64_t);
+int SystemNative_MSync (int,uint64_t,int);
+int64_t SystemNative_SysConf (int);
+int SystemNative_FTruncate (int,int64_t);
+int SystemNative_MAdvise (int,uint64_t,int);
+int SystemNative_ShmOpen (int,int,int);
+int SystemNative_ShmUnlink (int);
+int SystemNative_Unlink (int);
static PinvokeImport System_Native_imports [] = {
{"SystemNative_ConvertErrorPlatformToPal", SystemNative_ConvertErrorPlatformToPal},
{"SystemNative_ConvertErrorPalToPlatform", SystemNative_ConvertErrorPalToPlatform},
@@ -87,12 +133,19 @@ static PinvokeImport System_Native_imports [] = {
{"SystemNative_GetHostName", SystemNative_GetHostName},
{"SystemNative_GetPid", SystemNative_GetPid},
{"SystemNative_GetPwUidR", SystemNative_GetPwUidR},
+{"SystemNative_GetPwNamR", SystemNative_GetPwNamR},
{"SystemNative_GetNonCryptographicallySecureRandomBytes", SystemNative_GetNonCryptographicallySecureRandomBytes},
+{"SystemNative_GetSystemTimeAsTicks", SystemNative_GetSystemTimeAsTicks},
+{"SystemNative_GetTimestampResolution", SystemNative_GetTimestampResolution},
+{"SystemNative_GetTimestamp", SystemNative_GetTimestamp},
+{"SystemNative_GetUnixName", SystemNative_GetUnixName},
{"SystemNative_GetUnixRelease", SystemNative_GetUnixRelease},
+{"SystemNative_LockFileRegion", SystemNative_LockFileRegion},
{"SystemNative_LSeek", SystemNative_LSeek},
{"SystemNative_MksTemps", SystemNative_MksTemps},
{"SystemNative_GetAllMountPoints", SystemNative_GetAllMountPoints},
{"SystemNative_Open", SystemNative_Open},
+{"SystemNative_PathConf", SystemNative_PathConf},
{"SystemNative_PosixFAdvise", SystemNative_PosixFAdvise},
{"SystemNative_Read", SystemNative_Read},
{"SystemNative_OpenDir", SystemNative_OpenDir},
@@ -127,7 +180,6 @@ static PinvokeImport System_Native_imports [] = {
{"SystemNative_SetSignalForBreak", SystemNative_SetSignalForBreak},
{"SystemNative_SNPrintF", SystemNative_SNPrintF},
{"SystemNative_SNPrintF", SystemNative_SNPrintF},
-{"SystemNative_FStat", SystemNative_FStat},
{"SystemNative_Read", SystemNative_Read},
{"SystemNative_Write", SystemNative_Write},
{"SystemNative_GetWindowSize", SystemNative_GetWindowSize},
@@ -137,6 +189,46 @@ static PinvokeImport System_Native_imports [] = {
{"SystemNative_InitializeConsoleBeforeRead", SystemNative_InitializeConsoleBeforeRead},
{"SystemNative_UninitializeConsoleAfterRead", SystemNative_UninitializeConsoleAfterRead},
{"SystemNative_StdinReady", SystemNative_StdinReady},
+{"SystemNative_ConvertErrorPlatformToPal", SystemNative_ConvertErrorPlatformToPal},
+{"SystemNative_ConvertErrorPalToPlatform", SystemNative_ConvertErrorPalToPlatform},
+{"SystemNative_StrErrorR", SystemNative_StrErrorR},
+{"SystemNative_GetEUid", SystemNative_GetEUid},
+{"SystemNative_GetAllMountPoints", SystemNative_GetAllMountPoints},
+{"SystemNative_OpenDir", SystemNative_OpenDir},
+{"SystemNative_GetReadDirRBufferSize", SystemNative_GetReadDirRBufferSize},
+{"SystemNative_ReadDirR", SystemNative_ReadDirR},
+{"SystemNative_CloseDir", SystemNative_CloseDir},
+{"SystemNative_Stat", SystemNative_Stat},
+{"SystemNative_LStat", SystemNative_LStat},
+{"SystemNative_Unlink", SystemNative_Unlink},
+{"SystemNative_ChMod", SystemNative_ChMod},
+{"SystemNative_CopyFile", SystemNative_CopyFile},
+{"SystemNative_GetEGid", SystemNative_GetEGid},
+{"SystemNative_LChflags", SystemNative_LChflags},
+{"SystemNative_LChflagsCanSetHiddenFlag", SystemNative_LChflagsCanSetHiddenFlag},
+{"SystemNative_Link", SystemNative_Link},
+{"SystemNative_MkDir", SystemNative_MkDir},
+{"SystemNative_Rename", SystemNative_Rename},
+{"SystemNative_RmDir", SystemNative_RmDir},
+{"SystemNative_Stat", SystemNative_Stat},
+{"SystemNative_LStat", SystemNative_LStat},
+{"SystemNative_UTimensat", SystemNative_UTimensat},
+{"SystemNative_GetUnixName", SystemNative_GetUnixName},
+{"SystemNative_GetUnixVersion", SystemNative_GetUnixVersion},
+{"SystemNative_GetOSArchitecture", SystemNative_GetOSArchitecture},
+{"SystemNative_GetProcessArchitecture", SystemNative_GetProcessArchitecture},
+{"SystemNative_ConvertErrorPlatformToPal", SystemNative_ConvertErrorPlatformToPal},
+{"SystemNative_ConvertErrorPalToPlatform", SystemNative_ConvertErrorPalToPlatform},
+{"SystemNative_StrErrorR", SystemNative_StrErrorR},
+{"SystemNative_MMap", SystemNative_MMap},
+{"SystemNative_MUnmap", SystemNative_MUnmap},
+{"SystemNative_MSync", SystemNative_MSync},
+{"SystemNative_SysConf", SystemNative_SysConf},
+{"SystemNative_FTruncate", SystemNative_FTruncate},
+{"SystemNative_MAdvise", SystemNative_MAdvise},
+{"SystemNative_ShmOpen", SystemNative_ShmOpen},
+{"SystemNative_ShmUnlink", SystemNative_ShmUnlink},
+{"SystemNative_Unlink", SystemNative_Unlink},
{NULL, NULL}
};
static void *pinvoke_tables[] = { System_Native_imports,};
diff --git a/sdks/wasm/xunit-runner.cs b/sdks/wasm/xunit-runner/xunit-runner.cs
index 70c4111193a..70c4111193a 100644
--- a/sdks/wasm/xunit-runner.cs
+++ b/sdks/wasm/xunit-runner/xunit-runner.cs
diff --git a/sdks/wasm/xunit-runner/xunit-runner.csproj b/sdks/wasm/xunit-runner/xunit-runner.csproj
new file mode 100644
index 00000000000..5d36209ad4f
--- /dev/null
+++ b/sdks/wasm/xunit-runner/xunit-runner.csproj
@@ -0,0 +1,14 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>netcoreapp3.0</TargetFramework>
+ <RootNamespace>xunit_runner</RootNamespace>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="xunit.console" Version="2.4.1" />
+ <PackageReference Include="xunit.core" Version="2.4.1" />
+ </ItemGroup>
+
+</Project>