mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-26 15:32:16 +00:00
Add trapMode option to asc; Disable flatten/ssa passes for now
This commit is contained in:
parent
6d8de50565
commit
732068e981
12
README.md
12
README.md
@ -73,12 +73,16 @@ Options:
|
|||||||
-h, --help Prints this message.
|
-h, --help Prints this message.
|
||||||
-O, --optimize Optimizes the module.
|
-O, --optimize Optimizes the module.
|
||||||
-c, --validate Validates the module.
|
-c, --validate Validates the module.
|
||||||
-o, --outFile Specifies the output file.
|
-o, --outFile Specifies the output file. Format is determined by file extension.
|
||||||
-b, --binaryFile Specifies the binary format output file.
|
-b, --binaryFile Specifies the binary format output file (.wasm).
|
||||||
-t, --textFile Specifies the text format output file.
|
-t, --textFile Specifies the text format output file (.wast).
|
||||||
-a, --asmjsFile Specifies the asm.js format output file.
|
-a, --asmjsFile Specifies the asm.js format output file (.js).
|
||||||
--noTreeShaking Disables tree-shaking.
|
--noTreeShaking Disables tree-shaking.
|
||||||
--noDebug Disables assertions.
|
--noDebug Disables assertions.
|
||||||
|
--trapMode Sets the trap mode to use.
|
||||||
|
none Do not modify trapping operations. This is the default.
|
||||||
|
clamp Replace trapping operations with clamping semantics.
|
||||||
|
js Replace trapping operations with JS semantics.
|
||||||
```
|
```
|
||||||
|
|
||||||
Unless a bundle has been built to `dist/`, `asc` runs the TypeScript sources directly via [ts-node](https://www.npmjs.com/package/ts-node). Useful for development.
|
Unless a bundle has been built to `dist/`, `asc` runs the TypeScript sources directly via [ts-node](https://www.npmjs.com/package/ts-node). Useful for development.
|
||||||
|
15
bin/asc.js
15
bin/asc.js
@ -31,6 +31,7 @@ Object.keys(conf).forEach(key => {
|
|||||||
|
|
||||||
var args = minimist(process.argv.slice(2), opts);
|
var args = minimist(process.argv.slice(2), opts);
|
||||||
var version = require("../package.json").version;
|
var version = require("../package.json").version;
|
||||||
|
var indent = 20;
|
||||||
if (isDev) version += "-dev";
|
if (isDev) version += "-dev";
|
||||||
|
|
||||||
if (args.version) {
|
if (args.version) {
|
||||||
@ -48,8 +49,15 @@ if (args.help || args._.length < 1) {
|
|||||||
if (option.aliases && option.aliases[0].length === 1)
|
if (option.aliases && option.aliases[0].length === 1)
|
||||||
text += "-" + option.aliases[0] + ", ";
|
text += "-" + option.aliases[0] + ", ";
|
||||||
text += "--" + name;
|
text += "--" + name;
|
||||||
while (text.length < 24)
|
while (text.length < indent)
|
||||||
text += " ";
|
text += " ";
|
||||||
|
if (Array.isArray(option.desc)) {
|
||||||
|
options.push(text + option.desc[0] + option.desc.slice(1).map(line => {
|
||||||
|
for (var i = 0; i < indent; ++i)
|
||||||
|
line = " " + line;
|
||||||
|
return "\n" + line;
|
||||||
|
}).join(""));
|
||||||
|
} else
|
||||||
options.push(text + option.desc);
|
options.push(text + option.desc);
|
||||||
});
|
});
|
||||||
console.log([
|
console.log([
|
||||||
@ -135,6 +143,11 @@ if (args.validate)
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.trapMode === "clamp")
|
||||||
|
module.runPasses([ "trap-mode-clamp" ]);
|
||||||
|
else if (args.trapMode === "js")
|
||||||
|
module.runPasses([ "trap-mode-js" ]);
|
||||||
|
|
||||||
if (args.optimize)
|
if (args.optimize)
|
||||||
module.optimize();
|
module.optimize();
|
||||||
|
|
||||||
|
18
bin/asc.json
18
bin/asc.json
@ -20,22 +20,22 @@
|
|||||||
"aliases": [ "c", "check" ]
|
"aliases": [ "c", "check" ]
|
||||||
},
|
},
|
||||||
"outFile": {
|
"outFile": {
|
||||||
"desc": "Specifies the output file.",
|
"desc": "Specifies the output file. Format is determined by file extension.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"aliases": [ "o" ]
|
"aliases": [ "o" ]
|
||||||
},
|
},
|
||||||
"binaryFile": {
|
"binaryFile": {
|
||||||
"desc": "Specifies the binary format output file.",
|
"desc": "Specifies the binary format output file (.wasm).",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"aliases": [ "b" ]
|
"aliases": [ "b" ]
|
||||||
},
|
},
|
||||||
"textFile": {
|
"textFile": {
|
||||||
"desc": "Specifies the text format output file.",
|
"desc": "Specifies the text format output file (.wast).",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"aliases": [ "t" ]
|
"aliases": [ "t" ]
|
||||||
},
|
},
|
||||||
"asmjsFile": {
|
"asmjsFile": {
|
||||||
"desc": "Specifies the asm.js format output file.",
|
"desc": "Specifies the asm.js format output file (.js).",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"aliases": [ "a" ]
|
"aliases": [ "a" ]
|
||||||
},
|
},
|
||||||
@ -46,5 +46,15 @@
|
|||||||
"noDebug": {
|
"noDebug": {
|
||||||
"desc": "Disables assertions.",
|
"desc": "Disables assertions.",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"trapMode": {
|
||||||
|
"desc": [
|
||||||
|
"Sets the trap mode to use.",
|
||||||
|
"none Do not modify trapping operations. This is the default.",
|
||||||
|
"clamp Replace trapping operations with clamping semantics.",
|
||||||
|
"js Replace trapping operations with JS semantics."
|
||||||
|
],
|
||||||
|
"type": "string",
|
||||||
|
"default": "none"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -393,6 +393,7 @@ export class Compiler extends DiagnosticEmitter {
|
|||||||
if (getExpressionId(initializer) != ExpressionId.Const) {
|
if (getExpressionId(initializer) != ExpressionId.Const) {
|
||||||
initializer = this.precomputeExpressionRef(initializer);
|
initializer = this.precomputeExpressionRef(initializer);
|
||||||
if (getExpressionId(initializer) != ExpressionId.Const) {
|
if (getExpressionId(initializer) != ExpressionId.Const) {
|
||||||
|
if (element.isConstant)
|
||||||
this.warning(DiagnosticCode.Compiling_constant_global_with_non_constant_initializer_as_mutable, declaration.range);
|
this.warning(DiagnosticCode.Compiling_constant_global_with_non_constant_initializer_as_mutable, declaration.range);
|
||||||
initializeInStart = true;
|
initializeInStart = true;
|
||||||
}
|
}
|
||||||
@ -407,6 +408,7 @@ export class Compiler extends DiagnosticEmitter {
|
|||||||
this.module.createGetGlobal(previousValue.internalName, NativeType.I32),
|
this.module.createGetGlobal(previousValue.internalName, NativeType.I32),
|
||||||
this.module.createI32(1)
|
this.module.createI32(1)
|
||||||
);
|
);
|
||||||
|
if (element.isConstant)
|
||||||
this.warning(DiagnosticCode.Compiling_constant_global_with_non_constant_initializer_as_mutable, val.declaration.range);
|
this.warning(DiagnosticCode.Compiling_constant_global_with_non_constant_initializer_as_mutable, val.declaration.range);
|
||||||
initializeInStart = true;
|
initializeInStart = true;
|
||||||
}
|
}
|
||||||
|
@ -702,7 +702,7 @@ export class Module {
|
|||||||
|
|
||||||
optimize(func: FunctionRef = 0): void {
|
optimize(func: FunctionRef = 0): void {
|
||||||
// see: https://github.com/WebAssembly/binaryen/issues/1331#issuecomment-350328175
|
// see: https://github.com/WebAssembly/binaryen/issues/1331#issuecomment-350328175
|
||||||
this.runPasses([ "flatten", "ssa" ], func);
|
// this.runPasses([ "flatten", "ssa" ], func);
|
||||||
if (func) {
|
if (func) {
|
||||||
_BinaryenFunctionOptimize(func, this.ref);
|
_BinaryenFunctionOptimize(func, this.ref);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
var binaryen = require("binaryen");
|
|
||||||
|
|
||||||
// "unexpected false: module function exports must be found"
|
|
||||||
|
|
||||||
var mod = new binaryen.Module();
|
|
||||||
|
|
||||||
var funcType = mod.addFunctionType("v", binaryen.none, []);
|
|
||||||
var func = mod.addImport("test", "env", "test", funcType);
|
|
||||||
mod.addExport("test", "test");
|
|
||||||
|
|
||||||
console.log(mod.emitText());
|
|
||||||
if (!mod.validate())
|
|
||||||
console.log("-> does not validate");
|
|
@ -1,5 +1,7 @@
|
|||||||
(module
|
(module
|
||||||
|
(type $v (func))
|
||||||
|
(import "env" "external" (func $declare/external))
|
||||||
(memory $0 1)
|
(memory $0 1)
|
||||||
(data (i32.const 4) "\08")
|
(export "external" (func $declare/external))
|
||||||
(export "memory" (memory $0))
|
(export "memory" (memory $0))
|
||||||
)
|
)
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
declare function external(): void;
|
declare function external(): void;
|
||||||
|
|
||||||
// "unexpected false: module function exports must be found"
|
|
||||||
// see: https://github.com/WebAssembly/binaryen/issues/1325
|
|
||||||
export { external };
|
export { external };
|
||||||
|
@ -5,15 +5,11 @@
|
|||||||
(export "loopDoInDo" (func $do/loopDoInDo))
|
(export "loopDoInDo" (func $do/loopDoInDo))
|
||||||
(export "memory" (memory $0))
|
(export "memory" (memory $0))
|
||||||
(func $do/loopDo (; 0 ;) (type $iv) (param $0 i32)
|
(func $do/loopDo (; 0 ;) (type $iv) (param $0 i32)
|
||||||
(local $1 i32)
|
|
||||||
(set_local $1
|
|
||||||
(get_local $0)
|
|
||||||
)
|
|
||||||
(loop $continue|0
|
(loop $continue|0
|
||||||
(br_if $continue|0
|
(br_if $continue|0
|
||||||
(tee_local $1
|
(tee_local $0
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(get_local $1)
|
(get_local $0)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -21,10 +17,8 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
(func $do/loopDoInDo (; 1 ;) (type $iv) (param $0 i32)
|
(func $do/loopDoInDo (; 1 ;) (type $iv) (param $0 i32)
|
||||||
(local $1 i32)
|
|
||||||
(local $2 i32)
|
|
||||||
(loop $continue|0
|
(loop $continue|0
|
||||||
(set_local $1
|
(set_local $0
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
@ -32,20 +26,16 @@
|
|||||||
)
|
)
|
||||||
(loop $continue|1
|
(loop $continue|1
|
||||||
(br_if $continue|1
|
(br_if $continue|1
|
||||||
(tee_local $2
|
|
||||||
(tee_local $1
|
|
||||||
(tee_local $0
|
(tee_local $0
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(get_local $1)
|
(get_local $0)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
)
|
|
||||||
(br_if $continue|0
|
(br_if $continue|0
|
||||||
(get_local $2)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
(get_local $4)
|
(get_local $4)
|
||||||
(get_global $game-of-life/w)
|
(get_global $game-of-life/w)
|
||||||
)
|
)
|
||||||
(tee_local $3
|
(tee_local $2
|
||||||
(select
|
(select
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
@ -128,7 +128,7 @@
|
|||||||
(get_local $4)
|
(get_local $4)
|
||||||
(get_global $game-of-life/w)
|
(get_global $game-of-life/w)
|
||||||
)
|
)
|
||||||
(tee_local $2
|
(tee_local $3
|
||||||
(select
|
(select
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.add
|
(i32.add
|
||||||
@ -150,7 +150,7 @@
|
|||||||
(get_local $0)
|
(get_local $0)
|
||||||
(get_global $game-of-life/w)
|
(get_global $game-of-life/w)
|
||||||
)
|
)
|
||||||
(get_local $3)
|
(get_local $2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -160,7 +160,7 @@
|
|||||||
(get_local $0)
|
(get_local $0)
|
||||||
(get_global $game-of-life/w)
|
(get_global $game-of-life/w)
|
||||||
)
|
)
|
||||||
(get_local $2)
|
(get_local $3)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -170,7 +170,7 @@
|
|||||||
(get_local $5)
|
(get_local $5)
|
||||||
(get_global $game-of-life/w)
|
(get_global $game-of-life/w)
|
||||||
)
|
)
|
||||||
(get_local $3)
|
(get_local $2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -190,7 +190,7 @@
|
|||||||
(get_local $5)
|
(get_local $5)
|
||||||
(get_global $game-of-life/w)
|
(get_global $game-of-life/w)
|
||||||
)
|
)
|
||||||
(get_local $2)
|
(get_local $3)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -205,25 +205,20 @@
|
|||||||
(get_local $1)
|
(get_local $1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(block
|
|
||||||
(if
|
(if
|
||||||
(i32.eqz
|
(if (result i32)
|
||||||
(tee_local $3
|
(tee_local $3
|
||||||
(i32.lt_s
|
(i32.lt_s
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 2)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
(get_local $3)
|
||||||
(set_local $3
|
|
||||||
(i32.gt_s
|
(i32.gt_s
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
(i32.const 3)
|
(i32.const 3)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(if
|
|
||||||
(get_local $3)
|
|
||||||
(i32.store8
|
(i32.store8
|
||||||
(i32.add
|
(i32.add
|
||||||
(i32.add
|
(i32.add
|
||||||
@ -238,7 +233,6 @@
|
|||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(if
|
(if
|
||||||
(i32.eq
|
(i32.eq
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
|
@ -45,173 +45,157 @@
|
|||||||
(unreachable)
|
(unreachable)
|
||||||
)
|
)
|
||||||
(if
|
(if
|
||||||
|
(i32.eqz
|
||||||
|
(if (result i32)
|
||||||
(tee_local $0
|
(tee_local $0
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
(set_local $0
|
(tee_local $0
|
||||||
(i32.const 2)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(if
|
|
||||||
(i32.eqz
|
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
)
|
)
|
||||||
(if
|
|
||||||
(f64.ne
|
|
||||||
(tee_local $1
|
|
||||||
(f64.const 1)
|
|
||||||
)
|
|
||||||
(f64.const 0)
|
|
||||||
)
|
|
||||||
(set_local $1
|
|
||||||
(f64.const 2)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(if
|
(if
|
||||||
(f64.eq
|
(f64.eq
|
||||||
(get_local $1)
|
(if (result f64)
|
||||||
(f64.const 0)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(tee_local $0
|
|
||||||
(i32.const 1)
|
|
||||||
)
|
|
||||||
(set_local $0
|
|
||||||
(i32.const 2)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_global $logical/i
|
|
||||||
(get_local $0)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(i32.ne
|
|
||||||
(get_global $logical/i)
|
|
||||||
(i32.const 2)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(i32.eqz
|
|
||||||
(tee_local $0
|
|
||||||
(i32.const 0)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_local $0
|
|
||||||
(i32.const 1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_global $logical/i
|
|
||||||
(get_local $0)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(i32.ne
|
|
||||||
(get_global $logical/i)
|
|
||||||
(i32.const 1)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(i64.ne
|
|
||||||
(tee_local $2
|
|
||||||
(i64.const 1)
|
|
||||||
)
|
|
||||||
(i64.const 0)
|
|
||||||
)
|
|
||||||
(set_local $2
|
|
||||||
(i64.const 2)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_global $logical/I
|
|
||||||
(get_local $2)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(i64.ne
|
|
||||||
(get_global $logical/I)
|
|
||||||
(i64.const 2)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(i64.eq
|
|
||||||
(tee_local $2
|
|
||||||
(i64.const 0)
|
|
||||||
)
|
|
||||||
(i64.const 0)
|
|
||||||
)
|
|
||||||
(set_local $2
|
|
||||||
(i64.const 1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_global $logical/I
|
|
||||||
(get_local $2)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(i64.ne
|
|
||||||
(get_global $logical/I)
|
|
||||||
(i64.const 1)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(f32.ne
|
|
||||||
(tee_local $3
|
|
||||||
(f32.const 1)
|
|
||||||
)
|
|
||||||
(f32.const 0)
|
|
||||||
)
|
|
||||||
(set_local $3
|
|
||||||
(f32.const 2)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_global $logical/f
|
|
||||||
(get_local $3)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(f32.ne
|
|
||||||
(get_global $logical/f)
|
|
||||||
(f32.const 2)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(f32.eq
|
|
||||||
(tee_local $3
|
|
||||||
(f32.const 0)
|
|
||||||
)
|
|
||||||
(f32.const 0)
|
|
||||||
)
|
|
||||||
(set_local $3
|
|
||||||
(f32.const 1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(set_global $logical/f
|
|
||||||
(get_local $3)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(f32.ne
|
|
||||||
(get_global $logical/f)
|
|
||||||
(f32.const 1)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
(if
|
|
||||||
(f64.ne
|
(f64.ne
|
||||||
(tee_local $1
|
(tee_local $1
|
||||||
(f64.const 1)
|
(f64.const 1)
|
||||||
)
|
)
|
||||||
(f64.const 0)
|
(f64.const 0)
|
||||||
)
|
)
|
||||||
(set_local $1
|
(tee_local $1
|
||||||
(f64.const 2)
|
(f64.const 2)
|
||||||
)
|
)
|
||||||
|
(get_local $1)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(unreachable)
|
||||||
|
)
|
||||||
|
(set_global $logical/i
|
||||||
|
(if (result i32)
|
||||||
|
(tee_local $0
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
(i32.const 2)
|
||||||
|
(get_local $0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(i32.ne
|
||||||
|
(get_global $logical/i)
|
||||||
|
(i32.const 2)
|
||||||
|
)
|
||||||
|
(unreachable)
|
||||||
|
)
|
||||||
|
(set_global $logical/i
|
||||||
|
(if (result i32)
|
||||||
|
(tee_local $0
|
||||||
|
(i32.const 0)
|
||||||
|
)
|
||||||
|
(get_local $0)
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(i32.ne
|
||||||
|
(get_global $logical/i)
|
||||||
|
(i32.const 1)
|
||||||
|
)
|
||||||
|
(unreachable)
|
||||||
|
)
|
||||||
|
(set_global $logical/I
|
||||||
|
(if (result i64)
|
||||||
|
(i64.ne
|
||||||
|
(tee_local $2
|
||||||
|
(i64.const 1)
|
||||||
|
)
|
||||||
|
(i64.const 0)
|
||||||
|
)
|
||||||
|
(i64.const 2)
|
||||||
|
(get_local $2)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(i64.ne
|
||||||
|
(get_global $logical/I)
|
||||||
|
(i64.const 2)
|
||||||
|
)
|
||||||
|
(unreachable)
|
||||||
|
)
|
||||||
|
(set_global $logical/I
|
||||||
|
(if (result i64)
|
||||||
|
(i64.ne
|
||||||
|
(tee_local $2
|
||||||
|
(i64.const 0)
|
||||||
|
)
|
||||||
|
(i64.const 0)
|
||||||
|
)
|
||||||
|
(get_local $2)
|
||||||
|
(i64.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(i64.ne
|
||||||
|
(get_global $logical/I)
|
||||||
|
(i64.const 1)
|
||||||
|
)
|
||||||
|
(unreachable)
|
||||||
|
)
|
||||||
|
(set_global $logical/f
|
||||||
|
(if (result f32)
|
||||||
|
(f32.ne
|
||||||
|
(tee_local $3
|
||||||
|
(f32.const 1)
|
||||||
|
)
|
||||||
|
(f32.const 0)
|
||||||
|
)
|
||||||
|
(f32.const 2)
|
||||||
|
(get_local $3)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(f32.ne
|
||||||
|
(get_global $logical/f)
|
||||||
|
(f32.const 2)
|
||||||
|
)
|
||||||
|
(unreachable)
|
||||||
|
)
|
||||||
|
(set_global $logical/f
|
||||||
|
(if (result f32)
|
||||||
|
(f32.ne
|
||||||
|
(tee_local $3
|
||||||
|
(f32.const 0)
|
||||||
|
)
|
||||||
|
(f32.const 0)
|
||||||
|
)
|
||||||
|
(get_local $3)
|
||||||
|
(f32.const 1)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(if
|
||||||
|
(f32.ne
|
||||||
|
(get_global $logical/f)
|
||||||
|
(f32.const 1)
|
||||||
|
)
|
||||||
|
(unreachable)
|
||||||
)
|
)
|
||||||
(set_global $logical/F
|
(set_global $logical/F
|
||||||
|
(if (result f64)
|
||||||
|
(f64.ne
|
||||||
|
(tee_local $1
|
||||||
|
(f64.const 1)
|
||||||
|
)
|
||||||
|
(f64.const 0)
|
||||||
|
)
|
||||||
|
(f64.const 2)
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(if
|
(if
|
||||||
(f64.ne
|
(f64.ne
|
||||||
(get_global $logical/F)
|
(get_global $logical/F)
|
||||||
@ -219,20 +203,18 @@
|
|||||||
)
|
)
|
||||||
(unreachable)
|
(unreachable)
|
||||||
)
|
)
|
||||||
(if
|
(set_global $logical/F
|
||||||
(f64.eq
|
(if (result f64)
|
||||||
|
(f64.ne
|
||||||
(tee_local $1
|
(tee_local $1
|
||||||
(f64.const 0)
|
(f64.const 0)
|
||||||
)
|
)
|
||||||
(f64.const 0)
|
(f64.const 0)
|
||||||
)
|
)
|
||||||
(set_local $1
|
(get_local $1)
|
||||||
(f64.const 1)
|
(f64.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $logical/F
|
|
||||||
(get_local $1)
|
|
||||||
)
|
|
||||||
(if
|
(if
|
||||||
(f64.ne
|
(f64.ne
|
||||||
(get_global $logical/F)
|
(get_global $logical/F)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6,37 +6,16 @@
|
|||||||
(export "doSwitchDefaultOmitted" (func $switch/doSwitchDefaultOmitted))
|
(export "doSwitchDefaultOmitted" (func $switch/doSwitchDefaultOmitted))
|
||||||
(export "memory" (memory $0))
|
(export "memory" (memory $0))
|
||||||
(func $switch/doSwitch (; 0 ;) (type $ii) (param $0 i32) (result i32)
|
(func $switch/doSwitch (; 0 ;) (type $ii) (param $0 i32) (result i32)
|
||||||
(local $1 i32)
|
|
||||||
(block $case4|0
|
(block $case4|0
|
||||||
(block $case2|0
|
(block $case2|0
|
||||||
(if
|
(block $case0|0
|
||||||
(i32.ne
|
(block $tablify|0
|
||||||
(tee_local $1
|
(br_table $case2|0 $case0|0 $case4|0 $case4|0 $tablify|0
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
(i32.const 1)
|
|
||||||
)
|
|
||||||
(block
|
|
||||||
(br_if $case2|0
|
|
||||||
(i32.eqz
|
|
||||||
(get_local $1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(br_if $case4|0
|
|
||||||
(i32.eq
|
|
||||||
(get_local $1)
|
|
||||||
(i32.const 2)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(br_if $case4|0
|
|
||||||
(i32.eq
|
|
||||||
(get_local $1)
|
|
||||||
(i32.const 3)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
(br $case2|0)
|
(br $case2|0)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(return
|
(return
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
@ -48,33 +27,20 @@
|
|||||||
(i32.const 23)
|
(i32.const 23)
|
||||||
)
|
)
|
||||||
(func $switch/doSwitchDefaultFirst (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
(func $switch/doSwitchDefaultFirst (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||||
(local $1 i32)
|
|
||||||
(block $case3|0
|
(block $case3|0
|
||||||
(if
|
(block $case1|0
|
||||||
(i32.ne
|
(block $tablify|0
|
||||||
(tee_local $1
|
(br_table $case1|0 $case3|0 $case3|0 $tablify|0
|
||||||
|
(i32.sub
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
(block
|
|
||||||
(br_if $case3|0
|
|
||||||
(i32.eq
|
|
||||||
(get_local $1)
|
|
||||||
(i32.const 2)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(br_if $case3|0
|
|
||||||
(i32.eq
|
|
||||||
(get_local $1)
|
|
||||||
(i32.const 3)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(return
|
(return
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(return
|
(return
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
@ -82,32 +48,19 @@
|
|||||||
(i32.const 23)
|
(i32.const 23)
|
||||||
)
|
)
|
||||||
(func $switch/doSwitchDefaultOmitted (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
(func $switch/doSwitchDefaultOmitted (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
||||||
(local $1 i32)
|
|
||||||
(block $break|0
|
(block $break|0
|
||||||
(block $case2|0
|
(block $case2|0
|
||||||
(if
|
(block $case0|0
|
||||||
(i32.ne
|
(block $tablify|0
|
||||||
(tee_local $1
|
(br_table $case0|0 $case2|0 $case2|0 $tablify|0
|
||||||
|
(i32.sub
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
(block
|
|
||||||
(br_if $case2|0
|
|
||||||
(i32.eq
|
|
||||||
(get_local $1)
|
|
||||||
(i32.const 2)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(br_if $case2|0
|
|
||||||
(i32.eq
|
|
||||||
(get_local $1)
|
|
||||||
(i32.const 3)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(br $break|0)
|
(br $break|0)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(return
|
(return
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
|
@ -5,28 +5,14 @@
|
|||||||
(export "memory" (memory $0))
|
(export "memory" (memory $0))
|
||||||
(start $start)
|
(start $start)
|
||||||
(func $start (; 0 ;) (type $v)
|
(func $start (; 0 ;) (type $v)
|
||||||
(local $0 i32)
|
|
||||||
(set_global $ternary/a
|
(set_global $ternary/a
|
||||||
(tee_local $0
|
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(set_global $ternary/a
|
(set_global $ternary/a
|
||||||
(tee_local $0
|
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(if
|
|
||||||
(tee_local $0
|
|
||||||
(i32.const 1)
|
|
||||||
)
|
|
||||||
(set_local $0
|
|
||||||
(i32.const 1)
|
|
||||||
)
|
|
||||||
(unreachable)
|
|
||||||
)
|
|
||||||
(set_global $ternary/a
|
(set_global $ternary/a
|
||||||
(get_local $0)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -65,18 +65,30 @@
|
|||||||
(i32.const -1)
|
(i32.const -1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(set_global $unary/i
|
||||||
|
(block (result i32)
|
||||||
(set_global $unary/i
|
(set_global $unary/i
|
||||||
(i32.add
|
(i32.add
|
||||||
(get_global $unary/i)
|
(get_global $unary/i)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(get_global $unary/i)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/i
|
||||||
|
(block (result i32)
|
||||||
(set_global $unary/i
|
(set_global $unary/i
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(get_global $unary/i)
|
(get_global $unary/i)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(get_global $unary/i)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/i
|
||||||
|
(block (result i32)
|
||||||
(set_global $unary/i
|
(set_global $unary/i
|
||||||
(i32.add
|
(i32.add
|
||||||
(tee_local $0
|
(tee_local $0
|
||||||
@ -85,9 +97,11 @@
|
|||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $unary/i
|
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/i
|
||||||
|
(block (result i32)
|
||||||
(set_global $unary/i
|
(set_global $unary/i
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(tee_local $0
|
(tee_local $0
|
||||||
@ -96,9 +110,9 @@
|
|||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $unary/i
|
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(set_global $unary/I
|
(set_global $unary/I
|
||||||
(i64.add
|
(i64.add
|
||||||
(get_global $unary/I)
|
(get_global $unary/I)
|
||||||
@ -154,18 +168,30 @@
|
|||||||
(i64.const -1)
|
(i64.const -1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(set_global $unary/I
|
||||||
|
(block (result i64)
|
||||||
(set_global $unary/I
|
(set_global $unary/I
|
||||||
(i64.add
|
(i64.add
|
||||||
(get_global $unary/I)
|
(get_global $unary/I)
|
||||||
(i64.const 1)
|
(i64.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(get_global $unary/I)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/I
|
||||||
|
(block (result i64)
|
||||||
(set_global $unary/I
|
(set_global $unary/I
|
||||||
(i64.sub
|
(i64.sub
|
||||||
(get_global $unary/I)
|
(get_global $unary/I)
|
||||||
(i64.const 1)
|
(i64.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(get_global $unary/I)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/I
|
||||||
|
(block (result i64)
|
||||||
(set_global $unary/I
|
(set_global $unary/I
|
||||||
(i64.add
|
(i64.add
|
||||||
(tee_local $1
|
(tee_local $1
|
||||||
@ -174,9 +200,11 @@
|
|||||||
(i64.const 1)
|
(i64.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $unary/I
|
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/I
|
||||||
|
(block (result i64)
|
||||||
(set_global $unary/I
|
(set_global $unary/I
|
||||||
(i64.sub
|
(i64.sub
|
||||||
(tee_local $1
|
(tee_local $1
|
||||||
@ -185,9 +213,9 @@
|
|||||||
(i64.const 1)
|
(i64.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $unary/I
|
|
||||||
(get_local $1)
|
(get_local $1)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(set_global $unary/f
|
(set_global $unary/f
|
||||||
(f32.add
|
(f32.add
|
||||||
(get_global $unary/f)
|
(get_global $unary/f)
|
||||||
@ -232,18 +260,30 @@
|
|||||||
(f32.const 0)
|
(f32.const 0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(set_global $unary/f
|
||||||
|
(block (result f32)
|
||||||
(set_global $unary/f
|
(set_global $unary/f
|
||||||
(f32.add
|
(f32.add
|
||||||
(get_global $unary/f)
|
(get_global $unary/f)
|
||||||
(f32.const 1)
|
(f32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(get_global $unary/f)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/f
|
||||||
|
(block (result f32)
|
||||||
(set_global $unary/f
|
(set_global $unary/f
|
||||||
(f32.sub
|
(f32.sub
|
||||||
(get_global $unary/f)
|
(get_global $unary/f)
|
||||||
(f32.const 1)
|
(f32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(get_global $unary/f)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/f
|
||||||
|
(block (result f32)
|
||||||
(set_global $unary/f
|
(set_global $unary/f
|
||||||
(f32.add
|
(f32.add
|
||||||
(tee_local $2
|
(tee_local $2
|
||||||
@ -252,9 +292,11 @@
|
|||||||
(f32.const 1)
|
(f32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $unary/f
|
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/f
|
||||||
|
(block (result f32)
|
||||||
(set_global $unary/f
|
(set_global $unary/f
|
||||||
(f32.sub
|
(f32.sub
|
||||||
(tee_local $2
|
(tee_local $2
|
||||||
@ -263,9 +305,9 @@
|
|||||||
(f32.const 1)
|
(f32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $unary/f
|
|
||||||
(get_local $2)
|
(get_local $2)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
(set_global $unary/F
|
(set_global $unary/F
|
||||||
(f64.add
|
(f64.add
|
||||||
(get_global $unary/F)
|
(get_global $unary/F)
|
||||||
@ -312,18 +354,30 @@
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(set_global $unary/F
|
||||||
|
(block (result f64)
|
||||||
(set_global $unary/F
|
(set_global $unary/F
|
||||||
(f64.add
|
(f64.add
|
||||||
(get_global $unary/F)
|
(get_global $unary/F)
|
||||||
(f64.const 1)
|
(f64.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(get_global $unary/F)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/F
|
||||||
|
(block (result f64)
|
||||||
(set_global $unary/F
|
(set_global $unary/F
|
||||||
(f64.sub
|
(f64.sub
|
||||||
(get_global $unary/F)
|
(get_global $unary/F)
|
||||||
(f64.const 1)
|
(f64.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
(get_global $unary/F)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/F
|
||||||
|
(block (result f64)
|
||||||
(set_global $unary/F
|
(set_global $unary/F
|
||||||
(f64.add
|
(f64.add
|
||||||
(tee_local $3
|
(tee_local $3
|
||||||
@ -332,9 +386,11 @@
|
|||||||
(f64.const 1)
|
(f64.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $unary/F
|
|
||||||
(get_local $3)
|
(get_local $3)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
(set_global $unary/F
|
||||||
|
(block (result f64)
|
||||||
(set_global $unary/F
|
(set_global $unary/F
|
||||||
(f64.sub
|
(f64.sub
|
||||||
(tee_local $3
|
(tee_local $3
|
||||||
@ -343,8 +399,8 @@
|
|||||||
(f64.const 1)
|
(f64.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(set_global $unary/F
|
|
||||||
(get_local $3)
|
(get_local $3)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
@ -5,56 +5,42 @@
|
|||||||
(export "loopWhileInWhile" (func $while/loopWhileInWhile))
|
(export "loopWhileInWhile" (func $while/loopWhileInWhile))
|
||||||
(export "memory" (memory $0))
|
(export "memory" (memory $0))
|
||||||
(func $while/loopWhile (; 0 ;) (type $iv) (param $0 i32)
|
(func $while/loopWhile (; 0 ;) (type $iv) (param $0 i32)
|
||||||
(local $1 i32)
|
|
||||||
(set_local $1
|
|
||||||
(get_local $0)
|
|
||||||
)
|
|
||||||
(loop $continue|0
|
(loop $continue|0
|
||||||
(if
|
(if
|
||||||
(get_local $1)
|
(get_local $0)
|
||||||
(block
|
(block
|
||||||
(set_local $0
|
(set_local $0
|
||||||
(tee_local $1
|
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(br $continue|0)
|
(br $continue|0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(func $while/loopWhileInWhile (; 1 ;) (type $iv) (param $0 i32)
|
(func $while/loopWhileInWhile (; 1 ;) (type $iv) (param $0 i32)
|
||||||
(local $1 i32)
|
|
||||||
(set_local $1
|
|
||||||
(get_local $0)
|
|
||||||
)
|
|
||||||
(loop $continue|0
|
(loop $continue|0
|
||||||
(if
|
(if
|
||||||
(get_local $1)
|
(get_local $0)
|
||||||
(block
|
(block
|
||||||
(set_local $0
|
(set_local $0
|
||||||
(tee_local $1
|
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(get_local $0)
|
(get_local $0)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(loop $continue|1
|
(loop $continue|1
|
||||||
(if
|
(if
|
||||||
(get_local $1)
|
(get_local $0)
|
||||||
(block
|
(block
|
||||||
(set_local $0
|
(set_local $0
|
||||||
(tee_local $1
|
|
||||||
(i32.sub
|
(i32.sub
|
||||||
(get_local $1)
|
(get_local $0)
|
||||||
(i32.const 1)
|
(i32.const 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
(br $continue|1)
|
(br $continue|1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user