Update binaryen to latest nightly; Source map support

This commit is contained in:
dcodeIO
2018-02-02 03:07:54 +01:00
parent a8da04404a
commit 4736227879
120 changed files with 24133 additions and 2243 deletions

View File

@ -17,6 +17,9 @@ try {
assemblyscript = require("../src");
}
const SOURCEMAP_ROOT = "assemblyscript:///";
const LIBRARY_PREFIX = assemblyscript.LIBRARY_PREFIX;
const conf = require("./asc.json");
const opts = {};
@ -126,7 +129,7 @@ libDirs.forEach(libDir => {
var nextText = fs.readFileSync(path.join(libDir, file), { encoding: "utf8" });
++readCount;
var time = measure(() => {
parser = assemblyscript.parseFile(nextText, ".std/" + file, parser, false);
parser = assemblyscript.parseFile(nextText, LIBRARY_PREFIX + file, parser, false);
});
parseTime += time;
notIoTime += time;
@ -170,7 +173,7 @@ args._.forEach(filename => {
while ((nextFile = parser.nextFile()) != null) {
var found = false;
if (nextFile.startsWith(".std/")) {
if (nextFile.startsWith(LIBRARY_PREFIX)) {
for (var i = 0; i < libDirs.length; ++i) {
readTime += measure(() => {
try {
@ -311,15 +314,17 @@ if (runPasses.length)
function processSourceMap(sourceMap, sourceMapURL) {
var json = JSON.parse(sourceMap);
return SourceMapConsumer.with(sourceMap, sourceMapURL, consumer => {
json.sources = json.sources.map(name => SOURCEMAP_ROOT + name);
var libPrefix = SOURCEMAP_ROOT + LIBRARY_PREFIX;
return SourceMapConsumer.with(json, sourceMapURL, consumer => {
var generator = SourceMapGenerator.fromSourceMap(consumer);
json.sources.forEach(name => {
var text, found = false;
if (name.startsWith(".std/")) {
if (name.startsWith(libPrefix)) {
for (var i = 0, k = libDirs.length; i < k; ++i) {
readTime += measure(() => {
try {
text = fs.readFileSync(path.join(libDirs[i], name.substring(4)), { encoding: "utf8" });
text = fs.readFileSync(path.join(libDirs[i], name.substring(libPrefix.length)), { encoding: "utf8" });
found = true;
} catch (e) {}
});
@ -328,15 +333,16 @@ function processSourceMap(sourceMap, sourceMapURL) {
} else {
readTime += measure(() => {
try {
text = fs.readFileSync(name, { encoding: "utf8" });
text = fs.readFileSync(name.substring(SOURCEMAP_ROOT.length), { encoding: "utf8" });
found = true;
} catch (e) {}
});
++readCount;
}
if (found)
if (found) {
generator.setSourceContent(name, text);
else
console.log(name + " ???");
} else
console.error("No source content found for file '" + name + "'.");
});
return generator.toString();
@ -362,7 +368,7 @@ if (!args.noEmit) {
: null;
var binary;
writeTime += measure(() => {
binary = module.toBinary(sourceMapURL); // FIXME: 'not a valid URL' in FF
binary = module.toBinary("http://127.0.0.1:8080/"+sourceMapURL); // FIXME: 'not a valid URL' in FF
fs.writeFileSync(args.binaryFile, binary.output);
});
++writeCount;

1
examples/.gitignore vendored
View File

@ -1,5 +1,6 @@
*.wast
*.wasm
*.wasm.map
node_modules/
npm-debug.log
package-lock.json

View File

@ -5,7 +5,7 @@ fetch("game-of-life.optimized.wasm").then(response => response.arrayBuffer()).th
// Instantiate the module
var module = new WebAssembly.Module(binary);
var instance = new WebAssembly.Instance(module, { /* no imports */ });
var instance = new WebAssembly.Instance(module, { env: { abort: function() {} } });
// Set up the canvas with a 2D rendering context
var cnv = document.getElementById("canvas");

View File

@ -4,8 +4,8 @@
"private": true,
"scripts": {
"build": "npm run build:untouched && npm run build:optimized",
"build:untouched": "asc assembly/game-of-life.ts -b game-of-life.untouched.wasm -t game-of-life.untouched.wast --validate",
"build:optimized": "asc -O assembly/game-of-life.ts -b game-of-life.optimized.wasm -t game-of-life.optimized.wast --validate",
"build:untouched": "asc assembly/game-of-life.ts -b game-of-life.untouched.wasm -t game-of-life.untouched.wast --validate --sourceMap --measure",
"build:optimized": "asc -O assembly/game-of-life.ts -b game-of-life.optimized.wasm -t game-of-life.optimized.wast --validate --sourceMap --measure",
"browser": "game-of-life.html"
}
}

View File

@ -17,8 +17,8 @@
},
"scripts": {
"build": "npm run build:untouched && npm run build:optimized",
"build:untouched": "asc assembly/i64.ts -t i64.untouched.wast -b i64.untouched.wasm --noMemory --validate",
"build:optimized": "asc -O assembly/i64.ts -b i64.optimized.wasm -t i64.optimized.wast --noMemory --validate",
"build:untouched": "asc assembly/i64.ts -t i64.untouched.wast -b i64.untouched.wasm --noMemory --validate --sourceMap --measure",
"build:optimized": "asc -O assembly/i64.ts -b i64.optimized.wasm -t i64.optimized.wast --noMemory --validate --sourceMap --measure",
"test": "node tests"
},
"files": [

View File

@ -4,8 +4,8 @@
"private": true,
"scripts": {
"build": "npm run build:untouched && npm run build:optimized",
"build:untouched": "asc assembly/pson.ts -b pson.untouched.wasm -t pson.untouched.wast --validate",
"build:optimized": "asc -O assembly/pson.ts -b pson.optimized.wasm -t pson.optimized.wast --validate",
"build:untouched": "asc assembly/pson.ts -b pson.untouched.wasm -t pson.untouched.wast --validate --sourceMap --measure",
"build:optimized": "asc -O assembly/pson.ts -b pson.optimized.wasm -t pson.optimized.wast --validate --sourceMap --measure",
"test": "node tests"
},
"devDependencies": {

View File

@ -1,8 +1,7 @@
![](https://s.gravatar.com/avatar/f105de3decfafc734b8eabe9a960b25d?size=48) TLSF
=================
An implementation of the [Two Level Segregate Fit](http://www.gii.upv.es/tlsf/main/docs)
memory allocator in AssemblyScript.
An implementation of the [Two Level Segregate Fit](http://www.gii.upv.es/tlsf/main/docs) memory allocator in AssemblyScript.
Instructions
------------

View File

@ -4,8 +4,8 @@
"private": true,
"scripts": {
"build": "npm run build:untouched && npm run build:optimized",
"build:untouched": "asc assembly/ugc.ts -t ugc.untouched.wast -b ugc.untouched.wasm --validate",
"build:optimized": "asc -O3 assembly/ugc.ts -b ugc.optimized.wasm -t ugc.optimized.wast --validate --noDebug --noAssert",
"build:untouched": "asc assembly/ugc.ts -t ugc.untouched.wast -b ugc.untouched.wasm --validate --sourceMap --measure",
"build:optimized": "asc -O3 assembly/ugc.ts -b ugc.optimized.wasm -t ugc.optimized.wast --validate --noDebug --noAssert --sourceMap --measure",
"test": "node tests"
}
}

View File

@ -1,4 +1,4 @@
![](https://s.gravatar.com/avatar/f105de3decfafc734b8eabe9a960b25d?size=64) utils
![](https://s.gravatar.com/avatar/f105de3decfafc734b8eabe9a960b25d?size=48) utils
=================
Utilities for working with [AssemblyScript](http://assemblyscript.org) modules.

View File

@ -1,4 +1,4 @@
![](https://s.gravatar.com/avatar/f105de3decfafc734b8eabe9a960b25d?size=64) webpack
![](https://s.gravatar.com/avatar/f105de3decfafc734b8eabe9a960b25d?size=48) webpack
=================
[webpack](https://webpack.js.org/) loader for [AssemblyScript](http://assemblyscript.org) modules.
@ -7,9 +7,9 @@ Usage
-----
```js
import Module from "@assemblyscript/webpack!module.wasm";
import MyModule from "@assemblyscript/webpack!mymodule.wasm";
var myModule = Module({ imports: { ... }});
var myModule = new MyModule({ imports: { /* if any */ } });
```
TODO: Wire .ts files to the compiler API, accepting options, but also keep raw .wasm support.
TODO: Pipe .ts files through `asc`, accepting the usual options, but also keep raw .wasm support.

View File

@ -2,7 +2,7 @@
var s64 = new Array(123);
for (var i = 0; i < 64;) s64[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
module.exports = function(string) {
module.exports = function decode(string) {
// determine buffer length
var length = string.length;

View File

@ -4,9 +4,10 @@ function loader(buffer) {
var data = base64.encode(buffer, 0, buffer.length);
var code = [
'var data = "' + data + '", wasm;',
'module.exports = function(options) {',
' if (!wasm) wasm = require("@assemblyscript/webpack/decode")(data);',
' return new WebAssembly.Instance(new WebAssembly.Module(wasm), options && options.imports || {}).exports;',
'module.exports = function AssemblyScriptModule(options) {',
' if (!wasm)',
' wasm = new WebAssembly.Module(require("@assemblyscript/webpack/decode")(data));',
' return new WebAssembly.Instance(wasm, options && options.imports || {}).exports;',
'};'
];
return code.join("\n") + "\n";

2341
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,25 +11,20 @@
"url": "https://github.com/AssemblyScript/assemblyscript/issues"
},
"dependencies": {
"binaryen": "42.0.0-nightly.20180120",
"binaryen": "42.0.0-nightly.20180202",
"glob": "^7.1.2",
"minimist": "^1.2.0"
"minimist": "^1.2.0",
"source-map": "^0.7.0"
},
"devDependencies": {
"@types/chalk": "^2.2.0",
"@types/diff": "^3.2.2",
"@types/glob": "^5.0.34",
"@types/long": "^3.0.32",
"@types/minimist": "^1.2.0",
"@types/node": "^8.5.9",
"chalk": "^2.3.0",
"diff": "^3.4.0",
"long": "^3.2.0",
"source-map-support": "^0.5.2",
"ts-loader": "^3.2.0",
"source-map-support": "^0.5.3",
"ts-loader": "^3.4.0",
"ts-node": "^4.1.0",
"tslint": "^5.9.1",
"typescript": "^2.6.2",
"typescript": "^2.7.1",
"webpack": "^3.10.0"
},
"main": "index.js",

View File

@ -421,8 +421,17 @@ export abstract class Node {
stmt.range = range;
for (var i = 0, k = (stmt.members = members).length; i < k; ++i) members[i].parent = stmt;
stmt.path = path;
stmt.normalizedPath = path ? resolvePath(normalizePath(path.value), range.source.normalizedPath) : null;
stmt.internalPath = stmt.normalizedPath ? mangleInternalPath(stmt.normalizedPath) : null;
if (path) {
var normalizedPath = normalizePath(path.value);
if (path.value.startsWith(".")) // relative
stmt.normalizedPath = resolvePath(normalizedPath, range.source.normalizedPath);
else // absolute
stmt.normalizedPath = normalizedPath;
stmt.internalPath = mangleInternalPath(stmt.normalizedPath);
} else {
stmt.normalizedPath = null;
stmt.internalPath = null;
}
if (stmt.modifiers = modifiers)
for (i = 0, k = (<Modifier[]>modifiers).length; i < k; ++i)
(<Modifier[]>modifiers)[i].parent = stmt;
@ -470,7 +479,11 @@ export abstract class Node {
(<ImportDeclaration[]>declarations)[i].parent = stmt;
stmt.namespaceName = null;
stmt.path = path;
stmt.normalizedPath = resolvePath(normalizePath(path.value), range.source.normalizedPath);
var normalizedPath = normalizePath(path.value);
if (path.value.startsWith(".")) // relative
stmt.normalizedPath = resolvePath(normalizedPath, range.source.normalizedPath);
else // absolute
stmt.normalizedPath = normalizedPath;
stmt.internalPath = mangleInternalPath(stmt.normalizedPath);
return stmt;
}
@ -1000,7 +1013,7 @@ export abstract class Statement extends Node { }
export enum SourceKind {
DEFAULT,
ENTRY,
STDLIB
LIBRARY
}
/** A top-level source node. */
@ -1010,8 +1023,6 @@ export class Source extends Node {
/** Source kind. */
sourceKind: SourceKind;
/** Path as provided to the parser. */
path: string;
/** Normalized path. */
normalizedPath: string;
/** Path used internally. */
@ -1022,13 +1033,14 @@ export class Source extends Node {
text: string;
/** Tokenizer reference. */
tokenizer: Tokenizer | null = null;
/** Source map index. */
debugInfoIndex: i32 = -1;
/** Constructs a new source node. */
constructor(path: string, text: string, kind: SourceKind = SourceKind.DEFAULT) {
constructor(normalizedPath: string, text: string, kind: SourceKind = SourceKind.DEFAULT) {
super();
this.sourceKind = kind;
this.path = path;
this.normalizedPath = normalizePath(path, true);
this.normalizedPath = normalizedPath;
this.internalPath = mangleInternalPath(this.normalizedPath);
this.statements = new Array();
this.range = new Range(this, 0, text.length);
@ -1038,7 +1050,7 @@ export class Source extends Node {
/** Tests if this source is an entry file. */
get isEntry(): bool { return this.sourceKind == SourceKind.ENTRY; }
/** Tests if this source is a stdlib file. */
get isStdlib(): bool { return this.sourceKind == SourceKind.STDLIB; }
get isStdlib(): bool { return this.sourceKind == SourceKind.LIBRARY; }
}
/** Base class of all declaration statements. */
@ -1345,7 +1357,7 @@ export class Parameter extends Node {
kind = NodeKind.PARAMETER;
/** Parameter name. */
name: IdentifierExpression;
name: IdentifierExpression | null;
/** Parameter type. */
type: TypeNode | null;
/** Initializer expression, if present. */
@ -1528,6 +1540,8 @@ export function mangleInternalName(declaration: DeclarationStatement, asGlobal:
/** Mangles an external to an internal path. */
export function mangleInternalPath(path: string): string {
if (path.endsWith(".ts"))
path = path.substring(0, path.length - 3);
// not necessary with current config
// if (PATH_DELIMITER.charCodeAt(0) != CharCode.SLASH)
// path = path.replace("/", PATH_DELIMITER);

View File

@ -37,7 +37,9 @@ import {
import {
Program,
Global,
Function,
FunctionPrototype,
Parameter,
Local,
ElementFlags,
Class,
@ -88,6 +90,18 @@ export function initialize(program: Program): void {
addFunction(program, "changetype", true);
addFunction(program, "assert");
// abort is special in that it is imported conditionally. for example, when
// compiling with noAssert=true, it isn't necessary that it is present, that
// is if a user doesn't call it manually.
var abortPrototype = addFunction(program, "abort");
abortPrototype.set(ElementFlags.DECLARED);
abortPrototype.instances.set("", new Function(abortPrototype, "abort", null, [
new Parameter(null, program.options.usizeType), // message (string)
new Parameter(null, program.options.usizeType), // file name (string)
new Parameter(null, Type.u32), // line number
new Parameter(null, Type.u32) // column number
], Type.void, null));
// conversions and limits
var i32Func: FunctionPrototype,
u32Func: FunctionPrototype,
@ -1540,8 +1554,8 @@ export function compileCall(compiler: Compiler, prototype: FunctionPrototype, ty
compiler.error(DiagnosticCode.Operation_not_supported, reportNode.range);
return module.createUnreachable();
}
if (reportNode.range.source.sourceKind != SourceKind.STDLIB)
compiler.warning(DiagnosticCode.Operation_is_unsafe, reportNode.range);
// if (reportNode.range.source.sourceKind != SourceKind.STDLIB)
// compiler.warning(DiagnosticCode.Operation_is_unsafe, reportNode.range);
return arg0; // any usize to any usize
case "assert": // assert<T?>(isTrueish: T, message?: string) -> T with T != null (see also assembly.d.ts)
@ -1904,7 +1918,7 @@ export function compileAllocate(compiler: Compiler, cls: Class, reportNode: Node
return compiler.module.createUnreachable();
}
/** Compiles an abort wired to the global 'abort' function if present. */
/** Compiles an abort wired to the conditionally imported 'abort' function. */
export function compileAbort(compiler: Compiler, message: Expression | null, reportNode: Node): ExpressionRef {
var module = compiler.module;
@ -1913,18 +1927,14 @@ export function compileAbort(compiler: Compiler, message: Expression | null, rep
var stringType = compiler.program.types.get("string");
if (abortPrototype && abortPrototype.kind == ElementKind.FUNCTION_PROTOTYPE && stringType) {
var abortInstance = (<FunctionPrototype>abortPrototype).resolve();
if (abortInstance) {
if (abortInstance.parameters.length != 4) {
// TODO: validate parameter types (currently becomes a validation error if invalid)
var abortDeclaration = assert((<FunctionPrototype>abortPrototype).declaration);
compiler.error(DiagnosticCode.Expected_0_arguments_but_got_1, abortDeclaration.name.range, "4", abortInstance.parameters.length.toString(10));
} else if (compiler.compileFunction(abortInstance)) {
if (abortInstance && compiler.compileFunction(abortInstance)) { // reports
assert(abortInstance.parameters.length == 4); // to be sure
abort = module.createBlock(null, [
compiler.makeCall(abortInstance, [
message != null
? compiler.compileExpression(message, stringType)
: compiler.options.usizeType.toNativeZero(module),
compiler.compileStaticString(reportNode.range.source.path),
compiler.compileStaticString(reportNode.range.source.normalizedPath),
module.createI32(reportNode.range.line),
module.createI32(reportNode.range.column)
]),
@ -1932,6 +1942,5 @@ export function compileAbort(compiler: Compiler, message: Expression | null, rep
]);
}
}
}
return abort;
}

View File

@ -43,7 +43,8 @@ import {
Flow,
FlowFlags,
ElementFlags,
PATH_DELIMITER
PATH_DELIMITER,
LIBRARY_PREFIX
} from "./program";
import {
@ -56,6 +57,7 @@ import {
TypeNode,
Source,
SourceKind,
Range,
Statement,
BlockStatement,
@ -150,6 +152,8 @@ export class Options {
allocateImpl: string = "allocate_memory";
/** Memory freeing implementation to use. */
freeImpl: string = "free_memory";
/** If true, generates information necessary for source maps. */
sourceMap: bool = false;
/** Tests if the target is WASM64 or, otherwise, WASM32. */
get isWasm64(): bool { return this.target == Target.WASM64; }
@ -216,7 +220,7 @@ export class Compiler extends DiagnosticEmitter {
this.memoryOffset = new U64(this.options.usizeType.byteSize); // leave space for `null`
this.module = Module.create();
// set up start function
// set up the start function wrapping top-level statements, of all files.
var startFunctionTemplate = new FunctionPrototype(program, "start", "start", null);
var startFunctionInstance = new Function(startFunctionTemplate, startFunctionTemplate.internalName, [], [], Type.void, null);
startFunctionInstance.set(ElementFlags.START);
@ -229,40 +233,40 @@ export class Compiler extends DiagnosticEmitter {
// initialize lookup maps, built-ins, imports, exports, etc.
this.program.initialize(this.options);
// compile entry file (exactly one, usually)
var sources = this.program.sources;
for (var i = 0, k = sources.length; i < k; ++i)
if (sources[i].isEntry)
this.compileSource(sources[i]);
// make start function if not empty
// compile entry file(s) while traversing to reachable elements
for (var i = 0, k = sources.length; i < k; ++i)
if (sources[i].isEntry) this.compileSource(sources[i]);
// compile the start function if not empty
if (this.startFunctionBody.length) {
var typeRef = this.module.getFunctionTypeBySignature(NativeType.None, []);
if (!typeRef)
typeRef = this.module.addFunctionType("v", NativeType.None, []);
if (!typeRef) typeRef = this.module.addFunctionType("v", NativeType.None, []);
var ref: FunctionRef;
this.module.setStart(
this.module.addFunction(this.startFunction.prototype.internalName, typeRef, typesToNativeTypes(this.startFunction.additionalLocals),
ref = this.module.addFunction(this.startFunction.prototype.internalName, typeRef, typesToNativeTypes(this.startFunction.additionalLocals),
this.module.createBlock(null, this.startFunctionBody)
)
);
this.startFunction.finalize(this.module, ref);
}
// set up memory
// set up static memory segments and the heap base pointer
if (!this.options.noMemory) {
var initial = this.memoryOffset.clone();
var alignMask = this.options.usizeType.byteSize - 1;
initial.add32(alignMask); // align to 4/8 bytes
initial.and32(~alignMask, ~0);
if (this.options.target == Target.WASM64)
this.module.addGlobal("HEAP_BASE", NativeType.I64, false, this.module.createI64(initial.lo, initial.hi));
else
this.module.addGlobal("HEAP_BASE", NativeType.I32, false, this.module.createI32(initial.lo));
// determine initial page size
var initialOverlaps = initial.clone();
initialOverlaps.and32(0xffff);
if (!initialOverlaps.isZero) {
initial.or32(0xffff);
initial.add32(1);
}
initial.shru32(16); // now is initial size in 64k pages
initial.add32(0xffff); // align to page size
initial.and32(~0xffff, ~0);
initial.shru32(16); // ^= number of pages
this.module.setMemory(initial.toI32(), Module.MAX_MEMORY_WASM32 /* TODO: not WASM64 compatible yet */, this.memorySegments, this.options.target, "memory");
}
return this.module;
@ -270,39 +274,68 @@ export class Compiler extends DiagnosticEmitter {
// sources
compileSourceByPath(normalizedPath: string, reportNode: Node): void {
for (var i = 0, k = this.program.sources.length; i < k; ++i) {
var importedSource = this.program.sources[i];
if (importedSource.normalizedPath == normalizedPath) {
this.compileSource(importedSource);
compileSourceByPath(normalizedPathWithoutExtension: string, reportNode: Node): void {
var sources = this.program.sources;
var expected = normalizedPathWithoutExtension + ".ts";
for (var i = 0, k = sources.length; i < k; ++i) {
var source = sources[i];
var actual = source.normalizedPath;
if (source.normalizedPath == expected) {
this.compileSource(source);
return;
}
}
this.error(DiagnosticCode.File_0_not_found, reportNode.range, normalizedPath);
expected = normalizedPathWithoutExtension + "/index.ts";
for (var i = 0, k = sources.length; i < k; ++i) {
var source = sources[i];
var actual = source.normalizedPath;
if (source.normalizedPath == expected) {
this.compileSource(source);
return;
}
}
expected = LIBRARY_PREFIX + normalizedPathWithoutExtension + ".ts";
for (var i = 0, k = sources.length; i < k; ++i) {
var source = sources[i];
var actual = source.normalizedPath;
if (source.normalizedPath == expected) {
this.compileSource(source);
return;
}
}
this.error(DiagnosticCode.File_0_not_found, reportNode.range, normalizedPathWithoutExtension);
}
compileSource(source: Source): void {
if (this.files.has(source.normalizedPath))
var files = this.files;
if (files.has(source.normalizedPath))
return;
this.files.add(source.normalizedPath);
files.add(source.normalizedPath);
var noTreeShaking = this.options.noTreeShaking;
for (var i = 0, k = source.statements.length; i < k; ++i) {
var statement = source.statements[i];
var isEntry = source.isEntry;
var startFunctionBody = this.startFunctionBody;
var statements = source.statements;
for (var i = 0, k = statements.length; i < k; ++i) {
var statement = statements[i];
switch (statement.kind) {
case NodeKind.CLASSDECLARATION:
if ((noTreeShaking || source.isEntry && hasModifier(ModifierKind.EXPORT, (<ClassDeclaration>statement).modifiers)) && !(<ClassDeclaration>statement).typeParameters.length)
if ((noTreeShaking || isEntry && hasModifier(ModifierKind.EXPORT, (<ClassDeclaration>statement).modifiers)) && !(<ClassDeclaration>statement).typeParameters.length)
this.compileClassDeclaration(<ClassDeclaration>statement, []);
break;
case NodeKind.ENUMDECLARATION:
if (noTreeShaking || source.isEntry && hasModifier(ModifierKind.EXPORT, (<EnumDeclaration>statement).modifiers))
if (noTreeShaking || isEntry && hasModifier(ModifierKind.EXPORT, (<EnumDeclaration>statement).modifiers))
this.compileEnumDeclaration(<EnumDeclaration>statement);
break;
case NodeKind.FUNCTIONDECLARATION:
if ((noTreeShaking || source.isEntry && hasModifier(ModifierKind.EXPORT, (<FunctionDeclaration>statement).modifiers)) && !(<FunctionDeclaration>statement).typeParameters.length)
if ((noTreeShaking || isEntry && hasModifier(ModifierKind.EXPORT, (<FunctionDeclaration>statement).modifiers)) && !(<FunctionDeclaration>statement).typeParameters.length)
this.compileFunctionDeclaration(<FunctionDeclaration>statement, []);
break;
@ -311,20 +344,19 @@ export class Compiler extends DiagnosticEmitter {
break;
case NodeKind.NAMESPACEDECLARATION:
if (noTreeShaking || source.isEntry && hasModifier(ModifierKind.EXPORT, (<NamespaceDeclaration>statement).modifiers))
if (noTreeShaking || isEntry && hasModifier(ModifierKind.EXPORT, (<NamespaceDeclaration>statement).modifiers))
this.compileNamespaceDeclaration(<NamespaceDeclaration>statement);
break;
case NodeKind.VARIABLE: // global, always compiled because initializers might have side effects
var variableInit = this.compileVariableStatement(<VariableStatement>statement);
if (variableInit)
this.startFunctionBody.push(variableInit);
if (variableInit) startFunctionBody.push(variableInit);
break;
case NodeKind.EXPORT:
if ((<ExportStatement>statement).normalizedPath != null)
this.compileSourceByPath(<string>(<ExportStatement>statement).normalizedPath, <StringLiteralExpression>(<ExportStatement>statement).path);
if (noTreeShaking || source.isEntry)
if (noTreeShaking || isEntry)
this.compileExportStatement(<ExportStatement>statement);
break;
@ -365,14 +397,14 @@ export class Compiler extends DiagnosticEmitter {
if (!resolvedType)
return false;
if (resolvedType == Type.void) {
this.error(DiagnosticCode.Type_0_is_not_assignable_to_type_1, declaration.range, "*", resolvedType.toString());
this.error(DiagnosticCode.Type_0_is_not_assignable_to_type_1, declaration.type.range, "*", resolvedType.toString());
return false;
}
global.type = resolvedType;
} else if (declaration.initializer) { // infer type using void/NONE for proper literal inference
initExpr = this.compileExpression(declaration.initializer, Type.void, ConversionKind.NONE); // reports
if (this.currentType == Type.void) {
this.error(DiagnosticCode.Type_0_is_not_assignable_to_type_1, declaration.range, this.currentType.toString(), "<auto>");
this.error(DiagnosticCode.Type_0_is_not_assignable_to_type_1, declaration.initializer.range, this.currentType.toString(), "<auto>");
return false;
}
global.type = this.currentType;
@ -622,15 +654,17 @@ export class Compiler extends DiagnosticEmitter {
typeRef = this.module.addFunctionType(signatureNameParts.join(""), nativeResultType, nativeParamTypes);
// create the function
if (instance.is(ElementFlags.DECLARED)) {
this.module.addFunctionImport(instance.internalName, instance.prototype.namespace ? instance.prototype.namespace.simpleName : "env", instance.simpleName, typeRef);
} else {
this.module.addFunction(instance.internalName, typeRef, typesToNativeTypes(instance.additionalLocals), this.module.createBlock(null, <ExpressionRef[]>stmts, NativeType.None));
}
instance.finalize();
if (declaration && declaration.range.source.isEntry && declaration.isTopLevelExport) {
var ref: FunctionRef;
if (instance.is(ElementFlags.DECLARED))
ref = this.module.addFunctionImport(instance.internalName, instance.prototype.namespace ? instance.prototype.namespace.simpleName : "env", instance.simpleName, typeRef);
else
ref = this.module.addFunction(instance.internalName, typeRef, typesToNativeTypes(instance.additionalLocals), this.module.createBlock(null, <ExpressionRef[]>stmts, NativeType.None));
// check module export
if (declaration && declaration.range.source.isEntry && declaration.isTopLevelExport)
this.module.addFunctionExport(instance.internalName, declaration.name.name);
}
instance.finalize(this.module, ref);
return true;
}
@ -810,50 +844,65 @@ export class Compiler extends DiagnosticEmitter {
// statements
compileStatement(statement: Statement): ExpressionRef {
var expr: ExpressionRef;
switch (statement.kind) {
case NodeKind.BLOCK:
return this.compileBlockStatement(<BlockStatement>statement);
expr = this.compileBlockStatement(<BlockStatement>statement);
break;
case NodeKind.BREAK:
return this.compileBreakStatement(<BreakStatement>statement);
expr = this.compileBreakStatement(<BreakStatement>statement);
break;
case NodeKind.CONTINUE:
return this.compileContinueStatement(<ContinueStatement>statement);
expr = this.compileContinueStatement(<ContinueStatement>statement);
break;
case NodeKind.DO:
return this.compileDoStatement(<DoStatement>statement);
expr = this.compileDoStatement(<DoStatement>statement);
break;
case NodeKind.EMPTY:
return this.compileEmptyStatement(<EmptyStatement>statement);
expr = this.compileEmptyStatement(<EmptyStatement>statement);
break;
case NodeKind.EXPRESSION:
return this.compileExpressionStatement(<ExpressionStatement>statement);
expr = this.compileExpressionStatement(<ExpressionStatement>statement);
break;
case NodeKind.FOR:
return this.compileForStatement(<ForStatement>statement);
expr = this.compileForStatement(<ForStatement>statement);
break;
case NodeKind.IF:
return this.compileIfStatement(<IfStatement>statement);
expr = this.compileIfStatement(<IfStatement>statement);
break;
case NodeKind.RETURN:
return this.compileReturnStatement(<ReturnStatement>statement);
expr = this.compileReturnStatement(<ReturnStatement>statement);
break;
case NodeKind.SWITCH:
return this.compileSwitchStatement(<SwitchStatement>statement);
expr = this.compileSwitchStatement(<SwitchStatement>statement);
break;
case NodeKind.THROW:
return this.compileThrowStatement(<ThrowStatement>statement);
expr = this.compileThrowStatement(<ThrowStatement>statement);
break;
case NodeKind.TRY:
return this.compileTryStatement(<TryStatement>statement);
expr = this.compileTryStatement(<TryStatement>statement);
break;
case NodeKind.VARIABLE:
var variableInit = this.compileVariableStatement(<VariableStatement>statement);
return variableInit ? variableInit : this.module.createNop();
expr = variableInit ? variableInit : this.module.createNop();
break;
case NodeKind.WHILE:
return this.compileWhileStatement(<WhileStatement>statement);
expr = this.compileWhileStatement(<WhileStatement>statement);
break;
case NodeKind.TYPEDECLARATION:
if (this.currentFunction == this.startFunction)
@ -863,6 +912,9 @@ export class Compiler extends DiagnosticEmitter {
default:
throw new Error("statement expected");
}
this.addDebugLocation(expr, statement.range);
return expr;
}
compileStatements(statements: Statement[]): ExpressionRef[] {
@ -1095,8 +1147,9 @@ export class Compiler extends DiagnosticEmitter {
var fallsThrough = i != k - 1;
var nextLabel = !fallsThrough ? breakLabel : "case" + (i + 1).toString(10) + "|" + context;
for (var j = 0; j < l; ++j)
for (var j = 0; j < l; ++j) {
body[j + 1] = this.compileStatement(case_.statements[j]);
}
if (!(fallsThrough || this.currentFunction.flow.is(FlowFlags.RETURNS)))
alwaysReturns = false; // ignore fall-throughs
@ -1386,6 +1439,8 @@ export class Compiler extends DiagnosticEmitter {
expr = this.convertExpression(expr, this.currentType, contextualType, conversionKind, expression);
this.currentType = contextualType;
}
this.addDebugLocation(expr, expression.range);
return expr;
}
@ -2330,8 +2385,8 @@ export class Compiler extends DiagnosticEmitter {
left = this.compileExpression(expression.left, contextualType == Type.void ? Type.i32 : contextualType, ConversionKind.NONE);
right = this.compileExpression(expression.right, this.currentType, ConversionKind.IMPLICIT, false);
// clone left if free of side effects while tolerating one level of nesting
expr = this.module.cloneExpression(left, true, 1);
// clone left if free of side effects
expr = this.module.cloneExpression(left, true, 0);
// if not possible, tee left to a temp. local
if (!expr) {
@ -2364,8 +2419,8 @@ export class Compiler extends DiagnosticEmitter {
left = this.compileExpression(expression.left, contextualType == Type.void ? Type.i32 : contextualType, ConversionKind.NONE);
right = this.compileExpression(expression.right, this.currentType, ConversionKind.IMPLICIT, false);
// clone left if free of side effects while tolerating one level of nesting
expr = this.module.cloneExpression(left, true, 1);
// clone left if free of side effects
expr = this.module.cloneExpression(left, true, 0);
// if not possible, tee left to a temp. local
if (!expr) {
@ -3391,6 +3446,18 @@ export class Compiler extends DiagnosticEmitter {
? this.compileAssignmentWithValue(expression.operand, expr, contextualType != Type.void)
: expr;
}
addDebugLocation(expr: ExpressionRef, range: Range): void {
if (this.options.sourceMap != null) {
var source = range.source;
if (source.debugInfoIndex < 0)
source.debugInfoIndex = this.module.addDebugInfoFile(source.normalizedPath);
range.debugInfoRef = expr;
if (!this.currentFunction.debugLocations)
(this.currentFunction.debugLocations = new Array(8)).length = 0;
this.currentFunction.debugLocations.push(range);
}
}
}
// helpers

View File

@ -91,7 +91,7 @@ export class DiagnosticMessage {
toString(): string {
if (this.range)
return diagnosticCategoryToString(this.category) + " " + this.code.toString(10) + ": \"" + this.message + "\" in " + this.range.source.path + " @ " + this.range.start.toString(10) + "," + this.range.end.toString(10);
return diagnosticCategoryToString(this.category) + " " + this.code.toString(10) + ": \"" + this.message + "\" in " + this.range.source.normalizedPath + " @ " + this.range.start.toString(10) + "," + this.range.end.toString(10);
return diagnosticCategoryToString(this.category) + " " + this.code.toString(10) + ": " + this.message;
}
}
@ -122,7 +122,7 @@ export function formatDiagnosticMessage(message: DiagnosticMessage, useColors: b
}
sb.push("\n");
sb.push(" in ");
sb.push(range.source.path);
sb.push(range.source.normalizedPath);
sb.push("(");
sb.push(range.line.toString(10));
sb.push(",");

View File

@ -61,16 +61,14 @@ declare type BinaryenModuleRef = usize;
declare function _BinaryenModuleCreate(): BinaryenModuleRef;
declare function _BinaryenModuleDispose(module: BinaryenModuleRef): void;
declare type BinaryenLiteral = usize;
// LLVM C ABI with `out` being a buffer of 16 bytes receiving the BinaryenLiteral struct.
// union value starts at offset 8 due to alignment (?)
declare function _BinaryenLiteralInt32(out: BinaryenLiteral, x: i32): void;
declare function _BinaryenLiteralInt64(out: BinaryenLiteral, x: i32, y: i32): void;
declare function _BinaryenLiteralFloat32(out: BinaryenLiteral, x: f32): void;
declare function _BinaryenLiteralFloat64(out: BinaryenLiteral, x: f64): void;
declare function _BinaryenLiteralFloat32Bits(out: BinaryenLiteral, x: i32): void;
declare function _BinaryenLiteralFloat64Bits(out: BinaryenLiteral, x: i32, y: i32): void;
// LLVM C ABI with `out` being a large enough buffer receiving the
// BinaryenLiteral struct.
declare function _BinaryenLiteralInt32(out: usize, x: i32): void;
declare function _BinaryenLiteralInt64(out: usize, x: i32, y: i32): void;
declare function _BinaryenLiteralFloat32(out: usize, x: f32): void;
declare function _BinaryenLiteralFloat64(out: usize, x: f64): void;
declare function _BinaryenLiteralFloat32Bits(out: usize, x: i32): void;
declare function _BinaryenLiteralFloat64Bits(out: usize, x: i32, y: i32): void;
declare type BinaryenOp = i32;
@ -231,7 +229,7 @@ declare function _BinaryenGetGlobal(module: BinaryenModuleRef, name: usize, type
declare function _BinaryenSetGlobal(module: BinaryenModuleRef, name: usize, value: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenLoad(module: BinaryenModuleRef, bytes: u32, signed: i8, offset: u32, align: u32, type: BinaryenType, ptr: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenStore(module: BinaryenModuleRef, bytes: u32, offset: u32, align: u32, ptr: BinaryenExpressionRef, value: BinaryenExpressionRef, type: BinaryenType): BinaryenExpressionRef;
declare function _BinaryenConst(module: BinaryenModuleRef, value: BinaryenLiteral): BinaryenExpressionRef;
declare function _BinaryenConst(module: BinaryenModuleRef, value: usize): BinaryenExpressionRef;
declare function _BinaryenUnary(module: BinaryenModuleRef, op: BinaryenOp, value: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenBinary(module: BinaryenModuleRef, op: BinaryenOp, left: BinaryenExpressionRef, right: BinaryenExpressionRef): BinaryenExpressionRef;
declare function _BinaryenSelect(module: BinaryenModuleRef, condition: BinaryenExpressionRef, ifTrue: BinaryenExpressionRef, ifFalse: BinaryenExpressionRef): BinaryenExpressionRef;
@ -381,6 +379,7 @@ declare function _BinaryenFunctionGetVar(func: BinaryenFunctionRef, index: Binar
declare function _BinaryenFunctionGetBody(func: BinaryenFunctionRef): BinaryenExpressionRef;
declare function _BinaryenFunctionOptimize(func: BinaryenFunctionRef, module: BinaryenModuleRef): void;
declare function _BinaryenFunctionRunPasses(func: BinaryenFunctionRef, module: BinaryenModuleRef, passes: usize, numPasses: BinaryenIndex): void;
declare function _BinaryenFunctionSetDebugLocation(func: BinaryenFunctionRef, expr: BinaryenExpressionRef, fileIndex: BinaryenIndex, lineNumber: BinaryenIndex, columnNumber: BinaryenIndex): void;
declare type BinaryenImportRef = usize;
@ -415,9 +414,11 @@ declare function _BinaryenModuleValidate(module: BinaryenModuleRef): i32;
declare function _BinaryenModuleOptimize(module: BinaryenModuleRef): void;
declare function _BinaryenModuleRunPasses(module: BinaryenModuleRef, passes: usize, numPasses: BinaryenIndex): void;
declare function _BinaryenModuleAutoDrop(module: BinaryenModuleRef): void;
declare function _BinaryenModuleWrite(module: BinaryenModuleRef, output: usize, outputSize: usize): usize;
declare function _BinaryenModuleAllocateAndWrite(out: usize, module: BinaryenModuleRef, sourceMapUrl: usize): void;
declare function _BinaryenModuleRead(input: usize, inputSize: usize): BinaryenModuleRef;
declare function _BinaryenModuleInterpret(module: BinaryenModuleRef): void;
declare function _BinaryenModuleAddDebugInfoFileName(module: BinaryenModuleRef, filename: usize): BinaryenIndex;
declare function _BinaryenModuleGetDebugInfoFileName(module: BinaryenModuleRef, index: BinaryenIndex): usize;
declare type RelooperRef = usize;
declare type RelooperBlockRef = usize;

View File

@ -34,15 +34,7 @@ globalScope["load"] = function load(ptr) {
// Implement module stubs
var Module = require("../module").Module;
Module.prototype.toBinary = function toBinary(bufferSize) {
if (!bufferSize) bufferSize = 1024 * 1024; // FIXME: see binaryen.js-post.js in Binaryen
var ptr = allocate_memory(bufferSize);
var len = this.write(ptr, bufferSize);
var ret = new Uint8Array(len);
ret.set(binaryen.HEAPU8.subarray(ptr, ptr + len));
free_memory(ptr);
return ret;
};
Module.prototype.toText = function toText() {
var previousPrint = binaryen.print;
var ret = "";
@ -51,6 +43,7 @@ Module.prototype.toText = function toText() {
binaryen.print = previousPrint;
return ret;
};
Module.prototype.toAsmjs = function toAsmjs() {
var previousPrint = binaryen.print;
var ret = "";

View File

@ -50,6 +50,8 @@ import {
Decompiler
} from "./decompiler";
export { LIBRARY_PREFIX } from "./program";
/** Parses a single source file. If `parser` has been omitted a new one is created. */
export function parseFile(text: string, path: string, parser: Parser | null = null, isEntry: bool = false): Parser {
if (!parser) {
@ -118,6 +120,11 @@ export function setNoMemory(options: Options, noMemory: bool): void {
options.noMemory = noMemory;
}
/** Sets the `sourceMap` option. */
export function setSourceMap(options: Options, sourceMap: bool): void {
options.sourceMap = sourceMap;
}
/** Compiles the sources computed by the parser to a module. */
export function compile(parser: Parser, options: Options | null = null): Module {
var program = parser.finish();
@ -131,3 +138,4 @@ export function decompile(module: Module): string {
decompiler.decompile(module);
return decompiler.finish();
}

View File

@ -238,7 +238,7 @@ export class MemorySegment {
export class Module {
ref: ModuleRef;
lit: BinaryenLiteral;
out: usize;
static readonly MAX_MEMORY_WASM32: Index = 0xffff;
// TODO: static readonly MAX_MEMORY_WASM64
@ -246,7 +246,7 @@ export class Module {
static create(): Module {
var module = new Module();
module.ref = _BinaryenModuleCreate();
module.lit = changetype<BinaryenLiteral>(allocate_memory(16));
module.out = allocate_memory(16);
return module;
}
@ -255,7 +255,7 @@ export class Module {
try {
var module = new Module();
module.ref = _BinaryenModuleRead(cArr, buffer.length);
module.lit = changetype<BinaryenLiteral>(allocate_memory(16));
module.out = allocate_memory(3 * 8); // LLVM C-ABI, max used is 3 * usize
return module;
} finally {
free_memory(changetype<usize>(cArr));
@ -289,23 +289,27 @@ export class Module {
// expressions
createI32(value: i32): ExpressionRef {
_BinaryenLiteralInt32(this.lit, value);
return _BinaryenConst(this.ref, this.lit);
var out = this.out;
_BinaryenLiteralInt32(out, value);
return _BinaryenConst(this.ref, out);
}
createI64(lo: i32, hi: i32 = 0): ExpressionRef {
_BinaryenLiteralInt64(this.lit, lo, hi);
return _BinaryenConst(this.ref, this.lit);
var out = this.out;
_BinaryenLiteralInt64(out, lo, hi);
return _BinaryenConst(this.ref, out);
}
createF32(value: f32): ExpressionRef {
_BinaryenLiteralFloat32(this.lit, value);
return _BinaryenConst(this.ref, this.lit);
var out = this.out;
_BinaryenLiteralFloat32(out, value);
return _BinaryenConst(this.ref, out);
}
createF64(value: f64): ExpressionRef {
_BinaryenLiteralFloat64(this.lit, value);
return _BinaryenConst(this.ref, this.lit);
var out = this.out;
_BinaryenLiteralFloat64(out, value);
return _BinaryenConst(this.ref, out);
}
createUnary(op: UnaryOp, expr: ExpressionRef): ExpressionRef {
@ -713,10 +717,6 @@ export class Module {
_BinaryenModuleInterpret(this.ref);
}
write(output: usize, outputSize: usize = 1048576): usize {
return _BinaryenModuleWrite(this.ref, output, outputSize);
}
print(): void {
_BinaryenModulePrint(this.ref);
}
@ -725,9 +725,25 @@ export class Module {
_BinaryenModulePrintAsmjs(this.ref);
}
toBinary(bufferSize: usize = 1048576): Uint8Array {
// FIXME: target specific / JS glue overrides this
throw new Error("not implemented");
toBinary(sourceMapUrl: string | null): Binary {
var out = this.out;
var cStr = allocString(sourceMapUrl);
var binaryPtr: usize = 0;
var sourceMapPtr: usize = 0;
try {
_BinaryenModuleAllocateAndWrite(out, this.ref, cStr);
binaryPtr = readInt(out);
var binaryBytes = readInt(out + 4);
sourceMapPtr = readInt(out + 4 * 2);
var ret = new Binary();
ret.output = readBuffer(binaryPtr, binaryBytes);
ret.sourceMap = readString(sourceMapPtr);
return ret;
} finally {
if (cStr) free_memory(cStr);
if (binaryPtr) free_memory(binaryPtr);
if (sourceMapPtr) free_memory(sourceMapPtr);
}
}
toText(): string {
@ -738,7 +754,7 @@ export class Module {
dispose(): void {
if (!this.ref) return; // sic
_BinaryenModuleDispose(this.ref);
free_memory(changetype<usize>(this.lit));
free_memory(this.out);
}
createRelooper(): Relooper {
@ -794,6 +810,25 @@ export class Module {
}
return 0;
}
// source map generation
addDebugInfoFile(name: string): Index {
var cStr = allocString(name);
try {
return _BinaryenModuleAddDebugInfoFileName(this.ref, cStr);
} finally {
free_memory(cStr);
}
}
getDebugInfoFile(index: Index): string | null {
return readString(_BinaryenModuleGetDebugInfoFileName(this.ref, index));
}
setDebugLocation(func: FunctionRef, expr: ExpressionRef, fileIndex: Index, lineNumber: Index, columnNumber: Index): void {
_BinaryenFunctionSetDebugLocation(func, expr, fileIndex, lineNumber, columnNumber);
}
}
export class Relooper {
@ -934,6 +969,22 @@ function allocString(str: string | null): usize {
return ptr;
}
export function readInt(ptr: usize): i32 {
return (
load<u8>(ptr ) |
(load<u8>(ptr + 1) << 8) |
(load<u8>(ptr + 2) << 16) |
(load<u8>(ptr + 3) << 24)
);
}
export function readBuffer(ptr: usize, length: usize): Uint8Array {
var ret = new Uint8Array(length);
for (var i: usize = 0; i < length; ++i)
ret[i] = load<u8>(ptr + i);
return ret;
}
export function readString(ptr: usize): string | null {
if (!ptr) return null;
var arr = new Array<i32>();
@ -978,3 +1029,11 @@ export function readString(ptr: usize): string | null {
// return String.fromCharCodes(arr);
return String.fromCodePoints(arr);
}
/** Result structure of {@link Module#toBinary}. */
class Binary {
/** WebAssembly binary. */
output: Uint8Array;
/** Source map, if generated. */
sourceMap: string | null;
}

View File

@ -8,7 +8,8 @@
*/
import {
Program
Program,
LIBRARY_PREFIX
} from "./program";
import {
@ -106,7 +107,7 @@ export class Parser extends DiagnosticEmitter {
return; // already parsed
this.seenlog.add(normalizedPath);
var source = new Source(path, text, isEntry ? SourceKind.ENTRY : path.startsWith("std:") ? SourceKind.STDLIB : SourceKind.DEFAULT);
var source = new Source(normalizedPath, text, isEntry ? SourceKind.ENTRY : path.startsWith(LIBRARY_PREFIX) ? SourceKind.LIBRARY : SourceKind.DEFAULT);
this.program.sources.push(source);
var tn = new Tokenizer(source, this.program.diagnostics);

View File

@ -73,7 +73,10 @@ import {
} from "./ast";
import {
NativeType
Module,
NativeType,
ExpressionRef,
FunctionRef,
} from "./module";
/** Path delimiter inserted between file system levels. */
@ -88,6 +91,10 @@ export const SETTER_PREFIX = "set:";
export const INSTANCE_DELIMITER = "#";
/** Delimiter used between class and namespace names and static members. */
export const STATIC_DELIMITER = ".";
/** Substitution used to indicate a library directory. */
export const LIBRARY_SUBST = "(lib)";
/** Library directory prefix. */
export const LIBRARY_PREFIX = LIBRARY_SUBST + PATH_DELIMITER;
class QueuedExport {
isReExport: bool;
@ -1454,6 +1461,9 @@ export class Global extends VariableLikeElement {
case ModifierKind.LET: this.set(ElementFlags.SCOPED); break;
case ModifierKind.DECLARE: this.set(ElementFlags.DECLARED); break;
case ModifierKind.READONLY: this.set(this.declaration.initializer ? ElementFlags.CONSTANT | ElementFlags.READONLY : ElementFlags.READONLY); break;
case ModifierKind.PUBLIC:
case ModifierKind.PRIVATE:
case ModifierKind.PROTECTED:
case ModifierKind.STATIC: break; // static fields become globals
default: throw new Error("unexpected modifier");
}
@ -1472,14 +1482,14 @@ export class Parameter {
// not an Element on its own
/** Parameter name. */
name: string;
name: string | null;
/** Parameter type. */
type: Type;
/** Parameter initializer. */
initializer: Expression | null;
/** Constructs a new function parameter. */
constructor(name: string, type: Type, initializer: Expression | null = null) {
constructor(name: string | null, type: Type, initializer: Expression | null = null) {
this.name = name;
this.type = type;
this.initializer = initializer;
@ -1591,10 +1601,11 @@ export class FunctionPrototype extends Element {
var parameterTypes = new Array<Type>(k);
var typeNode: TypeNode | null;
for (i = 0; i < k; ++i) {
typeNode = assert(declaration.parameters[i].type);
var parameterDeclaration = declaration.parameters[i];
typeNode = assert(parameterDeclaration.type);
var parameterType = this.program.resolveType(typeNode, contextualTypeArguments, true); // reports
if (parameterType) {
parameters[i] = new Parameter(declaration.parameters[i].name.name, parameterType, declaration.parameters[i].initializer);
parameters[i] = new Parameter(parameterDeclaration.name ? parameterDeclaration.name.name : null, parameterType, parameterDeclaration.initializer);
parameterTypes[i] = parameterType;
} else
return null;
@ -1683,6 +1694,8 @@ export class Function extends Element {
contextualTypeArguments: Map<string,Type> | null;
/** Current control flow. */
flow: Flow;
/** Remembered debug locations. */
debugLocations: Range[] | null = null;
private nextBreakId: i32 = 0;
private breakStack: i32[] | null = null;
@ -1696,6 +1709,7 @@ export class Function extends Element {
this.returnType = returnType;
this.instanceMethodOf = instanceMethodOf;
this.flags = prototype.flags;
if (!prototype.is(ElementFlags.BUILTIN | ElementFlags.DECLARED)) {
var localIndex = 0;
if (instanceMethodOf) {
assert(this.is(ElementFlags.INSTANCE)); // internal error
@ -1710,7 +1724,9 @@ export class Function extends Element {
assert(!this.is(ElementFlags.INSTANCE)); // internal error
for (var i = 0, k = parameters.length; i < k; ++i) {
var parameter = parameters[i];
this.locals.set(parameter.name, new Local(prototype.program, parameter.name, localIndex++, parameter.type));
var parameterName = assert(parameter.name, "parameter must be named"); // not a builtin or declared
this.locals.set(parameterName, new Local(prototype.program, parameterName, localIndex++, parameter.type));
}
}
this.flow = Flow.create(this);
}
@ -1806,11 +1822,20 @@ export class Function extends Element {
}
/** Finalizes the function once compiled, releasing no longer needed resources. */
finalize(): void {
finalize(module: Module, ref: FunctionRef): void {
assert(!this.breakStack || !this.breakStack.length); // internal error
this.breakStack = null;
this.breakContext = null;
this.tempI32s = this.tempI64s = this.tempF32s = this.tempF64s = null;
if (this.program.options.sourceMap) {
var debugLocations = this.debugLocations;
if (debugLocations)
for (var i = 0, k = debugLocations.length; i < k; ++i) {
var debugLocation = debugLocations[i];
module.setDebugLocation(ref, debugLocation.debugInfoRef, debugLocation.source.debugInfoIndex, debugLocation.line, debugLocation.column);
}
}
this.debugLocations = null;
}
/** Returns the TypeScript representation of this function. */

View File

@ -310,17 +310,20 @@ export class Range {
get column(): i32 {
var text = this.source.text;
var pos = this.start;
var column = 1;
while (pos-- > 0)
var column = 0;
while (pos-- > 0) {
if (text.charCodeAt(pos) == CharCode.LINEFEED)
break;
column++;
}
return column;
}
toString(): string {
return this.source.text.substring(this.start, this.end);
}
debugInfoRef: usize = 0;
}
declare function parseFloat(str: string): f64;

View File

@ -2,8 +2,10 @@ import {
CharCode
} from "./charcode";
const separator = CharCode.SLASH;
/** Normalizes the specified path, removing interior placeholders. Expects a posix-formatted string / not Windows compatible. */
export function normalize(path: string, trimExtension: bool = false, separator: CharCode = CharCode.SLASH): string {
export function normalize(path: string): string {
// expects a relative path
var pos = 0;
@ -14,8 +16,8 @@ export function normalize(path: string, trimExtension: bool = false, separator:
pos += 2;
// trim extension if requested
if (trimExtension && len > pos + 3 && path.charCodeAt(len - 3) == CharCode.DOT && (path.charCodeAt(len - 2) == CharCode.t || path.charCodeAt(len - 2) == CharCode.a) && path.charCodeAt(len - 1) == CharCode.s)
len = len - 3;
// if (trimExtension && len > pos + 3 && path.charCodeAt(len - 3) == CharCode.DOT && (path.charCodeAt(len - 2) == CharCode.t || path.charCodeAt(len - 2) == CharCode.a) && path.charCodeAt(len - 1) == CharCode.s)
// len = len - 3;
if (pos > 0 || len < path.length) {
path = path.substring(pos, len);
@ -81,14 +83,14 @@ export function normalize(path: string, trimExtension: bool = false, separator:
}
/** Resolves the specified path to a normalized path relative to the specified origin. */
export function resolve(normalizedPath: string, normalizedOrigin: string, separator: CharCode = CharCode.SLASH): string {
if (normalizedPath.startsWith("std:"))
export function resolve(normalizedPath: string, normalizedOrigin: string): string {
if (normalizedPath.startsWith("std/"))
return normalizedPath;
return normalize(dirname(normalizedOrigin, separator) + String.fromCharCode(separator) + normalizedPath);
return normalize(dirname(normalizedOrigin) + String.fromCharCode(separator) + normalizedPath);
}
/** Obtains the directory portion of a normalized path. */
export function dirname(normalizedPath: string, separator: CharCode = CharCode.SLASH): string {
export function dirname(normalizedPath: string): string {
var pos = normalizedPath.length;
while (--pos > 0)
if (normalizedPath.charCodeAt(pos) == separator)

View File

@ -1,6 +1,8 @@
// A simple arena allocator that provides a `clear_memory` function to reset
// the heap to its initial state. A user has to make sure that there are no
// more references to cleared memory afterwards. Always aligns to 8 bytes.
/////////////// A simple yet effective Arena Memory Allocator /////////////////
// Provides a `reset_memory` function to reset the heap to its initial state. A
// user has to make sure that there are no more references to cleared memory
// afterwards. Always aligns to 8 bytes.
const ALIGN_LOG2: usize = 3;
const ALIGN_SIZE: usize = 1 << ALIGN_LOG2;
@ -27,6 +29,6 @@ export function free_memory(ptr: usize): void {
// nop
}
export function clear_memory(): void {
export function reset_memory(): void {
HEAP_OFFSET = HEAP_BASE;
}

View File

@ -0,0 +1,10 @@
// Re-export for now, so there's just one source file being worked on
export {
allocate_memory,
free_memory
} from "../../../examples/tlsf/assembly/tlsf";
export function reset_memory(): void {
throw new Error("not supported");
}

View File

@ -1,63 +1,74 @@
var fs = require("fs");
var path = require("path");
var chalk = require("chalk");
var glob = require("glob");
var diff = require("./util/diff");
const fs = require("fs");
const path = require("path");
const chalk = require("chalk");
const glob = require("glob");
const diff = require("./util/diff");
require("ts-node").register({ project: require("path").join(__dirname, "..", "src") });
require("../src/glue/js");
var Compiler = require("../src/compiler").Compiler;
var Module = require("../src/module").Module;
var Parser = require("../src/parser").Parser;
var ElementKind = require("../src/program").ElementKind;
const { Compiler, Options } = require("../src/compiler");
const { Module } = require("../src/module");
const { Parser } = require("../src/parser");
const { ElementKind, LIBRARY_PREFIX } = require("../src/program");
var isCreate = process.argv[2] === "--create";
var filter = process.argv.length > 2 && !isCreate ? "**/" + process.argv[2] + ".ts" : "**/*.ts";
var stdDir = __dirname + "/../std/assembly";
var stdDir = path.join(__dirname, "..", "std", "assembly");
var stdFiles = glob.sync("*.ts", { cwd: stdDir });
var success = 0;
var failures = 0;
glob.sync(filter, { cwd: __dirname + "/compiler" }).forEach(filename => {
if (filename.charAt(0) == "_")
return;
glob.sync(filter, { cwd: path.join(__dirname, "compiler") }).forEach(filename => {
if (filename.charAt(0) == "_") return;
console.log(chalk.whiteBright("Testing compiler/" + filename));
var fixture = path.basename(filename, ".ts");
var startTime = process.hrtime();
var parser = new Parser();
var cwd = path.join(__dirname, "compiler");
// include stdlib in std/ tests only. doing this to reduce the sheer amount of
// program elements listed at the bottom of the basic fixtures.
if (filename.startsWith("std/")) {
stdFiles.forEach(file => {
parser.parseFile(fs.readFileSync(__dirname + "/../std/assembly/" + file, { encoding: "utf8" }), "std:" + path.basename(file), false);
});
stdFiles.forEach(file => parser.parseFile(fs.readFileSync(path.join(stdDir, file), { encoding: "utf8" }), LIBRARY_PREFIX + path.basename(file), false));
fixture = "std/" + fixture;
}
var sourceText = fs.readFileSync(__dirname + "/compiler/" + filename, { encoding: "utf8" });
var sourceText = fs.readFileSync(path.join(cwd, filename), { encoding: "utf8" });
parser.parseFile(sourceText, filename, true);
var nextFile;
while ((nextFile = parser.nextFile()) !== null) {
var nextSourceText;
if (nextFile.startsWith(LIBRARY_PREFIX)) {
sourceText = fs.readFileSync(path.join(stdDir, nextFile.substring(LIBRARY_PREFIX.length) + ".ts"), { encoding: "utf8" });
nextFile = nextFile + ".ts";
} else {
try {
if (nextFile.startsWith("std:"))
nextSourceText = fs.readFileSync(path.join(stdDir, nextFile.substring(4) + ".ts"), { encoding: "utf8" });
else
nextSourceText = fs.readFileSync(path.join(__dirname, "compiler", nextFile + ".ts"), { encoding: "utf8" });
sourceText = fs.readFileSync(path.join(cwd, nextFile + ".ts"), { encoding: "utf8" });
nextFile += ".ts";
} catch (e) {
nextSourceText = fs.readFileSync(path.join(__dirname, "compiler", nextFile, "index.ts"), { encoding: "utf8" });
try {
sourceText = fs.readFileSync(path.join(cwd, nextFile, "index.ts"), { encoding: "utf8" });
nextFile += "/index.ts";
} catch (e) {
sourceText = fs.readFileSync(path.join(stdDir, nextFile + ".ts"), { encoding: "utf8" });
nextFile = LIBRARY_PREFIX + nextFile + ".ts";
// FIXME: what exactly is swallowing the error here?
}
parser.parseFile(nextSourceText, nextFile, false);
}
}
parser.parseFile(sourceText, nextFile, false);
}
var program = parser.finish();
var options = new Options();
options.sourceMap = true;
var parseTime = process.hrtime(startTime);
startTime = process.hrtime();
var module;
try {
module = Compiler.compile(program);
module = Compiler.compile(program, options);
} catch (e) {
failed = true;
module = Module.create();
@ -74,17 +85,14 @@ glob.sync(filter, { cwd: __dirname + "/compiler" }).forEach(filename => {
var failed = false;
if (module.validate()) {
console.log(chalk.green("validate OK"));
try {
// already covered by instantiate below, which is also able to use imports, but doesn't
// provide as much debugging information. might be necessary to remove this one once imports
// are tested more.
// module.interpret();
// console.log(chalk.green("interpret OK"));
try {
var binary = module.toBinary();
var wasmModule = new WebAssembly.Module(binary);
var wasmModule = new WebAssembly.Module(binary.output);
var wasmInstance = new WebAssembly.Instance(wasmModule, {
env: {
abort: function(msg, file, line, column) {
throw new Error("Assertion failed");
},
externalFunc: function(arg0, arg1, arg2) {
console.log("env.externalFunc called with: " + arg0 + ", " + arg1 + ", " + arg2);
},
@ -109,14 +117,14 @@ glob.sync(filter, { cwd: __dirname + "/compiler" }).forEach(filename => {
failed = true;
console.log(chalk.red("instantiate ERROR: ") + e.stack);
}
} catch (e) {
failed = true;
console.log(chalk.red("interpret ERROR:") + e.stack);
}
module.optimize();
actualOptimized = module.toText();
if (isCreate)
fs.writeFileSync(__dirname + "/compiler/" + fixture + ".optimized.wasm", module.toBinary());
if (isCreate) {
var binary = module.toBinary(fixture + ".optimized.wasm.map");
fs.writeFileSync(__dirname + "/compiler/" + fixture + ".optimized.wasm", binary.output);
if (binary.sourceMap != null)
fs.writeFileSync(__dirname + "/compiler/" + fixture + ".optimized.wasm.map", binary.sourceMap, { encoding: "utf8" });
}
} else {
failed = true;
console.log(chalk.red("validate ERROR"));

View File

@ -1 +1,2 @@
*.wasm
*.wasm.map

View File

@ -5,16 +5,21 @@
(start $start)
(func $start (; 0 ;) (type $v)
(local $0 i32)
;;@ assert.ts:10:0
(if
;;@ assert.ts:10:4
(i32.eqz
;;@ assert.ts:10:5
(if (result i32)
(tee_local $0
;;@ assert.ts:10:12
(i32.const 1)
)
(get_local $0)
(unreachable)
)
)
;;@ assert.ts:11:2
(unreachable)
)
)

View File

@ -6,63 +6,84 @@
(start $start)
(func $start (; 0 ;) (type $v)
(local $0 i32)
;;@ assert.ts:1:0
(if
(i32.eqz
;;@ assert.ts:1:7
(i32.const 1)
)
(unreachable)
)
;;@ assert.ts:2:0
(if
(i32.eqz
;;@ assert.ts:2:7
(i32.const 1)
)
(unreachable)
)
;;@ assert.ts:3:0
(if
(i32.eqz
;;@ assert.ts:3:7
(i32.gt_s
(i32.const 1)
;;@ assert.ts:3:11
(i32.const 0)
)
)
(unreachable)
)
;;@ assert.ts:4:0
(if
(f64.eq
;;@ assert.ts:4:7
(f64.const 0.5)
(f64.const 0)
)
(unreachable)
)
;;@ assert.ts:5:0
(if
(i32.eqz
;;@ assert.ts:5:7
(f64.gt
(f64.const 0.5)
;;@ assert.ts:5:13
(f64.const 0.4)
)
)
(unreachable)
)
;;@ assert.ts:6:0
(if
(i64.eqz
;;@ assert.ts:6:7
(i64.const 4294967296)
)
(unreachable)
)
;;@ assert.ts:7:0
(if
(i32.eqz
;;@ assert.ts:7:7
(i64.gt_s
(i64.const 4294967296)
;;@ assert.ts:7:21
(i64.const 1)
)
)
(unreachable)
)
;;@ assert.ts:10:0
(if
;;@ assert.ts:10:4
(i32.eqz
;;@ assert.ts:10:5
(if (result i32)
(i32.eqz
(tee_local $0
;;@ assert.ts:10:12
(i32.const 1)
)
)
@ -70,6 +91,7 @@
(get_local $0)
)
)
;;@ assert.ts:11:2
(unreachable)
)
)
@ -104,6 +126,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -9,507 +9,729 @@
(export "memory" (memory $0))
(start $start)
(func $start (; 0 ;) (type $v)
;;@ binary.ts:14:0
(drop
(i32.div_s
(get_global $binary/i)
;;@ binary.ts:14:4
(i32.const 1)
)
)
;;@ binary.ts:15:0
(drop
(i32.rem_s
(get_global $binary/i)
;;@ binary.ts:15:4
(i32.const 1)
)
)
;;@ binary.ts:23:0
(set_global $binary/b
;;@ binary.ts:23:4
(i32.lt_s
(get_global $binary/i)
;;@ binary.ts:23:8
(i32.const 1)
)
)
;;@ binary.ts:24:0
(set_global $binary/b
;;@ binary.ts:24:4
(i32.gt_s
(get_global $binary/i)
;;@ binary.ts:24:8
(i32.const 1)
)
)
;;@ binary.ts:25:0
(set_global $binary/b
;;@ binary.ts:25:4
(i32.le_s
(get_global $binary/i)
;;@ binary.ts:25:9
(i32.const 1)
)
)
;;@ binary.ts:26:0
(set_global $binary/b
;;@ binary.ts:26:4
(i32.ge_s
(get_global $binary/i)
;;@ binary.ts:26:9
(i32.const 1)
)
)
;;@ binary.ts:27:0
(set_global $binary/b
;;@ binary.ts:27:4
(i32.eq
(get_global $binary/i)
;;@ binary.ts:27:9
(i32.const 1)
)
)
;;@ binary.ts:28:0
(set_global $binary/b
;;@ binary.ts:28:4
(i32.eq
(get_global $binary/i)
;;@ binary.ts:28:10
(i32.const 1)
)
)
;;@ binary.ts:29:0
(set_global $binary/i
;;@ binary.ts:29:4
(i32.add
(get_global $binary/i)
;;@ binary.ts:29:8
(i32.const 1)
)
)
;;@ binary.ts:30:0
(set_global $binary/i
;;@ binary.ts:30:4
(i32.sub
(get_global $binary/i)
;;@ binary.ts:30:8
(i32.const 1)
)
)
;;@ binary.ts:31:0
(set_global $binary/i
;;@ binary.ts:31:4
(i32.mul
(get_global $binary/i)
;;@ binary.ts:31:8
(i32.const 1)
)
)
;;@ binary.ts:32:0
(set_global $binary/i
;;@ binary.ts:32:4
(i32.div_s
(get_global $binary/i)
;;@ binary.ts:32:8
(i32.const 1)
)
)
;;@ binary.ts:33:0
(set_global $binary/i
;;@ binary.ts:33:4
(i32.rem_s
(get_global $binary/i)
;;@ binary.ts:33:8
(i32.const 1)
)
)
;;@ binary.ts:34:0
(set_global $binary/i
;;@ binary.ts:34:4
(i32.shl
(get_global $binary/i)
;;@ binary.ts:34:9
(i32.const 1)
)
)
;;@ binary.ts:35:0
(set_global $binary/i
;;@ binary.ts:35:4
(i32.shr_s
(get_global $binary/i)
;;@ binary.ts:35:9
(i32.const 1)
)
)
;;@ binary.ts:36:0
(set_global $binary/i
;;@ binary.ts:36:4
(i32.shr_u
(get_global $binary/i)
;;@ binary.ts:36:10
(i32.const 1)
)
)
;;@ binary.ts:37:0
(set_global $binary/i
;;@ binary.ts:37:4
(i32.and
(get_global $binary/i)
;;@ binary.ts:37:8
(i32.const 1)
)
)
;;@ binary.ts:38:0
(set_global $binary/i
;;@ binary.ts:38:4
(i32.or
(get_global $binary/i)
;;@ binary.ts:38:8
(i32.const 1)
)
)
;;@ binary.ts:39:0
(set_global $binary/i
;;@ binary.ts:39:4
(i32.xor
(get_global $binary/i)
;;@ binary.ts:39:8
(i32.const 1)
)
)
;;@ binary.ts:41:0
(set_global $binary/i
(i32.add
(get_global $binary/i)
;;@ binary.ts:41:5
(i32.const 1)
)
)
;;@ binary.ts:42:0
(set_global $binary/i
(i32.sub
(get_global $binary/i)
;;@ binary.ts:42:5
(i32.const 1)
)
)
;;@ binary.ts:43:0
(set_global $binary/i
(i32.mul
(get_global $binary/i)
;;@ binary.ts:43:5
(i32.const 1)
)
)
;;@ binary.ts:44:0
(set_global $binary/i
(i32.rem_s
(get_global $binary/i)
;;@ binary.ts:44:5
(i32.const 1)
)
)
;;@ binary.ts:45:0
(set_global $binary/i
(i32.shl
(get_global $binary/i)
;;@ binary.ts:45:6
(i32.const 1)
)
)
;;@ binary.ts:46:0
(set_global $binary/i
(i32.shr_s
(get_global $binary/i)
;;@ binary.ts:46:6
(i32.const 1)
)
)
;;@ binary.ts:47:0
(set_global $binary/i
(i32.shr_u
(get_global $binary/i)
;;@ binary.ts:47:7
(i32.const 1)
)
)
;;@ binary.ts:48:0
(set_global $binary/i
(i32.and
(get_global $binary/i)
;;@ binary.ts:48:5
(i32.const 1)
)
)
;;@ binary.ts:49:0
(set_global $binary/i
(i32.or
(get_global $binary/i)
;;@ binary.ts:49:5
(i32.const 1)
)
)
;;@ binary.ts:50:0
(set_global $binary/i
(i32.xor
(get_global $binary/i)
;;@ binary.ts:50:5
(i32.const 1)
)
)
;;@ binary.ts:63:0
(drop
(i64.div_s
(get_global $binary/I)
;;@ binary.ts:63:4
(i64.const 1)
)
)
;;@ binary.ts:64:0
(drop
(i64.rem_s
(get_global $binary/I)
;;@ binary.ts:64:4
(i64.const 1)
)
)
;;@ binary.ts:72:0
(set_global $binary/b
;;@ binary.ts:72:4
(i64.lt_s
(get_global $binary/I)
;;@ binary.ts:72:8
(i64.const 1)
)
)
;;@ binary.ts:73:0
(set_global $binary/b
;;@ binary.ts:73:4
(i64.gt_s
(get_global $binary/I)
;;@ binary.ts:73:8
(i64.const 1)
)
)
;;@ binary.ts:74:0
(set_global $binary/b
;;@ binary.ts:74:4
(i64.le_s
(get_global $binary/I)
;;@ binary.ts:74:9
(i64.const 1)
)
)
;;@ binary.ts:75:0
(set_global $binary/b
;;@ binary.ts:75:4
(i64.ge_s
(get_global $binary/I)
;;@ binary.ts:75:9
(i64.const 1)
)
)
;;@ binary.ts:76:0
(set_global $binary/b
;;@ binary.ts:76:4
(i64.eq
(get_global $binary/I)
;;@ binary.ts:76:9
(i64.const 1)
)
)
;;@ binary.ts:77:0
(set_global $binary/b
;;@ binary.ts:77:4
(i64.eq
(get_global $binary/I)
;;@ binary.ts:77:10
(i64.const 1)
)
)
;;@ binary.ts:78:0
(set_global $binary/I
;;@ binary.ts:78:4
(i64.add
(get_global $binary/I)
;;@ binary.ts:78:8
(i64.const 1)
)
)
;;@ binary.ts:79:0
(set_global $binary/I
;;@ binary.ts:79:4
(i64.sub
(get_global $binary/I)
;;@ binary.ts:79:8
(i64.const 1)
)
)
;;@ binary.ts:80:0
(set_global $binary/I
;;@ binary.ts:80:4
(i64.mul
(get_global $binary/I)
;;@ binary.ts:80:8
(i64.const 1)
)
)
;;@ binary.ts:81:0
(set_global $binary/I
;;@ binary.ts:81:4
(i64.div_s
(get_global $binary/I)
;;@ binary.ts:81:8
(i64.const 1)
)
)
;;@ binary.ts:82:0
(set_global $binary/I
;;@ binary.ts:82:4
(i64.rem_s
(get_global $binary/I)
;;@ binary.ts:82:8
(i64.const 1)
)
)
;;@ binary.ts:83:0
(set_global $binary/I
;;@ binary.ts:83:4
(i64.shl
(get_global $binary/I)
;;@ binary.ts:83:9
(i64.const 1)
)
)
;;@ binary.ts:84:0
(set_global $binary/I
;;@ binary.ts:84:4
(i64.shr_s
(get_global $binary/I)
;;@ binary.ts:84:9
(i64.const 1)
)
)
;;@ binary.ts:85:0
(set_global $binary/I
;;@ binary.ts:85:4
(i64.shr_u
(get_global $binary/I)
;;@ binary.ts:85:10
(i64.const 1)
)
)
;;@ binary.ts:86:0
(set_global $binary/I
;;@ binary.ts:86:4
(i64.and
(get_global $binary/I)
;;@ binary.ts:86:8
(i64.const 1)
)
)
;;@ binary.ts:87:0
(set_global $binary/I
;;@ binary.ts:87:4
(i64.or
(get_global $binary/I)
;;@ binary.ts:87:8
(i64.const 1)
)
)
;;@ binary.ts:88:0
(set_global $binary/I
;;@ binary.ts:88:4
(i64.xor
(get_global $binary/I)
;;@ binary.ts:88:8
(i64.const 1)
)
)
;;@ binary.ts:90:0
(set_global $binary/I
(i64.add
(get_global $binary/I)
;;@ binary.ts:90:5
(i64.const 1)
)
)
;;@ binary.ts:91:0
(set_global $binary/I
(i64.sub
(get_global $binary/I)
;;@ binary.ts:91:5
(i64.const 1)
)
)
;;@ binary.ts:92:0
(set_global $binary/I
(i64.mul
(get_global $binary/I)
;;@ binary.ts:92:5
(i64.const 1)
)
)
;;@ binary.ts:93:0
(set_global $binary/I
(i64.rem_s
(get_global $binary/I)
;;@ binary.ts:93:5
(i64.const 1)
)
)
;;@ binary.ts:94:0
(set_global $binary/I
(i64.shl
(get_global $binary/I)
;;@ binary.ts:94:6
(i64.const 1)
)
)
;;@ binary.ts:95:0
(set_global $binary/I
(i64.shr_s
(get_global $binary/I)
;;@ binary.ts:95:6
(i64.const 1)
)
)
;;@ binary.ts:96:0
(set_global $binary/I
(i64.shr_u
(get_global $binary/I)
;;@ binary.ts:96:7
(i64.const 1)
)
)
;;@ binary.ts:97:0
(set_global $binary/I
(i64.and
(get_global $binary/I)
;;@ binary.ts:97:5
(i64.const 1)
)
)
;;@ binary.ts:98:0
(set_global $binary/I
(i64.or
(get_global $binary/I)
;;@ binary.ts:98:5
(i64.const 1)
)
)
;;@ binary.ts:99:0
(set_global $binary/I
(i64.xor
(get_global $binary/I)
;;@ binary.ts:99:5
(i64.const 1)
)
)
;;@ binary.ts:115:0
(set_global $binary/b
;;@ binary.ts:115:4
(f32.lt
(get_global $binary/f)
;;@ binary.ts:115:8
(f32.const 1)
)
)
;;@ binary.ts:116:0
(set_global $binary/b
;;@ binary.ts:116:4
(f32.gt
(get_global $binary/f)
;;@ binary.ts:116:8
(f32.const 1)
)
)
;;@ binary.ts:117:0
(set_global $binary/b
;;@ binary.ts:117:4
(f32.le
(get_global $binary/f)
;;@ binary.ts:117:9
(f32.const 1)
)
)
;;@ binary.ts:118:0
(set_global $binary/b
;;@ binary.ts:118:4
(f32.ge
(get_global $binary/f)
;;@ binary.ts:118:9
(f32.const 1)
)
)
;;@ binary.ts:119:0
(set_global $binary/b
;;@ binary.ts:119:4
(f32.eq
(get_global $binary/f)
;;@ binary.ts:119:9
(f32.const 1)
)
)
;;@ binary.ts:120:0
(set_global $binary/b
;;@ binary.ts:120:4
(f32.eq
(get_global $binary/f)
;;@ binary.ts:120:10
(f32.const 1)
)
)
;;@ binary.ts:121:0
(set_global $binary/f
;;@ binary.ts:121:4
(f32.add
(get_global $binary/f)
;;@ binary.ts:121:8
(f32.const 1)
)
)
;;@ binary.ts:122:0
(set_global $binary/f
;;@ binary.ts:122:4
(f32.sub
(get_global $binary/f)
;;@ binary.ts:122:8
(f32.const 1)
)
)
;;@ binary.ts:123:0
(set_global $binary/f
;;@ binary.ts:123:4
(f32.mul
(get_global $binary/f)
;;@ binary.ts:123:8
(f32.const 1)
)
)
;;@ binary.ts:124:0
(set_global $binary/f
;;@ binary.ts:124:4
(f32.div
(get_global $binary/f)
;;@ binary.ts:124:8
(f32.const 1)
)
)
;;@ binary.ts:127:0
(set_global $binary/f
(f32.add
(get_global $binary/f)
;;@ binary.ts:127:5
(f32.const 1)
)
)
;;@ binary.ts:128:0
(set_global $binary/f
(f32.sub
(get_global $binary/f)
;;@ binary.ts:128:5
(f32.const 1)
)
)
;;@ binary.ts:129:0
(set_global $binary/f
(f32.mul
(get_global $binary/f)
;;@ binary.ts:129:5
(f32.const 1)
)
)
;;@ binary.ts:146:0
(set_global $binary/b
;;@ binary.ts:146:4
(f64.lt
(get_global $binary/F)
;;@ binary.ts:146:8
(f64.const 1)
)
)
;;@ binary.ts:147:0
(set_global $binary/b
;;@ binary.ts:147:4
(f64.gt
(get_global $binary/F)
;;@ binary.ts:147:8
(f64.const 1)
)
)
;;@ binary.ts:148:0
(set_global $binary/b
;;@ binary.ts:148:4
(f64.le
(get_global $binary/F)
;;@ binary.ts:148:9
(f64.const 1)
)
)
;;@ binary.ts:149:0
(set_global $binary/b
;;@ binary.ts:149:4
(f64.ge
(get_global $binary/F)
;;@ binary.ts:149:9
(f64.const 1)
)
)
;;@ binary.ts:150:0
(set_global $binary/b
;;@ binary.ts:150:4
(f64.eq
(get_global $binary/F)
;;@ binary.ts:150:9
(f64.const 1)
)
)
;;@ binary.ts:151:0
(set_global $binary/b
;;@ binary.ts:151:4
(f64.eq
(get_global $binary/F)
;;@ binary.ts:151:10
(f64.const 1)
)
)
;;@ binary.ts:152:0
(set_global $binary/F
;;@ binary.ts:152:4
(f64.add
(get_global $binary/F)
;;@ binary.ts:152:8
(f64.const 1)
)
)
;;@ binary.ts:153:0
(set_global $binary/F
;;@ binary.ts:153:4
(f64.sub
(get_global $binary/F)
;;@ binary.ts:153:8
(f64.const 1)
)
)
;;@ binary.ts:154:0
(set_global $binary/F
;;@ binary.ts:154:4
(f64.mul
(get_global $binary/F)
;;@ binary.ts:154:8
(f64.const 1)
)
)
;;@ binary.ts:155:0
(set_global $binary/F
;;@ binary.ts:155:4
(f64.div
(get_global $binary/F)
;;@ binary.ts:155:8
(f64.const 1)
)
)
;;@ binary.ts:158:0
(set_global $binary/F
(f64.add
(get_global $binary/F)
;;@ binary.ts:158:5
(f64.const 1)
)
)
;;@ binary.ts:159:0
(set_global $binary/F
(f64.sub
(get_global $binary/F)
;;@ binary.ts:159:5
(f64.const 1)
)
)
;;@ binary.ts:160:0
(set_global $binary/F
(f64.mul
(get_global $binary/F)
;;@ binary.ts:160:5
(f64.const 1)
)
)

File diff suppressed because it is too large Load Diff

View File

@ -22,12 +22,15 @@
(local $3 i32)
(local $4 i64)
(local $5 i64)
;;@ builtins.ts:13:0
(drop
(select
(tee_local $2
;;@ builtins.ts:13:9
(i32.const 1)
)
(tee_local $3
;;@ builtins.ts:13:12
(i32.const 2)
)
(i32.gt_s
@ -36,22 +39,29 @@
)
)
)
;;@ builtins.ts:16:0
(set_global $builtins/i
(i32.const 31)
)
;;@ builtins.ts:17:0
(set_global $builtins/i
(i32.const 0)
)
;;@ builtins.ts:18:0
(set_global $builtins/i
(i32.const 1)
)
;;@ builtins.ts:19:0
(set_global $builtins/i
(i32.const 2)
)
;;@ builtins.ts:20:0
(set_global $builtins/i
(i32.const -2147483648)
)
;;@ builtins.ts:21:0
(set_global $builtins/i
;;@ builtins.ts:21:4
(select
(tee_local $2
(i32.const -42)
@ -66,18 +76,25 @@
)
)
)
;;@ builtins.ts:21:19
(if
;;@ builtins.ts:21:26
(i32.ne
(get_global $builtins/i)
;;@ builtins.ts:21:31
(i32.const 42)
)
(unreachable)
)
;;@ builtins.ts:22:0
(set_global $builtins/i
;;@ builtins.ts:22:4
(select
(tee_local $2
;;@ builtins.ts:22:13
(i32.const 1)
)
;;@ builtins.ts:22:16
(i32.const 2)
(i32.gt_s
(get_local $2)
@ -85,16 +102,23 @@
)
)
)
;;@ builtins.ts:22:20
(if
;;@ builtins.ts:22:27
(i32.ne
(get_global $builtins/i)
;;@ builtins.ts:22:32
(i32.const 2)
)
(unreachable)
)
;;@ builtins.ts:23:0
(set_global $builtins/i
;;@ builtins.ts:23:4
(select
;;@ builtins.ts:23:13
(i32.const 1)
;;@ builtins.ts:23:16
(i32.const 2)
(i32.lt_s
(get_local $2)
@ -102,29 +126,39 @@
)
)
)
;;@ builtins.ts:23:20
(if
;;@ builtins.ts:23:27
(i32.ne
(get_global $builtins/i)
;;@ builtins.ts:23:32
(i32.const 1)
)
(unreachable)
)
;;@ builtins.ts:34:0
(set_global $builtins/I
(i64.const 63)
)
;;@ builtins.ts:35:0
(set_global $builtins/I
(i64.const 0)
)
;;@ builtins.ts:36:0
(set_global $builtins/I
(i64.const 1)
)
;;@ builtins.ts:37:0
(set_global $builtins/I
(i64.const 2)
)
;;@ builtins.ts:38:0
(set_global $builtins/I
(i64.const -9223372036854775808)
)
;;@ builtins.ts:39:0
(set_global $builtins/I
;;@ builtins.ts:39:4
(select
(tee_local $4
(i64.const -42)
@ -139,19 +173,26 @@
)
)
)
;;@ builtins.ts:39:19
(if
;;@ builtins.ts:39:26
(i64.ne
(get_global $builtins/I)
;;@ builtins.ts:39:31
(i64.const 42)
)
(unreachable)
)
;;@ builtins.ts:40:0
(set_global $builtins/I
;;@ builtins.ts:40:4
(select
(tee_local $4
;;@ builtins.ts:40:13
(i64.const 1)
)
(tee_local $5
;;@ builtins.ts:40:16
(i64.const 2)
)
(i64.gt_s
@ -160,16 +201,23 @@
)
)
)
;;@ builtins.ts:40:20
(if
;;@ builtins.ts:40:27
(i64.ne
(get_global $builtins/I)
;;@ builtins.ts:40:32
(i64.const 2)
)
(unreachable)
)
;;@ builtins.ts:41:0
(set_global $builtins/I
;;@ builtins.ts:41:4
(select
;;@ builtins.ts:41:13
(i64.const 1)
;;@ builtins.ts:41:16
(i64.const 2)
(i64.lt_s
(get_local $4)
@ -177,58 +225,80 @@
)
)
)
;;@ builtins.ts:41:20
(if
;;@ builtins.ts:41:27
(i32.ne
(get_global $builtins/i)
;;@ builtins.ts:41:32
(i32.const 1)
)
(unreachable)
)
;;@ builtins.ts:61:0
(set_global $builtins/f
;;@ builtins.ts:61:4
(f32.const nan:0x400000)
)
;;@ builtins.ts:62:0
(set_global $builtins/f
;;@ builtins.ts:62:4
(f32.const inf)
)
;;@ builtins.ts:63:0
(set_global $builtins/f
(f32.const 1.25)
)
;;@ builtins.ts:64:0
(set_global $builtins/f
(f32.const 2)
)
;;@ builtins.ts:65:0
(set_global $builtins/f
(f32.const 1.25)
)
;;@ builtins.ts:66:0
(set_global $builtins/f
(f32.const 1)
)
;;@ builtins.ts:67:0
(set_global $builtins/f
(f32.const 2.5)
)
;;@ builtins.ts:68:0
(set_global $builtins/f
(f32.const 1.25)
)
;;@ builtins.ts:69:0
(set_global $builtins/f
(f32.const 1.25)
)
;;@ builtins.ts:70:0
(set_global $builtins/f
(f32.const 1.1180340051651)
)
;;@ builtins.ts:71:0
(set_global $builtins/f
(f32.const 1)
)
;;@ builtins.ts:72:0
(set_global $builtins/b
;;@ builtins.ts:72:4
(f32.ne
(tee_local $0
;;@ builtins.ts:72:15
(f32.const 1.25)
)
(get_local $0)
)
)
;;@ builtins.ts:73:0
(set_global $builtins/b
;;@ builtins.ts:73:4
(select
(f32.ne
(f32.abs
;;@ builtins.ts:73:18
(f32.const 1.25)
)
(f32.const inf)
@ -240,51 +310,70 @@
)
)
)
;;@ builtins.ts:93:0
(set_global $builtins/F
;;@ builtins.ts:93:4
(f64.const nan:0x8000000000000)
)
;;@ builtins.ts:94:0
(set_global $builtins/F
;;@ builtins.ts:94:4
(f64.const inf)
)
;;@ builtins.ts:95:0
(set_global $builtins/F
(f64.const 1.25)
)
;;@ builtins.ts:96:0
(set_global $builtins/F
(f64.const 2)
)
;;@ builtins.ts:97:0
(set_global $builtins/F
(f64.const 1.25)
)
;;@ builtins.ts:98:0
(set_global $builtins/F
(f64.const 1)
)
;;@ builtins.ts:99:0
(set_global $builtins/F
(f64.const 2.5)
)
;;@ builtins.ts:100:0
(set_global $builtins/F
(f64.const 1.25)
)
;;@ builtins.ts:101:0
(set_global $builtins/F
(f64.const 1)
)
;;@ builtins.ts:102:0
(set_global $builtins/F
(f64.const 1.118033988749895)
)
;;@ builtins.ts:103:0
(set_global $builtins/F
(f64.const 1)
)
;;@ builtins.ts:104:0
(set_global $builtins/b
;;@ builtins.ts:104:4
(f64.ne
(tee_local $1
;;@ builtins.ts:104:15
(f64.const 1.25)
)
(get_local $1)
)
)
;;@ builtins.ts:105:0
(set_global $builtins/b
;;@ builtins.ts:105:4
(select
(f64.ne
(f64.abs
;;@ builtins.ts:105:18
(f64.const 1.25)
)
(f64.const inf)
@ -296,321 +385,509 @@
)
)
)
;;@ builtins.ts:109:0
(set_global $builtins/i
;;@ builtins.ts:109:4
(i32.load
;;@ builtins.ts:109:14
(i32.const 8)
)
)
;;@ builtins.ts:109:18
(i32.store
;;@ builtins.ts:109:29
(i32.const 8)
;;@ builtins.ts:109:32
(get_global $builtins/i)
)
;;@ builtins.ts:110:0
(i32.store
;;@ builtins.ts:110:11
(i32.const 8)
;;@ builtins.ts:110:14
(i32.load
;;@ builtins.ts:110:24
(i32.const 8)
)
)
;;@ builtins.ts:111:0
(set_global $builtins/I
;;@ builtins.ts:111:4
(i64.load
;;@ builtins.ts:111:14
(i32.const 8)
)
)
;;@ builtins.ts:111:18
(i64.store
;;@ builtins.ts:111:29
(i32.const 8)
;;@ builtins.ts:111:32
(get_global $builtins/I)
)
;;@ builtins.ts:112:0
(i64.store
;;@ builtins.ts:112:11
(i32.const 8)
;;@ builtins.ts:112:14
(i64.load
;;@ builtins.ts:112:24
(i32.const 8)
)
)
;;@ builtins.ts:113:0
(set_global $builtins/f
;;@ builtins.ts:113:4
(f32.load
;;@ builtins.ts:113:14
(i32.const 8)
)
)
;;@ builtins.ts:113:18
(f32.store
;;@ builtins.ts:113:29
(i32.const 8)
;;@ builtins.ts:113:32
(get_global $builtins/f)
)
;;@ builtins.ts:114:0
(f32.store
;;@ builtins.ts:114:11
(i32.const 8)
;;@ builtins.ts:114:14
(f32.load
;;@ builtins.ts:114:24
(i32.const 8)
)
)
;;@ builtins.ts:115:0
(set_global $builtins/F
;;@ builtins.ts:115:4
(f64.load
;;@ builtins.ts:115:14
(i32.const 8)
)
)
;;@ builtins.ts:115:18
(f64.store
;;@ builtins.ts:115:29
(i32.const 8)
;;@ builtins.ts:115:32
(get_global $builtins/F)
)
;;@ builtins.ts:116:0
(f64.store
;;@ builtins.ts:116:11
(i32.const 8)
;;@ builtins.ts:116:14
(f64.load
;;@ builtins.ts:116:24
(i32.const 8)
)
)
;;@ builtins.ts:119:0
(set_global $builtins/i
;;@ builtins.ts:119:4
(i32.load
;;@ builtins.ts:119:14
(i32.const 8)
)
)
;;@ builtins.ts:119:34
(i32.store
;;@ builtins.ts:119:45
(i32.const 8)
;;@ builtins.ts:119:48
(get_global $builtins/i)
)
;;@ builtins.ts:120:0
(i32.store
;;@ builtins.ts:120:11
(i32.const 8)
;;@ builtins.ts:120:14
(i32.load
;;@ builtins.ts:120:24
(i32.const 8)
)
)
;;@ builtins.ts:121:0
(set_global $builtins/I
;;@ builtins.ts:121:4
(i64.load
;;@ builtins.ts:121:14
(i32.const 8)
)
)
;;@ builtins.ts:121:34
(i64.store
;;@ builtins.ts:121:45
(i32.const 8)
;;@ builtins.ts:121:48
(get_global $builtins/I)
)
;;@ builtins.ts:122:0
(i64.store
;;@ builtins.ts:122:11
(i32.const 8)
;;@ builtins.ts:122:14
(i64.load
;;@ builtins.ts:122:24
(i32.const 8)
)
)
;;@ builtins.ts:123:0
(set_global $builtins/f
;;@ builtins.ts:123:4
(f32.load
;;@ builtins.ts:123:14
(i32.const 8)
)
)
;;@ builtins.ts:123:34
(f32.store
;;@ builtins.ts:123:45
(i32.const 8)
;;@ builtins.ts:123:48
(get_global $builtins/f)
)
;;@ builtins.ts:124:0
(f32.store
;;@ builtins.ts:124:11
(i32.const 8)
;;@ builtins.ts:124:14
(f32.load
;;@ builtins.ts:124:24
(i32.const 8)
)
)
;;@ builtins.ts:125:0
(set_global $builtins/F
;;@ builtins.ts:125:4
(f64.load
;;@ builtins.ts:125:14
(i32.const 8)
)
)
;;@ builtins.ts:125:34
(f64.store
;;@ builtins.ts:125:45
(i32.const 8)
;;@ builtins.ts:125:48
(get_global $builtins/F)
)
;;@ builtins.ts:126:0
(f64.store
;;@ builtins.ts:126:11
(i32.const 8)
;;@ builtins.ts:126:14
(f64.load
;;@ builtins.ts:126:24
(i32.const 8)
)
)
;;@ builtins.ts:130:0
(set_global $builtins/i
;;@ builtins.ts:130:4
(i32.load8_s
;;@ builtins.ts:130:13
(i32.const 8)
)
)
;;@ builtins.ts:131:0
(set_global $builtins/i
;;@ builtins.ts:131:4
(i32.load16_s
;;@ builtins.ts:131:14
(i32.const 8)
)
)
;;@ builtins.ts:132:0
(set_global $builtins/i
;;@ builtins.ts:132:4
(i32.load
;;@ builtins.ts:132:14
(i32.const 8)
)
)
;;@ builtins.ts:134:0
(set_global $builtins/i
;;@ builtins.ts:134:4
(i32.load8_u
;;@ builtins.ts:134:13
(i32.const 8)
)
)
;;@ builtins.ts:135:0
(set_global $builtins/i
;;@ builtins.ts:135:4
(i32.load16_u
;;@ builtins.ts:135:14
(i32.const 8)
)
)
;;@ builtins.ts:136:0
(set_global $builtins/i
;;@ builtins.ts:136:4
(i32.load
;;@ builtins.ts:136:14
(i32.const 8)
)
)
;;@ builtins.ts:139:0
(set_global $builtins/u
;;@ builtins.ts:139:4
(i32.load8_u
;;@ builtins.ts:139:13
(i32.const 8)
)
)
;;@ builtins.ts:140:0
(set_global $builtins/u
;;@ builtins.ts:140:4
(i32.load16_u
;;@ builtins.ts:140:14
(i32.const 8)
)
)
;;@ builtins.ts:141:0
(set_global $builtins/u
;;@ builtins.ts:141:4
(i32.load
;;@ builtins.ts:141:14
(i32.const 8)
)
)
;;@ builtins.ts:143:0
(set_global $builtins/u
;;@ builtins.ts:143:4
(i32.load8_s
;;@ builtins.ts:143:13
(i32.const 8)
)
)
;;@ builtins.ts:144:0
(set_global $builtins/u
;;@ builtins.ts:144:4
(i32.load16_s
;;@ builtins.ts:144:14
(i32.const 8)
)
)
;;@ builtins.ts:145:0
(set_global $builtins/u
;;@ builtins.ts:145:4
(i32.load
;;@ builtins.ts:145:14
(i32.const 8)
)
)
;;@ builtins.ts:147:0
(set_global $builtins/I
;;@ builtins.ts:147:4
(i64.load8_s
;;@ builtins.ts:147:13
(i32.const 8)
)
)
;;@ builtins.ts:148:0
(set_global $builtins/I
;;@ builtins.ts:148:4
(i64.load16_s
;;@ builtins.ts:148:14
(i32.const 8)
)
)
;;@ builtins.ts:149:0
(set_global $builtins/I
;;@ builtins.ts:149:4
(i64.load32_s
;;@ builtins.ts:149:14
(i32.const 8)
)
)
;;@ builtins.ts:150:0
(set_global $builtins/I
;;@ builtins.ts:150:4
(i64.load
;;@ builtins.ts:150:14
(i32.const 8)
)
)
;;@ builtins.ts:153:0
(set_global $builtins/U
;;@ builtins.ts:153:4
(i64.load8_u
;;@ builtins.ts:153:13
(i32.const 8)
)
)
;;@ builtins.ts:154:0
(set_global $builtins/U
;;@ builtins.ts:154:4
(i64.load16_u
;;@ builtins.ts:154:14
(i32.const 8)
)
)
;;@ builtins.ts:155:0
(set_global $builtins/U
;;@ builtins.ts:155:4
(i64.load32_u
;;@ builtins.ts:155:14
(i32.const 8)
)
)
;;@ builtins.ts:156:0
(set_global $builtins/U
;;@ builtins.ts:156:4
(i64.load
;;@ builtins.ts:156:14
(i32.const 8)
)
)
;;@ builtins.ts:158:0
(i32.store8
;;@ builtins.ts:158:10
(i32.const 8)
;;@ builtins.ts:158:13
(i32.const 1)
)
;;@ builtins.ts:159:0
(i32.store16
;;@ builtins.ts:159:11
(i32.const 8)
;;@ builtins.ts:159:14
(i32.const 1)
)
;;@ builtins.ts:160:0
(i32.store
;;@ builtins.ts:160:11
(i32.const 8)
;;@ builtins.ts:160:14
(i32.const 1)
)
;;@ builtins.ts:162:0
(i64.store8
;;@ builtins.ts:162:10
(i32.const 8)
;;@ builtins.ts:162:13
(i64.const 1)
)
;;@ builtins.ts:163:0
(i64.store16
;;@ builtins.ts:163:11
(i32.const 8)
;;@ builtins.ts:163:14
(i64.const 1)
)
;;@ builtins.ts:164:0
(i64.store32
;;@ builtins.ts:164:11
(i32.const 8)
;;@ builtins.ts:164:14
(i64.const 1)
)
;;@ builtins.ts:165:0
(i64.store
;;@ builtins.ts:165:11
(i32.const 8)
;;@ builtins.ts:165:14
(i64.const 1)
)
;;@ builtins.ts:167:0
(i64.store
;;@ builtins.ts:167:11
(i32.const 8)
(i64.const 1)
)
;;@ builtins.ts:176:0
(set_global $builtins/i
(i32.const 1067450368)
)
;;@ builtins.ts:177:0
(set_global $builtins/f
(f32.const 3.5032461608120427e-44)
)
;;@ builtins.ts:178:0
(set_global $builtins/I
(i64.const 4608308318706860032)
)
;;@ builtins.ts:179:0
(set_global $builtins/F
(f64.const 1.24e-322)
)
;;@ builtins.ts:185:0
(drop
(current_memory)
)
;;@ builtins.ts:186:0
(drop
(grow_memory
;;@ builtins.ts:186:12
(i32.const 1)
)
)
;;@ builtins.ts:188:0
(set_global $builtins/s
;;@ builtins.ts:188:4
(current_memory)
)
;;@ builtins.ts:189:0
(set_global $builtins/s
;;@ builtins.ts:189:4
(grow_memory
;;@ builtins.ts:189:16
(i32.const 1)
)
)
;;@ builtins.ts:198:0
(set_global $builtins/i
(i32.const 10)
)
;;@ builtins.ts:199:0
(set_global $builtins/I
(i64.const 200)
)
;;@ builtins.ts:200:0
(set_global $builtins/f
(f32.const 1.25)
)
;;@ builtins.ts:201:0
(set_global $builtins/F
(f64.const 25)
)
;;@ builtins.ts:222:0
(if
;;@ builtins.ts:222:7
(f32.eq
(tee_local $0
;;@ builtins.ts:222:18
(f32.const nan:0x400000)
)
(get_local $0)
)
(unreachable)
)
;;@ builtins.ts:223:0
(if
;;@ builtins.ts:223:7
(f64.eq
(tee_local $1
;;@ builtins.ts:223:18
(f64.const nan:0x8000000000000)
)
(get_local $1)
)
(unreachable)
)
;;@ builtins.ts:224:0
(if
;;@ builtins.ts:224:8
(select
(f32.ne
(f32.abs
(tee_local $0
;;@ builtins.ts:224:22
(f32.const nan:0x400000)
)
)
@ -624,11 +901,14 @@
)
(unreachable)
)
;;@ builtins.ts:225:0
(if
;;@ builtins.ts:225:8
(select
(f32.ne
(f32.abs
(tee_local $0
;;@ builtins.ts:225:22
(f32.const inf)
)
)
@ -642,11 +922,14 @@
)
(unreachable)
)
;;@ builtins.ts:226:0
(if
;;@ builtins.ts:226:8
(select
(f64.ne
(f64.abs
(tee_local $1
;;@ builtins.ts:226:22
(f64.const nan:0x8000000000000)
)
)
@ -660,11 +943,14 @@
)
(unreachable)
)
;;@ builtins.ts:227:0
(if
;;@ builtins.ts:227:8
(select
(f64.ne
(f64.abs
(tee_local $1
;;@ builtins.ts:227:22
(f64.const inf)
)
)
@ -678,12 +964,15 @@
)
(unreachable)
)
;;@ builtins.ts:228:0
(if
(i32.eqz
;;@ builtins.ts:228:7
(select
(f32.ne
(f32.abs
(tee_local $0
;;@ builtins.ts:228:21
(f32.const 0)
)
)
@ -698,12 +987,15 @@
)
(unreachable)
)
;;@ builtins.ts:229:0
(if
(i32.eqz
;;@ builtins.ts:229:7
(select
(f64.ne
(f64.abs
(tee_local $1
;;@ builtins.ts:229:21
(f64.const 0)
)
)

File diff suppressed because it is too large Load Diff

View File

@ -4,22 +4,28 @@
(export "test" (func $class-extends/test))
(export "memory" (memory $0))
(func $class-extends/test (; 0 ;) (type $iv) (param $0 i32)
;;@ class-extends.ts:10:2
(drop
(i32.load
(get_local $0)
)
)
;;@ class-extends.ts:11:2
(drop
(i32.load16_s offset=4
(get_local $0)
)
)
;;@ class-extends.ts:12:2
(i32.store
(get_local $0)
;;@ class-extends.ts:12:8
(i32.const 2)
)
;;@ class-extends.ts:13:2
(i32.store16 offset=4
(get_local $0)
;;@ class-extends.ts:13:8
(i32.const 3)
)
)

View File

@ -5,22 +5,28 @@
(export "test" (func $class-extends/test))
(export "memory" (memory $0))
(func $class-extends/test (; 0 ;) (type $iv) (param $0 i32)
;;@ class-extends.ts:10:2
(drop
(i32.load
(get_local $0)
)
)
;;@ class-extends.ts:11:2
(drop
(i32.load16_s offset=4
(get_local $0)
)
)
;;@ class-extends.ts:12:2
(i32.store
(get_local $0)
;;@ class-extends.ts:12:8
(i32.const 2)
)
;;@ class-extends.ts:13:2
(i32.store16 offset=4
(get_local $0)
;;@ class-extends.ts:13:8
(i32.const 3)
)
)
@ -55,6 +61,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -6,33 +6,42 @@
(export "memory" (memory $0))
(start $start)
(func $class/test (; 0 ;) (type $ii) (param $0 i32) (result i32)
;;@ class.ts:23:2
(drop
(i32.load
(get_local $0)
)
)
;;@ class.ts:24:2
(drop
(i32.load16_s offset=4
(get_local $0)
)
)
;;@ class.ts:25:2
(drop
(i32.load8_s offset=6
(get_local $0)
)
)
;;@ class.ts:27:2
(i32.store
(get_local $0)
(i32.const 1)
)
;;@ class.ts:28:2
(i32.store16 offset=4
(get_local $0)
;;@ class.ts:28:19
(i32.const 2)
)
;;@ class.ts:29:2
(i32.store8 offset=6
(get_local $0)
;;@ class.ts:29:25
(i32.const 3)
)
;;@ class.ts:31:12
(get_local $0)
)
(func $start (; 1 ;) (type $v)

View File

@ -12,23 +12,31 @@
(export "memory" (memory $0))
(start $start)
(func $class/Animal.add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ class.ts:3:58
(return
;;@ class.ts:3:43
(i32.add
(i32.add
(get_local $0)
;;@ class.ts:3:47
(get_local $1)
)
;;@ class.ts:3:51
(get_global $class/Animal.ONE)
)
)
)
(func $class/Animal.sub<f32> (; 1 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32)
;;@ class.ts:4:58
(return
;;@ class.ts:4:40
(f32.add
(f32.sub
(get_local $0)
;;@ class.ts:4:44
(get_local $1)
)
;;@ class.ts:4:48
(f32.convert_s/i32
(get_global $class/Animal.ONE)
)
@ -36,23 +44,31 @@
)
)
(func $class/Animal#instanceAdd (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
;;@ class.ts:9:59
(return
;;@ class.ts:9:44
(i32.add
(i32.add
(get_local $1)
;;@ class.ts:9:48
(get_local $2)
)
;;@ class.ts:9:52
(get_global $class/Animal.ONE)
)
)
)
(func $class/Animal#instanceSub<f32> (; 3 ;) (type $ifff) (param $0 i32) (param $1 f32) (param $2 f32) (result f32)
;;@ class.ts:10:59
(return
;;@ class.ts:10:41
(f32.add
(f32.sub
(get_local $1)
;;@ class.ts:10:45
(get_local $2)
)
;;@ class.ts:10:49
(f32.convert_s/i32
(get_global $class/Animal.ONE)
)
@ -62,48 +78,65 @@
(func $class/test (; 4 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
;;@ class.ts:20:9
(drop
(call $class/Animal#instanceAdd
;;@ class.ts:20:2
(get_local $0)
;;@ class.ts:20:21
(i32.const 1)
;;@ class.ts:20:24
(i32.const 2)
)
)
;;@ class.ts:21:9
(drop
(call $class/Animal#instanceSub<f32>
;;@ class.ts:21:2
(get_local $0)
;;@ class.ts:21:26
(f32.const 1)
;;@ class.ts:21:29
(f32.const 2)
)
)
;;@ class.ts:23:2
(drop
(i32.load
(get_local $0)
)
)
;;@ class.ts:24:2
(drop
(i32.load16_s offset=4
(get_local $0)
)
)
;;@ class.ts:25:2
(drop
(i32.load8_s offset=6
(get_local $0)
)
)
;;@ class.ts:27:2
(i32.store
(get_local $0)
;;@ class.ts:27:15
(i32.add
(i32.const 0)
;;@ class.ts:27:19
(i32.const 1)
)
)
;;@ class.ts:28:2
(i32.store16 offset=4
(get_local $0)
;;@ class.ts:28:15
(i32.shr_s
(i32.shl
(i32.add
(i32.const 1)
;;@ class.ts:28:19
(i32.const 1)
)
(i32.const 16)
@ -111,15 +144,19 @@
(i32.const 16)
)
)
;;@ class.ts:29:2
(i32.store8 offset=6
(get_local $0)
;;@ class.ts:29:17
(i32.shr_s
(i32.shl
(i32.add
(i32.add
(i32.const 1)
;;@ class.ts:29:21
(i32.const 1)
)
;;@ class.ts:29:25
(i32.const 1)
)
(i32.const 24)
@ -127,38 +164,53 @@
(i32.const 24)
)
)
;;@ class.ts:31:2
(set_local $1
;;@ class.ts:31:12
(get_local $0)
)
;;@ class.ts:32:2
(set_local $2
;;@ class.ts:32:12
(get_local $1)
)
;;@ class.ts:33:9
(return
(get_local $2)
)
)
(func $start (; 5 ;) (type $v)
;;@ class.ts:13:0
(if
(i32.eqz
;;@ class.ts:13:7
(i32.eq
(i32.const 4)
;;@ class.ts:13:32
(i32.const 4)
)
)
(unreachable)
)
;;@ class.ts:15:0
(drop
(get_global $class/Animal.ONE)
)
;;@ class.ts:16:7
(drop
(call $class/Animal.add
;;@ class.ts:16:11
(i32.const 1)
;;@ class.ts:16:13
(i32.const 2)
)
)
;;@ class.ts:17:7
(drop
(call $class/Animal.sub<f32>
;;@ class.ts:17:16
(f32.const 1)
;;@ class.ts:17:19
(f32.const 2)
)
)
@ -194,6 +246,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -7,7 +7,9 @@
(start $start)
(func $start (; 0 ;) (type $v)
(local $0 i32)
;;@ comma.ts:3:0
(set_global $comma/b
;;@ comma.ts:3:4
(block (result i32)
(set_global $comma/a
(i32.add
@ -20,75 +22,105 @@
(get_local $0)
)
)
;;@ comma.ts:4:0
(if
;;@ comma.ts:4:7
(i32.ne
(get_global $comma/a)
;;@ comma.ts:4:12
(i32.const 1)
)
(unreachable)
)
;;@ comma.ts:5:0
(if
;;@ comma.ts:5:7
(get_global $comma/b)
(unreachable)
)
;;@ comma.ts:7:0
(set_global $comma/a
(i32.add
(get_global $comma/a)
(i32.const 1)
)
)
;;@ comma.ts:7:5
(set_global $comma/b
;;@ comma.ts:7:9
(get_global $comma/a)
)
;;@ comma.ts:8:0
(if
;;@ comma.ts:8:7
(i32.ne
(get_global $comma/a)
;;@ comma.ts:8:12
(i32.const 2)
)
(unreachable)
)
;;@ comma.ts:9:0
(if
;;@ comma.ts:9:7
(i32.ne
(get_global $comma/b)
;;@ comma.ts:9:12
(i32.const 2)
)
(unreachable)
)
;;@ comma.ts:11:0
(set_global $comma/a
;;@ comma.ts:11:4
(block (result i32)
(set_global $comma/b
;;@ comma.ts:11:8
(i32.const 0)
)
(get_global $comma/b)
)
)
;;@ comma.ts:13:0
(set_global $comma/b
;;@ comma.ts:13:4
(block (result i32)
;;@ comma.ts:13:5
(set_global $comma/a
(i32.add
(get_global $comma/a)
(i32.const 1)
)
)
;;@ comma.ts:13:10
(get_global $comma/a)
)
)
;;@ comma.ts:14:0
(if
;;@ comma.ts:14:7
(i32.ne
(get_global $comma/a)
;;@ comma.ts:14:12
(i32.const 1)
)
(unreachable)
)
;;@ comma.ts:15:0
(if
;;@ comma.ts:15:7
(i32.ne
(get_global $comma/b)
;;@ comma.ts:15:12
(i32.const 1)
)
(unreachable)
)
;;@ comma.ts:17:0
(set_global $comma/a
;;@ comma.ts:17:4
(block (result i32)
;;@ comma.ts:17:5
(set_global $comma/a
(i32.add
(get_global $comma/a)
@ -96,41 +128,54 @@
)
)
(set_global $comma/b
;;@ comma.ts:17:14
(get_global $comma/a)
)
(get_global $comma/b)
)
)
;;@ comma.ts:18:0
(if
;;@ comma.ts:18:7
(i32.ne
(get_global $comma/a)
;;@ comma.ts:18:12
(i32.const 2)
)
(unreachable)
)
;;@ comma.ts:19:0
(if
;;@ comma.ts:19:7
(i32.ne
(get_global $comma/b)
;;@ comma.ts:19:12
(i32.const 2)
)
(unreachable)
)
;;@ comma.ts:21:5
(set_local $0
;;@ comma.ts:21:13
(i32.const 0)
)
(loop $continue|0
(if
;;@ comma.ts:21:16
(i32.lt_u
(get_local $0)
;;@ comma.ts:21:20
(get_global $comma/a)
)
(block
;;@ comma.ts:21:23
(set_global $comma/a
(i32.sub
(get_global $comma/a)
(i32.const 1)
)
)
;;@ comma.ts:21:28
(set_local $0
(i32.add
(get_local $0)
@ -141,9 +186,12 @@
)
)
)
;;@ comma.ts:22:0
(if
;;@ comma.ts:22:7
(i32.ne
(get_local $0)
;;@ comma.ts:22:12
(i32.const 1)
)
(unreachable)

View File

@ -9,8 +9,10 @@
(func $start (; 0 ;) (type $v)
(local $0 i32)
(local $1 i32)
;;@ comma.ts:3:0
(block
(set_global $comma/b
;;@ comma.ts:3:4
(block (result i32)
(set_local $0
(get_global $comma/a)
@ -24,28 +26,36 @@
(get_local $0)
)
)
;;@ comma.ts:3:9
(drop
(get_global $comma/a)
)
)
;;@ comma.ts:4:0
(if
(i32.eqz
;;@ comma.ts:4:7
(i32.eq
(get_global $comma/a)
;;@ comma.ts:4:12
(i32.const 1)
)
)
(unreachable)
)
;;@ comma.ts:5:0
(if
(i32.eqz
;;@ comma.ts:5:7
(i32.eq
(get_global $comma/b)
;;@ comma.ts:5:12
(i32.const 0)
)
)
(unreachable)
)
;;@ comma.ts:7:0
(block
(set_global $comma/a
(i32.add
@ -53,111 +63,150 @@
(i32.const 1)
)
)
;;@ comma.ts:7:5
(set_global $comma/b
;;@ comma.ts:7:9
(get_global $comma/a)
)
)
;;@ comma.ts:8:0
(if
(i32.eqz
;;@ comma.ts:8:7
(i32.eq
(get_global $comma/a)
;;@ comma.ts:8:12
(i32.const 2)
)
)
(unreachable)
)
;;@ comma.ts:9:0
(if
(i32.eqz
;;@ comma.ts:9:7
(i32.eq
(get_global $comma/b)
;;@ comma.ts:9:12
(i32.const 2)
)
)
(unreachable)
)
;;@ comma.ts:11:0
(set_global $comma/a
;;@ comma.ts:11:4
(block (result i32)
(set_global $comma/b
;;@ comma.ts:11:8
(i32.const 0)
)
(get_global $comma/b)
)
)
;;@ comma.ts:13:0
(set_global $comma/b
;;@ comma.ts:13:4
(block (result i32)
;;@ comma.ts:13:5
(set_global $comma/a
(i32.add
(get_global $comma/a)
(i32.const 1)
)
)
;;@ comma.ts:13:10
(get_global $comma/a)
)
)
;;@ comma.ts:14:0
(if
(i32.eqz
;;@ comma.ts:14:7
(i32.eq
(get_global $comma/a)
;;@ comma.ts:14:12
(i32.const 1)
)
)
(unreachable)
)
;;@ comma.ts:15:0
(if
(i32.eqz
;;@ comma.ts:15:7
(i32.eq
(get_global $comma/b)
;;@ comma.ts:15:12
(i32.const 1)
)
)
(unreachable)
)
;;@ comma.ts:17:0
(set_global $comma/a
;;@ comma.ts:17:4
(block (result i32)
;;@ comma.ts:17:5
(set_global $comma/a
(i32.add
(get_global $comma/a)
(i32.const 1)
)
)
;;@ comma.ts:17:10
(block (result i32)
(set_global $comma/b
;;@ comma.ts:17:14
(get_global $comma/a)
)
(get_global $comma/b)
)
)
)
;;@ comma.ts:18:0
(if
(i32.eqz
;;@ comma.ts:18:7
(i32.eq
(get_global $comma/a)
;;@ comma.ts:18:12
(i32.const 2)
)
)
(unreachable)
)
;;@ comma.ts:19:0
(if
(i32.eqz
;;@ comma.ts:19:7
(i32.eq
(get_global $comma/b)
;;@ comma.ts:19:12
(i32.const 2)
)
)
(unreachable)
)
;;@ comma.ts:21:0
(block $break|0
;;@ comma.ts:21:5
(set_local $1
;;@ comma.ts:21:13
(i32.const 0)
)
(loop $continue|0
(if
;;@ comma.ts:21:16
(i32.lt_u
(get_local $1)
;;@ comma.ts:21:20
(get_global $comma/a)
)
(block
;;@ comma.ts:21:32
(nop)
;;@ comma.ts:21:23
(block
(set_global $comma/a
(i32.sub
@ -165,6 +214,7 @@
(i32.const 1)
)
)
;;@ comma.ts:21:28
(set_local $1
(i32.add
(get_local $1)
@ -177,22 +227,28 @@
)
)
)
;;@ comma.ts:22:0
(if
(i32.eqz
;;@ comma.ts:22:7
(i32.eq
(get_local $1)
;;@ comma.ts:22:12
(i32.const 1)
)
)
(unreachable)
)
;;@ comma.ts:24:0
(block
(drop
(i32.const 1)
)
;;@ comma.ts:24:3
(drop
(i32.const 2)
)
;;@ comma.ts:24:6
(drop
(i32.const 3)
)
@ -229,6 +285,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -6,7 +6,9 @@
(export "test" (func $declare/test))
(export "memory" (memory $0))
(func $declare/test (; 2 ;) (type $v)
;;@ declare.ts:11:2
(call $declare/externalFunc)
;;@ declare.ts:13:11
(call $declare/external.externalFunc)
)
)

View File

@ -9,11 +9,15 @@
(export "test" (func $declare/test))
(export "memory" (memory $0))
(func $declare/test (; 2 ;) (type $v)
;;@ declare.ts:11:2
(call $declare/externalFunc)
;;@ declare.ts:12:2
(drop
(get_global $declare/externalConst)
)
;;@ declare.ts:13:11
(call $declare/external.externalFunc)
;;@ declare.ts:14:2
(drop
(get_global $declare/external.externalConst)
)
@ -49,6 +53,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -9,12 +9,14 @@
(func $start (; 0 ;) (type $v)
(local $0 i32)
(loop $continue|0
;;@ do.ts:4:2
(set_global $do/n
(i32.sub
(get_global $do/n)
(i32.const 1)
)
)
;;@ do.ts:5:2
(set_global $do/m
(i32.add
(get_global $do/m)
@ -22,27 +24,36 @@
)
)
(br_if $continue|0
;;@ do.ts:6:9
(get_global $do/n)
)
)
;;@ do.ts:7:0
(if
;;@ do.ts:7:7
(get_global $do/n)
(unreachable)
)
;;@ do.ts:8:0
(if
;;@ do.ts:8:7
(i32.ne
(get_global $do/m)
;;@ do.ts:8:12
(i32.const 10)
)
(unreachable)
)
;;@ do.ts:10:0
(set_global $do/n
;;@ do.ts:10:4
(i32.const 10)
)
(loop $continue|1
(set_global $do/n
(i32.sub
(tee_local $0
;;@ do.ts:11:10
(get_global $do/n)
)
(i32.const 1)
@ -52,26 +63,34 @@
(get_local $0)
)
)
;;@ do.ts:12:0
(if
;;@ do.ts:12:7
(i32.ne
(get_global $do/n)
(i32.const -1)
)
(unreachable)
)
;;@ do.ts:14:0
(set_global $do/n
;;@ do.ts:14:4
(i32.const 10)
)
;;@ do.ts:15:0
(set_global $do/m
;;@ do.ts:15:4
(i32.const 0)
)
(loop $continue|2
;;@ do.ts:18:2
(set_global $do/n
(i32.sub
(get_global $do/n)
(i32.const 1)
)
)
;;@ do.ts:19:2
(set_global $do/m
(i32.add
(get_global $do/m)
@ -79,12 +98,14 @@
)
)
(loop $continue|3
;;@ do.ts:21:4
(set_global $do/n
(i32.sub
(get_global $do/n)
(i32.const 1)
)
)
;;@ do.ts:22:4
(set_global $do/o
(i32.add
(get_global $do/o)
@ -92,38 +113,53 @@
)
)
(br_if $continue|3
;;@ do.ts:23:11
(get_global $do/n)
)
)
;;@ do.ts:24:2
(if
;;@ do.ts:24:9
(get_global $do/n)
(unreachable)
)
;;@ do.ts:25:2
(if
;;@ do.ts:25:9
(i32.ne
(get_global $do/o)
;;@ do.ts:25:14
(i32.const 9)
)
(unreachable)
)
(br_if $continue|2
;;@ do.ts:26:9
(get_global $do/n)
)
)
;;@ do.ts:27:0
(if
;;@ do.ts:27:7
(get_global $do/n)
(unreachable)
)
;;@ do.ts:28:0
(if
;;@ do.ts:28:7
(i32.ne
(get_global $do/m)
;;@ do.ts:28:12
(i32.const 1)
)
(unreachable)
)
;;@ do.ts:29:0
(if
;;@ do.ts:29:7
(i32.ne
(get_global $do/o)
;;@ do.ts:29:12
(i32.const 9)
)
(unreachable)

View File

@ -9,15 +9,19 @@
(start $start)
(func $start (; 0 ;) (type $v)
(local $0 i32)
;;@ do.ts:3:0
(block $break|0
(loop $continue|0
;;@ do.ts:3:3
(block
;;@ do.ts:4:2
(set_global $do/n
(i32.sub
(get_global $do/n)
(i32.const 1)
)
)
;;@ do.ts:5:2
(set_global $do/m
(i32.add
(get_global $do/m)
@ -26,35 +30,47 @@
)
)
(br_if $continue|0
;;@ do.ts:6:9
(get_global $do/n)
)
)
)
;;@ do.ts:7:0
(if
(i32.eqz
;;@ do.ts:7:7
(i32.eq
(get_global $do/n)
;;@ do.ts:7:12
(i32.const 0)
)
)
(unreachable)
)
;;@ do.ts:8:0
(if
(i32.eqz
;;@ do.ts:8:7
(i32.eq
(get_global $do/m)
;;@ do.ts:8:12
(i32.const 10)
)
)
(unreachable)
)
;;@ do.ts:10:0
(set_global $do/n
;;@ do.ts:10:4
(i32.const 10)
)
;;@ do.ts:11:0
(block $break|1
(loop $continue|1
;;@ do.ts:11:2
(nop)
(br_if $continue|1
;;@ do.ts:11:10
(block (result i32)
(set_local $0
(get_global $do/n)
@ -70,48 +86,64 @@
)
)
)
;;@ do.ts:12:0
(if
(i32.eqz
;;@ do.ts:12:7
(i32.eq
(get_global $do/n)
;;@ do.ts:12:12
(i32.sub
(i32.const 0)
;;@ do.ts:12:13
(i32.const 1)
)
)
)
(unreachable)
)
;;@ do.ts:14:0
(set_global $do/n
;;@ do.ts:14:4
(i32.const 10)
)
;;@ do.ts:15:0
(set_global $do/m
;;@ do.ts:15:4
(i32.const 0)
)
;;@ do.ts:17:0
(block $break|2
(loop $continue|2
;;@ do.ts:17:3
(block
;;@ do.ts:18:2
(set_global $do/n
(i32.sub
(get_global $do/n)
(i32.const 1)
)
)
;;@ do.ts:19:2
(set_global $do/m
(i32.add
(get_global $do/m)
(i32.const 1)
)
)
;;@ do.ts:20:2
(block $break|3
(loop $continue|3
;;@ do.ts:20:5
(block
;;@ do.ts:21:4
(set_global $do/n
(i32.sub
(get_global $do/n)
(i32.const 1)
)
)
;;@ do.ts:22:4
(set_global $do/o
(i32.add
(get_global $do/o)
@ -120,23 +152,30 @@
)
)
(br_if $continue|3
;;@ do.ts:23:11
(get_global $do/n)
)
)
)
;;@ do.ts:24:2
(if
(i32.eqz
;;@ do.ts:24:9
(i32.eq
(get_global $do/n)
;;@ do.ts:24:14
(i32.const 0)
)
)
(unreachable)
)
;;@ do.ts:25:2
(if
(i32.eqz
;;@ do.ts:25:9
(i32.eq
(get_global $do/o)
;;@ do.ts:25:14
(i32.const 9)
)
)
@ -144,32 +183,42 @@
)
)
(br_if $continue|2
;;@ do.ts:26:9
(get_global $do/n)
)
)
)
;;@ do.ts:27:0
(if
(i32.eqz
;;@ do.ts:27:7
(i32.eq
(get_global $do/n)
;;@ do.ts:27:12
(i32.const 0)
)
)
(unreachable)
)
;;@ do.ts:28:0
(if
(i32.eqz
;;@ do.ts:28:7
(i32.eq
(get_global $do/m)
;;@ do.ts:28:12
(i32.const 1)
)
)
(unreachable)
)
;;@ do.ts:29:0
(if
(i32.eqz
;;@ do.ts:29:7
(i32.eq
(get_global $do/o)
;;@ do.ts:29:12
(i32.const 9)
)
)
@ -207,6 +256,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -33,6 +33,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -36,12 +36,14 @@
(export "memory" (memory $0))
(start $start)
(func $enum/getZero (; 0 ;) (type $i) (result i32)
;;@ enum.ts:23:9
(return
(i32.const 0)
)
)
(func $start (; 1 ;) (type $v)
(set_global $enum/NonConstant.ZERO
;;@ enum.ts:27:9
(call $enum/getZero)
)
(set_global $enum/NonConstant.ONE
@ -82,6 +84,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -14,20 +14,26 @@
(export "two" (func $export/ns.two))
(export "memory" (memory $0))
(func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:2:9
(i32.add
(get_local $0)
;;@ export.ts:2:13
(get_local $1)
)
)
(func $export/sub (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:6:9
(i32.sub
(get_local $0)
;;@ export.ts:6:13
(get_local $1)
)
)
(func $export/mul (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:12:9
(i32.mul
(get_local $0)
;;@ export.ts:12:13
(get_local $1)
)
)

View File

@ -15,25 +15,34 @@
(export "two" (func $export/ns.two))
(export "memory" (memory $0))
(func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:2:13
(return
;;@ export.ts:2:9
(i32.add
(get_local $0)
;;@ export.ts:2:13
(get_local $1)
)
)
)
(func $export/sub (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:6:13
(return
;;@ export.ts:6:9
(i32.sub
(get_local $0)
;;@ export.ts:6:13
(get_local $1)
)
)
)
(func $export/mul (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:12:13
(return
;;@ export.ts:12:9
(i32.mul
(get_local $0)
;;@ export.ts:12:13
(get_local $1)
)
)
@ -71,6 +80,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -6,18 +6,24 @@
(start $start)
(func $start (; 0 ;) (type $v)
(local $0 i32)
;;@ for.ts:2:5
(set_global $for/i
;;@ for.ts:2:9
(i32.const 0)
)
(loop $continue|0
(if
;;@ for.ts:2:12
(i32.lt_s
(get_global $for/i)
;;@ for.ts:2:16
(i32.const 10)
)
(block
;;@ for.ts:2:20
(set_global $for/i
(i32.add
;;@ for.ts:2:22
(get_global $for/i)
(i32.const 1)
)
@ -26,22 +32,29 @@
)
)
)
;;@ for.ts:5:0
(if
;;@ for.ts:5:7
(i32.ne
(get_global $for/i)
;;@ for.ts:5:12
(i32.const 10)
)
(unreachable)
)
(loop $continue|1
(if
;;@ for.ts:7:21
(i32.lt_s
(get_local $0)
;;@ for.ts:7:25
(i32.const 10)
)
(block
;;@ for.ts:7:29
(set_local $0
(i32.add
;;@ for.ts:7:31
(get_local $0)
(i32.const 1)
)
@ -52,13 +65,17 @@
)
(loop $continue|2
(if
;;@ for.ts:11:7
(i32.gt_s
(get_global $for/i)
;;@ for.ts:11:11
(i32.const 0)
)
(block
;;@ for.ts:11:14
(set_global $for/i
(i32.sub
;;@ for.ts:11:16
(get_global $for/i)
(i32.const 1)
)
@ -67,20 +84,28 @@
)
)
)
;;@ for.ts:12:0
(if
;;@ for.ts:12:7
(get_global $for/i)
(unreachable)
)
;;@ for.ts:14:0
(block $break|3
(loop $continue|3
;;@ for.ts:16:4
(br_if $break|3
;;@ for.ts:15:6
(i32.eq
(get_global $for/i)
;;@ for.ts:15:11
(i32.const 10)
)
)
;;@ for.ts:14:8
(set_global $for/i
(i32.add
;;@ for.ts:14:10
(get_global $for/i)
(i32.const 1)
)
@ -91,10 +116,12 @@
(loop $continue|4
(set_global $for/i
(i32.sub
;;@ for.ts:19:8
(get_global $for/i)
(i32.const 1)
)
)
;;@ for.ts:20:4
(br_if $continue|4
(get_global $for/i)
)

View File

@ -7,22 +7,30 @@
(start $start)
(func $start (; 0 ;) (type $v)
(local $0 i32)
;;@ for.ts:2:0
(block $break|0
;;@ for.ts:2:5
(set_global $for/i
;;@ for.ts:2:9
(i32.const 0)
)
(loop $continue|0
(if
;;@ for.ts:2:12
(i32.lt_s
(get_global $for/i)
;;@ for.ts:2:16
(i32.const 10)
)
(block
(block
;;@ for.ts:3:2
(nop)
)
;;@ for.ts:2:20
(set_global $for/i
(i32.add
;;@ for.ts:2:22
(get_global $for/i)
(i32.const 1)
)
@ -32,31 +40,42 @@
)
)
)
;;@ for.ts:5:0
(if
(i32.eqz
;;@ for.ts:5:7
(i32.eq
(get_global $for/i)
;;@ for.ts:5:12
(i32.const 10)
)
)
(unreachable)
)
;;@ for.ts:7:0
(block $break|1
;;@ for.ts:7:5
(set_local $0
;;@ for.ts:7:18
(i32.const 0)
)
(loop $continue|1
(if
;;@ for.ts:7:21
(i32.lt_s
(get_local $0)
;;@ for.ts:7:25
(i32.const 10)
)
(block
(block
;;@ for.ts:8:2
(nop)
)
;;@ for.ts:7:29
(set_local $0
(i32.add
;;@ for.ts:7:31
(get_local $0)
(i32.const 1)
)
@ -66,18 +85,24 @@
)
)
)
;;@ for.ts:11:0
(block $break|2
(nop)
(loop $continue|2
(if
;;@ for.ts:11:7
(i32.gt_s
(get_global $for/i)
;;@ for.ts:11:11
(i32.const 0)
)
(block
;;@ for.ts:11:18
(nop)
;;@ for.ts:11:14
(set_global $for/i
(i32.sub
;;@ for.ts:11:16
(get_global $for/i)
(i32.const 1)
)
@ -87,30 +112,40 @@
)
)
)
;;@ for.ts:12:0
(if
(i32.eqz
;;@ for.ts:12:7
(i32.eq
(get_global $for/i)
;;@ for.ts:12:12
(i32.const 0)
)
)
(unreachable)
)
;;@ for.ts:14:0
(block $break|3
(nop)
(loop $continue|3
(if
(i32.const 1)
(block
;;@ for.ts:15:2
(if
;;@ for.ts:15:6
(i32.eq
(get_global $for/i)
;;@ for.ts:15:11
(i32.const 10)
)
;;@ for.ts:16:4
(br $break|3)
)
;;@ for.ts:14:8
(set_global $for/i
(i32.add
;;@ for.ts:14:10
(get_global $for/i)
(i32.const 1)
)
@ -120,25 +155,31 @@
)
)
)
;;@ for.ts:18:0
(block $break|4
(nop)
(loop $continue|4
(if
(i32.const 1)
(block
;;@ for.ts:19:2
(if
;;@ for.ts:19:6
(i32.eq
(block (result i32)
(set_global $for/i
(i32.sub
;;@ for.ts:19:8
(get_global $for/i)
(i32.const 1)
)
)
(get_global $for/i)
)
;;@ for.ts:19:13
(i32.const 0)
)
;;@ for.ts:20:4
(br $break|4)
)
(nop)
@ -179,6 +220,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -21,21 +21,25 @@
(func $function/v (; 0 ;) (type $v)
)
(func $function/i (; 1 ;) (type $i) (result i32)
;;@ function.ts:2:27
(return
(i32.const 0)
)
)
(func $function/I (; 2 ;) (type $I) (result i64)
;;@ function.ts:3:27
(return
(i64.const 0)
)
)
(func $function/f (; 3 ;) (type $f) (result f32)
;;@ function.ts:4:27
(return
(f32.const 0)
)
)
(func $function/F (; 4 ;) (type $F) (result f64)
;;@ function.ts:5:27
(return
(f64.const 0)
)
@ -43,21 +47,25 @@
(func $function/iv (; 5 ;) (type $iv) (param $0 i32)
)
(func $function/ii (; 6 ;) (type $ii) (param $0 i32) (result i32)
;;@ function.ts:14:34
(return
(get_local $0)
)
)
(func $function/II (; 7 ;) (type $II) (param $0 i64) (result i64)
;;@ function.ts:15:34
(return
(get_local $0)
)
)
(func $function/ff (; 8 ;) (type $ff) (param $0 f32) (result f32)
;;@ function.ts:16:34
(return
(get_local $0)
)
)
(func $function/FF (; 9 ;) (type $FF) (param $0 f64) (result f64)
;;@ function.ts:17:34
(return
(get_local $0)
)
@ -65,17 +73,23 @@
(func $function/iiv (; 10 ;) (type $iiv) (param $0 i32) (param $1 i32)
)
(func $function/iii (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ function.ts:26:47
(return
;;@ function.ts:26:43
(i32.add
(get_local $0)
;;@ function.ts:26:47
(get_local $1)
)
)
)
(func $function/III (; 12 ;) (type $IiI) (param $0 i64) (param $1 i32) (result i64)
;;@ function.ts:27:47
(return
;;@ function.ts:27:43
(i64.add
(get_local $0)
;;@ function.ts:27:47
(i64.extend_s/i32
(get_local $1)
)
@ -83,83 +97,119 @@
)
)
(func $function/fff (; 13 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32)
;;@ function.ts:28:47
(return
;;@ function.ts:28:43
(f32.add
(get_local $0)
;;@ function.ts:28:47
(get_local $1)
)
)
)
(func $function/FFF (; 14 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64)
;;@ function.ts:29:47
(return
;;@ function.ts:29:43
(f64.add
(get_local $0)
;;@ function.ts:29:47
(get_local $1)
)
)
)
(func $start (; 15 ;) (type $v)
;;@ function.ts:7:0
(call $function/v)
;;@ function.ts:8:0
(drop
(call $function/i)
)
;;@ function.ts:9:0
(drop
(call $function/I)
)
;;@ function.ts:10:0
(drop
(call $function/f)
)
;;@ function.ts:11:0
(drop
(call $function/F)
)
;;@ function.ts:19:0
(call $function/iv
;;@ function.ts:19:3
(i32.const 0)
)
;;@ function.ts:20:0
(drop
(call $function/ii
;;@ function.ts:20:3
(i32.const 0)
)
)
;;@ function.ts:21:0
(drop
(call $function/II
;;@ function.ts:21:3
(i64.const 0)
)
)
;;@ function.ts:22:0
(drop
(call $function/ff
;;@ function.ts:22:3
(f32.const 0)
)
)
;;@ function.ts:23:0
(drop
(call $function/FF
;;@ function.ts:23:3
(f64.const 0)
)
)
;;@ function.ts:31:0
(call $function/iiv
;;@ function.ts:31:4
(i32.const 1)
;;@ function.ts:31:7
(i32.const 2)
)
;;@ function.ts:32:0
(drop
(call $function/iii
;;@ function.ts:32:4
(i32.const 1)
;;@ function.ts:32:7
(i32.const 2)
)
)
;;@ function.ts:33:0
(drop
(call $function/III
;;@ function.ts:33:4
(i64.const 1)
;;@ function.ts:33:7
(i32.const 2)
)
)
;;@ function.ts:34:0
(drop
(call $function/fff
;;@ function.ts:34:4
(f32.const 1)
;;@ function.ts:34:7
(f32.const 2)
)
)
;;@ function.ts:35:0
(drop
(call $function/FFF
;;@ function.ts:35:4
(f64.const 1)
;;@ function.ts:35:7
(f64.const 2)
)
)
@ -195,6 +245,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -9,15 +9,22 @@
(export "step" (func $../../examples/game-of-life/assembly/game-of-life/step))
(export "memory" (memory $0))
(func $../../examples/game-of-life/assembly/game-of-life/init (; 0 ;) (type $iiv) (param $0 i32) (param $1 i32)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:9:2
(set_global $../../examples/game-of-life/assembly/game-of-life/w
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:9:6
(get_local $0)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:10:2
(set_global $../../examples/game-of-life/assembly/game-of-life/h
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:10:6
(get_local $1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:11:2
(set_global $../../examples/game-of-life/assembly/game-of-life/s
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:11:6
(i32.mul
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:11:10
(get_global $../../examples/game-of-life/assembly/game-of-life/h)
)
)
@ -31,60 +38,84 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
(set_local $5
(set_local $6
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:16:12
(i32.sub
(get_global $../../examples/game-of-life/assembly/game-of-life/h)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:16:16
(i32.const 1)
)
)
(set_local $6
(set_local $7
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:17:12
(i32.sub
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:17:16
(i32.const 1)
)
)
(loop $continue|0
(if
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:23
(i32.lt_u
(get_local $0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:27
(get_global $../../examples/game-of-life/assembly/game-of-life/h)
)
(block
(set_local $3
(set_local $4
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:14
(select
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:31
(i32.sub
(get_local $0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:35
(i32.const 1)
)
(get_local $5)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:26
(get_local $6)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:38
(get_local $0)
)
)
(set_local $4
(set_local $5
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:14
(select
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:26
(i32.const 0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:29
(i32.add
(get_local $0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:33
(i32.const 1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:36
(i32.eq
(get_local $0)
(get_local $5)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:41
(get_local $6)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:9
(set_local $1
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:22
(i32.const 0)
)
(loop $continue|1
(if
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:25
(i32.lt_u
(get_local $1)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:29
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(block
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:24:6
(set_local $2
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:24:14
(i32.add
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:8
(i32.add
(i32.add
(i32.add
@ -92,170 +123,236 @@
(i32.add
(i32.add
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:17
(i32.add
(i32.mul
(get_local $3)
(get_local $4)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:23
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(tee_local $2
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:16
(select
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:33
(i32.sub
(get_local $1)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:37
(i32.const 1)
)
(get_local $6)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:28
(get_local $7)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:40
(get_local $1)
)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:34
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:43
(i32.add
(i32.mul
(get_local $3)
(get_local $4)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:49
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:53
(get_local $1)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:58
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:67
(i32.add
(i32.mul
(get_local $3)
(get_local $4)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:73
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(tee_local $7
(tee_local $3
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:16
(select
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:28
(i32.const 0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:31
(i32.add
(get_local $1)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:35
(i32.const 1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:38
(i32.eq
(get_local $1)
(get_local $6)
)
)
)
)
)
)
(i32.load8_u
(i32.add
(i32.mul
(get_local $0)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(get_local $2)
)
)
)
(i32.load8_u
(i32.add
(i32.mul
(get_local $0)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(get_local $7)
)
)
)
(i32.load8_u
(i32.add
(i32.mul
(get_local $4)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(get_local $2)
)
)
)
(i32.load8_u
(i32.add
(i32.mul
(get_local $4)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(get_local $1)
)
)
)
(i32.load8_u
(i32.add
(i32.mul
(get_local $4)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:43
(get_local $7)
)
)
)
)
(if
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:8
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:17
(i32.add
(i32.mul
(get_local $0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:23
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:27
(get_local $2)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:58
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:67
(i32.add
(i32.mul
(get_local $0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:73
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:77
(get_local $3)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:8
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:17
(i32.add
(i32.mul
(get_local $5)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:23
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:27
(get_local $2)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:34
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:43
(i32.add
(i32.mul
(get_local $5)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:49
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:53
(get_local $1)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:58
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:67
(i32.add
(i32.mul
(get_local $5)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:73
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:77
(get_local $3)
)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:29:6
(if
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:29:10
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:29:19
(i32.add
(i32.mul
(get_local $0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:29:23
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:29:27
(get_local $1)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:30:8
(if
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:30:12
(i32.and
(select
(if (result i32)
(tee_local $3
(i32.lt_s
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:30:16
(i32.const 2)
)
)
(get_local $3)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:30:21
(i32.gt_s
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:30:25
(i32.const 3)
)
(i32.lt_s
(get_local $2)
(i32.const 2)
)
)
(i32.const 1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:10
(i32.store8
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:20
(i32.add
(i32.add
(get_global $../../examples/game-of-life/assembly/game-of-life/s)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:24
(i32.mul
(get_local $0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:28
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:32
(get_local $1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:35
(i32.const 0)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:32:13
(if
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:32:17
(i32.eq
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:32:22
(i32.const 3)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:8
(i32.store8
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:18
(i32.add
(i32.add
(get_global $../../examples/game-of-life/assembly/game-of-life/s)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:22
(i32.mul
(get_local $0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:26
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:30
(get_local $1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:33
(i32.const 1)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:32
(set_local $1
(i32.add
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:34
(get_local $1)
(i32.const 1)
)
@ -264,8 +361,10 @@
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:30
(set_local $0
(i32.add
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:32
(get_local $0)
(i32.const 1)
)

View File

@ -10,15 +10,22 @@
(export "step" (func $../../examples/game-of-life/assembly/game-of-life/step))
(export "memory" (memory $0))
(func $../../examples/game-of-life/assembly/game-of-life/init (; 0 ;) (type $iiv) (param $0 i32) (param $1 i32)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:9:2
(set_global $../../examples/game-of-life/assembly/game-of-life/w
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:9:6
(get_local $0)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:10:2
(set_global $../../examples/game-of-life/assembly/game-of-life/h
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:10:6
(get_local $1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:11:2
(set_global $../../examples/game-of-life/assembly/game-of-life/s
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:11:6
(i32.mul
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:11:10
(get_global $../../examples/game-of-life/assembly/game-of-life/h)
)
)
@ -33,102 +40,145 @@
(local $6 i32)
(local $7 i32)
(local $8 i32)
(local $9 i32)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:16:2
(block
(set_local $0
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:16:12
(i32.sub
(get_global $../../examples/game-of-life/assembly/game-of-life/h)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:16:16
(i32.const 1)
)
)
(set_local $1
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:17:12
(i32.sub
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:17:16
(i32.const 1)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:2
(block $break|0
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:7
(set_local $2
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:20
(i32.const 0)
)
(loop $continue|0
(if
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:23
(i32.lt_u
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:27
(get_global $../../examples/game-of-life/assembly/game-of-life/h)
)
(block
(block
(block
(set_local $3
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:14
(select
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:26
(get_local $0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:31
(i32.sub
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:35
(i32.const 1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:38
(i32.eq
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:19:43
(i32.const 0)
)
)
)
(set_local $4
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:14
(select
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:26
(i32.const 0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:29
(i32.add
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:33
(i32.const 1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:36
(i32.eq
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:20:41
(get_local $0)
)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:4
(block $break|1
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:9
(set_local $5
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:22
(i32.const 0)
)
(loop $continue|1
(if
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:25
(i32.lt_u
(get_local $5)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:29
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(block
(block
(block
(set_local $6
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:16
(select
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:28
(get_local $1)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:33
(i32.sub
(get_local $5)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:37
(i32.const 1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:40
(i32.eq
(get_local $5)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:22:45
(i32.const 0)
)
)
)
(set_local $7
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:16
(select
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:28
(i32.const 0)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:31
(i32.add
(get_local $5)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:35
(i32.const 1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:38
(i32.eq
(get_local $5)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:23:43
(get_local $1)
)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:24:6
(set_local $8
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:24:14
(i32.add
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:8
(i32.add
(i32.add
(i32.add
@ -136,153 +186,210 @@
(i32.add
(i32.add
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:17
(i32.add
(i32.mul
(get_local $3)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:23
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:27
(get_local $6)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:34
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:43
(i32.add
(i32.mul
(get_local $3)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:49
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:53
(get_local $5)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:58
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:67
(i32.add
(i32.mul
(get_local $3)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:73
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:25:77
(get_local $7)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:8
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:17
(i32.add
(i32.mul
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:23
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:27
(get_local $6)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:58
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:67
(i32.add
(i32.mul
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:73
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:26:77
(get_local $7)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:8
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:17
(i32.add
(i32.mul
(get_local $4)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:23
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:27
(get_local $6)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:34
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:43
(i32.add
(i32.mul
(get_local $4)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:49
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:53
(get_local $5)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:58
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:67
(i32.add
(i32.mul
(get_local $4)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:73
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:27:77
(get_local $7)
)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:29:6
(if
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:29:10
(i32.load8_u
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:29:19
(i32.add
(i32.mul
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:29:23
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:29:27
(get_local $5)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:30:8
(if
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:30:12
(i32.and
(if (result i32)
(i32.ne
(tee_local $9
(i32.lt_s
(get_local $8)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:30:16
(i32.const 2)
)
)
(i32.const 0)
)
(i32.lt_s
(get_local $8)
(i32.const 2)
)
(get_local $9)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:30:21
(i32.gt_s
(get_local $8)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:30:25
(i32.const 3)
)
)
(i32.const 1)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:10
(i32.store8
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:20
(i32.add
(i32.add
(get_global $../../examples/game-of-life/assembly/game-of-life/s)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:24
(i32.mul
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:28
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:32
(get_local $5)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:31:35
(i32.const 0)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:32:13
(if
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:32:17
(i32.eq
(get_local $8)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:32:22
(i32.const 3)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:8
(i32.store8
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:18
(i32.add
(i32.add
(get_global $../../examples/game-of-life/assembly/game-of-life/s)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:22
(i32.mul
(get_local $2)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:26
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:30
(get_local $5)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:33:33
(i32.const 1)
)
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:32
(set_local $5
(i32.add
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:21:34
(get_local $5)
(i32.const 1)
)
@ -293,8 +400,10 @@
)
)
)
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:30
(set_local $2
(i32.add
;;@ ../../examples/game-of-life/assembly/game-of-life.ts:18:32
(get_local $2)
(i32.const 1)
)
@ -336,6 +445,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -1,41 +1,50 @@
(module
(type $i (func (result i32)))
(type $iv (func (param i32)))
(type $v (func))
(global $getter-setter/Foo._bar (mut i32) (i32.const 0))
(memory $0 1)
(export "memory" (memory $0))
(start $start)
(func $getter-setter/Foo.get:bar (; 0 ;) (type $i) (result i32)
(get_global $getter-setter/Foo._bar)
)
(func $getter-setter/Foo.set:bar (; 1 ;) (type $iv) (param $0 i32)
(func $getter-setter/Foo.set:bar (; 0 ;) (type $iv) (param $0 i32)
;;@ getter-setter.ts:9:4
(set_global $getter-setter/Foo._bar
;;@ getter-setter.ts:9:15
(get_local $0)
)
)
(func $start (; 2 ;) (type $v)
(func $start (; 1 ;) (type $v)
;;@ getter-setter.ts:13:0
(if
(call $getter-setter/Foo.get:bar)
(get_global $getter-setter/Foo._bar)
(unreachable)
)
;;@ getter-setter.ts:14:0
(call $getter-setter/Foo.set:bar
;;@ getter-setter.ts:14:10
(i32.const 1)
)
;;@ getter-setter.ts:15:0
(if
;;@ getter-setter.ts:15:7
(i32.ne
(call $getter-setter/Foo.get:bar)
(get_global $getter-setter/Foo._bar)
;;@ getter-setter.ts:15:18
(i32.const 1)
)
(unreachable)
)
;;@ getter-setter.ts:16:0
(if
;;@ getter-setter.ts:16:7
(block (result i32)
(call $getter-setter/Foo.set:bar
;;@ getter-setter.ts:16:18
(i32.const 2)
)
;;@ getter-setter.ts:16:7
(i32.ne
(call $getter-setter/Foo.get:bar)
(get_global $getter-setter/Foo._bar)
;;@ getter-setter.ts:16:24
(i32.const 2)
)
)

View File

@ -8,46 +8,62 @@
(export "memory" (memory $0))
(start $start)
(func $getter-setter/Foo.get:bar (; 0 ;) (type $i) (result i32)
;;@ getter-setter.ts:5:15
(return
;;@ getter-setter.ts:5:11
(get_global $getter-setter/Foo._bar)
)
)
(func $getter-setter/Foo.set:bar (; 1 ;) (type $iv) (param $0 i32)
;;@ getter-setter.ts:9:4
(set_global $getter-setter/Foo._bar
;;@ getter-setter.ts:9:15
(get_local $0)
)
)
(func $start (; 2 ;) (type $v)
;;@ getter-setter.ts:13:0
(if
(i32.eqz
;;@ getter-setter.ts:13:7
(i32.eq
(call $getter-setter/Foo.get:bar)
;;@ getter-setter.ts:13:18
(i32.const 0)
)
)
(unreachable)
)
;;@ getter-setter.ts:14:0
(call $getter-setter/Foo.set:bar
;;@ getter-setter.ts:14:10
(i32.const 1)
)
;;@ getter-setter.ts:15:0
(if
(i32.eqz
;;@ getter-setter.ts:15:7
(i32.eq
(call $getter-setter/Foo.get:bar)
;;@ getter-setter.ts:15:18
(i32.const 1)
)
)
(unreachable)
)
;;@ getter-setter.ts:16:0
(if
(i32.eqz
;;@ getter-setter.ts:16:7
(i32.eq
(block (result i32)
(call $getter-setter/Foo.set:bar
;;@ getter-setter.ts:16:18
(i32.const 2)
)
(call $getter-setter/Foo.get:bar)
)
;;@ getter-setter.ts:16:24
(i32.const 2)
)
)
@ -85,6 +101,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -10,71 +10,103 @@
(start $start)
(func $if/ifThenElse (; 0 ;) (type $ii) (param $0 i32) (result i32)
(select
;;@ if.ts:3:11
(i32.const 1)
;;@ if.ts:5:11
(i32.const 0)
;;@ if.ts:2:6
(get_local $0)
)
)
(func $if/ifThen (; 1 ;) (type $ii) (param $0 i32) (result i32)
;;@ if.ts:12:2
(if
;;@ if.ts:12:6
(get_local $0)
;;@ if.ts:13:11
(return
(i32.const 1)
)
)
;;@ if.ts:14:9
(i32.const 0)
)
(func $if/ifAlwaysReturns (; 2 ;) (type $ii) (param $0 i32) (result i32)
;;@ if.ts:34:2
(if
;;@ if.ts:34:6
(get_local $0)
;;@ if.ts:35:11
(return
(i32.const 1)
)
;;@ if.ts:37:4
(unreachable)
)
)
(func $start (; 3 ;) (type $v)
;;@ if.ts:8:0
(if
;;@ if.ts:8:7
(call $if/ifThenElse
;;@ if.ts:8:18
(i32.const 0)
)
(unreachable)
)
;;@ if.ts:9:0
(if
;;@ if.ts:9:7
(i32.ne
(call $if/ifThenElse
;;@ if.ts:9:18
(i32.const 1)
)
;;@ if.ts:9:24
(i32.const 1)
)
(unreachable)
)
;;@ if.ts:17:0
(if
;;@ if.ts:17:7
(call $if/ifThen
;;@ if.ts:17:14
(i32.const 0)
)
(unreachable)
)
;;@ if.ts:18:0
(if
;;@ if.ts:18:7
(i32.ne
(call $if/ifThen
;;@ if.ts:18:14
(i32.const 1)
)
;;@ if.ts:18:20
(i32.const 1)
)
(unreachable)
)
;;@ if.ts:30:0
(if
;;@ if.ts:30:7
(call $if/ifThenElse
;;@ if.ts:30:23
(i32.const 0)
)
(unreachable)
)
;;@ if.ts:31:0
(if
;;@ if.ts:31:7
(i32.ne
(call $if/ifThenElse
;;@ if.ts:31:23
(i32.const 1)
)
;;@ if.ts:31:29
(i32.const 1)
)
(unreachable)

View File

@ -10,38 +10,54 @@
(export "memory" (memory $0))
(start $start)
(func $if/ifThenElse (; 0 ;) (type $ii) (param $0 i32) (result i32)
;;@ if.ts:2:2
(if
;;@ if.ts:2:6
(get_local $0)
;;@ if.ts:3:11
(return
(i32.const 1)
)
;;@ if.ts:5:11
(return
(i32.const 0)
)
)
)
(func $if/ifThen (; 1 ;) (type $ii) (param $0 i32) (result i32)
;;@ if.ts:12:2
(if
;;@ if.ts:12:6
(get_local $0)
;;@ if.ts:13:11
(return
(i32.const 1)
)
)
;;@ if.ts:14:9
(return
(i32.const 0)
)
)
(func $if/ifThenElseBlock (; 2 ;) (type $ii) (param $0 i32) (result i32)
;;@ if.ts:21:2
(if
;;@ if.ts:21:6
(get_local $0)
;;@ if.ts:21:9
(block
;;@ if.ts:22:4
(nop)
;;@ if.ts:23:11
(return
(i32.const 1)
)
)
;;@ if.ts:24:9
(block
;;@ if.ts:25:4
(nop)
;;@ if.ts:26:11
(return
(i32.const 0)
)
@ -49,76 +65,104 @@
)
)
(func $if/ifAlwaysReturns (; 3 ;) (type $ii) (param $0 i32) (result i32)
;;@ if.ts:34:2
(if
;;@ if.ts:34:6
(get_local $0)
;;@ if.ts:35:11
(return
(i32.const 1)
)
;;@ if.ts:37:4
(unreachable)
)
)
(func $start (; 4 ;) (type $v)
;;@ if.ts:8:0
(if
(i32.eqz
;;@ if.ts:8:7
(i32.eq
(call $if/ifThenElse
;;@ if.ts:8:18
(i32.const 0)
)
;;@ if.ts:8:24
(i32.const 0)
)
)
(unreachable)
)
;;@ if.ts:9:0
(if
(i32.eqz
;;@ if.ts:9:7
(i32.eq
(call $if/ifThenElse
;;@ if.ts:9:18
(i32.const 1)
)
;;@ if.ts:9:24
(i32.const 1)
)
)
(unreachable)
)
;;@ if.ts:17:0
(if
(i32.eqz
;;@ if.ts:17:7
(i32.eq
(call $if/ifThen
;;@ if.ts:17:14
(i32.const 0)
)
;;@ if.ts:17:20
(i32.const 0)
)
)
(unreachable)
)
;;@ if.ts:18:0
(if
(i32.eqz
;;@ if.ts:18:7
(i32.eq
(call $if/ifThen
;;@ if.ts:18:14
(i32.const 1)
)
;;@ if.ts:18:20
(i32.const 1)
)
)
(unreachable)
)
;;@ if.ts:30:0
(if
(i32.eqz
;;@ if.ts:30:7
(i32.eq
(call $if/ifThenElseBlock
;;@ if.ts:30:23
(i32.const 0)
)
;;@ if.ts:30:29
(i32.const 0)
)
)
(unreachable)
)
;;@ if.ts:31:0
(if
(i32.eqz
;;@ if.ts:31:7
(i32.eq
(call $if/ifThenElseBlock
;;@ if.ts:31:23
(i32.const 1)
)
;;@ if.ts:31:29
(i32.const 1)
)
)
@ -156,6 +200,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -9,25 +9,34 @@
(export "memory" (memory $0))
(start $start)
(func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:2:13
(return
;;@ export.ts:2:9
(i32.add
(get_local $0)
;;@ export.ts:2:13
(get_local $1)
)
)
)
(func $export/sub (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:6:13
(return
;;@ export.ts:6:9
(i32.sub
(get_local $0)
;;@ export.ts:6:13
(get_local $1)
)
)
)
(func $export/mul (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:12:13
(return
;;@ export.ts:12:9
(i32.mul
(get_local $0)
;;@ export.ts:12:13
(get_local $1)
)
)
@ -35,24 +44,34 @@
(func $export/ns.two (; 3 ;) (type $v)
)
(func $start (; 4 ;) (type $v)
;;@ import.ts:11:0
(drop
(i32.add
(i32.add
(call $export/add
;;@ import.ts:11:4
(i32.const 1)
;;@ import.ts:11:7
(i32.const 2)
)
;;@ import.ts:11:12
(call $export/sub
;;@ import.ts:11:16
(i32.const 2)
;;@ import.ts:11:19
(i32.const 3)
)
)
;;@ import.ts:11:24
(call $export/mul
;;@ import.ts:11:28
(i32.const 3)
;;@ import.ts:11:31
(i32.const 1)
)
)
)
;;@ import.ts:13:11
(call $export/ns.two)
)
)
@ -86,6 +105,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -23,13 +23,16 @@
)
(loop $continue|0
(if
;;@ infer-type.ts:44:24
(i32.lt_u
(get_local $0)
(i32.const 10)
)
(block
;;@ infer-type.ts:44:31
(set_local $0
(i32.add
;;@ infer-type.ts:44:33
(get_local $0)
(i32.const 1)
)

View File

@ -22,41 +22,57 @@
(local $3 i32)
(local $4 i64)
(local $5 f64)
;;@ infer-type.ts:11:2
(set_local $0
;;@ infer-type.ts:11:11
(i32.const 10)
)
;;@ infer-type.ts:12:2
(set_local $1
;;@ infer-type.ts:12:11
(i64.const 4294967296)
)
;;@ infer-type.ts:13:2
(set_local $2
;;@ infer-type.ts:13:11
(f64.const 1.5)
)
;;@ infer-type.ts:14:2
(set_local $3
;;@ infer-type.ts:14:11
(i32.const 10)
)
;;@ infer-type.ts:15:2
(set_local $4
;;@ infer-type.ts:15:11
(i64.const 4294967296)
)
;;@ infer-type.ts:16:2
(set_local $5
;;@ infer-type.ts:16:11
(f64.const 1.5)
)
)
(func $infer-type/reti (; 1 ;) (type $i) (result i32)
;;@ infer-type.ts:21:9
(return
(i32.const 0)
)
)
(func $infer-type/retI (; 2 ;) (type $I) (result i64)
;;@ infer-type.ts:27:9
(return
(i64.const 0)
)
)
(func $infer-type/retf (; 3 ;) (type $f) (result f32)
;;@ infer-type.ts:33:9
(return
(f32.const 0)
)
)
(func $infer-type/refF (; 4 ;) (type $F) (result f64)
;;@ infer-type.ts:39:9
(return
(f64.const 0)
)
@ -64,61 +80,81 @@
(func $start (; 5 ;) (type $v)
(local $0 i32)
(local $1 i32)
;;@ infer-type.ts:2:0
(drop
(i32.const 10)
)
;;@ infer-type.ts:5:0
(drop
(i64.const 4294967296)
)
;;@ infer-type.ts:8:0
(drop
(f64.const 1.5)
)
;;@ infer-type.ts:18:0
(call $infer-type/locals)
(set_global $infer-type/ri
;;@ infer-type.ts:23:9
(call $infer-type/reti)
)
;;@ infer-type.ts:24:0
(drop
(get_global $infer-type/ri)
)
(set_global $infer-type/rI
;;@ infer-type.ts:29:9
(call $infer-type/retI)
)
;;@ infer-type.ts:30:0
(drop
(get_global $infer-type/rI)
)
(set_global $infer-type/rf
;;@ infer-type.ts:35:9
(call $infer-type/retf)
)
;;@ infer-type.ts:36:0
(drop
(get_global $infer-type/rf)
)
(set_global $infer-type/rF
;;@ infer-type.ts:41:9
(call $infer-type/refF)
)
;;@ infer-type.ts:42:0
(drop
(get_global $infer-type/rF)
)
;;@ infer-type.ts:44:0
(block $break|0
(block
(set_local $0
;;@ infer-type.ts:44:13
(i32.const 0)
)
(set_local $1
;;@ infer-type.ts:44:20
(i32.const 10)
)
)
(loop $continue|0
(if
;;@ infer-type.ts:44:24
(i32.lt_u
(get_local $0)
;;@ infer-type.ts:44:28
(get_local $1)
)
(block
(block
;;@ infer-type.ts:45:2
(nop)
)
;;@ infer-type.ts:44:31
(set_local $0
(i32.add
;;@ infer-type.ts:44:33
(get_local $0)
(i32.const 1)
)
@ -160,6 +196,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -9,12 +9,7 @@
(i32.const 3)
)
(func $start (; 1 ;) (type $v)
(if
(i32.ne
(call $inlining/test)
(i32.const 3)
)
(unreachable)
)
;;@ inlining.ts:8:0
(nop)
)
)

View File

@ -8,19 +8,26 @@
(export "memory" (memory $0))
(start $start)
(func $inlining/test (; 0 ;) (type $i) (result i32)
;;@ inlining.ts:4:2
(nop)
;;@ inlining.ts:5:26
(return
;;@ inlining.ts:5:9
(i32.add
(i32.const 1)
;;@ inlining.ts:5:26
(i32.const 2)
)
)
)
(func $start (; 1 ;) (type $v)
;;@ inlining.ts:8:0
(if
(i32.eqz
;;@ inlining.ts:8:7
(i32.eq
(call $inlining/test)
;;@ inlining.ts:8:17
(i32.const 3)
)
)
@ -58,6 +65,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -27,81 +27,107 @@
(export "memory" (memory $0))
(start $start)
(func $start (; 0 ;) (type $v)
;;@ limits.ts:1:0
(drop
(i32.const -128)
)
;;@ limits.ts:2:0
(drop
(i32.const 127)
)
;;@ limits.ts:3:0
(drop
(i32.const -32768)
)
;;@ limits.ts:4:0
(drop
(i32.const 32767)
)
;;@ limits.ts:5:0
(drop
(i32.const -2147483648)
)
;;@ limits.ts:6:0
(drop
(i32.const 2147483647)
)
;;@ limits.ts:7:0
(drop
(i64.const -9223372036854775808)
)
;;@ limits.ts:8:0
(drop
(i64.const 9223372036854775807)
)
;;@ limits.ts:9:0
(drop
(i32.const -2147483648)
)
;;@ limits.ts:10:0
(drop
(i32.const 2147483647)
)
;;@ limits.ts:11:0
(drop
(i32.const 0)
)
;;@ limits.ts:12:0
(drop
(i32.const 255)
)
;;@ limits.ts:13:0
(drop
(i32.const 0)
)
;;@ limits.ts:14:0
(drop
(i32.const 65535)
)
;;@ limits.ts:15:0
(drop
(i32.const 0)
)
;;@ limits.ts:16:0
(drop
(i32.const -1)
)
;;@ limits.ts:17:0
(drop
(i64.const 0)
)
;;@ limits.ts:18:0
(drop
(i64.const -1)
)
;;@ limits.ts:19:0
(drop
(i32.const 0)
)
;;@ limits.ts:20:0
(drop
(i32.const -1)
)
;;@ limits.ts:21:0
(drop
(i32.const 0)
)
;;@ limits.ts:22:0
(drop
(i32.const 1)
)
;;@ limits.ts:23:0
(drop
(f32.const -16777215)
)
;;@ limits.ts:24:0
(drop
(f32.const 16777215)
)
;;@ limits.ts:25:0
(drop
(f64.const -9007199254740991)
)
;;@ limits.ts:26:0
(drop
(f64.const 9007199254740991)
)
@ -137,6 +163,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -5,135 +5,179 @@
(export "memory" (memory $0))
(start $start)
(func $start (; 0 ;) (type $v)
;;@ literals.ts:1:0
(drop
(i32.const 0)
)
;;@ literals.ts:2:0
(drop
(i32.const 1)
)
;;@ literals.ts:3:0
(drop
(i32.const 2)
)
;;@ literals.ts:4:0
(drop
(i32.const 3)
)
;;@ literals.ts:5:0
(drop
(i32.const 4)
)
;;@ literals.ts:6:0
(drop
(i32.const 5)
)
;;@ literals.ts:7:0
(drop
(i32.const 6)
)
;;@ literals.ts:8:0
(drop
(i32.const 7)
)
;;@ literals.ts:9:0
(drop
(i32.const 8)
)
;;@ literals.ts:10:0
(drop
(i32.const 9)
)
;;@ literals.ts:11:0
(drop
(i32.const 0)
)
;;@ literals.ts:12:0
(drop
(i32.const 1)
)
;;@ literals.ts:13:0
(drop
(i32.const 2)
)
;;@ literals.ts:14:0
(drop
(i32.const 3)
)
;;@ literals.ts:15:0
(drop
(i32.const 4)
)
;;@ literals.ts:16:0
(drop
(i32.const 5)
)
;;@ literals.ts:17:0
(drop
(i32.const 6)
)
;;@ literals.ts:18:0
(drop
(i32.const 7)
)
;;@ literals.ts:19:0
(drop
(i32.const 8)
)
;;@ literals.ts:20:0
(drop
(i32.const 9)
)
;;@ literals.ts:21:0
(drop
(i32.const 10)
)
;;@ literals.ts:22:0
(drop
(i32.const 11)
)
;;@ literals.ts:23:0
(drop
(i32.const 12)
)
;;@ literals.ts:24:0
(drop
(i32.const 13)
)
;;@ literals.ts:25:0
(drop
(i32.const 14)
)
;;@ literals.ts:26:0
(drop
(i32.const 15)
)
;;@ literals.ts:27:0
(drop
(i32.const 10)
)
;;@ literals.ts:28:0
(drop
(i32.const 11)
)
;;@ literals.ts:29:0
(drop
(i32.const 12)
)
;;@ literals.ts:30:0
(drop
(i32.const 13)
)
;;@ literals.ts:31:0
(drop
(i32.const 14)
)
;;@ literals.ts:32:0
(drop
(i32.const 15)
)
;;@ literals.ts:33:0
(drop
(i32.const 0)
)
;;@ literals.ts:34:0
(drop
(i32.const 1)
)
;;@ literals.ts:35:0
(drop
(i32.const 2)
)
;;@ literals.ts:36:0
(drop
(i32.const 3)
)
;;@ literals.ts:37:0
(drop
(i32.const 4)
)
;;@ literals.ts:38:0
(drop
(i32.const 5)
)
;;@ literals.ts:39:0
(drop
(i32.const 6)
)
;;@ literals.ts:40:0
(drop
(i32.const 7)
)
;;@ literals.ts:41:0
(drop
(i32.const 0)
)
;;@ literals.ts:42:0
(drop
(i32.const 1)
)
;;@ literals.ts:43:0
(drop
(i32.const 1)
)
;;@ literals.ts:44:0
(drop
(i32.const 0)
)
@ -169,6 +213,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -16,6 +16,7 @@
(i32.const 2)
)
)
;;@ logical.ts:6:10
(unreachable)
)
(if
@ -25,84 +26,117 @@
)
(f64.const 0)
)
;;@ logical.ts:7:14
(unreachable)
)
;;@ logical.ts:11:0
(set_global $logical/i
(i32.const 2)
)
;;@ logical.ts:12:0
(if
;;@ logical.ts:12:7
(i32.ne
(get_global $logical/i)
;;@ logical.ts:12:12
(i32.const 2)
)
(unreachable)
)
;;@ logical.ts:14:0
(set_global $logical/i
(i32.const 1)
)
;;@ logical.ts:15:0
(if
;;@ logical.ts:15:7
(i32.ne
(get_global $logical/i)
;;@ logical.ts:15:12
(i32.const 1)
)
(unreachable)
)
;;@ logical.ts:19:0
(set_global $logical/I
(i64.const 2)
)
;;@ logical.ts:20:0
(if
;;@ logical.ts:20:7
(i64.ne
(get_global $logical/I)
;;@ logical.ts:20:12
(i64.const 2)
)
(unreachable)
)
;;@ logical.ts:22:0
(set_global $logical/I
(i64.const 1)
)
;;@ logical.ts:23:0
(if
;;@ logical.ts:23:7
(i64.ne
(get_global $logical/I)
;;@ logical.ts:23:12
(i64.const 1)
)
(unreachable)
)
;;@ logical.ts:27:0
(set_global $logical/f
(f32.const 2)
)
;;@ logical.ts:28:0
(if
;;@ logical.ts:28:7
(f32.ne
(get_global $logical/f)
;;@ logical.ts:28:12
(f32.const 2)
)
(unreachable)
)
;;@ logical.ts:30:0
(set_global $logical/f
(f32.const 1)
)
;;@ logical.ts:31:0
(if
;;@ logical.ts:31:7
(f32.ne
(get_global $logical/f)
;;@ logical.ts:31:12
(f32.const 1)
)
(unreachable)
)
;;@ logical.ts:35:0
(set_global $logical/F
(f64.const 2)
)
;;@ logical.ts:36:0
(if
;;@ logical.ts:36:7
(f64.ne
(get_global $logical/F)
;;@ logical.ts:36:12
(f64.const 2)
)
(unreachable)
)
;;@ logical.ts:38:0
(set_global $logical/F
(f64.const 1)
)
;;@ logical.ts:39:0
(if
;;@ logical.ts:39:7
(f64.ne
(get_global $logical/F)
;;@ logical.ts:39:12
(f64.const 1)
)
(unreachable)

View File

@ -11,26 +11,31 @@
(func $start (; 0 ;) (type $v)
(local $0 i32)
(local $1 f64)
;;@ logical.ts:1:0
(drop
(if (result i32)
(i32.ne
(i32.const 0)
(i32.const 0)
)
;;@ logical.ts:1:5
(unreachable)
(i32.const 0)
)
)
;;@ logical.ts:2:0
(drop
(if (result f64)
(f64.ne
(f64.const 0)
(f64.const 0)
)
;;@ logical.ts:2:7
(unreachable)
(f64.const 0)
)
)
;;@ logical.ts:3:0
(drop
(if (result i32)
(i32.ne
@ -38,9 +43,11 @@
(i32.const 0)
)
(i32.const 1)
;;@ logical.ts:3:5
(unreachable)
)
)
;;@ logical.ts:4:0
(drop
(if (result f64)
(f64.ne
@ -48,9 +55,11 @@
(f64.const 0)
)
(f64.const 1)
;;@ logical.ts:4:7
(unreachable)
)
)
;;@ logical.ts:6:0
(drop
(if (result i32)
(i32.ne
@ -60,6 +69,7 @@
(i32.const 1)
(i32.const 0)
)
;;@ logical.ts:6:5
(i32.const 2)
(i32.const 1)
)
@ -67,9 +77,11 @@
(i32.const 0)
)
(get_local $0)
;;@ logical.ts:6:10
(unreachable)
)
)
;;@ logical.ts:7:0
(drop
(if (result f64)
(f64.ne
@ -79,6 +91,7 @@
(f64.const 1)
(f64.const 0)
)
;;@ logical.ts:7:7
(f64.const 2)
(f64.const 1)
)
@ -86,156 +99,205 @@
(f64.const 0)
)
(get_local $1)
;;@ logical.ts:7:14
(unreachable)
)
)
;;@ logical.ts:11:0
(set_global $logical/i
;;@ logical.ts:11:4
(if (result i32)
(i32.ne
(i32.const 1)
(i32.const 0)
)
;;@ logical.ts:11:9
(i32.const 2)
(i32.const 1)
)
)
;;@ logical.ts:12:0
(if
(i32.eqz
;;@ logical.ts:12:7
(i32.eq
(get_global $logical/i)
;;@ logical.ts:12:12
(i32.const 2)
)
)
(unreachable)
)
;;@ logical.ts:14:0
(set_global $logical/i
;;@ logical.ts:14:4
(if (result i32)
(i32.ne
(i32.const 0)
(i32.const 0)
)
(i32.const 0)
;;@ logical.ts:14:9
(i32.const 1)
)
)
;;@ logical.ts:15:0
(if
(i32.eqz
;;@ logical.ts:15:7
(i32.eq
(get_global $logical/i)
;;@ logical.ts:15:12
(i32.const 1)
)
)
(unreachable)
)
;;@ logical.ts:19:0
(set_global $logical/I
;;@ logical.ts:19:4
(if (result i64)
(i64.ne
(i64.const 1)
(i64.const 0)
)
;;@ logical.ts:19:9
(i64.const 2)
(i64.const 1)
)
)
;;@ logical.ts:20:0
(if
(i32.eqz
;;@ logical.ts:20:7
(i64.eq
(get_global $logical/I)
;;@ logical.ts:20:12
(i64.const 2)
)
)
(unreachable)
)
;;@ logical.ts:22:0
(set_global $logical/I
;;@ logical.ts:22:4
(if (result i64)
(i64.ne
(i64.const 0)
(i64.const 0)
)
(i64.const 0)
;;@ logical.ts:22:9
(i64.const 1)
)
)
;;@ logical.ts:23:0
(if
(i32.eqz
;;@ logical.ts:23:7
(i64.eq
(get_global $logical/I)
;;@ logical.ts:23:12
(i64.const 1)
)
)
(unreachable)
)
;;@ logical.ts:27:0
(set_global $logical/f
;;@ logical.ts:27:4
(if (result f32)
(f32.ne
(f32.const 1)
(f32.const 0)
)
;;@ logical.ts:27:11
(f32.const 2)
(f32.const 1)
)
)
;;@ logical.ts:28:0
(if
(i32.eqz
;;@ logical.ts:28:7
(f32.eq
(get_global $logical/f)
;;@ logical.ts:28:12
(f32.const 2)
)
)
(unreachable)
)
;;@ logical.ts:30:0
(set_global $logical/f
;;@ logical.ts:30:4
(if (result f32)
(f32.ne
(f32.const 0)
(f32.const 0)
)
(f32.const 0)
;;@ logical.ts:30:11
(f32.const 1)
)
)
;;@ logical.ts:31:0
(if
(i32.eqz
;;@ logical.ts:31:7
(f32.eq
(get_global $logical/f)
;;@ logical.ts:31:12
(f32.const 1)
)
)
(unreachable)
)
;;@ logical.ts:35:0
(set_global $logical/F
;;@ logical.ts:35:4
(if (result f64)
(f64.ne
(f64.const 1)
(f64.const 0)
)
;;@ logical.ts:35:11
(f64.const 2)
(f64.const 1)
)
)
;;@ logical.ts:36:0
(if
(i32.eqz
;;@ logical.ts:36:7
(f64.eq
(get_global $logical/F)
;;@ logical.ts:36:12
(f64.const 2)
)
)
(unreachable)
)
;;@ logical.ts:38:0
(set_global $logical/F
;;@ logical.ts:38:4
(if (result f64)
(f64.ne
(f64.const 0)
(f64.const 0)
)
(f64.const 0)
;;@ logical.ts:38:11
(f64.const 1)
)
)
;;@ logical.ts:39:0
(if
(i32.eqz
;;@ logical.ts:39:7
(f64.eq
(get_global $logical/F)
;;@ logical.ts:39:12
(f64.const 1)
)
)
@ -273,6 +335,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,53 +8,77 @@
(func $memmove/memmove (; 0 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
;;@ memmove.ts:2:2
(set_local $4
;;@ memmove.ts:2:12
(get_local $0)
)
;;@ memmove.ts:3:2
(if
;;@ memmove.ts:3:6
(i32.eq
(get_local $0)
;;@ memmove.ts:3:14
(get_local $1)
)
;;@ memmove.ts:4:11
(return
(get_local $4)
)
)
;;@ memmove.ts:9:2
(if
;;@ memmove.ts:9:6
(i32.lt_u
(get_local $0)
;;@ memmove.ts:9:13
(get_local $1)
)
;;@ memmove.ts:9:18
(block
;;@ memmove.ts:10:4
(if
;;@ memmove.ts:10:8
(i32.eq
(i32.rem_u
(get_local $1)
;;@ memmove.ts:10:14
(i32.const 8)
)
;;@ memmove.ts:10:19
(i32.rem_u
(get_local $0)
;;@ memmove.ts:10:26
(i32.const 8)
)
)
;;@ memmove.ts:10:29
(block
(loop $continue|0
(if
;;@ memmove.ts:11:13
(i32.rem_u
(get_local $0)
;;@ memmove.ts:11:20
(i32.const 8)
)
(block
;;@ memmove.ts:12:8
(if
;;@ memmove.ts:12:12
(i32.eqz
;;@ memmove.ts:12:13
(get_local $2)
)
;;@ memmove.ts:13:17
(return
(get_local $4)
)
)
;;@ memmove.ts:14:8
(set_local $2
(i32.sub
;;@ memmove.ts:14:10
(get_local $2)
(i32.const 1)
)
@ -62,13 +86,16 @@
(set_local $0
(i32.add
(tee_local $3
;;@ memmove.ts:15:18
(get_local $0)
)
(i32.const 1)
)
)
;;@ memmove.ts:15:8
(i32.store8
(get_local $3)
;;@ memmove.ts:15:35
(block (result i32)
(set_local $1
(i32.add
@ -78,6 +105,7 @@
(i32.const 1)
)
)
;;@ memmove.ts:15:26
(i32.load8_u
(get_local $3)
)
@ -89,32 +117,44 @@
)
(loop $continue|1
(if
;;@ memmove.ts:17:13
(i32.ge_u
(get_local $2)
;;@ memmove.ts:17:18
(i32.const 8)
)
(block
;;@ memmove.ts:18:8
(i64.store
;;@ memmove.ts:18:19
(get_local $0)
;;@ memmove.ts:18:25
(i64.load
;;@ memmove.ts:18:35
(get_local $1)
)
)
;;@ memmove.ts:19:8
(set_local $2
(i32.sub
(get_local $2)
;;@ memmove.ts:19:13
(i32.const 8)
)
)
;;@ memmove.ts:20:8
(set_local $0
(i32.add
(get_local $0)
;;@ memmove.ts:20:16
(i32.const 8)
)
)
;;@ memmove.ts:21:8
(set_local $1
(i32.add
(get_local $1)
;;@ memmove.ts:21:15
(i32.const 8)
)
)
@ -126,18 +166,22 @@
)
(loop $continue|2
(if
;;@ memmove.ts:24:11
(get_local $2)
(block
(set_local $0
(i32.add
(tee_local $3
;;@ memmove.ts:25:16
(get_local $0)
)
(i32.const 1)
)
)
;;@ memmove.ts:25:6
(i32.store8
(get_local $3)
;;@ memmove.ts:25:33
(block (result i32)
(set_local $1
(i32.add
@ -147,13 +191,16 @@
(i32.const 1)
)
)
;;@ memmove.ts:25:24
(i32.load8_u
(get_local $3)
)
)
)
;;@ memmove.ts:26:6
(set_local $2
(i32.sub
;;@ memmove.ts:26:8
(get_local $2)
(i32.const 1)
)
@ -163,50 +210,72 @@
)
)
)
;;@ memmove.ts:28:9
(block
;;@ memmove.ts:29:4
(if
;;@ memmove.ts:29:8
(i32.eq
(i32.rem_u
(get_local $1)
;;@ memmove.ts:29:14
(i32.const 8)
)
;;@ memmove.ts:29:19
(i32.rem_u
(get_local $0)
;;@ memmove.ts:29:26
(i32.const 8)
)
)
;;@ memmove.ts:29:29
(block
(loop $continue|3
(if
;;@ memmove.ts:30:13
(i32.rem_u
(i32.add
;;@ memmove.ts:30:14
(get_local $0)
;;@ memmove.ts:30:21
(get_local $2)
)
;;@ memmove.ts:30:26
(i32.const 8)
)
(block
;;@ memmove.ts:31:8
(if
;;@ memmove.ts:31:12
(i32.eqz
;;@ memmove.ts:31:13
(get_local $2)
)
;;@ memmove.ts:32:17
(return
(get_local $4)
)
)
;;@ memmove.ts:33:8
(i32.store8
;;@ memmove.ts:33:18
(i32.add
(get_local $0)
;;@ memmove.ts:33:25
(tee_local $2
(i32.sub
;;@ memmove.ts:33:27
(get_local $2)
(i32.const 1)
)
)
)
;;@ memmove.ts:33:30
(i32.load8_u
;;@ memmove.ts:33:39
(i32.add
(get_local $1)
;;@ memmove.ts:33:45
(get_local $2)
)
)
@ -217,24 +286,33 @@
)
(loop $continue|4
(if
;;@ memmove.ts:35:13
(i32.ge_u
(get_local $2)
;;@ memmove.ts:35:18
(i32.const 8)
)
(block
;;@ memmove.ts:37:8
(i64.store
;;@ memmove.ts:37:19
(i32.add
(get_local $0)
;;@ memmove.ts:36:8
(tee_local $2
(i32.sub
(get_local $2)
;;@ memmove.ts:36:13
(i32.const 8)
)
)
)
;;@ memmove.ts:37:29
(i64.load
;;@ memmove.ts:37:39
(i32.add
(get_local $1)
;;@ memmove.ts:37:45
(get_local $2)
)
)
@ -247,21 +325,29 @@
)
(loop $continue|5
(if
;;@ memmove.ts:40:11
(get_local $2)
(block
;;@ memmove.ts:41:6
(i32.store8
;;@ memmove.ts:41:16
(i32.add
(get_local $0)
;;@ memmove.ts:41:23
(tee_local $2
(i32.sub
;;@ memmove.ts:41:25
(get_local $2)
(i32.const 1)
)
)
)
;;@ memmove.ts:41:28
(i32.load8_u
;;@ memmove.ts:41:37
(i32.add
(get_local $1)
;;@ memmove.ts:41:43
(get_local $2)
)
)
@ -272,153 +358,232 @@
)
)
)
;;@ memmove.ts:44:9
(get_local $4)
)
(func $start (; 1 ;) (type $v)
;;@ memmove.ts:48:0
(i64.store
;;@ memmove.ts:48:11
(i32.const 8)
;;@ memmove.ts:48:22
(i64.const 1229782938247303441)
)
;;@ memmove.ts:49:0
(i64.store
;;@ memmove.ts:49:18
(i32.const 16)
;;@ memmove.ts:49:22
(i64.const 2459565876494606882)
)
;;@ memmove.ts:50:0
(i64.store
;;@ memmove.ts:50:18
(i32.const 24)
;;@ memmove.ts:50:22
(i64.const 3689348814741910323)
)
;;@ memmove.ts:51:0
(i64.store
;;@ memmove.ts:51:18
(i32.const 32)
;;@ memmove.ts:51:22
(i64.const 4919131752989213764)
)
;;@ memmove.ts:54:0
(set_global $memmove/dest
;;@ memmove.ts:54:7
(call $memmove/memmove
;;@ memmove.ts:54:22
(i32.const 9)
;;@ memmove.ts:54:32
(i32.const 24)
;;@ memmove.ts:54:36
(i32.const 4)
)
)
;;@ memmove.ts:55:0
(if
;;@ memmove.ts:55:7
(i32.ne
(get_global $memmove/dest)
;;@ memmove.ts:55:22
(i32.const 9)
)
(unreachable)
)
;;@ memmove.ts:56:0
(if
;;@ memmove.ts:56:7
(i64.ne
(i64.load
;;@ memmove.ts:56:17
(i32.const 8)
)
;;@ memmove.ts:56:26
(i64.const 1229783084848853777)
)
(unreachable)
)
;;@ memmove.ts:58:0
(set_global $memmove/dest
;;@ memmove.ts:58:7
(call $memmove/memmove
;;@ memmove.ts:58:15
(i32.const 8)
;;@ memmove.ts:58:21
(i32.const 8)
;;@ memmove.ts:58:27
(i32.const 32)
)
)
;;@ memmove.ts:59:0
(if
;;@ memmove.ts:59:7
(i32.ne
(get_global $memmove/dest)
;;@ memmove.ts:59:15
(i32.const 8)
)
(unreachable)
)
;;@ memmove.ts:60:0
(if
;;@ memmove.ts:60:7
(i64.ne
(i64.load
;;@ memmove.ts:60:17
(i32.const 8)
)
;;@ memmove.ts:60:26
(i64.const 1229783084848853777)
)
(unreachable)
)
;;@ memmove.ts:61:0
(if
;;@ memmove.ts:61:7
(i64.ne
(i64.load
;;@ memmove.ts:61:24
(i32.const 16)
)
;;@ memmove.ts:61:30
(i64.const 2459565876494606882)
)
(unreachable)
)
;;@ memmove.ts:62:0
(if
;;@ memmove.ts:62:7
(i64.ne
(i64.load
;;@ memmove.ts:62:24
(i32.const 24)
)
;;@ memmove.ts:62:31
(i64.const 3689348814741910323)
)
(unreachable)
)
;;@ memmove.ts:63:0
(if
;;@ memmove.ts:63:7
(i64.ne
(i64.load
;;@ memmove.ts:63:24
(i32.const 32)
)
;;@ memmove.ts:63:31
(i64.const 4919131752989213764)
)
(unreachable)
)
;;@ memmove.ts:65:0
(set_global $memmove/dest
;;@ memmove.ts:65:7
(call $memmove/memmove
;;@ memmove.ts:65:22
(i32.const 13)
;;@ memmove.ts:65:32
(i32.const 36)
;;@ memmove.ts:65:36
(i32.const 3)
)
)
;;@ memmove.ts:66:0
(if
;;@ memmove.ts:66:7
(i64.ne
(i64.load
;;@ memmove.ts:66:17
(i32.const 8)
)
;;@ memmove.ts:66:26
(i64.const 4919131679688438545)
)
(unreachable)
)
;;@ memmove.ts:68:0
(set_global $memmove/dest
;;@ memmove.ts:68:7
(call $memmove/memmove
;;@ memmove.ts:68:22
(i32.const 16)
;;@ memmove.ts:68:32
(i32.const 24)
;;@ memmove.ts:68:36
(i32.const 15)
)
)
;;@ memmove.ts:69:0
(if
;;@ memmove.ts:69:7
(i64.ne
(i64.load
;;@ memmove.ts:69:17
(i32.const 8)
)
;;@ memmove.ts:69:26
(i64.const 4919131679688438545)
)
(unreachable)
)
;;@ memmove.ts:70:0
(if
;;@ memmove.ts:70:7
(i64.ne
(i64.load
;;@ memmove.ts:70:24
(i32.const 16)
)
;;@ memmove.ts:70:30
(i64.const 3689348814741910323)
)
(unreachable)
)
;;@ memmove.ts:71:0
(if
;;@ memmove.ts:71:7
(i64.ne
(i64.load
;;@ memmove.ts:71:24
(i32.const 24)
)
;;@ memmove.ts:71:31
(i64.const 3694152654344438852)
)
(unreachable)
)
;;@ memmove.ts:72:0
(if
;;@ memmove.ts:72:7
(i64.ne
(i64.load
;;@ memmove.ts:72:24
(i32.const 32)
)
;;@ memmove.ts:72:31
(i64.const 4919131752989213764)
)
(unreachable)

View File

@ -10,60 +10,86 @@
(func $memmove/memmove (; 0 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
;;@ memmove.ts:2:2
(set_local $3
;;@ memmove.ts:2:12
(get_local $0)
)
;;@ memmove.ts:3:2
(if
;;@ memmove.ts:3:6
(i32.eq
(get_local $0)
;;@ memmove.ts:3:14
(get_local $1)
)
;;@ memmove.ts:4:11
(return
(get_local $3)
)
)
;;@ memmove.ts:9:2
(if
;;@ memmove.ts:9:6
(i32.lt_u
(get_local $0)
;;@ memmove.ts:9:13
(get_local $1)
)
;;@ memmove.ts:9:18
(block
;;@ memmove.ts:10:4
(if
;;@ memmove.ts:10:8
(i32.eq
(i32.rem_u
(get_local $1)
;;@ memmove.ts:10:14
(i32.const 8)
)
;;@ memmove.ts:10:19
(i32.rem_u
(get_local $0)
;;@ memmove.ts:10:26
(i32.const 8)
)
)
;;@ memmove.ts:10:29
(block
(block $break|0
(loop $continue|0
(if
;;@ memmove.ts:11:13
(i32.rem_u
(get_local $0)
;;@ memmove.ts:11:20
(i32.const 8)
)
(block
(block
;;@ memmove.ts:12:8
(if
;;@ memmove.ts:12:12
(i32.eqz
;;@ memmove.ts:12:13
(get_local $2)
)
;;@ memmove.ts:13:17
(return
(get_local $3)
)
)
;;@ memmove.ts:14:8
(set_local $2
(i32.sub
;;@ memmove.ts:14:10
(get_local $2)
(i32.const 1)
)
)
;;@ memmove.ts:15:8
(i32.store8
;;@ memmove.ts:15:18
(block (result i32)
(set_local $4
(get_local $0)
@ -76,7 +102,9 @@
)
(get_local $4)
)
;;@ memmove.ts:15:26
(i32.load8_u
;;@ memmove.ts:15:35
(block (result i32)
(set_local $4
(get_local $1)
@ -97,36 +125,49 @@
)
)
)
;;@ memmove.ts:17:6
(block $break|1
(loop $continue|1
(if
;;@ memmove.ts:17:13
(i32.ge_u
(get_local $2)
;;@ memmove.ts:17:18
(i32.const 8)
)
(block
(block
;;@ memmove.ts:18:8
(i64.store
;;@ memmove.ts:18:19
(get_local $0)
;;@ memmove.ts:18:25
(i64.load
;;@ memmove.ts:18:35
(get_local $1)
)
)
;;@ memmove.ts:19:8
(set_local $2
(i32.sub
(get_local $2)
;;@ memmove.ts:19:13
(i32.const 8)
)
)
;;@ memmove.ts:20:8
(set_local $0
(i32.add
(get_local $0)
;;@ memmove.ts:20:16
(i32.const 8)
)
)
;;@ memmove.ts:21:8
(set_local $1
(i32.add
(get_local $1)
;;@ memmove.ts:21:15
(i32.const 8)
)
)
@ -138,13 +179,17 @@
)
)
)
;;@ memmove.ts:24:4
(block $break|2
(loop $continue|2
(if
;;@ memmove.ts:24:11
(get_local $2)
(block
(block
;;@ memmove.ts:25:6
(i32.store8
;;@ memmove.ts:25:16
(block (result i32)
(set_local $4
(get_local $0)
@ -157,7 +202,9 @@
)
(get_local $4)
)
;;@ memmove.ts:25:24
(i32.load8_u
;;@ memmove.ts:25:33
(block (result i32)
(set_local $4
(get_local $1)
@ -172,8 +219,10 @@
)
)
)
;;@ memmove.ts:26:6
(set_local $2
(i32.sub
;;@ memmove.ts:26:8
(get_local $2)
(i32.const 1)
)
@ -185,52 +234,74 @@
)
)
)
;;@ memmove.ts:28:9
(block
;;@ memmove.ts:29:4
(if
;;@ memmove.ts:29:8
(i32.eq
(i32.rem_u
(get_local $1)
;;@ memmove.ts:29:14
(i32.const 8)
)
;;@ memmove.ts:29:19
(i32.rem_u
(get_local $0)
;;@ memmove.ts:29:26
(i32.const 8)
)
)
;;@ memmove.ts:29:29
(block
(block $break|3
(loop $continue|3
(if
;;@ memmove.ts:30:13
(i32.rem_u
(i32.add
;;@ memmove.ts:30:14
(get_local $0)
;;@ memmove.ts:30:21
(get_local $2)
)
;;@ memmove.ts:30:26
(i32.const 8)
)
(block
(block
;;@ memmove.ts:31:8
(if
;;@ memmove.ts:31:12
(i32.eqz
;;@ memmove.ts:31:13
(get_local $2)
)
;;@ memmove.ts:32:17
(return
(get_local $3)
)
)
;;@ memmove.ts:33:8
(i32.store8
;;@ memmove.ts:33:18
(i32.add
(get_local $0)
;;@ memmove.ts:33:25
(tee_local $2
(i32.sub
;;@ memmove.ts:33:27
(get_local $2)
(i32.const 1)
)
)
)
;;@ memmove.ts:33:30
(i32.load8_u
;;@ memmove.ts:33:39
(i32.add
(get_local $1)
;;@ memmove.ts:33:45
(get_local $2)
)
)
@ -241,29 +312,40 @@
)
)
)
;;@ memmove.ts:35:6
(block $break|4
(loop $continue|4
(if
;;@ memmove.ts:35:13
(i32.ge_u
(get_local $2)
;;@ memmove.ts:35:18
(i32.const 8)
)
(block
(block
;;@ memmove.ts:36:8
(set_local $2
(i32.sub
(get_local $2)
;;@ memmove.ts:36:13
(i32.const 8)
)
)
;;@ memmove.ts:37:8
(i64.store
;;@ memmove.ts:37:19
(i32.add
(get_local $0)
;;@ memmove.ts:37:26
(get_local $2)
)
;;@ memmove.ts:37:29
(i64.load
;;@ memmove.ts:37:39
(i32.add
(get_local $1)
;;@ memmove.ts:37:45
(get_local $2)
)
)
@ -276,25 +358,34 @@
)
)
)
;;@ memmove.ts:40:4
(block $break|5
(loop $continue|5
(if
;;@ memmove.ts:40:11
(get_local $2)
(block
(block
;;@ memmove.ts:41:6
(i32.store8
;;@ memmove.ts:41:16
(i32.add
(get_local $0)
;;@ memmove.ts:41:23
(tee_local $2
(i32.sub
;;@ memmove.ts:41:25
(get_local $2)
(i32.const 1)
)
)
)
;;@ memmove.ts:41:28
(i32.load8_u
;;@ memmove.ts:41:37
(i32.add
(get_local $1)
;;@ memmove.ts:41:43
(get_local $2)
)
)
@ -307,226 +398,321 @@
)
)
)
;;@ memmove.ts:44:9
(return
(get_local $3)
)
)
(func $start (; 1 ;) (type $v)
;;@ memmove.ts:48:0
(i64.store
;;@ memmove.ts:48:11
(i32.const 8)
;;@ memmove.ts:48:22
(i64.const 1229782938247303441)
)
;;@ memmove.ts:49:0
(i64.store
;;@ memmove.ts:49:11
(i32.add
(i32.const 8)
;;@ memmove.ts:49:18
(i32.const 8)
)
;;@ memmove.ts:49:22
(i64.const 2459565876494606882)
)
;;@ memmove.ts:50:0
(i64.store
;;@ memmove.ts:50:11
(i32.add
(i32.const 8)
;;@ memmove.ts:50:18
(i32.const 16)
)
;;@ memmove.ts:50:22
(i64.const 3689348814741910323)
)
;;@ memmove.ts:51:0
(i64.store
;;@ memmove.ts:51:11
(i32.add
(i32.const 8)
;;@ memmove.ts:51:18
(i32.const 24)
)
;;@ memmove.ts:51:22
(i64.const 4919131752989213764)
)
;;@ memmove.ts:54:0
(set_global $memmove/dest
;;@ memmove.ts:54:7
(call $memmove/memmove
;;@ memmove.ts:54:15
(i32.add
(i32.const 8)
;;@ memmove.ts:54:22
(i32.const 1)
)
;;@ memmove.ts:54:25
(i32.add
(i32.const 8)
;;@ memmove.ts:54:32
(i32.const 16)
)
;;@ memmove.ts:54:36
(i32.const 4)
)
)
;;@ memmove.ts:55:0
(if
(i32.eqz
;;@ memmove.ts:55:7
(i32.eq
(get_global $memmove/dest)
;;@ memmove.ts:55:15
(i32.add
(i32.const 8)
;;@ memmove.ts:55:22
(i32.const 1)
)
)
)
(unreachable)
)
;;@ memmove.ts:56:0
(if
(i32.eqz
;;@ memmove.ts:56:7
(i64.eq
(i64.load
;;@ memmove.ts:56:17
(i32.const 8)
)
;;@ memmove.ts:56:26
(i64.const 1229783084848853777)
)
)
(unreachable)
)
;;@ memmove.ts:58:0
(set_global $memmove/dest
;;@ memmove.ts:58:7
(call $memmove/memmove
;;@ memmove.ts:58:15
(i32.const 8)
;;@ memmove.ts:58:21
(i32.const 8)
;;@ memmove.ts:58:27
(i32.const 32)
)
)
;;@ memmove.ts:59:0
(if
(i32.eqz
;;@ memmove.ts:59:7
(i32.eq
(get_global $memmove/dest)
;;@ memmove.ts:59:15
(i32.const 8)
)
)
(unreachable)
)
;;@ memmove.ts:60:0
(if
(i32.eqz
;;@ memmove.ts:60:7
(i64.eq
(i64.load
;;@ memmove.ts:60:17
(i32.const 8)
)
;;@ memmove.ts:60:26
(i64.const 1229783084848853777)
)
)
(unreachable)
)
;;@ memmove.ts:61:0
(if
(i32.eqz
;;@ memmove.ts:61:7
(i64.eq
(i64.load
;;@ memmove.ts:61:17
(i32.add
(i32.const 8)
;;@ memmove.ts:61:24
(i32.const 8)
)
)
;;@ memmove.ts:61:30
(i64.const 2459565876494606882)
)
)
(unreachable)
)
;;@ memmove.ts:62:0
(if
(i32.eqz
;;@ memmove.ts:62:7
(i64.eq
(i64.load
;;@ memmove.ts:62:17
(i32.add
(i32.const 8)
;;@ memmove.ts:62:24
(i32.const 16)
)
)
;;@ memmove.ts:62:31
(i64.const 3689348814741910323)
)
)
(unreachable)
)
;;@ memmove.ts:63:0
(if
(i32.eqz
;;@ memmove.ts:63:7
(i64.eq
(i64.load
;;@ memmove.ts:63:17
(i32.add
(i32.const 8)
;;@ memmove.ts:63:24
(i32.const 24)
)
)
;;@ memmove.ts:63:31
(i64.const 4919131752989213764)
)
)
(unreachable)
)
;;@ memmove.ts:65:0
(set_global $memmove/dest
;;@ memmove.ts:65:7
(call $memmove/memmove
;;@ memmove.ts:65:15
(i32.add
(i32.const 8)
;;@ memmove.ts:65:22
(i32.const 5)
)
;;@ memmove.ts:65:25
(i32.add
(i32.const 8)
;;@ memmove.ts:65:32
(i32.const 28)
)
;;@ memmove.ts:65:36
(i32.const 3)
)
)
;;@ memmove.ts:66:0
(if
(i32.eqz
;;@ memmove.ts:66:7
(i64.eq
(i64.load
;;@ memmove.ts:66:17
(i32.const 8)
)
;;@ memmove.ts:66:26
(i64.const 4919131679688438545)
)
)
(unreachable)
)
;;@ memmove.ts:68:0
(set_global $memmove/dest
;;@ memmove.ts:68:7
(call $memmove/memmove
;;@ memmove.ts:68:15
(i32.add
(i32.const 8)
;;@ memmove.ts:68:22
(i32.const 8)
)
;;@ memmove.ts:68:25
(i32.add
(i32.const 8)
;;@ memmove.ts:68:32
(i32.const 16)
)
;;@ memmove.ts:68:36
(i32.const 15)
)
)
;;@ memmove.ts:69:0
(if
(i32.eqz
;;@ memmove.ts:69:7
(i64.eq
(i64.load
;;@ memmove.ts:69:17
(i32.const 8)
)
;;@ memmove.ts:69:26
(i64.const 4919131679688438545)
)
)
(unreachable)
)
;;@ memmove.ts:70:0
(if
(i32.eqz
;;@ memmove.ts:70:7
(i64.eq
(i64.load
;;@ memmove.ts:70:17
(i32.add
(i32.const 8)
;;@ memmove.ts:70:24
(i32.const 8)
)
)
;;@ memmove.ts:70:30
(i64.const 3689348814741910323)
)
)
(unreachable)
)
;;@ memmove.ts:71:0
(if
(i32.eqz
;;@ memmove.ts:71:7
(i64.eq
(i64.load
;;@ memmove.ts:71:17
(i32.add
(i32.const 8)
;;@ memmove.ts:71:24
(i32.const 16)
)
)
;;@ memmove.ts:71:31
(i64.const 3694152654344438852)
)
)
(unreachable)
)
;;@ memmove.ts:72:0
(if
(i32.eqz
;;@ memmove.ts:72:7
(i64.eq
(i64.load
;;@ memmove.ts:72:17
(i32.add
(i32.const 8)
;;@ memmove.ts:72:24
(i32.const 24)
)
)
;;@ memmove.ts:72:31
(i64.const 4919131752989213764)
)
)
@ -564,6 +750,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -11,325 +11,479 @@
(local $4 i64)
(local $5 i32)
(block $folding-inner0
;;@ memset.ts:2:2
(set_local $3
;;@ memset.ts:2:12
(get_local $0)
)
(br_if $folding-inner0
;;@ memset.ts:5:6
(i32.eqz
;;@ memset.ts:5:7
(get_local $2)
)
)
;;@ memset.ts:7:2
(i32.store8
;;@ memset.ts:7:12
(get_local $0)
;;@ memset.ts:7:18
(get_local $1)
)
;;@ memset.ts:8:2
(i32.store8
;;@ memset.ts:8:12
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:8:19
(get_local $2)
)
;;@ memset.ts:8:23
(i32.const 1)
)
;;@ memset.ts:8:26
(get_local $1)
)
(br_if $folding-inner0
;;@ memset.ts:9:6
(i32.le_u
(get_local $2)
;;@ memset.ts:9:11
(i32.const 2)
)
)
;;@ memset.ts:12:2
(i32.store8
;;@ memset.ts:12:12
(i32.add
(get_local $0)
;;@ memset.ts:12:19
(i32.const 1)
)
;;@ memset.ts:12:22
(get_local $1)
)
;;@ memset.ts:13:2
(i32.store8
;;@ memset.ts:13:12
(i32.add
(get_local $0)
;;@ memset.ts:13:19
(i32.const 2)
)
;;@ memset.ts:13:22
(get_local $1)
)
;;@ memset.ts:14:2
(i32.store8
;;@ memset.ts:14:12
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:14:19
(get_local $2)
)
;;@ memset.ts:14:23
(i32.const 2)
)
;;@ memset.ts:14:26
(get_local $1)
)
;;@ memset.ts:15:2
(i32.store8
;;@ memset.ts:15:12
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:15:19
(get_local $2)
)
;;@ memset.ts:15:23
(i32.const 3)
)
;;@ memset.ts:15:26
(get_local $1)
)
(br_if $folding-inner0
;;@ memset.ts:16:6
(i32.le_u
(get_local $2)
;;@ memset.ts:16:11
(i32.const 6)
)
)
;;@ memset.ts:18:2
(i32.store8
;;@ memset.ts:18:12
(i32.add
(get_local $0)
;;@ memset.ts:18:19
(i32.const 3)
)
;;@ memset.ts:18:22
(get_local $1)
)
;;@ memset.ts:19:2
(i32.store8
;;@ memset.ts:19:12
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:19:19
(get_local $2)
)
;;@ memset.ts:19:23
(i32.const 4)
)
;;@ memset.ts:19:26
(get_local $1)
)
(br_if $folding-inner0
;;@ memset.ts:20:6
(i32.le_u
(get_local $2)
;;@ memset.ts:20:11
(i32.const 8)
)
)
;;@ memset.ts:32:2
(i32.store
;;@ memset.ts:25:2
(tee_local $0
(i32.add
(get_local $0)
;;@ memset.ts:24:2
(tee_local $5
;;@ memset.ts:24:17
(i32.and
(i32.sub
(i32.const 0)
;;@ memset.ts:24:18
(get_local $0)
)
;;@ memset.ts:24:25
(i32.const 3)
)
)
)
)
;;@ memset.ts:29:2
(tee_local $1
;;@ memset.ts:29:17
(i32.mul
;;@ memset.ts:29:28
(get_local $1)
(i32.const 16843009)
)
)
)
;;@ memset.ts:33:2
(i32.store
;;@ memset.ts:33:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:27:2
(tee_local $2
(i32.and
(i32.sub
;;@ memset.ts:26:2
(get_local $2)
;;@ memset.ts:26:7
(get_local $5)
)
(i32.const -4)
)
)
)
;;@ memset.ts:33:24
(i32.const 4)
)
;;@ memset.ts:33:27
(get_local $1)
)
(br_if $folding-inner0
;;@ memset.ts:34:6
(i32.le_u
(get_local $2)
;;@ memset.ts:34:11
(i32.const 8)
)
)
;;@ memset.ts:36:2
(i32.store
;;@ memset.ts:36:13
(i32.add
(get_local $0)
;;@ memset.ts:36:20
(i32.const 4)
)
;;@ memset.ts:36:23
(get_local $1)
)
;;@ memset.ts:37:2
(i32.store
;;@ memset.ts:37:13
(i32.add
(get_local $0)
;;@ memset.ts:37:20
(i32.const 8)
)
;;@ memset.ts:37:23
(get_local $1)
)
;;@ memset.ts:38:2
(i32.store
;;@ memset.ts:38:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:38:20
(get_local $2)
)
;;@ memset.ts:38:24
(i32.const 12)
)
;;@ memset.ts:38:28
(get_local $1)
)
;;@ memset.ts:39:2
(i32.store
;;@ memset.ts:39:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:39:20
(get_local $2)
)
;;@ memset.ts:39:24
(i32.const 8)
)
;;@ memset.ts:39:27
(get_local $1)
)
(br_if $folding-inner0
;;@ memset.ts:40:6
(i32.le_u
(get_local $2)
;;@ memset.ts:40:11
(i32.const 24)
)
)
;;@ memset.ts:42:2
(i32.store
;;@ memset.ts:42:13
(i32.add
(get_local $0)
;;@ memset.ts:42:20
(i32.const 12)
)
;;@ memset.ts:42:24
(get_local $1)
)
;;@ memset.ts:43:2
(i32.store
;;@ memset.ts:43:13
(i32.add
(get_local $0)
;;@ memset.ts:43:20
(i32.const 16)
)
;;@ memset.ts:43:24
(get_local $1)
)
;;@ memset.ts:44:2
(i32.store
;;@ memset.ts:44:13
(i32.add
(get_local $0)
;;@ memset.ts:44:20
(i32.const 20)
)
;;@ memset.ts:44:24
(get_local $1)
)
;;@ memset.ts:45:2
(i32.store
;;@ memset.ts:45:13
(i32.add
(get_local $0)
;;@ memset.ts:45:20
(i32.const 24)
)
;;@ memset.ts:45:24
(get_local $1)
)
;;@ memset.ts:46:2
(i32.store
;;@ memset.ts:46:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:46:20
(get_local $2)
)
;;@ memset.ts:46:24
(i32.const 28)
)
;;@ memset.ts:46:28
(get_local $1)
)
;;@ memset.ts:47:2
(i32.store
;;@ memset.ts:47:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:47:20
(get_local $2)
)
;;@ memset.ts:47:24
(i32.const 24)
)
;;@ memset.ts:47:28
(get_local $1)
)
;;@ memset.ts:48:2
(i32.store
;;@ memset.ts:48:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:48:20
(get_local $2)
)
;;@ memset.ts:48:24
(i32.const 20)
)
;;@ memset.ts:48:28
(get_local $1)
)
;;@ memset.ts:49:2
(i32.store
;;@ memset.ts:49:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:49:20
(get_local $2)
)
;;@ memset.ts:49:24
(i32.const 16)
)
;;@ memset.ts:49:28
(get_local $1)
)
;;@ memset.ts:53:2
(set_local $0
(i32.add
(get_local $0)
;;@ memset.ts:52:2
(tee_local $5
;;@ memset.ts:52:6
(i32.add
;;@ memset.ts:52:11
(i32.and
;;@ memset.ts:52:12
(get_local $0)
;;@ memset.ts:52:19
(i32.const 4)
)
;;@ memset.ts:52:6
(i32.const 24)
)
)
)
)
;;@ memset.ts:54:2
(set_local $2
(i32.sub
(get_local $2)
;;@ memset.ts:54:7
(get_local $5)
)
)
;;@ memset.ts:57:2
(set_local $4
;;@ memset.ts:57:17
(i64.or
(i64.extend_u/i32
(get_local $1)
)
;;@ memset.ts:57:28
(i64.shl
;;@ memset.ts:57:29
(i64.extend_u/i32
(get_local $1)
)
;;@ memset.ts:57:41
(i64.const 32)
)
)
)
(loop $continue|0
(if
;;@ memset.ts:58:9
(i32.ge_u
(get_local $2)
;;@ memset.ts:58:14
(i32.const 32)
)
(block
;;@ memset.ts:59:4
(i64.store
;;@ memset.ts:59:15
(get_local $0)
;;@ memset.ts:59:21
(get_local $4)
)
;;@ memset.ts:60:4
(i64.store
;;@ memset.ts:60:15
(i32.add
(get_local $0)
;;@ memset.ts:60:22
(i32.const 8)
)
;;@ memset.ts:60:25
(get_local $4)
)
;;@ memset.ts:61:4
(i64.store
;;@ memset.ts:61:15
(i32.add
(get_local $0)
;;@ memset.ts:61:22
(i32.const 16)
)
;;@ memset.ts:61:26
(get_local $4)
)
;;@ memset.ts:62:4
(i64.store
;;@ memset.ts:62:15
(i32.add
(get_local $0)
;;@ memset.ts:62:22
(i32.const 24)
)
;;@ memset.ts:62:26
(get_local $4)
)
;;@ memset.ts:63:4
(set_local $2
(i32.sub
(get_local $2)
;;@ memset.ts:63:9
(i32.const 32)
)
)
;;@ memset.ts:64:4
(set_local $0
(i32.add
(get_local $0)
;;@ memset.ts:64:12
(i32.const 32)
)
)
@ -338,94 +492,134 @@
)
)
(return
;;@ memset.ts:66:9
(get_local $3)
)
)
;;@ memset.ts:6:11
(get_local $3)
)
(func $start (; 1 ;) (type $v)
(set_global $memset/dest
;;@ memset.ts:69:11
(get_global $HEAP_BASE)
)
;;@ memset.ts:70:0
(drop
(call $memset/memset
;;@ memset.ts:70:7
(get_global $memset/dest)
;;@ memset.ts:70:13
(i32.const 1)
;;@ memset.ts:70:16
(i32.const 16)
)
)
;;@ memset.ts:72:0
(if
;;@ memset.ts:72:7
(i32.ne
(i32.load8_u
;;@ memset.ts:72:16
(get_global $memset/dest)
)
;;@ memset.ts:72:25
(i32.const 1)
)
(unreachable)
)
;;@ memset.ts:73:0
(if
;;@ memset.ts:73:7
(i32.ne
(i32.load8_u
;;@ memset.ts:73:16
(i32.add
(get_global $memset/dest)
;;@ memset.ts:73:23
(i32.const 15)
)
)
;;@ memset.ts:73:30
(i32.const 1)
)
(unreachable)
)
;;@ memset.ts:75:0
(drop
(call $memset/memset
;;@ memset.ts:75:7
(i32.add
(get_global $memset/dest)
;;@ memset.ts:75:14
(i32.const 1)
)
;;@ memset.ts:75:17
(i32.const 2)
;;@ memset.ts:75:20
(i32.const 14)
)
)
;;@ memset.ts:77:0
(if
;;@ memset.ts:77:7
(i32.ne
(i32.load8_u
;;@ memset.ts:77:16
(get_global $memset/dest)
)
;;@ memset.ts:77:25
(i32.const 1)
)
(unreachable)
)
;;@ memset.ts:78:0
(if
;;@ memset.ts:78:7
(i32.ne
(i32.load8_u
;;@ memset.ts:78:16
(i32.add
(get_global $memset/dest)
;;@ memset.ts:78:23
(i32.const 1)
)
)
;;@ memset.ts:78:29
(i32.const 2)
)
(unreachable)
)
;;@ memset.ts:79:0
(if
;;@ memset.ts:79:7
(i32.ne
(i32.load8_u
;;@ memset.ts:79:16
(i32.add
(get_global $memset/dest)
;;@ memset.ts:79:23
(i32.const 14)
)
)
;;@ memset.ts:79:30
(i32.const 2)
)
(unreachable)
)
;;@ memset.ts:80:0
(if
;;@ memset.ts:80:7
(i32.ne
(i32.load8_u
;;@ memset.ts:80:16
(i32.add
(get_global $memset/dest)
;;@ memset.ts:80:23
(i32.const 15)
)
)
;;@ memset.ts:80:30
(i32.const 1)
)
(unreachable)

View File

@ -11,362 +11,537 @@
(local $4 i32)
(local $5 i32)
(local $6 i64)
;;@ memset.ts:2:2
(set_local $3
;;@ memset.ts:2:12
(get_local $0)
)
;;@ memset.ts:5:2
(if
;;@ memset.ts:5:6
(i32.eqz
;;@ memset.ts:5:7
(get_local $2)
)
;;@ memset.ts:6:11
(return
(get_local $3)
)
)
;;@ memset.ts:7:2
(i32.store8
;;@ memset.ts:7:12
(get_local $0)
;;@ memset.ts:7:18
(get_local $1)
)
;;@ memset.ts:8:2
(i32.store8
;;@ memset.ts:8:12
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:8:19
(get_local $2)
)
;;@ memset.ts:8:23
(i32.const 1)
)
;;@ memset.ts:8:26
(get_local $1)
)
;;@ memset.ts:9:2
(if
;;@ memset.ts:9:6
(i32.le_u
(get_local $2)
;;@ memset.ts:9:11
(i32.const 2)
)
;;@ memset.ts:10:11
(return
(get_local $3)
)
)
;;@ memset.ts:12:2
(i32.store8
;;@ memset.ts:12:12
(i32.add
(get_local $0)
;;@ memset.ts:12:19
(i32.const 1)
)
;;@ memset.ts:12:22
(get_local $1)
)
;;@ memset.ts:13:2
(i32.store8
;;@ memset.ts:13:12
(i32.add
(get_local $0)
;;@ memset.ts:13:19
(i32.const 2)
)
;;@ memset.ts:13:22
(get_local $1)
)
;;@ memset.ts:14:2
(i32.store8
;;@ memset.ts:14:12
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:14:19
(get_local $2)
)
;;@ memset.ts:14:23
(i32.const 2)
)
;;@ memset.ts:14:26
(get_local $1)
)
;;@ memset.ts:15:2
(i32.store8
;;@ memset.ts:15:12
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:15:19
(get_local $2)
)
;;@ memset.ts:15:23
(i32.const 3)
)
;;@ memset.ts:15:26
(get_local $1)
)
;;@ memset.ts:16:2
(if
;;@ memset.ts:16:6
(i32.le_u
(get_local $2)
;;@ memset.ts:16:11
(i32.const 6)
)
;;@ memset.ts:17:11
(return
(get_local $3)
)
)
;;@ memset.ts:18:2
(i32.store8
;;@ memset.ts:18:12
(i32.add
(get_local $0)
;;@ memset.ts:18:19
(i32.const 3)
)
;;@ memset.ts:18:22
(get_local $1)
)
;;@ memset.ts:19:2
(i32.store8
;;@ memset.ts:19:12
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:19:19
(get_local $2)
)
;;@ memset.ts:19:23
(i32.const 4)
)
;;@ memset.ts:19:26
(get_local $1)
)
;;@ memset.ts:20:2
(if
;;@ memset.ts:20:6
(i32.le_u
(get_local $2)
;;@ memset.ts:20:11
(i32.const 8)
)
;;@ memset.ts:21:11
(return
(get_local $3)
)
)
;;@ memset.ts:24:2
(set_local $4
;;@ memset.ts:24:17
(i32.and
(i32.sub
(i32.const 0)
;;@ memset.ts:24:18
(get_local $0)
)
;;@ memset.ts:24:25
(i32.const 3)
)
)
;;@ memset.ts:25:2
(set_local $0
(i32.add
(get_local $0)
;;@ memset.ts:25:10
(get_local $4)
)
)
;;@ memset.ts:26:2
(set_local $2
(i32.sub
(get_local $2)
;;@ memset.ts:26:7
(get_local $4)
)
)
;;@ memset.ts:27:2
(set_local $2
(i32.and
(get_local $2)
;;@ memset.ts:27:7
(i32.sub
(i32.const 0)
;;@ memset.ts:27:8
(i32.const 4)
)
)
)
;;@ memset.ts:29:2
(set_local $5
;;@ memset.ts:29:17
(i32.mul
(i32.div_u
(i32.sub
(i32.const 0)
;;@ memset.ts:29:18
(i32.const 1)
)
;;@ memset.ts:29:22
(i32.const 255)
)
;;@ memset.ts:29:28
(get_local $1)
)
)
;;@ memset.ts:32:2
(i32.store
;;@ memset.ts:32:13
(get_local $0)
;;@ memset.ts:32:19
(get_local $5)
)
;;@ memset.ts:33:2
(i32.store
;;@ memset.ts:33:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:33:20
(get_local $2)
)
;;@ memset.ts:33:24
(i32.const 4)
)
;;@ memset.ts:33:27
(get_local $5)
)
;;@ memset.ts:34:2
(if
;;@ memset.ts:34:6
(i32.le_u
(get_local $2)
;;@ memset.ts:34:11
(i32.const 8)
)
;;@ memset.ts:35:11
(return
(get_local $3)
)
)
;;@ memset.ts:36:2
(i32.store
;;@ memset.ts:36:13
(i32.add
(get_local $0)
;;@ memset.ts:36:20
(i32.const 4)
)
;;@ memset.ts:36:23
(get_local $5)
)
;;@ memset.ts:37:2
(i32.store
;;@ memset.ts:37:13
(i32.add
(get_local $0)
;;@ memset.ts:37:20
(i32.const 8)
)
;;@ memset.ts:37:23
(get_local $5)
)
;;@ memset.ts:38:2
(i32.store
;;@ memset.ts:38:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:38:20
(get_local $2)
)
;;@ memset.ts:38:24
(i32.const 12)
)
;;@ memset.ts:38:28
(get_local $5)
)
;;@ memset.ts:39:2
(i32.store
;;@ memset.ts:39:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:39:20
(get_local $2)
)
;;@ memset.ts:39:24
(i32.const 8)
)
;;@ memset.ts:39:27
(get_local $5)
)
;;@ memset.ts:40:2
(if
;;@ memset.ts:40:6
(i32.le_u
(get_local $2)
;;@ memset.ts:40:11
(i32.const 24)
)
;;@ memset.ts:41:11
(return
(get_local $3)
)
)
;;@ memset.ts:42:2
(i32.store
;;@ memset.ts:42:13
(i32.add
(get_local $0)
;;@ memset.ts:42:20
(i32.const 12)
)
;;@ memset.ts:42:24
(get_local $5)
)
;;@ memset.ts:43:2
(i32.store
;;@ memset.ts:43:13
(i32.add
(get_local $0)
;;@ memset.ts:43:20
(i32.const 16)
)
;;@ memset.ts:43:24
(get_local $5)
)
;;@ memset.ts:44:2
(i32.store
;;@ memset.ts:44:13
(i32.add
(get_local $0)
;;@ memset.ts:44:20
(i32.const 20)
)
;;@ memset.ts:44:24
(get_local $5)
)
;;@ memset.ts:45:2
(i32.store
;;@ memset.ts:45:13
(i32.add
(get_local $0)
;;@ memset.ts:45:20
(i32.const 24)
)
;;@ memset.ts:45:24
(get_local $5)
)
;;@ memset.ts:46:2
(i32.store
;;@ memset.ts:46:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:46:20
(get_local $2)
)
;;@ memset.ts:46:24
(i32.const 28)
)
;;@ memset.ts:46:28
(get_local $5)
)
;;@ memset.ts:47:2
(i32.store
;;@ memset.ts:47:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:47:20
(get_local $2)
)
;;@ memset.ts:47:24
(i32.const 24)
)
;;@ memset.ts:47:28
(get_local $5)
)
;;@ memset.ts:48:2
(i32.store
;;@ memset.ts:48:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:48:20
(get_local $2)
)
;;@ memset.ts:48:24
(i32.const 20)
)
;;@ memset.ts:48:28
(get_local $5)
)
;;@ memset.ts:49:2
(i32.store
;;@ memset.ts:49:13
(i32.sub
(i32.add
(get_local $0)
;;@ memset.ts:49:20
(get_local $2)
)
;;@ memset.ts:49:24
(i32.const 16)
)
;;@ memset.ts:49:28
(get_local $5)
)
;;@ memset.ts:52:2
(set_local $4
;;@ memset.ts:52:6
(i32.add
(i32.const 24)
;;@ memset.ts:52:11
(i32.and
;;@ memset.ts:52:12
(get_local $0)
;;@ memset.ts:52:19
(i32.const 4)
)
)
)
;;@ memset.ts:53:2
(set_local $0
(i32.add
(get_local $0)
;;@ memset.ts:53:10
(get_local $4)
)
)
;;@ memset.ts:54:2
(set_local $2
(i32.sub
(get_local $2)
;;@ memset.ts:54:7
(get_local $4)
)
)
;;@ memset.ts:57:2
(set_local $6
;;@ memset.ts:57:17
(i64.or
(i64.extend_u/i32
(get_local $5)
)
;;@ memset.ts:57:28
(i64.shl
;;@ memset.ts:57:29
(i64.extend_u/i32
(get_local $5)
)
;;@ memset.ts:57:41
(i64.const 32)
)
)
)
;;@ memset.ts:58:2
(block $break|0
(loop $continue|0
(if
;;@ memset.ts:58:9
(i32.ge_u
(get_local $2)
;;@ memset.ts:58:14
(i32.const 32)
)
(block
(block
;;@ memset.ts:59:4
(i64.store
;;@ memset.ts:59:15
(get_local $0)
;;@ memset.ts:59:21
(get_local $6)
)
;;@ memset.ts:60:4
(i64.store
;;@ memset.ts:60:15
(i32.add
(get_local $0)
;;@ memset.ts:60:22
(i32.const 8)
)
;;@ memset.ts:60:25
(get_local $6)
)
;;@ memset.ts:61:4
(i64.store
;;@ memset.ts:61:15
(i32.add
(get_local $0)
;;@ memset.ts:61:22
(i32.const 16)
)
;;@ memset.ts:61:26
(get_local $6)
)
;;@ memset.ts:62:4
(i64.store
;;@ memset.ts:62:15
(i32.add
(get_local $0)
;;@ memset.ts:62:22
(i32.const 24)
)
;;@ memset.ts:62:26
(get_local $6)
)
;;@ memset.ts:63:4
(set_local $2
(i32.sub
(get_local $2)
;;@ memset.ts:63:9
(i32.const 32)
)
)
;;@ memset.ts:64:4
(set_local $0
(i32.add
(get_local $0)
;;@ memset.ts:64:12
(i32.const 32)
)
)
@ -376,104 +551,143 @@
)
)
)
;;@ memset.ts:66:9
(return
(get_local $3)
)
)
(func $start (; 1 ;) (type $v)
(set_global $memset/dest
;;@ memset.ts:69:11
(get_global $HEAP_BASE)
)
;;@ memset.ts:70:0
(drop
(call $memset/memset
;;@ memset.ts:70:7
(get_global $memset/dest)
;;@ memset.ts:70:13
(i32.const 1)
;;@ memset.ts:70:16
(i32.const 16)
)
)
;;@ memset.ts:72:0
(if
(i32.eqz
;;@ memset.ts:72:7
(i32.eq
(i32.load8_u
;;@ memset.ts:72:16
(get_global $memset/dest)
)
;;@ memset.ts:72:25
(i32.const 1)
)
)
(unreachable)
)
;;@ memset.ts:73:0
(if
(i32.eqz
;;@ memset.ts:73:7
(i32.eq
(i32.load8_u
;;@ memset.ts:73:16
(i32.add
(get_global $memset/dest)
;;@ memset.ts:73:23
(i32.const 15)
)
)
;;@ memset.ts:73:30
(i32.const 1)
)
)
(unreachable)
)
;;@ memset.ts:75:0
(drop
(call $memset/memset
;;@ memset.ts:75:7
(i32.add
(get_global $memset/dest)
;;@ memset.ts:75:14
(i32.const 1)
)
;;@ memset.ts:75:17
(i32.const 2)
;;@ memset.ts:75:20
(i32.const 14)
)
)
;;@ memset.ts:77:0
(if
(i32.eqz
;;@ memset.ts:77:7
(i32.eq
(i32.load8_u
;;@ memset.ts:77:16
(get_global $memset/dest)
)
;;@ memset.ts:77:25
(i32.const 1)
)
)
(unreachable)
)
;;@ memset.ts:78:0
(if
(i32.eqz
;;@ memset.ts:78:7
(i32.eq
(i32.load8_u
;;@ memset.ts:78:16
(i32.add
(get_global $memset/dest)
;;@ memset.ts:78:23
(i32.const 1)
)
)
;;@ memset.ts:78:29
(i32.const 2)
)
)
(unreachable)
)
;;@ memset.ts:79:0
(if
(i32.eqz
;;@ memset.ts:79:7
(i32.eq
(i32.load8_u
;;@ memset.ts:79:16
(i32.add
(get_global $memset/dest)
;;@ memset.ts:79:23
(i32.const 14)
)
)
;;@ memset.ts:79:30
(i32.const 2)
)
)
(unreachable)
)
;;@ memset.ts:80:0
(if
(i32.eqz
;;@ memset.ts:80:7
(i32.eq
(i32.load8_u
;;@ memset.ts:80:16
(i32.add
(get_global $memset/dest)
;;@ memset.ts:80:23
(i32.const 15)
)
)
;;@ memset.ts:80:30
(i32.const 1)
)
)
@ -511,6 +725,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -10,25 +10,32 @@
(export "memory" (memory $0))
(start $start)
(func $namespace/Outer.Inner.aFunc (; 0 ;) (type $i) (result i32)
;;@ namespace.ts:4:42
(return
(get_global $namespace/Outer.Inner.aVar)
)
)
(func $namespace/Joined.anotherFunc (; 1 ;) (type $i) (result i32)
;;@ namespace.ts:17:53
(return
;;@ namespace.ts:17:46
(i32.const 3)
)
)
(func $start (; 2 ;) (type $v)
;;@ namespace.ts:9:0
(drop
(get_global $namespace/Outer.Inner.aVar)
)
;;@ namespace.ts:10:12
(drop
(call $namespace/Outer.Inner.aFunc)
)
;;@ namespace.ts:11:0
(drop
(i32.const 1)
)
;;@ namespace.ts:20:7
(drop
(call $namespace/Joined.anotherFunc)
)
@ -64,6 +71,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -6,111 +6,145 @@
(export "memory" (memory $0))
(start $start)
(func $start (; 0 ;) (type $v)
;;@ portable-conversions.ts:8:0
(drop
(i32.trunc_s/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:9:0
(drop
(i32.trunc_s/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:13:0
(drop
(i32.trunc_s/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:14:0
(drop
(i32.trunc_s/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:18:0
(drop
;;@ portable-conversions.ts:18:4
(i32.trunc_s/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:19:0
(drop
;;@ portable-conversions.ts:19:4
(i32.trunc_s/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:23:0
(drop
;;@ portable-conversions.ts:23:4
(i64.trunc_s/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:24:0
(drop
;;@ portable-conversions.ts:24:4
(i64.trunc_s/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:28:0
(drop
;;@ portable-conversions.ts:28:6
(i32.trunc_s/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:29:0
(drop
;;@ portable-conversions.ts:29:6
(i32.trunc_s/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:33:0
(drop
(i32.trunc_u/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:34:0
(drop
(i32.trunc_u/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:38:0
(drop
(i32.trunc_u/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:39:0
(drop
(i32.trunc_u/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:43:0
(drop
;;@ portable-conversions.ts:43:4
(i32.trunc_u/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:44:0
(drop
;;@ portable-conversions.ts:44:4
(i32.trunc_u/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:48:0
(drop
;;@ portable-conversions.ts:48:4
(i64.trunc_u/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:49:0
(drop
;;@ portable-conversions.ts:49:4
(i64.trunc_u/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:53:0
(drop
;;@ portable-conversions.ts:53:6
(i32.trunc_u/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:54:0
(drop
;;@ portable-conversions.ts:54:6
(i32.trunc_u/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:58:0
(drop
(i32.trunc_u/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:59:0
(drop
(i32.trunc_u/f64
(get_global $portable-conversions/F)

View File

@ -9,7 +9,9 @@
(export "memory" (memory $0))
(start $start)
(func $start (; 0 ;) (type $v)
;;@ portable-conversions.ts:6:0
(drop
;;@ portable-conversions.ts:6:3
(i32.shr_s
(i32.shl
(get_global $portable-conversions/i)
@ -18,7 +20,9 @@
(i32.const 24)
)
)
;;@ portable-conversions.ts:7:0
(drop
;;@ portable-conversions.ts:7:3
(i32.shr_s
(i32.shl
(i32.wrap/i64
@ -29,7 +33,9 @@
(i32.const 24)
)
)
;;@ portable-conversions.ts:8:0
(drop
;;@ portable-conversions.ts:8:3
(i32.shr_s
(i32.shl
(i32.trunc_s/f32
@ -40,7 +46,9 @@
(i32.const 24)
)
)
;;@ portable-conversions.ts:9:0
(drop
;;@ portable-conversions.ts:9:3
(i32.shr_s
(i32.shl
(i32.trunc_s/f64
@ -51,7 +59,9 @@
(i32.const 24)
)
)
;;@ portable-conversions.ts:11:0
(drop
;;@ portable-conversions.ts:11:4
(i32.shr_s
(i32.shl
(get_global $portable-conversions/i)
@ -60,7 +70,9 @@
(i32.const 16)
)
)
;;@ portable-conversions.ts:12:0
(drop
;;@ portable-conversions.ts:12:4
(i32.shr_s
(i32.shl
(i32.wrap/i64
@ -71,7 +83,9 @@
(i32.const 16)
)
)
;;@ portable-conversions.ts:13:0
(drop
;;@ portable-conversions.ts:13:4
(i32.shr_s
(i32.shl
(i32.trunc_s/f32
@ -82,7 +96,9 @@
(i32.const 16)
)
)
;;@ portable-conversions.ts:14:0
(drop
;;@ portable-conversions.ts:14:4
(i32.shr_s
(i32.shl
(i32.trunc_s/f64
@ -93,67 +109,95 @@
(i32.const 16)
)
)
;;@ portable-conversions.ts:16:0
(drop
;;@ portable-conversions.ts:16:4
(get_global $portable-conversions/i)
)
;;@ portable-conversions.ts:17:0
(drop
;;@ portable-conversions.ts:17:4
(i32.wrap/i64
(get_global $portable-conversions/I)
)
)
;;@ portable-conversions.ts:18:0
(drop
;;@ portable-conversions.ts:18:4
(i32.trunc_s/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:19:0
(drop
;;@ portable-conversions.ts:19:4
(i32.trunc_s/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:21:0
(drop
;;@ portable-conversions.ts:21:4
(i64.extend_s/i32
(get_global $portable-conversions/i)
)
)
;;@ portable-conversions.ts:22:0
(drop
;;@ portable-conversions.ts:22:4
(get_global $portable-conversions/I)
)
;;@ portable-conversions.ts:23:0
(drop
;;@ portable-conversions.ts:23:4
(i64.trunc_s/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:24:0
(drop
;;@ portable-conversions.ts:24:4
(i64.trunc_s/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:26:0
(drop
;;@ portable-conversions.ts:26:6
(get_global $portable-conversions/i)
)
;;@ portable-conversions.ts:27:0
(drop
;;@ portable-conversions.ts:27:6
(i32.wrap/i64
(get_global $portable-conversions/I)
)
)
;;@ portable-conversions.ts:28:0
(drop
;;@ portable-conversions.ts:28:6
(i32.trunc_s/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:29:0
(drop
;;@ portable-conversions.ts:29:6
(i32.trunc_s/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:31:0
(drop
;;@ portable-conversions.ts:31:3
(i32.and
(get_global $portable-conversions/i)
(i32.const 255)
)
)
;;@ portable-conversions.ts:32:0
(drop
;;@ portable-conversions.ts:32:3
(i32.and
(i32.wrap/i64
(get_global $portable-conversions/I)
@ -161,7 +205,9 @@
(i32.const 255)
)
)
;;@ portable-conversions.ts:33:0
(drop
;;@ portable-conversions.ts:33:3
(i32.and
(i32.trunc_u/f32
(get_global $portable-conversions/f)
@ -169,7 +215,9 @@
(i32.const 255)
)
)
;;@ portable-conversions.ts:34:0
(drop
;;@ portable-conversions.ts:34:3
(i32.and
(i32.trunc_u/f64
(get_global $portable-conversions/F)
@ -177,13 +225,17 @@
(i32.const 255)
)
)
;;@ portable-conversions.ts:36:0
(drop
;;@ portable-conversions.ts:36:4
(i32.and
(get_global $portable-conversions/i)
(i32.const 65535)
)
)
;;@ portable-conversions.ts:37:0
(drop
;;@ portable-conversions.ts:37:4
(i32.and
(i32.wrap/i64
(get_global $portable-conversions/I)
@ -191,7 +243,9 @@
(i32.const 65535)
)
)
;;@ portable-conversions.ts:38:0
(drop
;;@ portable-conversions.ts:38:4
(i32.and
(i32.trunc_u/f32
(get_global $portable-conversions/f)
@ -199,7 +253,9 @@
(i32.const 65535)
)
)
;;@ portable-conversions.ts:39:0
(drop
;;@ portable-conversions.ts:39:4
(i32.and
(i32.trunc_u/f64
(get_global $portable-conversions/F)
@ -207,67 +263,95 @@
(i32.const 65535)
)
)
;;@ portable-conversions.ts:41:0
(drop
;;@ portable-conversions.ts:41:4
(get_global $portable-conversions/i)
)
;;@ portable-conversions.ts:42:0
(drop
;;@ portable-conversions.ts:42:4
(i32.wrap/i64
(get_global $portable-conversions/I)
)
)
;;@ portable-conversions.ts:43:0
(drop
;;@ portable-conversions.ts:43:4
(i32.trunc_u/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:44:0
(drop
;;@ portable-conversions.ts:44:4
(i32.trunc_u/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:46:0
(drop
;;@ portable-conversions.ts:46:4
(i64.extend_u/i32
(get_global $portable-conversions/i)
)
)
;;@ portable-conversions.ts:47:0
(drop
;;@ portable-conversions.ts:47:4
(get_global $portable-conversions/I)
)
;;@ portable-conversions.ts:48:0
(drop
;;@ portable-conversions.ts:48:4
(i64.trunc_u/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:49:0
(drop
;;@ portable-conversions.ts:49:4
(i64.trunc_u/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:51:0
(drop
;;@ portable-conversions.ts:51:6
(get_global $portable-conversions/i)
)
;;@ portable-conversions.ts:52:0
(drop
;;@ portable-conversions.ts:52:6
(i32.wrap/i64
(get_global $portable-conversions/I)
)
)
;;@ portable-conversions.ts:53:0
(drop
;;@ portable-conversions.ts:53:6
(i32.trunc_u/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:54:0
(drop
;;@ portable-conversions.ts:54:6
(i32.trunc_u/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:56:0
(drop
;;@ portable-conversions.ts:56:5
(i32.and
(get_global $portable-conversions/i)
(i32.const 1)
)
)
;;@ portable-conversions.ts:57:0
(drop
;;@ portable-conversions.ts:57:5
(i32.and
(i32.wrap/i64
(get_global $portable-conversions/I)
@ -275,7 +359,9 @@
(i32.const 1)
)
)
;;@ portable-conversions.ts:58:0
(drop
;;@ portable-conversions.ts:58:5
(i32.and
(i32.trunc_u/f32
(get_global $portable-conversions/f)
@ -283,7 +369,9 @@
(i32.const 1)
)
)
;;@ portable-conversions.ts:59:0
(drop
;;@ portable-conversions.ts:59:5
(i32.and
(i32.trunc_u/f64
(get_global $portable-conversions/F)
@ -291,40 +379,56 @@
(i32.const 1)
)
)
;;@ portable-conversions.ts:61:0
(drop
;;@ portable-conversions.ts:61:4
(f32.convert_s/i32
(get_global $portable-conversions/i)
)
)
;;@ portable-conversions.ts:62:0
(drop
;;@ portable-conversions.ts:62:4
(f32.convert_s/i64
(get_global $portable-conversions/I)
)
)
;;@ portable-conversions.ts:63:0
(drop
;;@ portable-conversions.ts:63:4
(get_global $portable-conversions/f)
)
;;@ portable-conversions.ts:64:0
(drop
;;@ portable-conversions.ts:64:4
(f32.demote/f64
(get_global $portable-conversions/F)
)
)
;;@ portable-conversions.ts:66:0
(drop
;;@ portable-conversions.ts:66:4
(f64.convert_s/i32
(get_global $portable-conversions/i)
)
)
;;@ portable-conversions.ts:67:0
(drop
;;@ portable-conversions.ts:67:4
(f64.convert_s/i64
(get_global $portable-conversions/I)
)
)
;;@ portable-conversions.ts:68:0
(drop
;;@ portable-conversions.ts:68:4
(f64.promote/f32
(get_global $portable-conversions/f)
)
)
;;@ portable-conversions.ts:69:0
(drop
;;@ portable-conversions.ts:69:4
(get_global $portable-conversions/F)
)
)
@ -359,6 +463,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -4,25 +4,35 @@
(export "fib" (func $recursive/fib))
(export "memory" (memory $0))
(func $recursive/fib (; 0 ;) (type $ii) (param $0 i32) (result i32)
;;@ recursive.ts:2:2
(if
;;@ recursive.ts:2:6
(i32.le_s
(get_local $0)
;;@ recursive.ts:2:11
(i32.const 1)
)
;;@ recursive.ts:2:21
(return
(i32.const 1)
)
)
;;@ recursive.ts:3:9
(i32.add
(call $recursive/fib
;;@ recursive.ts:3:13
(i32.sub
(get_local $0)
;;@ recursive.ts:3:17
(i32.const 1)
)
)
;;@ recursive.ts:3:22
(call $recursive/fib
;;@ recursive.ts:3:26
(i32.sub
(get_local $0)
;;@ recursive.ts:3:30
(i32.const 2)
)
)

View File

@ -5,26 +5,37 @@
(export "fib" (func $recursive/fib))
(export "memory" (memory $0))
(func $recursive/fib (; 0 ;) (type $ii) (param $0 i32) (result i32)
;;@ recursive.ts:2:2
(if
;;@ recursive.ts:2:6
(i32.le_s
(get_local $0)
;;@ recursive.ts:2:11
(i32.const 1)
)
;;@ recursive.ts:2:21
(return
(i32.const 1)
)
)
;;@ recursive.ts:3:31
(return
;;@ recursive.ts:3:9
(i32.add
(call $recursive/fib
;;@ recursive.ts:3:13
(i32.sub
(get_local $0)
;;@ recursive.ts:3:17
(i32.const 1)
)
)
;;@ recursive.ts:3:22
(call $recursive/fib
;;@ recursive.ts:3:26
(i32.sub
(get_local $0)
;;@ recursive.ts:3:30
(i32.const 2)
)
)
@ -62,6 +73,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -18,32 +18,44 @@
(export "memory" (memory $0))
(start $start)
(func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:2:9
(i32.add
(get_local $0)
;;@ export.ts:2:13
(get_local $1)
)
)
(func $export/sub (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:6:9
(i32.sub
(get_local $0)
;;@ export.ts:6:13
(get_local $1)
)
)
(func $export/mul (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:12:9
(i32.mul
(get_local $0)
;;@ export.ts:12:13
(get_local $1)
)
)
(func $start (; 3 ;) (type $v)
;;@ reexport.ts:24:0
(drop
(i32.add
(call $export/add
;;@ reexport.ts:24:13
(i32.const 1)
;;@ reexport.ts:24:16
(i32.const 2)
)
;;@ reexport.ts:24:21
(call $export/mul
;;@ reexport.ts:24:34
(i32.const 3)
;;@ reexport.ts:24:37
(i32.const 4)
)
)

View File

@ -19,25 +19,34 @@
(export "memory" (memory $0))
(start $start)
(func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:2:13
(return
;;@ export.ts:2:9
(i32.add
(get_local $0)
;;@ export.ts:2:13
(get_local $1)
)
)
)
(func $export/sub (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:6:13
(return
;;@ export.ts:6:9
(i32.sub
(get_local $0)
;;@ export.ts:6:13
(get_local $1)
)
)
)
(func $export/mul (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ export.ts:12:13
(return
;;@ export.ts:12:9
(i32.mul
(get_local $0)
;;@ export.ts:12:13
(get_local $1)
)
)
@ -45,14 +54,20 @@
(func $export/ns.two (; 3 ;) (type $v)
)
(func $start (; 4 ;) (type $v)
;;@ reexport.ts:24:0
(drop
(i32.add
(call $export/add
;;@ reexport.ts:24:13
(i32.const 1)
;;@ reexport.ts:24:16
(i32.const 2)
)
;;@ reexport.ts:24:21
(call $export/mul
;;@ reexport.ts:24:34
(i32.const 3)
;;@ reexport.ts:24:37
(i32.const 4)
)
)
@ -89,6 +104,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

View File

@ -7,17 +7,22 @@
(export "memory" (memory $0))
(start $start)
(func $retain-i32/test (; 0 ;) (type $iiv) (param $0 i32) (param $1 i32)
;;@ retain-i32.ts:4:2
(if
;;@ retain-i32.ts:4:9
(i32.ne
(i32.and
;;@ retain-i32.ts:4:14
(i32.add
(get_local $0)
;;@ retain-i32.ts:4:18
(get_local $1)
)
(i32.const 255)
)
(i32.and
(i32.add
;;@ retain-i32.ts:4:29
(i32.shr_s
(i32.shl
(get_local $0)
@ -25,6 +30,7 @@
)
(i32.const 24)
)
;;@ retain-i32.ts:4:37
(i32.shr_s
(i32.shl
(get_local $1)
@ -38,17 +44,22 @@
)
(unreachable)
)
;;@ retain-i32.ts:5:2
(if
;;@ retain-i32.ts:5:9
(i32.ne
(i32.and
;;@ retain-i32.ts:5:14
(i32.sub
(get_local $0)
;;@ retain-i32.ts:5:18
(get_local $1)
)
(i32.const 255)
)
(i32.and
(i32.sub
;;@ retain-i32.ts:5:29
(i32.shr_s
(i32.shl
(get_local $0)
@ -56,6 +67,7 @@
)
(i32.const 24)
)
;;@ retain-i32.ts:5:37
(i32.shr_s
(i32.shl
(get_local $1)
@ -69,17 +81,22 @@
)
(unreachable)
)
;;@ retain-i32.ts:6:2
(if
;;@ retain-i32.ts:6:9
(i32.ne
(i32.and
;;@ retain-i32.ts:6:14
(i32.mul
(get_local $0)
;;@ retain-i32.ts:6:18
(get_local $1)
)
(i32.const 255)
)
(i32.and
(i32.mul
;;@ retain-i32.ts:6:29
(i32.shr_s
(i32.shl
(get_local $0)
@ -87,6 +104,7 @@
)
(i32.const 24)
)
;;@ retain-i32.ts:6:37
(i32.shr_s
(i32.shl
(get_local $1)
@ -100,17 +118,22 @@
)
(unreachable)
)
;;@ retain-i32.ts:7:2
(if
;;@ retain-i32.ts:7:9
(i32.ne
(i32.and
;;@ retain-i32.ts:7:14
(i32.and
(get_local $0)
;;@ retain-i32.ts:7:18
(get_local $1)
)
(i32.const 255)
)
(i32.and
(i32.and
;;@ retain-i32.ts:7:29
(i32.shr_s
(i32.shl
(get_local $0)
@ -118,6 +141,7 @@
)
(i32.const 24)
)
;;@ retain-i32.ts:7:37
(i32.shr_s
(i32.shl
(get_local $1)
@ -131,17 +155,22 @@
)
(unreachable)
)
;;@ retain-i32.ts:8:2
(if
;;@ retain-i32.ts:8:9
(i32.ne
(i32.and
;;@ retain-i32.ts:8:14
(i32.or
(get_local $0)
;;@ retain-i32.ts:8:18
(get_local $1)
)
(i32.const 255)
)
(i32.and
(i32.or
;;@ retain-i32.ts:8:29
(i32.shr_s
(i32.shl
(get_local $0)
@ -149,6 +178,7 @@
)
(i32.const 24)
)
;;@ retain-i32.ts:8:37
(i32.shr_s
(i32.shl
(get_local $1)
@ -162,17 +192,22 @@
)
(unreachable)
)
;;@ retain-i32.ts:9:2
(if
;;@ retain-i32.ts:9:9
(i32.ne
(i32.and
;;@ retain-i32.ts:9:14
(i32.xor
(get_local $0)
;;@ retain-i32.ts:9:18
(get_local $1)
)
(i32.const 255)
)
(i32.and
(i32.xor
;;@ retain-i32.ts:9:29
(i32.shr_s
(i32.shl
(get_local $0)
@ -180,6 +215,7 @@
)
(i32.const 24)
)
;;@ retain-i32.ts:9:37
(i32.shr_s
(i32.shl
(get_local $1)
@ -193,17 +229,22 @@
)
(unreachable)
)
;;@ retain-i32.ts:10:2
(if
;;@ retain-i32.ts:10:9
(i32.ne
(i32.and
;;@ retain-i32.ts:10:14
(i32.shl
(get_local $0)
;;@ retain-i32.ts:10:19
(get_local $1)
)
(i32.const 255)
)
(i32.and
(i32.shl
;;@ retain-i32.ts:10:30
(i32.shr_s
(i32.shl
(get_local $0)
@ -211,6 +252,7 @@
)
(i32.const 24)
)
;;@ retain-i32.ts:10:39
(i32.shr_s
(i32.shl
(get_local $1)
@ -224,21 +266,28 @@
)
(unreachable)
)
;;@ retain-i32.ts:13:2
(if
;;@ retain-i32.ts:13:9
(i32.ne
(i32.and
;;@ retain-i32.ts:13:14
(i32.add
(get_local $0)
;;@ retain-i32.ts:13:18
(get_local $1)
)
(i32.const 255)
)
;;@ retain-i32.ts:13:24
(i32.and
(i32.add
;;@ retain-i32.ts:13:29
(i32.and
(get_local $0)
(i32.const 255)
)
;;@ retain-i32.ts:13:37
(i32.and
(get_local $1)
(i32.const 255)
@ -249,21 +298,28 @@
)
(unreachable)
)
;;@ retain-i32.ts:14:2
(if
;;@ retain-i32.ts:14:9
(i32.ne
(i32.and
;;@ retain-i32.ts:14:14
(i32.sub
(get_local $0)
;;@ retain-i32.ts:14:18
(get_local $1)
)
(i32.const 255)
)
;;@ retain-i32.ts:14:24
(i32.and
(i32.sub
;;@ retain-i32.ts:14:29
(i32.and
(get_local $0)
(i32.const 255)
)
;;@ retain-i32.ts:14:37
(i32.and
(get_local $1)
(i32.const 255)
@ -274,21 +330,28 @@
)
(unreachable)
)
;;@ retain-i32.ts:15:2
(if
;;@ retain-i32.ts:15:9
(i32.ne
(i32.and
;;@ retain-i32.ts:15:14
(i32.mul
(get_local $0)
;;@ retain-i32.ts:15:18
(get_local $1)
)
(i32.const 255)
)
;;@ retain-i32.ts:15:24
(i32.and
(i32.mul
;;@ retain-i32.ts:15:29
(i32.and
(get_local $0)
(i32.const 255)
)
;;@ retain-i32.ts:15:37
(i32.and
(get_local $1)
(i32.const 255)
@ -299,20 +362,26 @@
)
(unreachable)
)
;;@ retain-i32.ts:16:2
(if
;;@ retain-i32.ts:16:9
(i32.ne
(i32.and
;;@ retain-i32.ts:16:14
(i32.and
(get_local $0)
;;@ retain-i32.ts:16:18
(get_local $1)
)
(i32.const 255)
)
(i32.and
;;@ retain-i32.ts:16:29
(i32.and
(get_local $0)
(i32.const 255)
)
;;@ retain-i32.ts:16:37
(i32.and
(get_local $1)
(i32.const 255)
@ -321,20 +390,26 @@
)
(unreachable)
)
;;@ retain-i32.ts:17:2
(if
;;@ retain-i32.ts:17:9
(i32.ne
(i32.and
;;@ retain-i32.ts:17:14
(i32.or
(get_local $0)
;;@ retain-i32.ts:17:18
(get_local $1)
)
(i32.const 255)
)
(i32.or
;;@ retain-i32.ts:17:29
(i32.and
(get_local $0)
(i32.const 255)
)
;;@ retain-i32.ts:17:37
(i32.and
(get_local $1)
(i32.const 255)
@ -343,20 +418,26 @@
)
(unreachable)
)
;;@ retain-i32.ts:18:2
(if
;;@ retain-i32.ts:18:9
(i32.ne
(i32.and
;;@ retain-i32.ts:18:14
(i32.xor
(get_local $0)
;;@ retain-i32.ts:18:18
(get_local $1)
)
(i32.const 255)
)
(i32.xor
;;@ retain-i32.ts:18:29
(i32.and
(get_local $0)
(i32.const 255)
)
;;@ retain-i32.ts:18:37
(i32.and
(get_local $1)
(i32.const 255)
@ -365,21 +446,28 @@
)
(unreachable)
)
;;@ retain-i32.ts:19:2
(if
;;@ retain-i32.ts:19:9
(i32.ne
(i32.and
;;@ retain-i32.ts:19:14
(i32.shl
(get_local $0)
;;@ retain-i32.ts:19:19
(get_local $1)
)
(i32.const 255)
)
;;@ retain-i32.ts:19:25
(i32.and
(i32.shl
;;@ retain-i32.ts:19:30
(i32.and
(get_local $0)
(i32.const 255)
)
;;@ retain-i32.ts:19:39
(i32.and
(get_local $1)
(i32.const 255)
@ -393,158 +481,262 @@
)
(func $start (; 1 ;) (type $v)
(local $0 i32)
;;@ retain-i32.ts:23:0
(call $retain-i32/test
;;@ retain-i32.ts:23:5
(i32.const 0)
;;@ retain-i32.ts:23:8
(i32.const 127)
)
;;@ retain-i32.ts:24:0
(call $retain-i32/test
;;@ retain-i32.ts:24:5
(i32.const 127)
;;@ retain-i32.ts:24:19
(i32.const 0)
)
;;@ retain-i32.ts:26:0
(call $retain-i32/test
;;@ retain-i32.ts:26:5
(i32.const 1)
;;@ retain-i32.ts:26:8
(i32.const 127)
)
;;@ retain-i32.ts:27:0
(call $retain-i32/test
;;@ retain-i32.ts:27:5
(i32.const 127)
;;@ retain-i32.ts:27:19
(i32.const 1)
)
;;@ retain-i32.ts:29:0
(call $retain-i32/test
(i32.const -1)
;;@ retain-i32.ts:29:9
(i32.const 127)
)
;;@ retain-i32.ts:30:0
(call $retain-i32/test
;;@ retain-i32.ts:30:5
(i32.const 127)
(i32.const -1)
)
;;@ retain-i32.ts:32:0
(call $retain-i32/test
;;@ retain-i32.ts:32:5
(i32.const 0)
;;@ retain-i32.ts:32:8
(i32.const -128)
)
;;@ retain-i32.ts:33:0
(call $retain-i32/test
;;@ retain-i32.ts:33:5
(i32.const -128)
;;@ retain-i32.ts:33:19
(i32.const 0)
)
;;@ retain-i32.ts:35:0
(call $retain-i32/test
;;@ retain-i32.ts:35:5
(i32.const 1)
;;@ retain-i32.ts:35:8
(i32.const -128)
)
;;@ retain-i32.ts:36:0
(call $retain-i32/test
;;@ retain-i32.ts:36:5
(i32.const -128)
;;@ retain-i32.ts:36:19
(i32.const 1)
)
;;@ retain-i32.ts:38:0
(call $retain-i32/test
(i32.const -1)
;;@ retain-i32.ts:38:9
(i32.const -128)
)
;;@ retain-i32.ts:39:0
(call $retain-i32/test
;;@ retain-i32.ts:39:5
(i32.const -128)
(i32.const -1)
)
;;@ retain-i32.ts:41:0
(call $retain-i32/test
;;@ retain-i32.ts:41:5
(i32.const 127)
;;@ retain-i32.ts:41:19
(i32.const 127)
)
;;@ retain-i32.ts:42:0
(call $retain-i32/test
;;@ retain-i32.ts:42:5
(i32.const -128)
;;@ retain-i32.ts:42:19
(i32.const -128)
)
;;@ retain-i32.ts:43:0
(call $retain-i32/test
;;@ retain-i32.ts:43:5
(i32.const 127)
;;@ retain-i32.ts:43:19
(i32.const -128)
)
;;@ retain-i32.ts:44:0
(call $retain-i32/test
;;@ retain-i32.ts:44:5
(i32.const -128)
;;@ retain-i32.ts:44:19
(i32.const 127)
)
;;@ retain-i32.ts:47:0
(call $retain-i32/test
;;@ retain-i32.ts:47:5
(i32.const 0)
;;@ retain-i32.ts:47:8
(i32.const 255)
)
;;@ retain-i32.ts:48:0
(call $retain-i32/test
;;@ retain-i32.ts:48:5
(i32.const 255)
;;@ retain-i32.ts:48:19
(i32.const 0)
)
;;@ retain-i32.ts:50:0
(call $retain-i32/test
;;@ retain-i32.ts:50:5
(i32.const 1)
;;@ retain-i32.ts:50:8
(i32.const 255)
)
;;@ retain-i32.ts:51:0
(call $retain-i32/test
;;@ retain-i32.ts:51:5
(i32.const 255)
;;@ retain-i32.ts:51:19
(i32.const 1)
)
;;@ retain-i32.ts:53:0
(call $retain-i32/test
(i32.const -1)
;;@ retain-i32.ts:53:9
(i32.const 255)
)
;;@ retain-i32.ts:54:0
(call $retain-i32/test
;;@ retain-i32.ts:54:5
(i32.const 255)
(i32.const -1)
)
;;@ retain-i32.ts:56:0
(call $retain-i32/test
;;@ retain-i32.ts:56:5
(i32.const 255)
;;@ retain-i32.ts:56:19
(i32.const 255)
)
;;@ retain-i32.ts:59:5
(set_local $0
;;@ retain-i32.ts:59:18
(i32.const -128)
)
(loop $continue|0
(if
;;@ retain-i32.ts:59:32
(i32.le_s
(get_local $0)
;;@ retain-i32.ts:59:37
(i32.const 255)
)
(block
;;@ retain-i32.ts:60:2
(call $retain-i32/test
;;@ retain-i32.ts:60:7
(i32.const 0)
;;@ retain-i32.ts:60:10
(get_local $0)
)
;;@ retain-i32.ts:61:2
(call $retain-i32/test
;;@ retain-i32.ts:61:7
(i32.const 1)
;;@ retain-i32.ts:61:10
(get_local $0)
)
;;@ retain-i32.ts:62:2
(call $retain-i32/test
(i32.const -1)
;;@ retain-i32.ts:62:11
(get_local $0)
)
;;@ retain-i32.ts:63:2
(call $retain-i32/test
;;@ retain-i32.ts:63:7
(i32.const -128)
;;@ retain-i32.ts:63:21
(get_local $0)
)
;;@ retain-i32.ts:64:2
(call $retain-i32/test
;;@ retain-i32.ts:64:7
(i32.const 127)
;;@ retain-i32.ts:64:21
(get_local $0)
)
;;@ retain-i32.ts:65:2
(call $retain-i32/test
;;@ retain-i32.ts:65:7
(i32.const 255)
;;@ retain-i32.ts:65:21
(get_local $0)
)
;;@ retain-i32.ts:66:2
(call $retain-i32/test
;;@ retain-i32.ts:66:7
(i32.const -32768)
;;@ retain-i32.ts:66:22
(get_local $0)
)
;;@ retain-i32.ts:67:2
(call $retain-i32/test
;;@ retain-i32.ts:67:7
(i32.const 32767)
;;@ retain-i32.ts:67:22
(get_local $0)
)
;;@ retain-i32.ts:68:2
(call $retain-i32/test
;;@ retain-i32.ts:68:7
(i32.const 65535)
;;@ retain-i32.ts:68:22
(get_local $0)
)
;;@ retain-i32.ts:69:2
(call $retain-i32/test
;;@ retain-i32.ts:69:7
(i32.const 2147483647)
;;@ retain-i32.ts:69:22
(get_local $0)
)
;;@ retain-i32.ts:70:2
(call $retain-i32/test
;;@ retain-i32.ts:70:7
(i32.const -2147483648)
;;@ retain-i32.ts:70:22
(get_local $0)
)
;;@ retain-i32.ts:71:2
(call $retain-i32/test
;;@ retain-i32.ts:71:7
(i32.const -1)
;;@ retain-i32.ts:71:22
(get_local $0)
)
;;@ retain-i32.ts:59:51
(set_local $0
(i32.add
;;@ retain-i32.ts:59:53
(get_local $0)
(i32.const 1)
)
@ -553,177 +745,240 @@
)
)
)
;;@ retain-i32.ts:77:0
(set_global $retain-i32/si
(i32.const -1)
)
;;@ retain-i32.ts:78:0
(if
;;@ retain-i32.ts:78:7
(i32.ne
(get_global $retain-i32/si)
(i32.const -1)
)
(unreachable)
)
;;@ retain-i32.ts:80:0
(set_global $retain-i32/si
(i32.const -1)
)
;;@ retain-i32.ts:81:0
(if
;;@ retain-i32.ts:81:7
(i32.ne
(get_global $retain-i32/si)
(i32.const -1)
)
(unreachable)
)
;;@ retain-i32.ts:83:0
(set_global $retain-i32/si
(i32.const -2)
)
;;@ retain-i32.ts:84:0
(if
;;@ retain-i32.ts:84:7
(i32.ne
(get_global $retain-i32/si)
(i32.const -2)
)
(unreachable)
)
;;@ retain-i32.ts:86:0
(set_global $retain-i32/si
(i32.const -128)
)
;;@ retain-i32.ts:87:0
(if
;;@ retain-i32.ts:87:7
(i32.ne
(get_global $retain-i32/si)
(i32.const -128)
)
(unreachable)
)
;;@ retain-i32.ts:89:0
(set_global $retain-i32/si
(i32.const -128)
)
;;@ retain-i32.ts:90:0
(if
;;@ retain-i32.ts:90:7
(i32.ne
(get_global $retain-i32/si)
(i32.const -128)
)
(unreachable)
)
;;@ retain-i32.ts:92:0
(set_global $retain-i32/si
(i32.const -127)
)
;;@ retain-i32.ts:93:0
(if
;;@ retain-i32.ts:93:7
(i32.ne
(get_global $retain-i32/si)
(i32.const -127)
)
(unreachable)
)
;;@ retain-i32.ts:95:0
(set_global $retain-i32/si
(i32.const -128)
)
;;@ retain-i32.ts:96:0
(if
;;@ retain-i32.ts:96:7
(i32.ne
(get_global $retain-i32/si)
(i32.const -128)
)
(unreachable)
)
;;@ retain-i32.ts:98:0
(set_global $retain-i32/si
(i32.const 1)
)
;;@ retain-i32.ts:99:0
(if
;;@ retain-i32.ts:99:7
(i32.ne
(get_global $retain-i32/si)
;;@ retain-i32.ts:99:13
(i32.const 1)
)
(unreachable)
)
;;@ retain-i32.ts:101:0
(set_global $retain-i32/si
(i32.const 1)
)
;;@ retain-i32.ts:102:0
(if
;;@ retain-i32.ts:102:7
(i32.ne
(get_global $retain-i32/si)
;;@ retain-i32.ts:102:13
(i32.const 1)
)
(unreachable)
)
;;@ retain-i32.ts:104:0
(set_global $retain-i32/si
(i32.const 0)
)
;;@ retain-i32.ts:105:0
(if
;;@ retain-i32.ts:105:7
(get_global $retain-i32/si)
(unreachable)
)
;;@ retain-i32.ts:107:0
(set_global $retain-i32/si
(i32.const 1)
)
;;@ retain-i32.ts:108:0
(if
;;@ retain-i32.ts:108:7
(i32.ne
(get_global $retain-i32/si)
;;@ retain-i32.ts:108:13
(i32.const 1)
)
(unreachable)
)
;;@ retain-i32.ts:112:0
(set_global $retain-i32/ui
(i32.const 255)
)
;;@ retain-i32.ts:113:0
(if
;;@ retain-i32.ts:113:7
(i32.ne
(get_global $retain-i32/ui)
;;@ retain-i32.ts:113:13
(i32.const 255)
)
(unreachable)
)
;;@ retain-i32.ts:115:0
(set_global $retain-i32/ui
(i32.const 255)
)
;;@ retain-i32.ts:116:0
(if
;;@ retain-i32.ts:116:7
(i32.ne
(get_global $retain-i32/ui)
;;@ retain-i32.ts:116:13
(i32.const 255)
)
(unreachable)
)
;;@ retain-i32.ts:118:0
(set_global $retain-i32/ui
(i32.const 254)
)
;;@ retain-i32.ts:119:0
(if
;;@ retain-i32.ts:119:7
(i32.ne
(get_global $retain-i32/ui)
;;@ retain-i32.ts:119:13
(i32.const 254)
)
(unreachable)
)
;;@ retain-i32.ts:121:0
(set_global $retain-i32/ui
(i32.const 1)
)
;;@ retain-i32.ts:122:0
(if
;;@ retain-i32.ts:122:7
(i32.ne
(get_global $retain-i32/ui)
;;@ retain-i32.ts:122:13
(i32.const 1)
)
(unreachable)
)
;;@ retain-i32.ts:124:0
(set_global $retain-i32/ui
(i32.const 1)
)
;;@ retain-i32.ts:125:0
(if
;;@ retain-i32.ts:125:7
(i32.ne
(get_global $retain-i32/ui)
;;@ retain-i32.ts:125:13
(i32.const 1)
)
(unreachable)
)
;;@ retain-i32.ts:127:0
(set_global $retain-i32/ui
(i32.const 1)
)
;;@ retain-i32.ts:128:0
(if
;;@ retain-i32.ts:128:7
(i32.ne
(get_global $retain-i32/ui)
;;@ retain-i32.ts:128:13
(i32.const 1)
)
(unreachable)
)
;;@ retain-i32.ts:130:0
(set_global $retain-i32/ui
(i32.const 0)
)
;;@ retain-i32.ts:131:0
(if
;;@ retain-i32.ts:131:7
(get_global $retain-i32/ui)
(unreachable)
)

File diff suppressed because it is too large Load Diff

View File

@ -7,13 +7,17 @@
(local $0 i32)
(loop $continue|0
(if
;;@ scoped.ts:5:45
(i32.lt_s
(get_local $0)
;;@ scoped.ts:5:73
(i32.const 1)
)
(block
;;@ scoped.ts:5:76
(set_local $0
(i32.add
;;@ scoped.ts:5:78
(get_local $0)
(i32.const 1)
)
@ -22,18 +26,24 @@
)
)
)
;;@ scoped.ts:6:5
(set_local $0
;;@ scoped.ts:6:43
(i32.const 0)
)
(loop $continue|1
(if
;;@ scoped.ts:6:46
(i32.lt_s
(get_local $0)
;;@ scoped.ts:6:56
(i32.const 1)
)
(block
;;@ scoped.ts:6:59
(set_local $0
(i32.add
;;@ scoped.ts:6:61
(get_local $0)
(i32.const 1)
)

View File

@ -12,20 +12,28 @@
(local $1 i32)
(local $2 i64)
(local $3 f32)
;;@ scoped.ts:5:0
(block $break|0
;;@ scoped.ts:5:5
(set_local $0
;;@ scoped.ts:5:42
(i32.const 0)
)
(loop $continue|0
(if
;;@ scoped.ts:5:45
(i32.lt_s
(get_local $0)
;;@ scoped.ts:5:73
(i32.const 1)
)
(block
;;@ scoped.ts:5:104
(nop)
;;@ scoped.ts:5:76
(set_local $0
(i32.add
;;@ scoped.ts:5:78
(get_local $0)
(i32.const 1)
)
@ -35,22 +43,30 @@
)
)
)
;;@ scoped.ts:6:0
(block $break|1
;;@ scoped.ts:6:5
(set_local $1
;;@ scoped.ts:6:43
(i32.const 0)
)
(loop $continue|1
(if
;;@ scoped.ts:6:46
(i32.lt_s
(get_local $1)
;;@ scoped.ts:6:56
(i32.const 1)
)
(block
;;@ scoped.ts:7:2
(drop
(get_local $1)
)
;;@ scoped.ts:6:59
(set_local $1
(i32.add
;;@ scoped.ts:6:61
(get_local $1)
(i32.const 1)
)
@ -60,12 +76,18 @@
)
)
)
;;@ scoped.ts:9:0
(block
;;@ scoped.ts:10:2
(set_local $2
;;@ scoped.ts:10:42
(i64.const 5)
)
;;@ scoped.ts:11:2
(block
;;@ scoped.ts:12:4
(set_local $3
;;@ scoped.ts:12:41
(f32.const 10)
)
)
@ -102,6 +124,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import "std:memory/arena";
import "allocator/arena";
const size: usize = 42;
let ptr1: usize = allocate_memory(size);
@ -22,6 +22,6 @@ assert(compare_memory(ptr1, ptr2, size) == 0);
free_memory(ptr1);
free_memory(ptr2);
clear_memory();
reset_memory();
ptr1 = allocate_memory(size);
assert(ptr1 == HEAP_BASE);

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import "std:memory/arena";
import "allocator/arena";
var arr = changetype<i32[]>(allocate_memory(sizeof<usize>() + 2 * sizeof<i32>()));

File diff suppressed because it is too large Load Diff

View File

@ -1,171 +1,332 @@
(module
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $iiiv (func (param i32 i32 i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $std/carray/arr (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 4))
(global $HEAP_BASE i32 (i32.const 40))
(memory $0 1)
(data (i32.const 8) "\0d\00\00\00s\00t\00d\00/\00c\00a\00r\00r\00a\00y\00.\00t\00s")
(export "memory" (memory $0))
(start $start)
(func $std:array/CArray#__get (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func "$(lib)/array/CArray#__get" (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ (lib)/array.ts:173:4
(if
;;@ (lib)/array.ts:173:8
(i32.lt_s
(get_local $1)
;;@ (lib)/array.ts:173:16
(i32.const 0)
)
;;@ (lib)/array.ts:174:6
(unreachable)
)
;;@ (lib)/array.ts:175:11
(i32.load
;;@ (lib)/array.ts:175:19
(i32.add
(get_local $0)
;;@ (lib)/array.ts:175:45
(i32.mul
(get_local $1)
;;@ (lib)/array.ts:175:60
(i32.const 4)
)
)
)
)
(func $std:array/CArray#__set (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func "$(lib)/array/CArray#__set" (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
;;@ (lib)/array.ts:180:4
(if
;;@ (lib)/array.ts:180:8
(i32.lt_s
(get_local $1)
;;@ (lib)/array.ts:180:16
(i32.const 0)
)
;;@ (lib)/array.ts:181:6
(unreachable)
)
;;@ (lib)/array.ts:182:4
(i32.store
;;@ (lib)/array.ts:182:13
(i32.add
(get_local $0)
;;@ (lib)/array.ts:182:39
(i32.mul
(get_local $1)
;;@ (lib)/array.ts:182:54
(i32.const 4)
)
)
;;@ (lib)/array.ts:182:67
(get_local $2)
)
)
(func $start (; 2 ;) (type $v)
(func $start (; 3 ;) (type $v)
(local $0 i32)
(set_global $std/carray/arr
;;@ std/carray.ts:6:23
(get_global $HEAP_BASE)
)
;;@ std/carray.ts:8:0
(if
;;@ std/carray.ts:8:7
(i32.load
;;@ std/carray.ts:8:17
(get_global $HEAP_BASE)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 8)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:9:0
(if
;;@ std/carray.ts:9:7
(i32.load
;;@ std/carray.ts:9:17
(i32.add
(get_global $HEAP_BASE)
;;@ std/carray.ts:9:29
(i32.const 4)
)
)
(unreachable)
)
(if
(call $std:array/CArray#__get
(get_global $std/carray/arr)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 9)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:11:0
(if
(call $std:array/CArray#__get
;;@ std/carray.ts:11:7
(call "$(lib)/array/CArray#__get"
(get_global $std/carray/arr)
;;@ std/carray.ts:11:11
(i32.const 0)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 11)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:12:0
(if
;;@ std/carray.ts:12:7
(call "$(lib)/array/CArray#__get"
(get_global $std/carray/arr)
;;@ std/carray.ts:12:11
(i32.const 1)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 12)
(i32.const 0)
)
(unreachable)
)
(call $std:array/CArray#__set
)
;;@ std/carray.ts:14:0
(call "$(lib)/array/CArray#__set"
(get_global $std/carray/arr)
;;@ std/carray.ts:14:4
(i32.const 0)
;;@ std/carray.ts:14:9
(i32.const 42)
)
(call $std:array/CArray#__set
;;@ std/carray.ts:15:0
(call "$(lib)/array/CArray#__set"
(get_global $std/carray/arr)
;;@ std/carray.ts:15:4
(i32.const 1)
;;@ std/carray.ts:15:9
(i32.const 24)
)
;;@ std/carray.ts:17:0
(if
;;@ std/carray.ts:17:7
(i32.ne
(i32.load
;;@ std/carray.ts:17:17
(get_global $HEAP_BASE)
)
;;@ std/carray.ts:17:31
(i32.const 42)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 17)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:18:0
(if
;;@ std/carray.ts:18:7
(i32.ne
(i32.load
;;@ std/carray.ts:18:17
(i32.add
(get_global $HEAP_BASE)
;;@ std/carray.ts:18:29
(i32.const 4)
)
)
;;@ std/carray.ts:18:35
(i32.const 24)
)
(unreachable)
)
(if
(i32.ne
(call $std:array/CArray#__get
(get_global $std/carray/arr)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 18)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:20:0
(if
;;@ std/carray.ts:20:7
(i32.ne
(call "$(lib)/array/CArray#__get"
(get_global $std/carray/arr)
;;@ std/carray.ts:20:11
(i32.const 0)
)
;;@ std/carray.ts:20:17
(i32.const 42)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 20)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:21:0
(if
;;@ std/carray.ts:21:7
(i32.ne
(call $std:array/CArray#__get
(call "$(lib)/array/CArray#__get"
(get_global $std/carray/arr)
;;@ std/carray.ts:21:11
(i32.const 1)
)
;;@ std/carray.ts:21:17
(i32.const 24)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 21)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:23:0
(if
;;@ std/carray.ts:23:7
(block (result i32)
(call $std:array/CArray#__set
(call "$(lib)/array/CArray#__set"
;;@ std/carray.ts:23:8
(get_global $std/carray/arr)
;;@ std/carray.ts:23:12
(i32.const 3)
(tee_local $0
;;@ std/carray.ts:23:17
(i32.const 9000)
)
)
;;@ std/carray.ts:23:7
(i32.ne
(get_local $0)
;;@ std/carray.ts:23:26
(i32.const 9000)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 23)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:25:0
(if
;;@ std/carray.ts:25:7
(i32.ne
(i32.load
;;@ std/carray.ts:25:17
(i32.add
(get_global $HEAP_BASE)
;;@ std/carray.ts:25:29
(i32.const 12)
)
)
;;@ std/carray.ts:25:36
(i32.const 9000)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 25)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:26:0
(if
;;@ std/carray.ts:26:7
(i32.ne
(call $std:array/CArray#__get
(call "$(lib)/array/CArray#__get"
(get_global $std/carray/arr)
;;@ std/carray.ts:26:11
(i32.const 3)
)
;;@ std/carray.ts:26:17
(i32.const 9000)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 26)
(i32.const 0)
)
(unreachable)
)
)
)
)

View File

@ -1,209 +1,374 @@
(module
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $iiiv (func (param i32 i32 i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $std/carray/arr (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 4))
(global $HEAP_BASE i32 (i32.const 40))
(memory $0 1)
(data (i32.const 8) "\0d\00\00\00s\00t\00d\00/\00c\00a\00r\00r\00a\00y\00.\00t\00s\00")
(export "memory" (memory $0))
(start $start)
(func $std:array/CArray#__get (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
(func "$(lib)/array/CArray#__get" (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32)
;;@ (lib)/array.ts:173:4
(if
;;@ (lib)/array.ts:173:8
(i32.lt_s
(get_local $1)
;;@ (lib)/array.ts:173:16
(i32.const 0)
)
;;@ (lib)/array.ts:174:6
(unreachable)
)
;;@ (lib)/array.ts:175:71
(return
;;@ (lib)/array.ts:175:11
(i32.load
;;@ (lib)/array.ts:175:19
(i32.add
(get_local $0)
;;@ (lib)/array.ts:175:45
(i32.mul
(get_local $1)
;;@ (lib)/array.ts:175:60
(i32.const 4)
)
)
)
)
)
(func $std:array/CArray#__set (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func "$(lib)/array/CArray#__set" (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
;;@ (lib)/array.ts:180:4
(if
;;@ (lib)/array.ts:180:8
(i32.lt_s
(get_local $1)
;;@ (lib)/array.ts:180:16
(i32.const 0)
)
;;@ (lib)/array.ts:181:6
(unreachable)
)
;;@ (lib)/array.ts:182:4
(i32.store
;;@ (lib)/array.ts:182:13
(i32.add
(get_local $0)
;;@ (lib)/array.ts:182:39
(i32.mul
(get_local $1)
;;@ (lib)/array.ts:182:54
(i32.const 4)
)
)
;;@ (lib)/array.ts:182:67
(get_local $2)
)
)
(func $start (; 2 ;) (type $v)
(func $start (; 3 ;) (type $v)
(local $0 i32)
(set_global $std/carray/arr
;;@ std/carray.ts:6:23
(get_global $HEAP_BASE)
)
;;@ std/carray.ts:8:0
(if
(i32.eqz
;;@ std/carray.ts:8:7
(i32.eq
(i32.load
;;@ std/carray.ts:8:17
(get_global $HEAP_BASE)
)
;;@ std/carray.ts:8:31
(i32.const 0)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 8)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:9:0
(if
(i32.eqz
;;@ std/carray.ts:9:7
(i32.eq
(i32.load
;;@ std/carray.ts:9:17
(i32.add
(get_global $HEAP_BASE)
;;@ std/carray.ts:9:29
(i32.const 4)
)
)
;;@ std/carray.ts:9:35
(i32.const 0)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 9)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:11:0
(if
(i32.eqz
;;@ std/carray.ts:11:7
(i32.eq
(call $std:array/CArray#__get
(call "$(lib)/array/CArray#__get"
(get_global $std/carray/arr)
;;@ std/carray.ts:11:11
(i32.const 0)
)
;;@ std/carray.ts:11:17
(i32.const 0)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 11)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:12:0
(if
(i32.eqz
;;@ std/carray.ts:12:7
(i32.eq
(call $std:array/CArray#__get
(call "$(lib)/array/CArray#__get"
(get_global $std/carray/arr)
;;@ std/carray.ts:12:11
(i32.const 1)
)
;;@ std/carray.ts:12:17
(i32.const 0)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 12)
(i32.const 0)
)
(unreachable)
)
(call $std:array/CArray#__set
)
;;@ std/carray.ts:14:0
(call "$(lib)/array/CArray#__set"
(get_global $std/carray/arr)
;;@ std/carray.ts:14:4
(i32.const 0)
;;@ std/carray.ts:14:9
(i32.const 42)
)
(call $std:array/CArray#__set
;;@ std/carray.ts:15:0
(call "$(lib)/array/CArray#__set"
(get_global $std/carray/arr)
;;@ std/carray.ts:15:4
(i32.const 1)
;;@ std/carray.ts:15:9
(i32.const 24)
)
;;@ std/carray.ts:17:0
(if
(i32.eqz
;;@ std/carray.ts:17:7
(i32.eq
(i32.load
;;@ std/carray.ts:17:17
(get_global $HEAP_BASE)
)
;;@ std/carray.ts:17:31
(i32.const 42)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 17)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:18:0
(if
(i32.eqz
;;@ std/carray.ts:18:7
(i32.eq
(i32.load
;;@ std/carray.ts:18:17
(i32.add
(get_global $HEAP_BASE)
;;@ std/carray.ts:18:29
(i32.const 4)
)
)
;;@ std/carray.ts:18:35
(i32.const 24)
)
)
(unreachable)
)
(if
(i32.eqz
(i32.eq
(call $std:array/CArray#__get
(get_global $std/carray/arr)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 18)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:20:0
(if
(i32.eqz
;;@ std/carray.ts:20:7
(i32.eq
(call "$(lib)/array/CArray#__get"
(get_global $std/carray/arr)
;;@ std/carray.ts:20:11
(i32.const 0)
)
;;@ std/carray.ts:20:17
(i32.const 42)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 20)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:21:0
(if
(i32.eqz
;;@ std/carray.ts:21:7
(i32.eq
(call $std:array/CArray#__get
(call "$(lib)/array/CArray#__get"
(get_global $std/carray/arr)
;;@ std/carray.ts:21:11
(i32.const 1)
)
;;@ std/carray.ts:21:17
(i32.const 24)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 21)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:23:0
(if
(i32.eqz
;;@ std/carray.ts:23:7
(i32.eq
(block (result i32)
(call $std:array/CArray#__set
(call "$(lib)/array/CArray#__set"
;;@ std/carray.ts:23:8
(get_global $std/carray/arr)
;;@ std/carray.ts:23:12
(i32.const 3)
(tee_local $0
;;@ std/carray.ts:23:17
(i32.const 9000)
)
)
(get_local $0)
)
;;@ std/carray.ts:23:26
(i32.const 9000)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 23)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:25:0
(if
(i32.eqz
;;@ std/carray.ts:25:7
(i32.eq
(i32.load
;;@ std/carray.ts:25:17
(i32.add
(get_global $HEAP_BASE)
;;@ std/carray.ts:25:29
(i32.const 12)
)
)
;;@ std/carray.ts:25:36
(i32.const 9000)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 25)
(i32.const 0)
)
(unreachable)
)
)
;;@ std/carray.ts:26:0
(if
(i32.eqz
;;@ std/carray.ts:26:7
(i32.eq
(call $std:array/CArray#__get
(call "$(lib)/array/CArray#__get"
(get_global $std/carray/arr)
;;@ std/carray.ts:26:11
(i32.const 3)
)
;;@ std/carray.ts:26:17
(i32.const 9000)
)
)
(block
(call $abort
(i32.const 0)
(i32.const 8)
(i32.const 26)
(i32.const 0)
)
(unreachable)
)
)
)
)
(;
[program.elements]
@ -235,6 +400,7 @@
FUNCTION_PROTOTYPE: grow_memory
FUNCTION_PROTOTYPE: changetype
FUNCTION_PROTOTYPE: assert
FUNCTION_PROTOTYPE: abort
FUNCTION_PROTOTYPE: i8
FUNCTION_PROTOTYPE: i16
FUNCTION_PROTOTYPE: i32
@ -249,78 +415,78 @@
FUNCTION_PROTOTYPE: isize
FUNCTION_PROTOTYPE: usize
GLOBAL: HEAP_BASE
CLASS_PROTOTYPE: std:array/Array
PROPERTY: std:array/Array#length
CLASS_PROTOTYPE: (lib)/array/Array
PROPERTY: (lib)/array/Array#length
CLASS_PROTOTYPE: Array
CLASS_PROTOTYPE: std:array/CArray
CLASS_PROTOTYPE: (lib)/array/CArray
CLASS_PROTOTYPE: CArray
CLASS_PROTOTYPE: std:error/Error
CLASS_PROTOTYPE: (lib)/error/Error
CLASS_PROTOTYPE: Error
CLASS_PROTOTYPE: std:error/RangeError
CLASS_PROTOTYPE: (lib)/error/RangeError
CLASS_PROTOTYPE: RangeError
CLASS_PROTOTYPE: std:map/Map
PROPERTY: std:map/Map#size
CLASS_PROTOTYPE: (lib)/map/Map
PROPERTY: (lib)/map/Map#size
CLASS_PROTOTYPE: Map
FUNCTION_PROTOTYPE: std:memory/copy_memory
FUNCTION_PROTOTYPE: std:memory/move_memory
FUNCTION_PROTOTYPE: (lib)/memory/copy_memory
FUNCTION_PROTOTYPE: (lib)/memory/move_memory
FUNCTION_PROTOTYPE: move_memory
FUNCTION_PROTOTYPE: std:memory/set_memory
FUNCTION_PROTOTYPE: (lib)/memory/set_memory
FUNCTION_PROTOTYPE: set_memory
FUNCTION_PROTOTYPE: std:memory/compare_memory
FUNCTION_PROTOTYPE: (lib)/memory/compare_memory
FUNCTION_PROTOTYPE: compare_memory
CLASS_PROTOTYPE: std:regexp/RegExp
CLASS_PROTOTYPE: (lib)/regexp/RegExp
CLASS_PROTOTYPE: RegExp
CLASS_PROTOTYPE: std:set/Set
PROPERTY: std:set/Set#size
CLASS_PROTOTYPE: (lib)/set/Set
PROPERTY: (lib)/set/Set#size
CLASS_PROTOTYPE: Set
GLOBAL: std:string/EMPTY
GLOBAL: std:string/HEAD
FUNCTION_PROTOTYPE: std:string/allocate
CLASS_PROTOTYPE: std:string/String
FUNCTION_PROTOTYPE: std:string/String.__concat
FUNCTION_PROTOTYPE: std:string/String.__eq
GLOBAL: (lib)/string/EMPTY
GLOBAL: (lib)/string/HEAD
FUNCTION_PROTOTYPE: (lib)/string/allocate
CLASS_PROTOTYPE: (lib)/string/String
FUNCTION_PROTOTYPE: (lib)/string/String.__concat
FUNCTION_PROTOTYPE: (lib)/string/String.__eq
CLASS_PROTOTYPE: String
FUNCTION_PROTOTYPE: std:string/isWhiteSpaceOrLineTerminator
ENUM: std:string/CharCode
FUNCTION_PROTOTYPE: std:string/parseInt
FUNCTION_PROTOTYPE: (lib)/string/isWhiteSpaceOrLineTerminator
ENUM: (lib)/string/CharCode
FUNCTION_PROTOTYPE: (lib)/string/parseInt
FUNCTION_PROTOTYPE: parseInt
FUNCTION_PROTOTYPE: std:string/parseI32
FUNCTION_PROTOTYPE: (lib)/string/parseI32
FUNCTION_PROTOTYPE: parseI32
FUNCTION_PROTOTYPE: std:string/parseI64
FUNCTION_PROTOTYPE: (lib)/string/parseI64
FUNCTION_PROTOTYPE: parseI64
FUNCTION_PROTOTYPE: std:string/parse
FUNCTION_PROTOTYPE: std:string/parseFloat
FUNCTION_PROTOTYPE: (lib)/string/parse
FUNCTION_PROTOTYPE: (lib)/string/parseFloat
FUNCTION_PROTOTYPE: parseFloat
GLOBAL: std/carray/arr
[program.exports]
CLASS_PROTOTYPE: std:array/Array
CLASS_PROTOTYPE: (lib)/array/Array
CLASS_PROTOTYPE: Array
CLASS_PROTOTYPE: std:array/CArray
CLASS_PROTOTYPE: (lib)/array/CArray
CLASS_PROTOTYPE: CArray
CLASS_PROTOTYPE: std:error/Error
CLASS_PROTOTYPE: (lib)/error/Error
CLASS_PROTOTYPE: Error
CLASS_PROTOTYPE: std:error/RangeError
CLASS_PROTOTYPE: (lib)/error/RangeError
CLASS_PROTOTYPE: RangeError
CLASS_PROTOTYPE: std:map/Map
CLASS_PROTOTYPE: (lib)/map/Map
CLASS_PROTOTYPE: Map
FUNCTION_PROTOTYPE: move_memory
FUNCTION_PROTOTYPE: std:memory/move_memory
FUNCTION_PROTOTYPE: (lib)/memory/move_memory
FUNCTION_PROTOTYPE: set_memory
FUNCTION_PROTOTYPE: std:memory/set_memory
FUNCTION_PROTOTYPE: (lib)/memory/set_memory
FUNCTION_PROTOTYPE: compare_memory
FUNCTION_PROTOTYPE: std:memory/compare_memory
CLASS_PROTOTYPE: std:regexp/RegExp
FUNCTION_PROTOTYPE: (lib)/memory/compare_memory
CLASS_PROTOTYPE: (lib)/regexp/RegExp
CLASS_PROTOTYPE: RegExp
CLASS_PROTOTYPE: std:set/Set
CLASS_PROTOTYPE: (lib)/set/Set
CLASS_PROTOTYPE: Set
CLASS_PROTOTYPE: std:string/String
CLASS_PROTOTYPE: (lib)/string/String
CLASS_PROTOTYPE: String
FUNCTION_PROTOTYPE: parseInt
FUNCTION_PROTOTYPE: std:string/parseInt
FUNCTION_PROTOTYPE: (lib)/string/parseInt
FUNCTION_PROTOTYPE: parseI32
FUNCTION_PROTOTYPE: std:string/parseI32
FUNCTION_PROTOTYPE: (lib)/string/parseI32
FUNCTION_PROTOTYPE: parseI64
FUNCTION_PROTOTYPE: std:string/parseI64
FUNCTION_PROTOTYPE: (lib)/string/parseI64
FUNCTION_PROTOTYPE: parseFloat
FUNCTION_PROTOTYPE: std:string/parseFloat
FUNCTION_PROTOTYPE: (lib)/string/parseFloat
;)

View File

@ -1,113 +1,148 @@
(module
(type $ii (func (param i32) (result i32)))
(type $v (func))
(global $std:memory/arena/HEAP_OFFSET (mut i32) (i32.const 0))
(global "$(lib)/allocator/arena/HEAP_OFFSET" (mut i32) (i32.const 0))
(global $std/new/aClass (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 4))
(memory $0 1)
(export "memory" (memory $0))
(start $start)
(func $std:memory/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32)
(func "$(lib)/allocator/arena/allocate_memory" (; 0 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
;;@ (lib)/allocator/arena.ts:14:2
(if
;;@ (lib)/allocator/arena.ts:14:6
(i32.eqz
;;@ (lib)/allocator/arena.ts:14:7
(get_local $0)
)
;;@ (lib)/allocator/arena.ts:14:20
(return
(i32.const 0)
)
)
;;@ (lib)/allocator/arena.ts:18:2
(if
;;@ (lib)/allocator/arena.ts:18:6
(i32.and
(if (result i32)
(i32.gt_u
(tee_local $0
(i32.gt_u
;;@ (lib)/allocator/arena.ts:16:2
(tee_local $2
;;@ (lib)/allocator/arena.ts:16:12
(i32.and
(i32.add
;;@ (lib)/allocator/arena.ts:16:13
(i32.add
(tee_local $2
(get_global $std:memory/arena/HEAP_OFFSET)
;;@ (lib)/allocator/arena.ts:15:2
(tee_local $3
;;@ (lib)/allocator/arena.ts:15:12
(get_global "$(lib)/allocator/arena/HEAP_OFFSET")
)
;;@ (lib)/allocator/arena.ts:16:19
(get_local $0)
)
;;@ (lib)/allocator/arena.ts:16:26
(i32.const 7)
)
(i32.const -8)
)
)
;;@ (lib)/allocator/arena.ts:17:2
(tee_local $1
;;@ (lib)/allocator/arena.ts:17:14
(i32.shl
(current_memory)
;;@ (lib)/allocator/arena.ts:17:41
(i32.const 16)
)
)
)
)
;;@ (lib)/allocator/arena.ts:18:21
(i32.lt_s
(grow_memory
;;@ (lib)/allocator/arena.ts:19:4
(select
(tee_local $3
(tee_local $0
;;@ (lib)/allocator/arena.ts:20:6
(i32.shr_u
(i32.sub
;;@ (lib)/allocator/arena.ts:20:7
(i32.and
;;@ (lib)/allocator/arena.ts:20:8
(i32.add
(get_local $0)
;;@ (lib)/allocator/arena.ts:20:9
(get_local $2)
;;@ (lib)/allocator/arena.ts:20:15
(i32.const 65535)
)
(i32.const -65536)
)
;;@ (lib)/allocator/arena.ts:20:36
(get_local $1)
)
;;@ (lib)/allocator/arena.ts:20:46
(i32.const 16)
)
)
(tee_local $1
;;@ (lib)/allocator/arena.ts:21:6
(i32.shr_u
(get_local $1)
;;@ (lib)/allocator/arena.ts:21:46
(i32.const 16)
)
)
(i32.gt_u
(get_local $3)
(get_local $1)
)
)
)
(i32.const 0)
)
(i32.gt_u
(get_local $0)
(get_local $1)
)
)
)
;;@ (lib)/allocator/arena.ts:23:6
(i32.const 0)
)
(get_local $0)
)
(i32.const 1)
)
;;@ (lib)/allocator/arena.ts:23:9
(unreachable)
)
(set_global $std:memory/arena/HEAP_OFFSET
(get_local $0)
)
;;@ (lib)/allocator/arena.ts:24:2
(set_global "$(lib)/allocator/arena/HEAP_OFFSET"
;;@ (lib)/allocator/arena.ts:24:16
(get_local $2)
)
;;@ (lib)/allocator/arena.ts:25:9
(get_local $3)
)
(func $start (; 1 ;) (type $v)
(local $0 i32)
(local $1 i32)
(set_global $std:memory/arena/HEAP_OFFSET
(set_global "$(lib)/allocator/arena/HEAP_OFFSET"
;;@ (lib)/allocator/arena.ts:11:25
(get_global $HEAP_BASE)
)
(set_global $std/new/aClass
;;@ std/new.ts:13:13
(block (result i32)
(i32.store
(tee_local $0
(call $std:memory/arena/allocate_memory
(call "$(lib)/allocator/arena/allocate_memory"
(i32.const 8)
)
)
;;@ std/new.ts:5:16
(i32.const 1)
)
(f32.store offset=4
(get_local $0)
;;@ std/new.ts:6:22
(f32.const 2)
)
(i32.store

Some files were not shown because too many files have changed in this diff Show More