Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit d864698

Browse files
MaxGraeyyurydelendik
authored andcommitted
Setup adjustments for new runtime in AssemblyScript template (#420)
* improve runtime setup * additional notes
1 parent 8209e9a commit d864698

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

templates/empty_ts/gulpfile.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,36 @@
11
const gulp = require("gulp");
2+
/*
3+
Runtime variants:
24
5+
"--runtime", "full" (default)
6+
A proper memory manager and reference-counting based garbage collector, with runtime interfaces
7+
being exported to the host for being able to create managed objects externally.
8+
9+
"--runtime", "half"
10+
The same as full but without any exports, i.e. where creating objects externally is not required.
11+
This allows the optimizer to eliminate parts of the runtime that are not needed.
12+
13+
"--runtime", "stub"
14+
A minimalist arena memory manager without any means of freeing up memory again, but the same external
15+
interface as full. Useful for very short-lived programs or programs with hardly any memory footprint,
16+
while keeping the option to switch to full without any further changes. No garbage collection.
17+
18+
"--runtime", "none"
19+
The same as stub but without any exports, for the same reasons as explained in half. Essentially
20+
evaporates entirely after optimizations.
21+
22+
For more information see: https://docs.assemblyscript.org/details/runtime
23+
*/
324
gulp.task("build", callback => {
425
const asc = require("assemblyscript/bin/asc");
526
asc.main([
627
"main.ts",
728
"--baseDir", "assembly",
829
"--binaryFile", "../out/main.wasm",
930
"--sourceMap",
10-
"--measure"
31+
"--measure",
32+
"--runtime", "half",
33+
"--optimize"
1134
], callback);
1235
});
1336

templates/empty_ts/src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ WebAssembly.instantiateStreaming(fetch("../out/main.wasm"), {
55
}
66
},
77
env: {
8-
abort(msg, file, line, column) {
8+
abort(_msg, _file, line, column) {
99
console.error("abort called at main.ts:" + line + ":" + column);
1010
}
1111
},

0 commit comments

Comments
 (0)