Skip to content

Commit

Permalink
[wasm] Enable the full gc by default (dotnet#38345)
Browse files Browse the repository at this point in the history
* [wasm] Enable the full gc by default

* fix the condition

* rename argument
  • Loading branch information
lewing authored Jun 29, 2020
1 parent 2b325cd commit 831634c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion eng/testing/tests.mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
<!-- We need to set this in order to get extensibility on xunit category traits and other arguments we pass down to xunit via MSBuild properties -->
<RunScriptCommand>$HARNESS_RUNNER xharness wasm test --engine=$(JSEngine) --js-file=runtime.js -v --output-directory=$XHARNESS_OUT -- --enable-gc --run WasmTestRunner.dll $(AssemblyName).dll</RunScriptCommand>
<RunScriptCommand>$HARNESS_RUNNER xharness wasm test --engine=$(JSEngine) --js-file=runtime.js -v --output-directory=$XHARNESS_OUT -- --run WasmTestRunner.dll $(AssemblyName).dll</RunScriptCommand>
</PropertyGroup>

<!-- Generate a self-contained app bundle for Android with tests. -->
Expand Down
2 changes: 1 addition & 1 deletion src/mono/netcore/sample/wasm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ clean:
rm -rf bin

run:
cd bin/$(CONFIG)/publish && ~/.jsvu/v8 --expose_wasm runtime.js -- --enable-gc --run WasmSample.dll
cd bin/$(CONFIG)/publish && ~/.jsvu/v8 --expose_wasm runtime.js -- --run WasmSample.dll

runtimepack:
EMSDK_PATH=$(abspath $(TOP)/src/mono/wasm/emsdk) $(TOP)/build.sh -c $(CONFIG) -os Browser -arch wasm -subset Mono+Libs
11 changes: 5 additions & 6 deletions src/mono/wasm/runtime-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ print("Arguments: " + testArguments);
profilers = [];
setenv = {};
runtime_args = [];
enable_gc = false;
enable_gc = true;
enable_zoneinfo = false;
while (true) {
if (args [0].startsWith ("--profile=")) {
Expand All @@ -127,8 +127,8 @@ while (true) {
var arg = args [0].substring ("--runtime-arg=".length);
runtime_args.push (arg);
args = args.slice (1);
} else if (args [0] == "--enable-gc") {
enable_gc = true;
} else if (args [0] == "--disable-on-demand-gc") {
enable_gc = false;
args = args.slice (1);
} else if (args [0] == "--enable-zoneinfo") {
enable_zoneinfo = true;
Expand Down Expand Up @@ -201,9 +201,8 @@ var Module = {
}
}

if (enable_gc) {
var f = Module.cwrap ('mono_wasm_enable_on_demand_gc', 'void', []);
f ();
if (!enable_gc) {
Module.ccall ('mono_wasm_enable_on_demand_gc', 'void', ['number'], [0]);
}
if (enable_zoneinfo) {
// Load the zoneinfo data into the VFS rooted at /zoneinfo
Expand Down
6 changes: 3 additions & 3 deletions src/mono/wasm/runtime/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static MonoClass* datetimeoffset_class;
static MonoClass* uri_class;
static MonoClass* safehandle_class;

int mono_wasm_enable_gc;
int mono_wasm_enable_gc = 1;

/* Not part of public headers */
#define MONO_ICALL_TABLE_CALLBACKS_VERSION 2
Expand Down Expand Up @@ -730,9 +730,9 @@ mono_wasm_parse_runtime_options (int argc, char* argv[])
}

EMSCRIPTEN_KEEPALIVE void
mono_wasm_enable_on_demand_gc (void)
mono_wasm_enable_on_demand_gc (int enable)
{
mono_wasm_enable_gc = 1;
mono_wasm_enable_gc = enable ? 1 : 0;
}

// Returns the local timezone default is UTC.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public override bool Execute ()

using (var sw = File.CreateText(Path.Join(AppDir, "run-v8.sh")))
{
sw.WriteLine("v8 --expose_wasm runtime.js -- --enable-gc --run " + Path.GetFileName(MainAssembly) + " $*");
sw.WriteLine("v8 --expose_wasm runtime.js -- --run " + Path.GetFileName(MainAssembly) + " $*");
}

return true;
Expand Down

0 comments on commit 831634c

Please sign in to comment.