Skip to content

Commit 24a75b8

Browse files
committed
Merge remote-tracking branch 'origin/master' into release
2 parents c1c600e + 897d1e3 commit 24a75b8

File tree

67 files changed

+3280
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3280
-347
lines changed

Diff for: cli/asc.d.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ interface CompilerOptions {
7777
binaryFile?: string;
7878
/** Specifies the text output file (.wat). */
7979
textFile?: string;
80-
/** Specifies the asm.js output file (.js). */
81-
asmjsFile?: string;
80+
/** Specifies the JavaScript (via wasm2js) output file (.js). */
81+
jsFile?: string;
8282
/** Specifies the WebIDL output file (.webidl). */
8383
idlFile?: string;
8484
/** Specifies the TypeScript definition output file (.d.ts). */
@@ -97,8 +97,14 @@ interface CompilerOptions {
9797
noEmit?: boolean;
9898
/** Imports the memory provided as 'env.memory'. */
9999
importMemory?: boolean;
100-
/** Declare memory as shared by settings the max shared memory. */
101-
sharedMemory?: number;
100+
/** Does not export the memory as 'memory'. */
101+
noExportMemory?: boolean;
102+
/** Sets the initial memory size in pages. */
103+
initialMemory?: number;
104+
/** Sets the maximum memory size in pages. */
105+
maximumMemory?: number;
106+
/** Declare memory as shared. Requires maximumMemory. */
107+
sharedMemory?: boolean;
102108
/** Sets the start offset of compiler-generated static memory. */
103109
memoryBase?: number;
104110
/** Imports the function table provided as 'env.table'. */
@@ -133,8 +139,6 @@ interface CompilerOptions {
133139
listFiles?: boolean;
134140
/** Prints measuring information on I/O and compile times. */
135141
measure?: boolean;
136-
/** Prints the module's runtime type information to stderr. */
137-
printrtti?: boolean;
138142
/** Disables terminal colors. */
139143
noColors?: boolean;
140144
/** Specifies an alternative file extension. */

Diff for: cli/asc.js

+14-22
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,10 @@ exports.main = function main(argv, options, callback) {
272272
const compilerOptions = assemblyscript.newOptions();
273273
assemblyscript.setTarget(compilerOptions, 0);
274274
assemblyscript.setNoAssert(compilerOptions, args.noAssert);
275+
assemblyscript.setExportMemory(compilerOptions, !args.noExportMemory);
275276
assemblyscript.setImportMemory(compilerOptions, args.importMemory);
277+
assemblyscript.setInitialMemory(compilerOptions, args.initialMemory >>> 0);
278+
assemblyscript.setMaximumMemory(compilerOptions, args.maximumMemory >>> 0);
276279
assemblyscript.setSharedMemory(compilerOptions, args.sharedMemory);
277280
assemblyscript.setImportTable(compilerOptions, args.importTable);
278281
assemblyscript.setExportTable(compilerOptions, args.exportTable);
@@ -711,8 +714,8 @@ exports.main = function main(argv, options, callback) {
711714
if (args.outFile != null) {
712715
if (/\.was?t$/.test(args.outFile) && args.textFile == null) {
713716
args.textFile = args.outFile;
714-
} else if (/\.js$/.test(args.outFile) && args.asmjsFile == null) {
715-
args.asmjsFile = args.outFile;
717+
} else if (/\.js$/.test(args.outFile) && args.jsFile == null) {
718+
args.jsFile = args.outFile;
716719
} else if (args.binaryFile == null) {
717720
args.binaryFile = args.outFile;
718721
}
@@ -763,21 +766,21 @@ exports.main = function main(argv, options, callback) {
763766
}
764767
}
765768

766-
// Write asm.js
767-
if (args.asmjsFile != null) {
768-
let asm;
769-
if (args.asmjsFile.length) {
769+
// Write JS
770+
if (args.jsFile != null) {
771+
let js;
772+
if (args.jsFile.length) {
770773
stats.emitCount++;
771774
stats.emitTime += measure(() => {
772-
asm = module.toAsmjs();
775+
js = module.toAsmjs();
773776
});
774-
writeFile(args.asmjsFile, asm, baseDir);
777+
writeFile(args.jsFile, js, baseDir);
775778
} else if (!hasStdout) {
776779
stats.emitCount++;
777780
stats.emitTime += measure(() => {
778-
asm = module.toAsmjs();
781+
js = module.toAsmjs();
779782
});
780-
writeStdout(asm);
783+
writeStdout(js);
781784
hasStdout = true;
782785
}
783786
hasOutput = true;
@@ -846,9 +849,7 @@ exports.main = function main(argv, options, callback) {
846849
if (args.measure) {
847850
printStats(stats, stderr);
848851
}
849-
if (args.printrtti) {
850-
printRTTI(program, stderr);
851-
}
852+
852853
return callback(null);
853854

854855
function readFileNode(filename, baseDir) {
@@ -1001,15 +1002,6 @@ function printStats(stats, output) {
10011002

10021003
exports.printStats = printStats;
10031004

1004-
/** Prints runtime type information. */
1005-
function printRTTI(program, output) {
1006-
if (!output) output = process.stderr;
1007-
output.write("# Runtime type information (RTTI)\n");
1008-
output.write(assemblyscript.buildRTTI(program));
1009-
}
1010-
1011-
exports.printRTTI = printRTTI;
1012-
10131005
var allocBuffer = typeof global !== "undefined" && global.Buffer
10141006
? global.Buffer.allocUnsafe || function(len) { return new global.Buffer(len); }
10151007
: function(len) { return new Uint8Array(len) };

Diff for: cli/asc.json

+23-10
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@
8888
"type": "s",
8989
"alias": "t"
9090
},
91-
"asmjsFile": {
91+
"jsFile": {
9292
"category": "Output",
93-
"description": "Specifies the asm.js output file (.js).",
93+
"description": "Specifies the JavaScript (via wasm2js) output file (.js).",
9494
"type": "s",
95-
"alias": "a"
95+
"alias": "j"
9696
},
9797
"idlFile": {
9898
"category": "Output",
@@ -128,12 +128,30 @@
128128
"type": "b",
129129
"default": false
130130
},
131-
"sharedMemory": {
131+
"noExportMemory": {
132+
"category": "Features",
133+
"description": "Does not export the memory as 'memory'.",
134+
"type": "b",
135+
"default": false
136+
},
137+
"initialMemory": {
138+
"category": "Features",
139+
"description": "Sets the initial memory size in pages.",
140+
"type": "i",
141+
"default": 0
142+
},
143+
"maximumMemory": {
132144
"category": "Features",
133-
"description": "Declare memory as shared by settings the max shared memory.",
145+
"description": "Sets the maximum memory size in pages.",
134146
"type": "i",
135147
"default": 0
136148
},
149+
"sharedMemory": {
150+
"category": "Features",
151+
"description": "Declare memory as shared. Requires maximumMemory.",
152+
"type": "b",
153+
"default": false
154+
},
137155
"importTable": {
138156
"category": "Features",
139157
"description": "Imports the function table provided as 'env.table'.",
@@ -303,11 +321,6 @@
303321
"type": "b",
304322
"default": false
305323
},
306-
"printrtti": {
307-
"description": "Prints the module's runtime type information to stderr.",
308-
"type": "b",
309-
"default": false
310-
},
311324
" ...": {
312325
"description": "Specifies node.js options (CLI only). See: node --help"
313326
},

Diff for: cli/util/options.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export interface OptionDescription {
1313
value?: { [key: string]: number | string },
1414
/** Short alias, if any. */
1515
alias?: string
16+
/** The default value, if any. */
17+
default?: string | number | boolean | string[] | number[];
1618
}
1719

1820
/** Configuration object. */
@@ -29,7 +31,9 @@ interface Result {
2931
/** Normal arguments. */
3032
arguments: string[],
3133
/** Trailing arguments. */
32-
trailing: string[]
34+
trailing: string[],
35+
/** Provided arguments from the cli. */
36+
provided: Set<string>
3337
}
3438

3539
/** Parses the specified command line arguments according to the given configuration. */

Diff for: cli/util/options.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function parse(argv, config) {
2121
var unknown = [];
2222
var arguments = [];
2323
var trailing = [];
24+
var provided = new Set();
2425

2526
// make an alias map and initialize defaults
2627
var aliases = {};
@@ -53,9 +54,13 @@ function parse(argv, config) {
5354
else { arguments.push(arg); continue; } // argument
5455
}
5556
if (option) {
56-
if (option.type == null || option.type === "b") options[key] = true; // flag
57-
else {
57+
if (option.type == null || option.type === "b") {
58+
options[key] = true; // flag
59+
provided.add(key);
60+
} else {
61+
// the argument was provided
5862
if (i + 1 < argv.length && argv[i + 1].charCodeAt(0) != 45) { // present
63+
provided.add(key);
5964
switch (option.type) {
6065
case "i": options[key] = parseInt(argv[++i], 10); break;
6166
case "I": options[key] = (options[key] || []).concat(parseInt(argv[++i], 10)); break;
@@ -82,7 +87,7 @@ function parse(argv, config) {
8287
}
8388
while (i < k) trailing.push(argv[i++]); // trailing
8489

85-
return { options, unknown, arguments, trailing };
90+
return { options, unknown, arguments, trailing, provided };
8691
}
8792

8893
exports.parse = parse;

Diff for: lib/loader/index.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ export interface ResultObject {
55
instance: WebAssembly.Instance;
66
}
77

8-
/** WebAssembly imports with two levels of nesting. */
8+
9+
/** WebAssembly imports with an optional env object and two levels of nesting. */
910
export type Imports = {
10-
[key: string]: object,
11+
[key: string]: any;
1112
env?: {
1213
memory?: WebAssembly.Memory;
1314
table?: WebAssembly.Table;

Diff for: package-lock.json

+13-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"assemblyscript",
99
"wasm"
1010
],
11-
"version": "0.9.4",
11+
"version": "0.10.0",
1212
"author": "Daniel Wirtz <[email protected]>",
1313
"contributors": [],
1414
"license": "Apache-2.0",
@@ -21,22 +21,22 @@
2121
"url": "https://github.com/AssemblyScript/assemblyscript/issues"
2222
},
2323
"dependencies": {
24-
"binaryen": "92.0.0-nightly.20200426",
24+
"binaryen": "93.0.0-nightly.20200514",
2525
"long": "^4.0.0",
2626
"source-map-support": "^0.5.19",
2727
"ts-node": "^6.2.0"
2828
},
2929
"devDependencies": {
30-
"@types/node": "^13.13.2",
30+
"@types/node": "^14.0.1",
3131
"browser-process-hrtime": "^1.0.0",
3232
"diff": "^4.0.2",
3333
"glob": "^7.1.6",
3434
"physical-cpu-count": "^2.0.0",
3535
"source-map-support": "^0.5.19",
36-
"ts-loader": "^6.2.2",
36+
"ts-loader": "^7.0.4",
3737
"ts-node": "^6.2.0",
3838
"tslint": "^5.20.1",
39-
"typescript": "^3.8.3",
39+
"typescript": "^3.9.2",
4040
"webpack": "^4.43.0",
4141
"webpack-cli": "^3.3.11"
4242
},

0 commit comments

Comments
 (0)