diff --git a/README.md b/README.md index d6d5f6b3..2e78bac1 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ See [the AssemblyScript wiki](https://github.com/AssemblyScript/assemblyscript/w Building -------- -Building an UMD bundle to `dist/assemblyscript.js` (does not bundle [binaryen.js](https://github.com/AssemblyScript/binaryen.js) which remains an external dependency): +Building an UMD bundle to `dist/assemblyscript.js` ([binaryen.js](https://github.com/AssemblyScript/binaryen.js) remains an external dependency): ``` $> npm run build diff --git a/examples/i64-polyfill/package.json b/examples/i64-polyfill/package.json index d5064795..6764b48a 100644 --- a/examples/i64-polyfill/package.json +++ b/examples/i64-polyfill/package.json @@ -12,6 +12,9 @@ }, "main": "index.js", "types": "index.d.ts", + "engines": { + "node": ">=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", diff --git a/package.json b/package.json index 4fd3a28d..9de25cd5 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,9 @@ "bin": { "asc": "bin/asc" }, + "engines": { + "node" : ">=8" + }, "scripts": { "build": "webpack", "clean": "rm dist/assemblyscript.*", diff --git a/src/builtins.ts b/src/builtins.ts index 099f19e5..4227dd26 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -34,7 +34,7 @@ import { Local } from "./program"; -/** Initializes the specified program with built-in functions. */ +/** Initializes the specified program with built-in constants and functions. */ export function initialize(program: Program): void { // math @@ -162,7 +162,7 @@ function addFunction(program: Program, name: string, isGeneric: bool = false): F } /** Compiles a get of a built-in global. */ -export function compileGetGlobal(compiler: Compiler, global: Global): ExpressionRef { +export function compileGetConstant(compiler: Compiler, global: Global): ExpressionRef { switch (global.internalName) { case "NaN": diff --git a/src/compiler.ts b/src/compiler.ts index f9fce9b3..8cdf4db4 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -1,6 +1,6 @@ import { compileCall as compileBuiltinCall, - compileGetGlobal as compileBuiltinGetGlobal + compileGetConstant as compileBuiltinGetConstant } from "./builtins"; import { @@ -37,7 +37,8 @@ import { Local, Namespace, Parameter, - EnumValue + EnumValue, + Property } from "./program"; import { @@ -49,7 +50,8 @@ import { NodeKind, TypeNode, Source, - // statements + + Statement, BlockStatement, BreakStatement, ClassDeclaration, @@ -70,7 +72,6 @@ import { ModifierKind, NamespaceDeclaration, ReturnStatement, - Statement, SwitchCase, SwitchStatement, ThrowStatement, @@ -79,12 +80,12 @@ import { VariableDeclaration, VariableStatement, WhileStatement, - // expressions + + Expression, AssertionExpression, BinaryExpression, CallExpression, ElementAccessExpression, - Expression, FloatLiteralExpression, IdentifierExpression, IntegerLiteralExpression, @@ -97,7 +98,7 @@ import { StringLiteralExpression, UnaryPostfixExpression, UnaryPrefixExpression, - // utility + hasModifier } from "./ast"; @@ -340,7 +341,7 @@ export class Compiler extends DiagnosticEmitter { } compileGlobal(global: Global): bool { - if (global.isCompiled || (global.isBuiltIn && compileBuiltinGetGlobal(this, global))) + if (global.isCompiled || (global.isBuiltIn && compileBuiltinGetConstant(this, global))) return true; const declaration: VariableLikeDeclarationStatement | null = global.declaration; @@ -582,6 +583,21 @@ export class Compiler extends DiagnosticEmitter { return true; } + // compilePropertyUsingTypeArguments(prototype: PropertyPrototype, contextualTypeArguments: Map | null = null, alternativeReportNode: Node | null = null): Function | null { + // let getter: Function | null = null; + // let setter: Function | null = null; + // if (prototype.getterPrototype) { + // getter = prototype.getterPrototype.resolve([], contextualTypeArguments); // reports + // if (prototype.setterPrototype) + // setter = prototype.setterPrototype.resolve([], contextualTypeArguments); // reports + // } + + // } + + // compileProperty(instance: Property): bool { + + // } + // namespaces compileNamespaceDeclaration(declaration: NamespaceDeclaration): void { @@ -1625,37 +1641,83 @@ export class Compiler extends DiagnosticEmitter { compileAssignment(expression: Expression, valueExpression: Expression, contextualType: Type): ExpressionRef { let element: Element | null = null; switch (expression.kind) { + case NodeKind.IDENTIFIER: element = this.program.resolveIdentifier(expression, this.currentFunction); // reports break; + case NodeKind.PROPERTYACCESS: element = this.program.resolvePropertyAccess(expression, this.currentFunction); // reports break; + default: this.error(DiagnosticCode.Operation_not_supported, expression.range); } if (!element) return this.module.createUnreachable(); + let type: Type | null = null; switch (element.kind) { + case ElementKind.LOCAL: type = (element).type; break; + case ElementKind.GLOBAL: if (this.compileGlobal(element)) type = (element).type; break; + + case ElementKind.PROPERTY: + const setterPrototype: FunctionPrototype | null = (element).setterPrototype; + if (setterPrototype) { + const setterInstance: Function | null = setterPrototype.resolve(); // reports + if (setterInstance) { + if (contextualType == Type.void) { // just set if dropped anyway + return this.compileCall(setterInstance, [ valueExpression ], expression); + } else { // otherwise do a set followed by a get + const getterPrototype: FunctionPrototype | null = (element).getterPrototype; + if (getterPrototype) { + const getterInstance: Function | null = getterPrototype.resolve(); // reports + if (getterInstance) { + return this.module.createBlock(null, [ + this.compileCall(setterInstance, [ valueExpression ], expression), + this.compileCall(getterInstance, [], expression) + ], getterInstance.returnType.toNativeType()); + } + } else + this.error(DiagnosticCode.Property_0_does_not_exist_on_type_1, expression.range, (element).simpleName, (element).parent.internalName); + } + } + } else + this.error(DiagnosticCode.Property_0_does_not_exist_on_type_1, expression.range, (element).simpleName, (element).parent.internalName); + return this.module.createUnreachable(); + default: this.error(DiagnosticCode.Operation_not_supported, expression.range); } if (!type) return this.module.createUnreachable(); + this.currentType = type; return this.compileAssignmentWithValue(expression, this.compileExpression(valueExpression, type, ConversionKind.IMPLICIT), contextualType != Type.void); } compileAssignmentWithValue(expression: Expression, valueWithCorrectType: ExpressionRef, tee: bool = false): ExpressionRef { - const element: Element | null = this.program.resolveElement(expression, this.currentFunction); + let element: Element | null = null; + switch (expression.kind) { + + case NodeKind.IDENTIFIER: + element = this.program.resolveIdentifier(expression, this.currentFunction); + break; + + case NodeKind.PROPERTYACCESS: + element = this.program.resolvePropertyAccess(expression, this.currentFunction); + break; + + default: + this.error(DiagnosticCode.Operation_not_supported, expression.range); + } if (!element) return this.module.createUnreachable(); @@ -1693,7 +1755,21 @@ export class Compiler extends DiagnosticEmitter { } compileCallExpression(expression: CallExpression, contextualType: Type): ExpressionRef { - const element: Element | null = this.program.resolveElement(expression.expression, this.currentFunction); // reports + let element: Element | null = null; + switch (expression.expression.kind) { + // case NodeKind.SUPER: + + case NodeKind.IDENTIFIER: + element = this.program.resolveIdentifier(expression.expression, this.currentFunction); + break; + + case NodeKind.PROPERTYACCESS: + element = this.program.resolvePropertyAccess(expression.expression, this.currentFunction); + break; + + default: + throw new Error("not implemented"); + } if (!element) return this.module.createUnreachable(); @@ -1837,7 +1913,7 @@ export class Compiler extends DiagnosticEmitter { // global if (element.kind == ElementKind.GLOBAL) { if (element.isBuiltIn) - return compileBuiltinGetGlobal(this, element); + return compileBuiltinGetConstant(this, element); const global: Global = element; if (!this.compileGlobal(global)) // reports @@ -1984,16 +2060,17 @@ export class Compiler extends DiagnosticEmitter { if (target.members) { element = target.members.get(propertyName); if (!element) { - this.error(DiagnosticCode.Property_0_does_not_exist_on_type_1, propertyAccess.property.range, propertyName); + this.error(DiagnosticCode.Property_0_does_not_exist_on_type_1, propertyAccess.property.range, propertyName, target.internalName); return this.module.createUnreachable(); } // handle enum values right away if (element.kind == ElementKind.ENUMVALUE) { this.currentType = Type.i32; - return (element).hasConstantValue - ? this.module.createI32((element).constantValue) - : this.module.createGetGlobal((element).internalName, NativeType.I32); + if ((element).hasConstantValue) + return this.module.createI32((element).constantValue) + this.compileEnum((element).enum); + return this.module.createGetGlobal((element).internalName, NativeType.I32); } } else { this.error(DiagnosticCode.Property_0_does_not_exist_on_type_1, propertyAccess.property.range, propertyName, target.internalName); @@ -2013,21 +2090,26 @@ export class Compiler extends DiagnosticEmitter { return this.module.createUnreachable(); this.currentType = (element).type; if ((element).hasConstantValue) - return this.currentType== Type.f32 - ? this.module.createF32((element).constantFloatValue) - : this.currentType == Type.f64 - ? this.module.createF64((element).constantFloatValue) - : this.currentType.isLongInteger - ? this.module.createI64(((element).constantIntegerValue).lo, ((element).constantIntegerValue).hi) - : this.module.createI32(((element).constantIntegerValue).lo); + return this.currentType== Type.f32 ? this.module.createF32((element).constantFloatValue) + : this.currentType == Type.f64 ? this.module.createF64((element).constantFloatValue) + : this.currentType.isLongInteger + ? this.module.createI64(((element).constantIntegerValue).lo, ((element).constantIntegerValue).hi) + : this.module.createI32(((element).constantIntegerValue).lo); return this.module.createGetGlobal((element).internalName, this.currentType.toNativeType()); - case ElementKind.FUNCTION: // getter - if (!(element).prototype.isGetter) { - this.error(DiagnosticCode.Property_0_does_not_exist_on_type_1, propertyAccess.property.range, propertyName, element.internalName); + case ElementKind.PROPERTY: // getter + const getterPrototype: FunctionPrototype | null = (element).getterPrototype; + if (getterPrototype) { + const getterInstance: Function | null = getterPrototype.resolve([], this.currentFunction.contextualTypeArguments); + if (getterInstance) { + return this.compileCall(getterInstance, [], propertyAccess); + } else { + return this.module.createUnreachable(); + } + } else { + this.error(DiagnosticCode.Property_0_does_not_exist_on_type_1, propertyAccess.property.range, propertyName, target.internalName); return this.module.createUnreachable(); } - return this.compileCall(element, [], propertyAccess); } this.error(DiagnosticCode.Operation_not_supported, propertyAccess.range); throw new Error("not implemented"); diff --git a/src/diagnosticMessages.generated.ts b/src/diagnosticMessages.generated.ts index d0f5d1fa..fa8388bb 100644 --- a/src/diagnosticMessages.generated.ts +++ b/src/diagnosticMessages.generated.ts @@ -66,6 +66,7 @@ export enum DiagnosticCode { Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures = 2349, The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access = 2357, The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access = 2364, + _get_and_set_accessor_must_have_the_same_type = 2380, Constructor_implementation_is_missing = 2390, Function_implementation_is_missing_or_not_immediately_following_the_declaration = 2391, Duplicate_function_implementation = 2393, @@ -146,6 +147,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 2349: return "Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures."; case 2357: return "The operand of an increment or decrement operator must be a variable or a property access."; case 2364: return "The left-hand side of an assignment expression must be a variable or a property access."; + case 2380: return "'get' and 'set' accessor must have the same type."; case 2390: return "Constructor implementation is missing."; case 2391: return "Function implementation is missing or not immediately following the declaration."; case 2393: return "Duplicate function implementation."; diff --git a/src/diagnosticMessages.json b/src/diagnosticMessages.json index dd29b980..612ce7bd 100644 --- a/src/diagnosticMessages.json +++ b/src/diagnosticMessages.json @@ -66,6 +66,7 @@ "Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures.": 2349, "The operand of an increment or decrement operator must be a variable or a property access.": 2357, "The left-hand side of an assignment expression must be a variable or a property access.": 2364, + "'get' and 'set' accessor must have the same type.": 2380, "Constructor implementation is missing.": 2390, "Function implementation is missing or not immediately following the declaration.": 2391, "Duplicate function implementation.": 2393, diff --git a/src/parser.ts b/src/parser.ts index 0071c310..5b209a44 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -608,12 +608,8 @@ export class Parser extends DiagnosticEmitter { returnType = this.parseType(tn, isSetter); if (!returnType) return null; - } else { - if (isSetter) { - if (parameters.length) - returnType = parameters[0].type; - } else - this.error(DiagnosticCode.Type_expected, tn.range(tn.pos)); // recoverable + } else if (!isSetter) { + this.error(DiagnosticCode.Type_expected, tn.range(tn.pos)); // recoverable } const isDeclare: bool = hasModifier(ModifierKind.DECLARE, modifiers); let statements: Statement[] | null = null; @@ -765,13 +761,8 @@ export class Parser extends DiagnosticEmitter { returnType = this.parseType(tn, identifier.kind == NodeKind.CONSTRUCTOR || isSetter); if (!returnType) return null; - } else { - if (isSetter) { - if (parameters.length) - returnType = parameters[0].type; - } else if (identifier.kind != NodeKind.CONSTRUCTOR) - this.error(DiagnosticCode.Type_expected, tn.range()); // recoverable - } + } else if (!isSetter && identifier.kind != NodeKind.CONSTRUCTOR) + this.error(DiagnosticCode.Type_expected, tn.range()); // recoverable let statements: Statement[] | null = null; if (tn.skip(Token.OPENBRACE)) { if (parentIsDeclare) diff --git a/src/program.ts b/src/program.ts index 3f3ad61b..157319b6 100644 --- a/src/program.ts +++ b/src/program.ts @@ -7,7 +7,11 @@ import { } from "./compiler"; import { - PATH_DELIMITER + PATH_DELIMITER, + GETTER_PREFIX, + SETTER_PREFIX, + STATIC_DELIMITER, + INSTANCE_DELIMITER } from "./constants"; import { @@ -60,7 +64,8 @@ import { VariableDeclaration, VariableStatement, - hasModifier + hasModifier, + mangleInternalName } from "./ast"; import { @@ -88,7 +93,7 @@ export class Program extends DiagnosticEmitter { sources: Source[]; /** Diagnostic offset used where sequentially obtaining the next diagnostic. */ diagnosticsOffset: i32 = 0; - /** WASM target. */ + /** WebAssembly target. */ target: Target = Target.WASM32; // set on initialization /** Elements by internal name. */ elements: Map = new Map(); @@ -102,7 +107,7 @@ export class Program extends DiagnosticEmitter { /** Constructs a new program, optionally inheriting parser diagnostics. */ constructor(diagnostics: DiagnosticMessage[] | null = null) { super(diagnostics); - this.sources = new Array(); + this.sources = []; } /** Initializes the program and its elements prior to compilation. */ @@ -130,15 +135,15 @@ export class Program extends DiagnosticEmitter { initializeBuiltins(this); - const queuedExports: Map = new Map(); - const queuedImports: QueuedImport[] = new Array(); + const queuedExports = new Map(); + const queuedImports = new Array(); // build initial lookup maps of internal names to declarations - for (let i: i32 = 0, k: i32 = this.sources.length; i < k; ++i) { - const source: Source = this.sources[i]; - const statements: Statement[] = source.statements; - for (let j: i32 = 0, l: i32 = statements.length; j < l; ++j) { - const statement: Statement = statements[j]; + for (let i = 0, k = this.sources.length; i < k; ++i) { + const source = this.sources[i]; + const statements = source.statements; + for (let j = 0, l = statements.length; j < l; ++j) { + const statement = statements[j]; switch (statement.kind) { case NodeKind.CLASS: @@ -183,15 +188,15 @@ export class Program extends DiagnosticEmitter { let element: Element | null; // queued imports should be resolvable now through traversing exports and queued exports - for (let i: i32 = 0; i < queuedImports.length;) { - const queuedImport: QueuedImport = queuedImports[i]; + for (let j = 0; j < queuedImports.length;) { + const queuedImport = queuedImports[j]; element = this.tryResolveImport(queuedImport.referencedName, queuedExports); if (element) { this.elements.set(queuedImport.internalName, element); - queuedImports.splice(i, 1); + queuedImports.splice(j, 1); } else { this.error(DiagnosticCode.Module_0_has_no_exported_member_1, queuedImport.declaration.range, (queuedImport.declaration.parent).path.value, queuedImport.declaration.externalIdentifier.name); - ++i; + ++j; } } @@ -200,16 +205,16 @@ export class Program extends DiagnosticEmitter { let currentExport: QueuedExport | null = queuedExport; do { if (currentExport.isReExport) { - element = this.exports.get(currentExport.referencedName); + element = this.exports.get(currentExport.referencedName); if (element) { this.exports.set(exportName, element); break; } - currentExport = queuedExports.get(currentExport.referencedName); + currentExport = queuedExports.get(currentExport.referencedName); if (!currentExport) this.error(DiagnosticCode.Module_0_has_no_exported_member_1, queuedExport.member.externalIdentifier.range, ((queuedExport.member.parent).path).value, queuedExport.member.externalIdentifier.name); } else { - element = this.elements.get(currentExport.referencedName); + element = this.elements.get(currentExport.referencedName); if (element) this.exports.set(exportName, element); else @@ -224,29 +229,30 @@ export class Program extends DiagnosticEmitter { private tryResolveImport(referencedName: string, queuedExports: Map): Element | null { let element: Element | null; do { - element = this.exports.get(referencedName); + element = this.exports.get(referencedName); if (element) return element; - const queuedExport: QueuedExport | null = queuedExports.get(referencedName); + const queuedExport = queuedExports.get(referencedName); if (!queuedExport) return null; if (queuedExport.isReExport) { referencedName = queuedExport.referencedName; continue; } - return this.elements.get(queuedExport.referencedName); + return this.elements.get(queuedExport.referencedName); } while (true); } private initializeClass(declaration: ClassDeclaration, namespace: Element | null = null): void { - const internalName: string = declaration.internalName; + const internalName = declaration.internalName; if (this.elements.has(internalName)) { this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, internalName); return; } - const prototype: ClassPrototype = new ClassPrototype(this, declaration.name.name, internalName, declaration); + const prototype = new ClassPrototype(this, declaration.name.name, internalName, declaration); this.elements.set(internalName, prototype); + // add program-level alias if annotated as @global if (hasDecorator("global", declaration.decorators)) { if (this.elements.has(declaration.name.name)) this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, internalName); @@ -254,6 +260,7 @@ export class Program extends DiagnosticEmitter { this.elements.set(declaration.name.name, prototype); } + // add as namespace member if applicable if (namespace) { if (namespace.members) { if (namespace.members.has(declaration.name.name)) { @@ -263,6 +270,8 @@ export class Program extends DiagnosticEmitter { } else namespace.members = new Map(); namespace.members.set(declaration.name.name, prototype); + + // otherwise add to file-level exports if exported } else if (prototype.isExported) { if (this.exports.has(internalName)) { this.error(DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0, declaration.name.range, internalName); @@ -271,27 +280,28 @@ export class Program extends DiagnosticEmitter { this.exports.set(internalName, prototype); } - const memberDeclarations: DeclarationStatement[] = declaration.members; - for (let j: i32 = 0, l: i32 = memberDeclarations.length; j < l; ++j) { - switch (memberDeclarations[j].kind) { + // initialize members + const memberDeclarations = declaration.members; + for (let i = 0, k = memberDeclarations.length; i < k; ++i) { + switch (memberDeclarations[i].kind) { case NodeKind.FIELD: - this.initializeField(memberDeclarations[j], prototype); + this.initializeField(memberDeclarations[i], prototype); break; - case NodeKind.METHOD: - this.initializeMethod(memberDeclarations[j], prototype); + case NodeKind.METHOD: // also getter/setter + this.initializeMethod(memberDeclarations[i], prototype); break; default: - throw new Error("unexpected class member"); + throw new Error("class member expected"); } } } private initializeField(declaration: FieldDeclaration, classPrototype: ClassPrototype): void { - const name: string = declaration.name.name; - const internalName: string = declaration.internalName; + const name = declaration.name.name; + const internalName = declaration.internalName; // static fields become global variables if (hasModifier(ModifierKind.STATIC, declaration.modifiers)) { @@ -306,7 +316,7 @@ export class Program extends DiagnosticEmitter { } } else classPrototype.members = new Map(); - const staticField: Global = new Global(this, internalName, declaration, null); + const staticField = new Global(this, internalName, declaration, null); classPrototype.members.set(name, staticField); this.elements.set(internalName, staticField); @@ -325,11 +335,17 @@ export class Program extends DiagnosticEmitter { } private initializeMethod(declaration: MethodDeclaration, classPrototype: ClassPrototype): void { - let name: string = declaration.name.name; - const internalName: string = declaration.internalName; + let isGetter = false; + if ((isGetter = hasModifier(ModifierKind.GET, declaration.modifiers)) || hasModifier(ModifierKind.SET, declaration.modifiers)) { + this.initializeAccessor(declaration, classPrototype, isGetter); + return; + } + const name = declaration.name.name; + const internalName = declaration.internalName; // static methods become global functions if (hasModifier(ModifierKind.STATIC, declaration.modifiers)) { + if (this.elements.has(internalName)) { this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, declaration.internalName); return; @@ -359,13 +375,64 @@ export class Program extends DiagnosticEmitter { } } + private initializeAccessor(declaration: MethodDeclaration, classPrototype: ClassPrototype, isGetter: bool): void { + const propertyName = declaration.name.name; + const internalPropertyName = declaration.internalName; + + let propertyElement = this.elements.get(internalPropertyName); + if (propertyElement) { + if (propertyElement.kind != ElementKind.PROPERTY || (isGetter ? (propertyElement).getterPrototype : (propertyElement).setterPrototype)) { + this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, internalPropertyName); + return; + } + } else + propertyElement = new Property(this, propertyName, internalPropertyName, classPrototype); + + let name = (isGetter ? GETTER_PREFIX : SETTER_PREFIX) + propertyName; + + // static accessors become global functions + if (hasModifier(ModifierKind.STATIC, declaration.modifiers)) { + const internalStaticName = classPrototype.internalName + STATIC_DELIMITER + name; + if (this.elements.has(internalStaticName)) { + this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, internalStaticName); + return; + } + const staticPrototype = new FunctionPrototype(this, name, internalStaticName, declaration, null); + if (isGetter) + (propertyElement).getterPrototype = staticPrototype; + else + (propertyElement).setterPrototype = staticPrototype; + if (!classPrototype.members) + classPrototype.members = new Map(); + classPrototype.members.set(propertyName, propertyElement); // checked above + this.elements.set(internalPropertyName, propertyElement); + + // instance accessors are remembered until resolved + } else { + const internalInstanceName = classPrototype.internalName + INSTANCE_DELIMITER + name; + if (classPrototype.instanceMembers) { + if (classPrototype.instanceMembers.has(name)) { + this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, declaration.internalName); + return; + } + } else + classPrototype.instanceMembers = new Map(); + const instancePrototype = new FunctionPrototype(this, name, internalInstanceName, declaration, classPrototype); + if (isGetter) + (propertyElement).getterPrototype = instancePrototype; + else + (propertyElement).setterPrototype = instancePrototype; + classPrototype.instanceMembers.set(name, propertyElement); + } + } + private initializeEnum(declaration: EnumDeclaration, namespace: Element | null = null): void { - const internalName: string = declaration.internalName; + const internalName = declaration.internalName; if (this.elements.has(internalName)) { this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, internalName); return; } - const enm: Enum = new Enum(this, internalName, declaration); + const enm = new Enum(this, internalName, declaration); this.elements.set(internalName, enm); if (namespace) { @@ -385,14 +452,14 @@ export class Program extends DiagnosticEmitter { this.exports.set(internalName, enm); } - const values: EnumValueDeclaration[] = declaration.values; + const values = declaration.values; for (let i: i32 = 0, k: i32 = values.length; i < k; ++i) this.initializeEnumValue(values[i], enm); } private initializeEnumValue(declaration: EnumValueDeclaration, enm: Enum): void { - const name: string = declaration.name.name; - const internalName: string = declaration.internalName; + const name = declaration.name.name; + const internalName = declaration.internalName; if (enm.members) { if (enm.members.has(name)) { this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, internalName); @@ -400,13 +467,13 @@ export class Program extends DiagnosticEmitter { } } else enm.members = new Map(); - const value: EnumValue = new EnumValue(enm, this, internalName, declaration); + const value = new EnumValue(enm, this, internalName, declaration); enm.members.set(name, value); } private initializeExports(statement: ExportStatement, queuedExports: Map): void { - const members: ExportMember[] = statement.members; - for (let i: i32 = 0, k: i32 = members.length; i < k; ++i) + const members = statement.members; + for (let i = 0, k = members.length; i < k; ++i) this.initializeExport(members[i], statement.internalPath, queuedExports); } @@ -433,7 +500,7 @@ export class Program extends DiagnosticEmitter { this.error(DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0, member.externalIdentifier.range, externalName); return; } - const queuedExport: QueuedExport = new QueuedExport(); + const queuedExport = new QueuedExport(); queuedExport.isReExport = false; queuedExport.referencedName = referencedName; // -> internal name queuedExport.member = member; @@ -450,9 +517,9 @@ export class Program extends DiagnosticEmitter { } // walk already known queued exports - const seen: Set = new Set(); - while (queuedExports.has(referencedName)) { - const queuedExport: QueuedExport = queuedExports.get(referencedName); + const seen = new Set(); + let queuedExport: QueuedExport | null; + while (queuedExport = queuedExports.get(referencedName)) { if (queuedExport.isReExport) { if (this.exports.has(queuedExport.referencedName)) { this.exports.set(externalName, this.exports.get(referencedName)); @@ -476,7 +543,7 @@ export class Program extends DiagnosticEmitter { this.error(DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0, member.externalIdentifier.range, externalName); return; } - const queuedReExport: QueuedExport = new QueuedExport(); + const queuedReExport = new QueuedExport(); queuedReExport.isReExport = true; queuedReExport.referencedName = referencedName; // -> export name queuedReExport.member = member; @@ -485,12 +552,12 @@ export class Program extends DiagnosticEmitter { } private initializeFunction(declaration: FunctionDeclaration, namespace: Element | null = null): void { - const internalName: string = declaration.internalName; + const internalName = declaration.internalName; if (this.elements.has(internalName)) { this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, internalName); return; } - const prototype: FunctionPrototype = new FunctionPrototype(this, declaration.name.name, internalName, declaration, null); + const prototype = new FunctionPrototype(this, declaration.name.name, internalName, declaration, null); this.elements.set(internalName, prototype); if (hasDecorator("global", declaration.decorators)) { @@ -519,14 +586,12 @@ export class Program extends DiagnosticEmitter { } private initializeImports(statement: ImportStatement, queuedExports: Map, queuedImports: QueuedImport[]): void { - const declarations: ImportDeclaration[] | null = statement.declarations; + const declarations = statement.declarations; if (declarations) { - for (let i: i32 = 0, k: i32 = declarations.length; i < k; ++i) { - const declaration: ImportDeclaration = declarations[i]; - this.initializeImport(declaration, statement.internalPath, queuedExports, queuedImports); - } + for (let i = 0, k = declarations.length; i < k; ++i) + this.initializeImport(declarations[i], statement.internalPath, queuedExports, queuedImports); } else if (statement.namespaceName) { - const internalName: string = statement.range.source.internalPath + "/" + statement.namespaceName.name; + const internalName = statement.range.source.internalPath + "/" + statement.namespaceName.name; if (this.elements.has(internalName)) { this.error(DiagnosticCode.Duplicate_identifier_0, statement.namespaceName.range, internalName); return; @@ -537,13 +602,13 @@ export class Program extends DiagnosticEmitter { } private initializeImport(declaration: ImportDeclaration, internalPath: string, queuedExports: Map, queuedImports: QueuedImport[]): void { - const internalName: string = declaration.internalName; + const internalName = declaration.internalName; if (this.elements.has(internalName)) { this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, internalName); return; } - let referencedName: string = internalPath + PATH_DELIMITER + declaration.externalIdentifier.name; + let referencedName = internalPath + PATH_DELIMITER + declaration.externalIdentifier.name; // resolve right away if the export exists if (this.exports.has(referencedName)) { @@ -552,9 +617,9 @@ export class Program extends DiagnosticEmitter { } // walk already known queued exports - const seen: Set = new Set(); - while (queuedExports.has(referencedName)) { - const queuedExport: QueuedExport = queuedExports.get(referencedName); + const seen = new Set(); + let queuedExport: QueuedExport | null; + while (queuedExport = queuedExports.get(referencedName)) { if (queuedExport.isReExport) { if (this.exports.has(queuedExport.referencedName)) { this.elements.set(internalName, this.exports.get(referencedName)); @@ -574,7 +639,7 @@ export class Program extends DiagnosticEmitter { } // otherwise queue it - const queuedImport: QueuedImport = new QueuedImport(); + const queuedImport = new QueuedImport(); queuedImport.internalName = internalName; queuedImport.referencedName = referencedName; queuedImport.declaration = declaration; @@ -582,8 +647,8 @@ export class Program extends DiagnosticEmitter { } private initializeInterface(declaration: InterfaceDeclaration, namespace: Element | null = null): void { - const internalName: string = declaration.internalName; - const prototype: InterfacePrototype = new InterfacePrototype(this, declaration.name.name, internalName, declaration); + const internalName = declaration.internalName; + const prototype = new InterfacePrototype(this, declaration.name.name, internalName, declaration); if (this.elements.has(internalName)) { this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, internalName); @@ -608,8 +673,8 @@ export class Program extends DiagnosticEmitter { this.exports.set(internalName, prototype); } - const memberDeclarations: DeclarationStatement[] = declaration.members; - for (let i: i32 = 0, k: i32 = memberDeclarations.length; i < k; ++i) { + const memberDeclarations = declaration.members; + for (let i = 0, k = memberDeclarations.length; i < k; ++i) { switch (memberDeclarations[i].kind) { case NodeKind.FIELD: @@ -621,15 +686,15 @@ export class Program extends DiagnosticEmitter { break; default: - throw new Error("unexpected interface member"); + throw new Error("interface member expected"); } } } private initializeNamespace(declaration: NamespaceDeclaration, parentNamespace: Element | null = null): void { - const internalName: string = declaration.internalName; + const internalName = declaration.internalName; - let namespace: Element | null = this.elements.get(internalName); + let namespace = this.elements.get(internalName); if (!namespace) { namespace = new Namespace(this, internalName, declaration); this.elements.set(internalName, namespace); @@ -652,8 +717,8 @@ export class Program extends DiagnosticEmitter { this.exports.set(internalName, namespace); } - const members: Statement[] = declaration.members; - for (let i: i32 = 0, k: i32 = members.length; i < k; ++i) { + const members = declaration.members; + for (let i = 0, k = members.length; i < k; ++i) { switch (members[i].kind) { case NodeKind.CLASS: @@ -692,7 +757,7 @@ export class Program extends DiagnosticEmitter { private initializeType(declaration: TypeDeclaration, namespace: Element | null = null): void { // type aliases are program globals - const name: string = declaration.name.name; + const name = declaration.name.name; if (this.types.has(name) || this.typeAliases.has(name)) { this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, name); return; @@ -701,16 +766,16 @@ export class Program extends DiagnosticEmitter { } private initializeVariables(statement: VariableStatement, namespace: Element | null = null): void { - const declarations: VariableDeclaration[] = statement.declarations; - for (let i: i32 = 0, k: i32 = declarations.length; i < k; ++i) { - const declaration: VariableDeclaration = declarations[i]; - const internalName: string = declaration.internalName; + const declarations = statement.declarations; + for (let i = 0, k = declarations.length; i < k; ++i) { + const declaration = declarations[i]; + const internalName = declaration.internalName; if (this.elements.has(internalName)) { this.error(DiagnosticCode.Duplicate_identifier_0, declaration.name.range, internalName); continue; } - const global: Global = new Global(this, internalName, declaration, null); + const global = new Global(this, internalName, declaration, null); this.elements.set(internalName, global); if (hasDecorator("global", declaration.decorators)) { @@ -742,20 +807,20 @@ export class Program extends DiagnosticEmitter { resolveType(node: TypeNode, contextualTypeArguments: Map | null = null, reportNotFound: bool = true): Type | null { // resolve parameters - const k: i32 = node.typeArguments.length; - const paramTypes: Type[] = new Array(k); - for (let i: i32 = 0; i < k; ++i) { - const paramType: Type | null = this.resolveType(node.typeArguments[i], contextualTypeArguments, reportNotFound); + const k = node.typeArguments.length; + const paramTypes = new Array(k); + for (let i = 0; i < k; ++i) { + const paramType = this.resolveType(node.typeArguments[i], contextualTypeArguments, reportNotFound); if (!paramType) return null; - paramTypes[i] = paramType; + paramTypes[i] = paramType; } - let globalName: string = node.identifier.name; + let globalName = node.identifier.name; if (k) // can't be a placeholder if it has parameters globalName += typesToString(paramTypes); else if (contextualTypeArguments) { - const placeholderType: Type | null = contextualTypeArguments.get(globalName); + const placeholderType = contextualTypeArguments.get(globalName); if (placeholderType) return placeholderType; } @@ -763,15 +828,15 @@ export class Program extends DiagnosticEmitter { let type: Type | null; // check file-global type - if (type = this.types.get(node.range.source.internalPath + PATH_DELIMITER + globalName)) + if (type = this.types.get(node.range.source.internalPath + PATH_DELIMITER + globalName)) return type; // check program-global type - if (type = this.types.get(globalName)) + if (type = this.types.get(globalName)) return type; // check type alias - let alias: TypeNode | null = this.typeAliases.get(globalName); + let alias = this.typeAliases.get(globalName); if (alias && (type = this.resolveType(alias, null, reportNotFound))) return type; @@ -783,8 +848,8 @@ export class Program extends DiagnosticEmitter { /** Resolves an array of type parameters to concrete types. */ resolveTypeArguments(typeParameters: TypeParameter[], typeArgumentNodes: TypeNode[] | null, contextualTypeArguments: Map | null = null, alternativeReportNode: Node | null = null): Type[] | null { - const parameterCount: i32 = typeParameters.length; - const argumentCount: i32 = typeArgumentNodes ? typeArgumentNodes.length : 0; + const parameterCount = typeParameters.length; + const argumentCount = typeArgumentNodes ? typeArgumentNodes.length : 0; if (parameterCount != argumentCount) { if (argumentCount) this.error(DiagnosticCode.Expected_0_type_arguments_but_got_1, Range.join((typeArgumentNodes)[0].range, (typeArgumentNodes)[argumentCount - 1].range), parameterCount.toString(10), argumentCount.toString(10)); @@ -792,9 +857,9 @@ export class Program extends DiagnosticEmitter { this.error(DiagnosticCode.Expected_0_type_arguments_but_got_1, alternativeReportNode.range.atEnd, parameterCount.toString(10), "0"); return null; } - const typeArguments: Type[] = new Array(parameterCount); - for (let i: i32 = 0; i < parameterCount; ++i) { - const type: Type | null = this.resolveType((typeArgumentNodes)[i], contextualTypeArguments, true); // reports + const typeArguments = new Array(parameterCount); + for (let i = 0; i < parameterCount; ++i) { + const type = this.resolveType((typeArgumentNodes)[i], contextualTypeArguments, true); // reports if (!type) return null; // TODO: check extendsType @@ -805,8 +870,8 @@ export class Program extends DiagnosticEmitter { /** Resolves an identifier to the element is refers to. */ resolveIdentifier(identifier: IdentifierExpression, contextualFunction: Function): Element | null { - const name: string = identifier.name; - const local: Local | null = contextualFunction.locals.get(name); + const name = identifier.name; + const local = contextualFunction.locals.get(name); if (local) return local; let element: Element | null; @@ -820,7 +885,7 @@ export class Program extends DiagnosticEmitter { /** Resolves a property access the element it refers to. */ resolvePropertyAccess(propertyAccess: PropertyAccessExpression, contextualFunction: Function): Element | null { - const expression: Expression = propertyAccess.expression; + const expression = propertyAccess.expression; let target: Element | null = null; if (expression.kind == NodeKind.IDENTIFIER) { target = this.resolveIdentifier(expression, contextualFunction); @@ -830,9 +895,9 @@ export class Program extends DiagnosticEmitter { throw new Error("unexpected target kind"); if (!target) return null; - const propertyName: string = propertyAccess.property.name; + const propertyName = propertyAccess.property.name; if (target.members) { - const member: Element | null = target.members.get(propertyName); + const member = target.members.get(propertyName); if (member) return member; } @@ -869,11 +934,10 @@ export class Program extends DiagnosticEmitter { function hasDecorator(name: string, decorators: Decorator[] | null): bool { if (decorators) - for (let i: i32 = 0, k: i32 = decorators.length; i < k; ++i) { - const decorator: Decorator = decorators[i]; - const expression: Expression = decorator.name; - const args: Expression[] = decorator.arguments; - if (expression.kind == NodeKind.IDENTIFIER && args.length <= 1 && (expression).name == name) + for (let i = 0, k = decorators.length; i < k; ++i) { + const decorator = decorators[i]; + const expression = decorator.name; + if (expression.kind == NodeKind.IDENTIFIER && decorator.arguments.length <= 1 && (expression).name == name) return true; } return false; @@ -905,9 +969,7 @@ export enum ElementKind { FIELD_PROTOTYPE, /** A {@link Field}. */ FIELD, - /** A {@link PropertyPrototype}. */ - PROPERTY_PROTOTYPE, - /** A {@link Property}. */ + /** A {@link PropertyContainer}. */ PROPERTY, /** A {@link Namespace}. */ NAMESPACE @@ -1028,7 +1090,7 @@ export class Namespace extends Element { constructor(program: Program, internalName: string, declaration: NamespaceDeclaration | null = null) { super(program, internalName); if ((this.declaration = declaration) && this.declaration.modifiers) { - for (let i: i32 = 0, k: i32 = this.declaration.modifiers.length; i < k; ++i) { + for (let i = 0, k = this.declaration.modifiers.length; i < k; ++i) { switch (this.declaration.modifiers[i].modifierKind) { case ModifierKind.IMPORT: this.isImported = true; break; case ModifierKind.EXPORT: this.isExported = true; break; @@ -1052,7 +1114,7 @@ export class Enum extends Element { constructor(program: Program, internalName: string, declaration: EnumDeclaration | null = null) { super(program, internalName); if ((this.declaration = declaration) && this.declaration.modifiers) { - for (let i: i32 = 0, k = this.declaration.modifiers.length; i < k; ++i) { + for (let i = 0, k = this.declaration.modifiers.length; i < k; ++i) { switch (this.declaration.modifiers[i].modifierKind) { case ModifierKind.EXPORT: this.isExported = true; break; case ModifierKind.IMPORT: this.isImported = true; break; @@ -1102,7 +1164,7 @@ export class Global extends Element { super(program, internalName); if (this.declaration = declaration) { if (this.declaration.modifiers) { - for (let i: i32 = 0, k = this.declaration.modifiers.length; i < k; ++i) { + for (let i = 0, k = this.declaration.modifiers.length; i < k; ++i) { switch (this.declaration.modifiers[i].modifierKind) { case ModifierKind.IMPORT: this.isImported = true; break; case ModifierKind.EXPORT: this.isExported = true; break; @@ -1191,7 +1253,7 @@ export class FunctionPrototype extends Element { this.simpleName = simpleName; if (this.declaration = declaration) { if (this.declaration.modifiers) - for (let i: i32 = 0, k: i32 = this.declaration.modifiers.length; i < k; ++i) { + for (let i = 0, k = this.declaration.modifiers.length; i < k; ++i) { switch (this.declaration.modifiers[i].modifierKind) { case ModifierKind.IMPORT: this.isImported = true; break; case ModifierKind.EXPORT: this.isExported = true; break; @@ -1222,18 +1284,21 @@ export class FunctionPrototype extends Element { get isSetter(): bool { return (this.flags & ElementFlags.SETTER) != 0; } set isSetter(is: bool) { if (is) this.flags |= ElementFlags.SETTER; else this.flags &= ~ElementFlags.SETTER; } - resolve(typeArguments: Type[], contextualTypeArguments: Map | null): Function | null { - const instanceKey: string = typesToString(typeArguments, "", ""); - let instance: Function | null = this.instances.get(instanceKey); + // Whether a getter/setter function or not. + get isAccessor(): bool { return (this.flags & (ElementFlags.GETTER | ElementFlags.SETTER)) != 0; } + + resolve(typeArguments: Type[] | null = null, contextualTypeArguments: Map | null = null): Function | null { + const instanceKey = typeArguments ? typesToString(typeArguments, "", "") : ""; + let instance = this.instances.get(instanceKey); if (instance) return instance; - const declaration: FunctionDeclaration | null = this.declaration; + const declaration = this.declaration; if (!declaration) - throw new Error("unexpected instantiation of internal function"); + throw new Error("declaration expected"); // cannot resolve built-ins // override call specific contextual type arguments - let i: i32, k: i32 = typeArguments.length; - if (k) { + let i: i32, k: i32; + if (typeArguments && (k = typeArguments.length)) { const inheritedTypeArguments: Map | null = contextualTypeArguments; contextualTypeArguments = new Map(); if (inheritedTypeArguments) @@ -1245,15 +1310,15 @@ export class FunctionPrototype extends Element { // resolve parameters k = declaration.parameters.length; - const parameters: Parameter[] = new Array(k); - const parameterTypes: Type[] = new Array(k); - let typeNode: TypeNode | null ; + const parameters = new Array(k); + const parameterTypes = new Array(k); + let typeNode: TypeNode | null; for (i = 0; i < k; ++i) { if (typeNode = declaration.parameters[i].type) { - const type: Type | null = this.program.resolveType(typeNode, contextualTypeArguments, true); // reports + const type = this.program.resolveType(typeNode, contextualTypeArguments, true); // reports if (type) { parameters[i] = new Parameter(declaration.parameters[i].name.name, type); - parameterTypes[i] = type; + parameterTypes[i] = type; } else return null; } else @@ -1262,16 +1327,20 @@ export class FunctionPrototype extends Element { // resolve return type let returnType: Type; - if (typeNode = declaration.returnType) { - const type: Type | null = this.program.resolveType(typeNode, contextualTypeArguments, true); // reports - if (type) - returnType = type; - else + if (this.isSetter) { + returnType = Type.void; // not annotated + } else { + if (typeNode = declaration.returnType) { + const type = this.program.resolveType(typeNode, contextualTypeArguments, true); // reports + if (type) + returnType = type; + else + return null; + } else return null; - } else - return null; + } - let internalName: string = this.internalName; + let internalName = this.internalName; if (instanceKey.length) internalName += "<" + instanceKey + ">"; instance = new Function(this, internalName, typeArguments, parameters, returnType, null); // TODO: class @@ -1284,7 +1353,7 @@ export class FunctionPrototype extends Element { if (this.isGeneric) { assert(typeArgumentNodes != null && typeArgumentNodes.length != 0); if (!this.declaration) - throw new Error("missing declaration"); + throw new Error("declaration expected"); resolvedTypeArguments = this.program.resolveTypeArguments(this.declaration.typeParameters, typeArgumentNodes, contextualTypeArguments, alternativeReportNode); if (!resolvedTypeArguments) return null; @@ -1306,7 +1375,7 @@ export class Function extends Element { /** Prototype reference. */ prototype: FunctionPrototype; /** Concrete type arguments. */ - typeArguments: Type[]; + typeArguments: Type[] | null; /** Concrete function parameters. Excluding `this` if an instance method. */ parameters: Parameter[]; /** Concrete return type. */ @@ -1326,7 +1395,7 @@ export class Function extends Element { private breakStack: i32[] | null = null; /** Constructs a new concrete function. */ - constructor(prototype: FunctionPrototype, internalName: string, typeArguments: Type[], parameters: Parameter[], returnType: Type, instanceMethodOf: Class | null) { + constructor(prototype: FunctionPrototype, internalName: string, typeArguments: Type[] | null, parameters: Parameter[], returnType: Type, instanceMethodOf: Class | null) { super(prototype.program, internalName); this.prototype = prototype; this.typeArguments = typeArguments; @@ -1334,7 +1403,7 @@ export class Function extends Element { this.returnType = returnType; this.instanceMethodOf = instanceMethodOf; this.flags = prototype.flags; - let localIndex: i32 = 0; + let localIndex = 0; if (instanceMethodOf) { assert(this.isInstance); this.locals.set("this", new Local(prototype.program, "this", localIndex++, instanceMethodOf.type)); @@ -1345,8 +1414,8 @@ export class Function extends Element { } } else assert(!this.isInstance); - for (let i: i32 = 0, k: i32 = parameters.length; i < k; ++i) { - const parameter: Parameter = parameters[i]; + for (let i = 0, k = parameters.length; i < k; ++i) { + const parameter = parameters[i]; this.locals.set(parameter.name, new Local(prototype.program, parameter.name, localIndex++, parameter.type)); } } @@ -1356,11 +1425,11 @@ export class Function extends Element { // if it has a name, check previously as this method will throw otherwise let localIndex = this.parameters.length + this.additionalLocals.length; if (this.isInstance) localIndex++; // plus 'this' - const local: Local = new Local(this.prototype.program, name ? name : "anonymous$" + localIndex.toString(10), localIndex, type); + const local = new Local(this.prototype.program, name ? name : "anonymous$" + localIndex.toString(10), localIndex, type); if (name) { - if (this.locals.has(name)) + if (this.locals.has(name)) throw new Error("unexpected duplicate local name"); - this.locals.set(name, local); + this.locals.set(name, local); } this.additionalLocals.push(type); return local; @@ -1418,7 +1487,7 @@ export class Function extends Element { /** Enters a(nother) break context. */ enterBreakContext(): string { - const id: i32 = this.nextBreakId++; + const id = this.nextBreakId++; if (!this.breakStack) this.breakStack = [ id ]; else @@ -1429,7 +1498,7 @@ export class Function extends Element { /** Leaves the current break context. */ leaveBreakContext(): void { assert(this.breakStack != null); - const length: i32 = (this.breakStack).length; + const length = (this.breakStack).length; assert(length > 0); (this.breakStack).pop(); if (length > 1) { @@ -1470,7 +1539,7 @@ export class FieldPrototype extends Element { super(classPrototype.program, internalName); this.classPrototype = classPrototype; if ((this.declaration = declaration) && this.declaration.modifiers) { - for (let i: i32 = 0, k = this.declaration.modifiers.length; i < k; ++i) { + for (let i = 0, k = this.declaration.modifiers.length; i < k; ++i) { switch (this.declaration.modifiers[i].modifierKind) { case ModifierKind.EXPORT: this.isExported = true; break; case ModifierKind.READONLY: this.isReadonly = true; break; @@ -1511,73 +1580,25 @@ export class Field extends Element { } } -/** A yet unresolved property. */ -export class PropertyPrototype extends Element { - - kind = ElementKind.PROPERTY_PROTOTYPE; - - /** Simple name. */ - simpleName: string; - /** Parent class prototype. */ - classPrototype: ClassPrototype; - /** Getter declaration reference. */ - getterDeclaration: FunctionDeclaration | null; - /** Setter declaration reference. */ - setterDeclaration: FunctionDeclaration | null; - - /** Constructs a new propery prototype. */ - constructor(classPrototype: ClassPrototype, simpleName: string, internalName: string, getterDeclaration: FunctionDeclaration | null = null, setterDeclaration: FunctionDeclaration | null = null) { - super(classPrototype.program, internalName); - this.simpleName = simpleName; - this.classPrototype = classPrototype; - - let i: i32, k: i32; - if ((this.getterDeclaration = getterDeclaration) && this.getterDeclaration.modifiers) { - assert(this.getterDeclaration.typeParameters.length == 0); - assert(this.getterDeclaration.parameters.length == 0); - for (i = 0, k = this.getterDeclaration.modifiers.length; i < k; ++i) { - switch (this.getterDeclaration.modifiers[i].modifierKind) { - case ModifierKind.EXPORT: this.isExported = true; break; - case ModifierKind.GET: - case ModifierKind.STATIC: break; // already handled - default: assert(false); - } - } - } - if ((this.setterDeclaration = setterDeclaration) && this.setterDeclaration.modifiers) { - assert(this.setterDeclaration.typeParameters.length == 0); - assert(this.setterDeclaration.parameters.length == 1); - for (i = 0, k = this.setterDeclaration.modifiers.length; i < k; ++i) { - switch (this.setterDeclaration.modifiers[i].modifierKind) { - case ModifierKind.EXPORT: this.isExported = true; break; - case ModifierKind.SET: - case ModifierKind.STATIC: break; // already handled - default: assert(false); - } - } - } - } -} - -/** A resolved property. */ +/** A property comprised of a getter and a setter function. */ export class Property extends Element { kind = ElementKind.PROPERTY; - /** Prototype reference. */ - prototype: PropertyPrototype; - /** Property type. */ - type: Type; - /** Getter function. */ - getter: Function | null = null; - /** Setter function. */ - setter: Function | null = null; + /** Simple name. */ + simpleName: string; + /** Parent class prototype. */ + parent: ClassPrototype; + /** Getter prototype. */ + getterPrototype: FunctionPrototype | null = null; + /** Setter prototype. */ + setterPrototype: FunctionPrototype | null = null; - /** Constructs a new property. */ - constructor(prototype: PropertyPrototype, internalName: string, type: Type) { - super(prototype.program, internalName); - this.flags = prototype.flags; - this.type = type; + /** Constructs a new property prototype. */ + constructor(program: Program, simpleName: string, internalName: string, parent: ClassPrototype) { + super(program, internalName); + this.simpleName = simpleName; + this.parent = parent; } } @@ -1600,7 +1621,7 @@ export class ClassPrototype extends Element { this.simpleName = simpleName; if (this.declaration = declaration) { if (this.declaration.modifiers) { - for (let i: i32 = 0, k: i32 = this.declaration.modifiers.length; i < k; ++i) { + for (let i = 0, k = this.declaration.modifiers.length; i < k; ++i) { switch (this.declaration.modifiers[i].modifierKind) { case ModifierKind.IMPORT: this.isImported = true; break; case ModifierKind.EXPORT: this.isExported = true; break; @@ -1615,16 +1636,16 @@ export class ClassPrototype extends Element { } resolve(typeArguments: Type[], contextualTypeArguments: Map | null): Class { - const instanceKey: string = typesToString(typeArguments, "", ""); - let instance: Class | null = this.instances.get(instanceKey); + const instanceKey = typesToString(typeArguments, "", ""); + let instance = this.instances.get(instanceKey); if (instance) return instance; - const declaration: ClassDeclaration | null = this.declaration; + const declaration = this.declaration; if (!declaration) - throw new Error("unexpected instantiation of internal class"); + throw new Error("declaration expected"); // cannot resolve built-ins // override call specific contextual type arguments - let i: i32, k: i32 = typeArguments.length; + let i: i32, k = typeArguments.length; if (k) { const inheritedTypeArguments: Map | null = contextualTypeArguments; contextualTypeArguments = new Map(); @@ -1645,7 +1666,7 @@ export class ClassPrototype extends Element { } } - let internalName: string = this.internalName; + let internalName = this.internalName; if (instanceKey.length) internalName += "<" + instanceKey + ">"; instance = new Class(this, internalName, typeArguments, null); // TODO: base class @@ -1659,7 +1680,7 @@ export class ClassPrototype extends Element { if (this.isGeneric) { assert(typeArgumentNodes != null && typeArgumentNodes.length != 0); if (!this.declaration) - throw new Error("missing declaration"); // generic built-in + throw new Error("declaration expected"); // generic built-in resolvedTypeArguments = this.program.resolveTypeArguments(this.declaration.typeParameters, typeArgumentNodes, contextualTypeArguments, alternativeReportNode); if (!resolvedTypeArguments) return null; @@ -1711,10 +1732,11 @@ export class Class extends Element { const typeParameters: TypeParameter[] = declaration.typeParameters; if (typeParameters.length != typeArguments.length) throw new Error("unexpected type argument count mismatch"); - const k: i32 = typeArguments.length; + const k = typeArguments.length; if (k) { - if (!this.contextualTypeArguments) this.contextualTypeArguments = new Map(); - for (let i: i32 = 0; i < k; ++i) + if (!this.contextualTypeArguments) + this.contextualTypeArguments = new Map(); + for (let i = 0; i < k; ++i) this.contextualTypeArguments.set(typeParameters[i].identifier.name, typeArguments[i]); } } diff --git a/src/types.ts b/src/types.ts index 06d122b3..bda929da 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,7 @@ +import { + Target +} from "./compiler"; + import { Class, Function @@ -205,6 +209,18 @@ export class Type { static readonly void: Type = new Type(TypeKind.VOID, 0); } +// export class ClassType extends Type { +// constructor(cls: Class) { +// super(TypeKind.USIZE, clz.size); +// } +// } + +// export class FunctionType extends Type { +// constructor(fun: Function) { +// super(TypeKind.USIZE, fun.program.target == Target.WASM64 ? 8 : 4); +// } +// } + /** Converts an array of types to an array of native types. */ export function typesToNativeTypes(types: Type[]): NativeType[] { const k: i32 = types.length; diff --git a/tests/binaryen/get_global-missing.js b/tests/binaryen/get_global-missing.js new file mode 100644 index 00000000..b732e04d --- /dev/null +++ b/tests/binaryen/get_global-missing.js @@ -0,0 +1,16 @@ +var binaryen = require("binaryen"); + +var mod = new binaryen.Module(); +var funcType = mod.addFunctionType("v", binaryen.void, []); +var func = mod.addFunction("test", funcType, [], + mod.block("", [ + mod.drop( + mod.getGlobal("missing", binaryen.i32) + ) + ]) +); +mod.addExport("test", func); + +if (mod.validate()) + console.log("-> validates"); +mod.emitBinary(); // -> Assertion failed: mappedGlobals.count(name), at: binaryen/src/wasm/wasm-binary.cpp,355,getGlobalIndex at Error diff --git a/tests/compiler.js b/tests/compiler.js index 20927475..d8521c3a 100644 --- a/tests/compiler.js +++ b/tests/compiler.js @@ -10,6 +10,7 @@ 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; var isCreate = process.argv[2] === "--create"; var filter = process.argv.length > 2 && !isCreate ? "**/" + process.argv[2] + ".ts" : "**/*.ts"; @@ -45,7 +46,9 @@ glob.sync(filter, { cwd: __dirname + "/compiler" }).forEach(filename => { } var program = parser.finish(); var module = Compiler.compile(program); - var actual = module.toText() + "(;\n[program.elements]\n " + iterate(program.elements.keys()).join("\n ") + "\n[program.exports]\n " + iterate(program.exports.keys()).join("\n ") + "\n;)\n"; + var actual = module.toText() + "(;\n[program.elements]\n " + elements(program.elements) + + "\n[program.exports]\n " + elements(program.exports) + + "\n;)\n"; var actualOptimized = null; var actualInlined = null; @@ -54,9 +57,21 @@ glob.sync(filter, { cwd: __dirname + "/compiler" }).forEach(filename => { try { module.interpret(); console.log(chalk.default.green("interpret OK")); + try { + var wasmModule = new WebAssembly.Module(module.toBinary()); + var wasmInstance = new WebAssembly.Instance(wasmModule, { + env: { + external: function() {} + } + }); + console.log(chalk.default.green("instantiate OK")); + } catch (e) { + process.exitCode = 1; + console.log(chalk.default.red("instantiate ERROR: ") + e); + } } catch (e) { process.exitCode = 1; - console.log(chalk.default.red("interpret ERROR")); + console.log(chalk.default.red("interpret ERROR:") + e); } module.optimize(); actualOptimized = module.toText(); @@ -107,10 +122,10 @@ glob.sync(filter, { cwd: __dirname + "/compiler" }).forEach(filename => { console.log(); }); -function iterate(it) { - var current; +function elements(map) { var arr = []; - while ((current = it.next()) && !current.done) - arr.push(current.value); - return arr; + map.forEach((value, key) => { + arr.push(ElementKind[value.kind] + ": " + key); + }); + return arr.join("\n "); } diff --git a/tests/compiler/assert.wast b/tests/compiler/assert.wast index d84b8b6d..0d7ca8ee 100644 --- a/tests/compiler/assert.wast +++ b/tests/compiler/assert.wast @@ -15,50 +15,50 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE [program.exports] ;) diff --git a/tests/compiler/binary.wast b/tests/compiler/binary.wast index 6089b36c..33840cdc 100644 --- a/tests/compiler/binary.wast +++ b/tests/compiler/binary.wast @@ -818,55 +818,55 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - binary/b - binary/i - binary/I - binary/f - binary/F + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + GLOBAL: binary/b + GLOBAL: binary/i + GLOBAL: binary/I + GLOBAL: binary/f + GLOBAL: binary/F [program.exports] ;) diff --git a/tests/compiler/builtins.wast b/tests/compiler/builtins.wast index 4a5662da..854d6257 100644 --- a/tests/compiler/builtins.wast +++ b/tests/compiler/builtins.wast @@ -1035,56 +1035,56 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - builtins/b - builtins/i - builtins/I - builtins/f - builtins/F - builtins/s + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + GLOBAL: builtins/b + GLOBAL: builtins/i + GLOBAL: builtins/I + GLOBAL: builtins/f + GLOBAL: builtins/F + GLOBAL: builtins/s [program.exports] ;) diff --git a/tests/compiler/class.wast b/tests/compiler/class.wast index f2e6d071..ec597c0f 100644 --- a/tests/compiler/class.wast +++ b/tests/compiler/class.wast @@ -43,54 +43,54 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - class/Animal - class/Animal.MAX - class/Animal.add - class/Animal.sub + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + CLASS_PROTOTYPE: class/Animal + GLOBAL: class/Animal.MAX + FUNCTION_PROTOTYPE: class/Animal.add + FUNCTION_PROTOTYPE: class/Animal.sub [program.exports] ;) diff --git a/tests/compiler/declare.wast b/tests/compiler/declare.wast index 6f16b73b..f9449155 100644 --- a/tests/compiler/declare.wast +++ b/tests/compiler/declare.wast @@ -8,51 +8,51 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - declare/external + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: declare/external [program.exports] - declare/external + FUNCTION_PROTOTYPE: declare/external ;) diff --git a/tests/compiler/do.wast b/tests/compiler/do.wast index 4647d394..864e2154 100644 --- a/tests/compiler/do.wast +++ b/tests/compiler/do.wast @@ -53,53 +53,53 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - do/loopDo - do/loopDoInDo + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: do/loopDo + FUNCTION_PROTOTYPE: do/loopDoInDo [program.exports] - do/loopDo - do/loopDoInDo + FUNCTION_PROTOTYPE: do/loopDo + FUNCTION_PROTOTYPE: do/loopDoInDo ;) diff --git a/tests/compiler/enum.wast b/tests/compiler/enum.wast index 37e4f386..2a301b82 100644 --- a/tests/compiler/enum.wast +++ b/tests/compiler/enum.wast @@ -38,58 +38,58 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - enum/Implicit - enum/Explicit - enum/Mixed - enum/getZero - enum/NonConstant + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + ENUM: enum/Implicit + ENUM: enum/Explicit + ENUM: enum/Mixed + FUNCTION_PROTOTYPE: enum/getZero + ENUM: enum/NonConstant [program.exports] - enum/Implicit - enum/Explicit - enum/Mixed - enum/NonConstant + ENUM: enum/Implicit + ENUM: enum/Explicit + ENUM: enum/Mixed + ENUM: enum/NonConstant ;) diff --git a/tests/compiler/export.wast b/tests/compiler/export.wast index 9f203840..db50f644 100644 --- a/tests/compiler/export.wast +++ b/tests/compiler/export.wast @@ -32,61 +32,61 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - export/add - export/sub - export/a - export/b - export/ns - export/ns.one - export/ns.two + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: export/add + FUNCTION_PROTOTYPE: export/sub + GLOBAL: export/a + GLOBAL: export/b + NAMESPACE: export/ns + FUNCTION_PROTOTYPE: export/ns.one + FUNCTION_PROTOTYPE: export/ns.two [program.exports] - export/add - export/renamed_sub - export/a - export/renamed_b - export/ns + FUNCTION_PROTOTYPE: export/add + FUNCTION_PROTOTYPE: export/renamed_sub + GLOBAL: export/a + GLOBAL: export/renamed_b + NAMESPACE: export/ns ;) diff --git a/tests/compiler/for.wast b/tests/compiler/for.wast index f4321ba8..53d87193 100644 --- a/tests/compiler/for.wast +++ b/tests/compiler/for.wast @@ -149,51 +149,51 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - for/i + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + GLOBAL: for/i [program.exports] ;) diff --git a/tests/compiler/game-of-life.wast b/tests/compiler/game-of-life.wast index 74624a88..ce2c7882 100644 --- a/tests/compiler/game-of-life.wast +++ b/tests/compiler/game-of-life.wast @@ -310,58 +310,58 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - ../../examples/game-of-life/assembly/game-of-life/w - ../../examples/game-of-life/assembly/game-of-life/h - ../../examples/game-of-life/assembly/game-of-life/s - ../../examples/game-of-life/assembly/game-of-life/init - ../../examples/game-of-life/assembly/game-of-life/step + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + GLOBAL: ../../examples/game-of-life/assembly/game-of-life/w + GLOBAL: ../../examples/game-of-life/assembly/game-of-life/h + GLOBAL: ../../examples/game-of-life/assembly/game-of-life/s + FUNCTION_PROTOTYPE: ../../examples/game-of-life/assembly/game-of-life/init + FUNCTION_PROTOTYPE: ../../examples/game-of-life/assembly/game-of-life/step [program.exports] - ../../examples/game-of-life/assembly/game-of-life/init - ../../examples/game-of-life/assembly/game-of-life/step - game-of-life/init - game-of-life/step + FUNCTION_PROTOTYPE: ../../examples/game-of-life/assembly/game-of-life/init + FUNCTION_PROTOTYPE: ../../examples/game-of-life/assembly/game-of-life/step + FUNCTION_PROTOTYPE: game-of-life/init + FUNCTION_PROTOTYPE: game-of-life/step ;) diff --git a/tests/compiler/getter-setter.optimized.wast b/tests/compiler/getter-setter.optimized.wast new file mode 100644 index 00000000..2a61f28a --- /dev/null +++ b/tests/compiler/getter-setter.optimized.wast @@ -0,0 +1,45 @@ +(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) + (set_global $getter-setter/Foo._bar + (get_local $0) + ) + ) + (func $start (; 2 ;) (type $v) + (if + (call $getter-setter/Foo.get_bar) + (unreachable) + ) + (call $getter-setter/Foo.set_bar + (i32.const 1) + ) + (if + (i32.ne + (call $getter-setter/Foo.get_bar) + (i32.const 1) + ) + (unreachable) + ) + (if + (block (result i32) + (call $getter-setter/Foo.set_bar + (i32.const 2) + ) + (i32.ne + (call $getter-setter/Foo.get_bar) + (i32.const 2) + ) + ) + (unreachable) + ) + ) +) diff --git a/tests/compiler/getter-setter.ts b/tests/compiler/getter-setter.ts new file mode 100644 index 00000000..e000f7fd --- /dev/null +++ b/tests/compiler/getter-setter.ts @@ -0,0 +1,16 @@ +class Foo { + static _bar: i32 = 0; + + static get bar(): i32 { + return Foo._bar; + } + + static set bar(bar: i32) { + Foo._bar = bar; + } +} + +assert(Foo.bar == 0); +Foo.bar = 1; +assert(Foo.bar == 1); +assert((Foo.bar = 2) == 2); diff --git a/tests/compiler/getter-setter.wast b/tests/compiler/getter-setter.wast new file mode 100644 index 00000000..4ba98cf5 --- /dev/null +++ b/tests/compiler/getter-setter.wast @@ -0,0 +1,109 @@ +(module + (type $i (func (result i32))) + (type $iv (func (param i32))) + (type $v (func)) + (global $getter-setter/Foo._bar (mut i32) (i32.const 0)) + (global $HEAP_BASE i32 (i32.const 4)) + (memory $0 1) + (export "memory" (memory $0)) + (start $start) + (func $getter-setter/Foo.get_bar (; 0 ;) (type $i) (result i32) + (return + (get_global $getter-setter/Foo._bar) + ) + ) + (func $getter-setter/Foo.set_bar (; 1 ;) (type $iv) (param $0 i32) + (set_global $getter-setter/Foo._bar + (get_local $0) + ) + ) + (func $start (; 2 ;) (type $v) + (if + (i32.eqz + (i32.eq + (call $getter-setter/Foo.get_bar) + (i32.const 0) + ) + ) + (unreachable) + ) + (call $getter-setter/Foo.set_bar + (i32.const 1) + ) + (if + (i32.eqz + (i32.eq + (call $getter-setter/Foo.get_bar) + (i32.const 1) + ) + ) + (unreachable) + ) + (if + (i32.eqz + (i32.eq + (block (result i32) + (call $getter-setter/Foo.set_bar + (i32.const 2) + ) + (call $getter-setter/Foo.get_bar) + ) + (i32.const 2) + ) + ) + (unreachable) + ) + ) +) +(; +[program.elements] + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + CLASS_PROTOTYPE: getter-setter/Foo + GLOBAL: getter-setter/Foo._bar + PROPERTY: getter-setter/Foo.bar +[program.exports] + +;) diff --git a/tests/compiler/i64-polyfill.wast b/tests/compiler/i64-polyfill.wast index 8b5ccfdf..48ced19a 100644 --- a/tests/compiler/i64-polyfill.wast +++ b/tests/compiler/i64-polyfill.wast @@ -1191,144 +1191,144 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - ../../examples/i64-polyfill/assembly/i64/lo - ../../examples/i64-polyfill/assembly/i64/hi - ../../examples/i64-polyfill/assembly/i64/getLo - ../../examples/i64-polyfill/assembly/i64/getHi - ../../examples/i64-polyfill/assembly/i64/clz_ - ../../examples/i64-polyfill/assembly/i64/ctz_ - ../../examples/i64-polyfill/assembly/i64/popcnt_ - ../../examples/i64-polyfill/assembly/i64/eqz - ../../examples/i64-polyfill/assembly/i64/add - ../../examples/i64-polyfill/assembly/i64/sub - ../../examples/i64-polyfill/assembly/i64/mul - ../../examples/i64-polyfill/assembly/i64/div_s - ../../examples/i64-polyfill/assembly/i64/div_u - ../../examples/i64-polyfill/assembly/i64/rem_s - ../../examples/i64-polyfill/assembly/i64/rem_u - ../../examples/i64-polyfill/assembly/i64/and - ../../examples/i64-polyfill/assembly/i64/or - ../../examples/i64-polyfill/assembly/i64/xor - ../../examples/i64-polyfill/assembly/i64/shl - ../../examples/i64-polyfill/assembly/i64/shr_s - ../../examples/i64-polyfill/assembly/i64/shr_u - ../../examples/i64-polyfill/assembly/i64/rotl_ - ../../examples/i64-polyfill/assembly/i64/rotr_ - ../../examples/i64-polyfill/assembly/i64/eq - ../../examples/i64-polyfill/assembly/i64/ne - ../../examples/i64-polyfill/assembly/i64/lt_s - ../../examples/i64-polyfill/assembly/i64/lt_u - ../../examples/i64-polyfill/assembly/i64/le_s - ../../examples/i64-polyfill/assembly/i64/le_u - ../../examples/i64-polyfill/assembly/i64/gt_s - ../../examples/i64-polyfill/assembly/i64/gt_u - ../../examples/i64-polyfill/assembly/i64/ge_s - ../../examples/i64-polyfill/assembly/i64/ge_u + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + GLOBAL: ../../examples/i64-polyfill/assembly/i64/lo + GLOBAL: ../../examples/i64-polyfill/assembly/i64/hi + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/getLo + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/getHi + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/clz_ + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/ctz_ + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/popcnt_ + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/eqz + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/add + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/sub + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/mul + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/div_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/div_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/rem_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/rem_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/and + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/or + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/xor + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/shl + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/shr_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/shr_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/rotl_ + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/rotr_ + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/eq + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/ne + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/lt_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/lt_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/le_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/le_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/gt_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/gt_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/ge_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/ge_u [program.exports] - ../../examples/i64-polyfill/assembly/i64/getLo - ../../examples/i64-polyfill/assembly/i64/getHi - ../../examples/i64-polyfill/assembly/i64/clz - ../../examples/i64-polyfill/assembly/i64/ctz - ../../examples/i64-polyfill/assembly/i64/popcnt - ../../examples/i64-polyfill/assembly/i64/eqz - ../../examples/i64-polyfill/assembly/i64/add - ../../examples/i64-polyfill/assembly/i64/sub - ../../examples/i64-polyfill/assembly/i64/mul - ../../examples/i64-polyfill/assembly/i64/div_s - ../../examples/i64-polyfill/assembly/i64/div_u - ../../examples/i64-polyfill/assembly/i64/rem_s - ../../examples/i64-polyfill/assembly/i64/rem_u - ../../examples/i64-polyfill/assembly/i64/and - ../../examples/i64-polyfill/assembly/i64/or - ../../examples/i64-polyfill/assembly/i64/xor - ../../examples/i64-polyfill/assembly/i64/shl - ../../examples/i64-polyfill/assembly/i64/shr_s - ../../examples/i64-polyfill/assembly/i64/shr_u - ../../examples/i64-polyfill/assembly/i64/rotl - ../../examples/i64-polyfill/assembly/i64/rotr - ../../examples/i64-polyfill/assembly/i64/eq - ../../examples/i64-polyfill/assembly/i64/ne - ../../examples/i64-polyfill/assembly/i64/lt_s - ../../examples/i64-polyfill/assembly/i64/lt_u - ../../examples/i64-polyfill/assembly/i64/le_s - ../../examples/i64-polyfill/assembly/i64/le_u - ../../examples/i64-polyfill/assembly/i64/gt_s - ../../examples/i64-polyfill/assembly/i64/gt_u - ../../examples/i64-polyfill/assembly/i64/ge_s - ../../examples/i64-polyfill/assembly/i64/ge_u - i64-polyfill/getHi - i64-polyfill/getLo - i64-polyfill/clz - i64-polyfill/ctz - i64-polyfill/popcnt - i64-polyfill/eqz - i64-polyfill/add - i64-polyfill/sub - i64-polyfill/mul - i64-polyfill/div_s - i64-polyfill/div_u - i64-polyfill/rem_s - i64-polyfill/rem_u - i64-polyfill/and - i64-polyfill/or - i64-polyfill/xor - i64-polyfill/shl - i64-polyfill/shr_s - i64-polyfill/shr_u - i64-polyfill/rotl - i64-polyfill/rotr - i64-polyfill/eq - i64-polyfill/ne - i64-polyfill/lt_s - i64-polyfill/lt_u - i64-polyfill/le_s - i64-polyfill/le_u - i64-polyfill/gt_s - i64-polyfill/gt_u - i64-polyfill/ge_s - i64-polyfill/ge_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/getLo + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/getHi + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/clz + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/ctz + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/popcnt + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/eqz + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/add + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/sub + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/mul + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/div_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/div_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/rem_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/rem_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/and + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/or + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/xor + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/shl + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/shr_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/shr_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/rotl + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/rotr + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/eq + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/ne + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/lt_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/lt_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/le_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/le_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/gt_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/gt_u + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/ge_s + FUNCTION_PROTOTYPE: ../../examples/i64-polyfill/assembly/i64/ge_u + FUNCTION_PROTOTYPE: i64-polyfill/getHi + FUNCTION_PROTOTYPE: i64-polyfill/getLo + FUNCTION_PROTOTYPE: i64-polyfill/clz + FUNCTION_PROTOTYPE: i64-polyfill/ctz + FUNCTION_PROTOTYPE: i64-polyfill/popcnt + FUNCTION_PROTOTYPE: i64-polyfill/eqz + FUNCTION_PROTOTYPE: i64-polyfill/add + FUNCTION_PROTOTYPE: i64-polyfill/sub + FUNCTION_PROTOTYPE: i64-polyfill/mul + FUNCTION_PROTOTYPE: i64-polyfill/div_s + FUNCTION_PROTOTYPE: i64-polyfill/div_u + FUNCTION_PROTOTYPE: i64-polyfill/rem_s + FUNCTION_PROTOTYPE: i64-polyfill/rem_u + FUNCTION_PROTOTYPE: i64-polyfill/and + FUNCTION_PROTOTYPE: i64-polyfill/or + FUNCTION_PROTOTYPE: i64-polyfill/xor + FUNCTION_PROTOTYPE: i64-polyfill/shl + FUNCTION_PROTOTYPE: i64-polyfill/shr_s + FUNCTION_PROTOTYPE: i64-polyfill/shr_u + FUNCTION_PROTOTYPE: i64-polyfill/rotl + FUNCTION_PROTOTYPE: i64-polyfill/rotr + FUNCTION_PROTOTYPE: i64-polyfill/eq + FUNCTION_PROTOTYPE: i64-polyfill/ne + FUNCTION_PROTOTYPE: i64-polyfill/lt_s + FUNCTION_PROTOTYPE: i64-polyfill/lt_u + FUNCTION_PROTOTYPE: i64-polyfill/le_s + FUNCTION_PROTOTYPE: i64-polyfill/le_u + FUNCTION_PROTOTYPE: i64-polyfill/gt_s + FUNCTION_PROTOTYPE: i64-polyfill/gt_u + FUNCTION_PROTOTYPE: i64-polyfill/ge_s + FUNCTION_PROTOTYPE: i64-polyfill/ge_u ;) diff --git a/tests/compiler/if.wast b/tests/compiler/if.wast index 4a1efe0a..4bc40888 100644 --- a/tests/compiler/if.wast +++ b/tests/compiler/if.wast @@ -48,55 +48,55 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - if/ifThenElse - if/ifThen - if/ifThenElseBlock + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: if/ifThenElse + FUNCTION_PROTOTYPE: if/ifThen + FUNCTION_PROTOTYPE: if/ifThenElseBlock [program.exports] - if/ifThenElse - if/ifThen - if/ifThenElseBlock + FUNCTION_PROTOTYPE: if/ifThenElse + FUNCTION_PROTOTYPE: if/ifThen + FUNCTION_PROTOTYPE: if/ifThenElseBlock ;) diff --git a/tests/compiler/import.wast b/tests/compiler/import.wast index 55342210..f7541ce6 100644 --- a/tests/compiler/import.wast +++ b/tests/compiler/import.wast @@ -43,66 +43,66 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - export/add - export/sub - export/a - export/b - export/ns - export/ns.one - export/ns.two - import/add - import/sub - import/a - import/b - import/renamed_ns + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: export/add + FUNCTION_PROTOTYPE: export/sub + GLOBAL: export/a + GLOBAL: export/b + NAMESPACE: export/ns + FUNCTION_PROTOTYPE: export/ns.one + FUNCTION_PROTOTYPE: export/ns.two + FUNCTION_PROTOTYPE: import/add + FUNCTION_PROTOTYPE: import/sub + GLOBAL: import/a + GLOBAL: import/b + NAMESPACE: import/renamed_ns [program.exports] - export/add - export/renamed_sub - export/a - export/renamed_b - export/ns + FUNCTION_PROTOTYPE: export/add + FUNCTION_PROTOTYPE: export/renamed_sub + GLOBAL: export/a + GLOBAL: export/renamed_b + NAMESPACE: export/ns ;) diff --git a/tests/compiler/infer-type.optimized-inlined.wast b/tests/compiler/infer-type.optimized-inlined.wast index 8d9af600..770db033 100644 --- a/tests/compiler/infer-type.optimized-inlined.wast +++ b/tests/compiler/infer-type.optimized-inlined.wast @@ -12,6 +12,8 @@ (export "memory" (memory $0)) (start $start) (func $start (; 0 ;) (type $v) + (local $0 i32) + (local $1 i32) (block (block $__inlined_func$infer-type/locals (nop) @@ -45,5 +47,28 @@ ) ) ) + (set_local $0 + (i32.const 0) + ) + (set_local $1 + (i32.const 10) + ) + (loop $continue|0 + (if + (i32.lt_u + (get_local $0) + (get_local $1) + ) + (block + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) ) ) diff --git a/tests/compiler/infer-type.optimized.wast b/tests/compiler/infer-type.optimized.wast index 8110dafa..4e4a48bd 100644 --- a/tests/compiler/infer-type.optimized.wast +++ b/tests/compiler/infer-type.optimized.wast @@ -27,6 +27,8 @@ (f64.const 0) ) (func $start (; 5 ;) (type $v) + (local $0 i32) + (local $1 i32) (call $infer-type/locals) (set_global $infer-type/ri (call $infer-type/reti) @@ -40,5 +42,28 @@ (set_global $infer-type/rF (call $infer-type/refF) ) + (set_local $0 + (i32.const 0) + ) + (set_local $1 + (i32.const 10) + ) + (loop $continue|0 + (if + (i32.lt_u + (get_local $0) + (get_local $1) + ) + (block + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) ) ) diff --git a/tests/compiler/infer-type.ts b/tests/compiler/infer-type.ts index fd086063..0333c576 100644 --- a/tests/compiler/infer-type.ts +++ b/tests/compiler/infer-type.ts @@ -40,3 +40,7 @@ function refF(): f64 { } let rF = refF(); rF; + +for (let a = 0, b = 10; a < b; ++a) { + ; +} diff --git a/tests/compiler/infer-type.wast b/tests/compiler/infer-type.wast index 4d0dda04..a137b856 100644 --- a/tests/compiler/infer-type.wast +++ b/tests/compiler/infer-type.wast @@ -74,6 +74,8 @@ ) ) (func $start (; 5 ;) (type $v) + (local $0 i32) + (local $1 i32) (drop (i32.const 10) ) @@ -108,66 +110,94 @@ (drop (get_global $infer-type/rF) ) + (block $break|0 + (block + (set_local $0 + (i32.const 0) + ) + (set_local $1 + (i32.const 10) + ) + ) + (loop $continue|0 + (if + (i32.lt_u + (get_local $0) + (get_local $1) + ) + (block + (nop) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ) ) ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - infer-type/i - infer-type/I - infer-type/F - infer-type/locals - infer-type/reti - infer-type/ri - infer-type/retI - infer-type/rI - infer-type/retf - infer-type/rf - infer-type/refF - infer-type/rF + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + GLOBAL: infer-type/i + GLOBAL: infer-type/I + GLOBAL: infer-type/F + FUNCTION_PROTOTYPE: infer-type/locals + FUNCTION_PROTOTYPE: infer-type/reti + GLOBAL: infer-type/ri + FUNCTION_PROTOTYPE: infer-type/retI + GLOBAL: infer-type/rI + FUNCTION_PROTOTYPE: infer-type/retf + GLOBAL: infer-type/rf + FUNCTION_PROTOTYPE: infer-type/refF + GLOBAL: infer-type/rF [program.exports] ;) diff --git a/tests/compiler/limits.wast b/tests/compiler/limits.wast index 6623c2ee..f41e914e 100644 --- a/tests/compiler/limits.wast +++ b/tests/compiler/limits.wast @@ -109,50 +109,50 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE [program.exports] ;) diff --git a/tests/compiler/literals.wast b/tests/compiler/literals.wast index 3317e936..91cdc14b 100644 --- a/tests/compiler/literals.wast +++ b/tests/compiler/literals.wast @@ -141,50 +141,50 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE [program.exports] ;) diff --git a/tests/compiler/logical.wast b/tests/compiler/logical.wast index 6b57728b..a1c34c85 100644 --- a/tests/compiler/logical.wast +++ b/tests/compiler/logical.wast @@ -257,54 +257,54 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - logical/i - logical/I - logical/f - logical/F + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + GLOBAL: logical/i + GLOBAL: logical/I + GLOBAL: logical/f + GLOBAL: logical/F [program.exports] ;) diff --git a/tests/compiler/memcpy.wast b/tests/compiler/memcpy.wast index 0093e7c2..d2520799 100644 --- a/tests/compiler/memcpy.wast +++ b/tests/compiler/memcpy.wast @@ -2055,53 +2055,53 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - memcpy/memcpy - memcpy/base - memcpy/dest + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: memcpy/memcpy + GLOBAL: memcpy/base + GLOBAL: memcpy/dest [program.exports] - memcpy/memcpy + FUNCTION_PROTOTYPE: memcpy/memcpy ;) diff --git a/tests/compiler/namespace.ts b/tests/compiler/namespace.ts index 0591f630..006e7ebd 100644 --- a/tests/compiler/namespace.ts +++ b/tests/compiler/namespace.ts @@ -2,7 +2,7 @@ namespace Outer { export namespace Inner { export let aVar: i32; export function aFunc(): void {} - export enum anEnum { ONE = 1 } + export enum anEnum { ONE = 1, TWO = 2 } } } diff --git a/tests/compiler/namespace.wast b/tests/compiler/namespace.wast index bf8989df..1130d637 100644 --- a/tests/compiler/namespace.wast +++ b/tests/compiler/namespace.wast @@ -1,6 +1,8 @@ (module (type $v (func)) (global $namespace/Outer.Inner.aVar (mut i32) (i32.const 0)) + (global $namespace/Outer.Inner.anEnum.ONE i32 (i32.const 1)) + (global $namespace/Outer.Inner.anEnum.TWO i32 (i32.const 2)) (global $HEAP_BASE i32 (i32.const 4)) (memory $0 1) (export "test" (func $namespace/test)) @@ -19,56 +21,56 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - namespace/Outer - namespace/Outer.Inner - namespace/Outer.Inner.aVar - namespace/Outer.Inner.aFunc - namespace/Outer.Inner.anEnum - namespace/test + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + NAMESPACE: namespace/Outer + NAMESPACE: namespace/Outer.Inner + GLOBAL: namespace/Outer.Inner.aVar + FUNCTION_PROTOTYPE: namespace/Outer.Inner.aFunc + ENUM: namespace/Outer.Inner.anEnum + FUNCTION_PROTOTYPE: namespace/test [program.exports] - namespace/test + FUNCTION_PROTOTYPE: namespace/test ;) diff --git a/tests/compiler/portable-conversions.wast b/tests/compiler/portable-conversions.wast index 8cb5f849..375c464b 100644 --- a/tests/compiler/portable-conversions.wast +++ b/tests/compiler/portable-conversions.wast @@ -331,54 +331,54 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - portable-conversions/i - portable-conversions/I - portable-conversions/f - portable-conversions/F + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + GLOBAL: portable-conversions/i + GLOBAL: portable-conversions/I + GLOBAL: portable-conversions/f + GLOBAL: portable-conversions/F [program.exports] ;) diff --git a/tests/compiler/recursive.wast b/tests/compiler/recursive.wast index ad137f13..08dfc6b0 100644 --- a/tests/compiler/recursive.wast +++ b/tests/compiler/recursive.wast @@ -34,51 +34,51 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - recursive/fib + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: recursive/fib [program.exports] - recursive/fib + FUNCTION_PROTOTYPE: recursive/fib ;) diff --git a/tests/compiler/reexport.wast b/tests/compiler/reexport.wast index 35dce4a8..b9740ca9 100644 --- a/tests/compiler/reexport.wast +++ b/tests/compiler/reexport.wast @@ -48,71 +48,71 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - export/add - export/sub - export/a - export/b - export/ns - export/ns.one - export/ns.two - reexport/imported_add - reexport/imported_sub - reexport/imported_ns + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: export/add + FUNCTION_PROTOTYPE: export/sub + GLOBAL: export/a + GLOBAL: export/b + NAMESPACE: export/ns + FUNCTION_PROTOTYPE: export/ns.one + FUNCTION_PROTOTYPE: export/ns.two + FUNCTION_PROTOTYPE: reexport/imported_add + FUNCTION_PROTOTYPE: reexport/imported_sub + NAMESPACE: reexport/imported_ns [program.exports] - export/add - export/renamed_sub - export/a - export/renamed_b - export/ns - reexport/add - reexport/renamed_sub - reexport/renamed_a - reexport/rerenamed_b - reexport/renamed_add - reexport/rerenamed_sub - reexport/renamed_ns + FUNCTION_PROTOTYPE: export/add + FUNCTION_PROTOTYPE: export/renamed_sub + GLOBAL: export/a + GLOBAL: export/renamed_b + NAMESPACE: export/ns + FUNCTION_PROTOTYPE: reexport/add + FUNCTION_PROTOTYPE: reexport/renamed_sub + GLOBAL: reexport/renamed_a + GLOBAL: reexport/rerenamed_b + FUNCTION_PROTOTYPE: reexport/renamed_add + FUNCTION_PROTOTYPE: reexport/rerenamed_sub + NAMESPACE: reexport/renamed_ns ;) diff --git a/tests/compiler/std/array.wast b/tests/compiler/std/array.wast index 800e7ccc..802551c7 100644 --- a/tests/compiler/std/array.wast +++ b/tests/compiler/std/array.wast @@ -5,84 +5,84 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - std:array/Array - Array - std:error/Error - Error - std:error/RangeError - RangeError - std:heap/ALIGN_LOG2 - std:heap/ALIGN_SIZE - std:heap/ALIGN_MASK - std:heap/HEAP_OFFSET - std:heap/Heap - Heap - std:heap/Heap.used - std:heap/Heap.free - std:heap/Heap.size - std:heap/Heap.allocate - std:heap/Heap.dispose - std:heap/Heap.copy - std:heap/Heap.fill - std:heap/Heap.compare - std:map/Map - Map - std:set/Set - Set - std:string/EMPTY - std:string/String - String - std:string/isWhiteSpaceOrLineTerminator + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + CLASS_PROTOTYPE: std:array/Array + CLASS_PROTOTYPE: Array + CLASS_PROTOTYPE: std:error/Error + CLASS_PROTOTYPE: Error + CLASS_PROTOTYPE: std:error/RangeError + CLASS_PROTOTYPE: RangeError + GLOBAL: std:heap/ALIGN_LOG2 + GLOBAL: std:heap/ALIGN_SIZE + GLOBAL: std:heap/ALIGN_MASK + GLOBAL: std:heap/HEAP_OFFSET + CLASS_PROTOTYPE: std:heap/Heap + CLASS_PROTOTYPE: Heap + PROPERTY: std:heap/Heap.used + PROPERTY: std:heap/Heap.free + PROPERTY: std:heap/Heap.size + FUNCTION_PROTOTYPE: std:heap/Heap.allocate + FUNCTION_PROTOTYPE: std:heap/Heap.dispose + FUNCTION_PROTOTYPE: std:heap/Heap.copy + FUNCTION_PROTOTYPE: std:heap/Heap.fill + FUNCTION_PROTOTYPE: std:heap/Heap.compare + CLASS_PROTOTYPE: std:map/Map + CLASS_PROTOTYPE: Map + CLASS_PROTOTYPE: std:set/Set + CLASS_PROTOTYPE: Set + GLOBAL: std:string/EMPTY + CLASS_PROTOTYPE: std:string/String + CLASS_PROTOTYPE: String + FUNCTION_PROTOTYPE: std:string/isWhiteSpaceOrLineTerminator [program.exports] - std:array/Array - std:error/Error - std:error/RangeError - std:heap/Heap - std:map/Map - std:set/Set - std:string/String + CLASS_PROTOTYPE: std:array/Array + CLASS_PROTOTYPE: std:error/Error + CLASS_PROTOTYPE: std:error/RangeError + CLASS_PROTOTYPE: std:heap/Heap + CLASS_PROTOTYPE: std:map/Map + CLASS_PROTOTYPE: std:set/Set + CLASS_PROTOTYPE: std:string/String ;) diff --git a/tests/compiler/std/heap.wast b/tests/compiler/std/heap.wast index 8f4069b2..ad635d15 100644 --- a/tests/compiler/std/heap.wast +++ b/tests/compiler/std/heap.wast @@ -2558,88 +2558,88 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - std:array/Array - Array - std:error/Error - Error - std:error/RangeError - RangeError - std:heap/ALIGN_LOG2 - std:heap/ALIGN_SIZE - std:heap/ALIGN_MASK - std:heap/HEAP_OFFSET - std:heap/Heap - Heap - std:heap/Heap.used - std:heap/Heap.free - std:heap/Heap.size - std:heap/Heap.allocate - std:heap/Heap.dispose - std:heap/Heap.copy - std:heap/Heap.fill - std:heap/Heap.compare - std:map/Map - Map - std:set/Set - Set - std:string/EMPTY - std:string/String - String - std:string/isWhiteSpaceOrLineTerminator - std/heap/size - std/heap/ptr1 - std/heap/ptr2 - std/heap/i + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + CLASS_PROTOTYPE: std:array/Array + CLASS_PROTOTYPE: Array + CLASS_PROTOTYPE: std:error/Error + CLASS_PROTOTYPE: Error + CLASS_PROTOTYPE: std:error/RangeError + CLASS_PROTOTYPE: RangeError + GLOBAL: std:heap/ALIGN_LOG2 + GLOBAL: std:heap/ALIGN_SIZE + GLOBAL: std:heap/ALIGN_MASK + GLOBAL: std:heap/HEAP_OFFSET + CLASS_PROTOTYPE: std:heap/Heap + CLASS_PROTOTYPE: Heap + PROPERTY: std:heap/Heap.used + PROPERTY: std:heap/Heap.free + PROPERTY: std:heap/Heap.size + FUNCTION_PROTOTYPE: std:heap/Heap.allocate + FUNCTION_PROTOTYPE: std:heap/Heap.dispose + FUNCTION_PROTOTYPE: std:heap/Heap.copy + FUNCTION_PROTOTYPE: std:heap/Heap.fill + FUNCTION_PROTOTYPE: std:heap/Heap.compare + CLASS_PROTOTYPE: std:map/Map + CLASS_PROTOTYPE: Map + CLASS_PROTOTYPE: std:set/Set + CLASS_PROTOTYPE: Set + GLOBAL: std:string/EMPTY + CLASS_PROTOTYPE: std:string/String + CLASS_PROTOTYPE: String + FUNCTION_PROTOTYPE: std:string/isWhiteSpaceOrLineTerminator + GLOBAL: std/heap/size + GLOBAL: std/heap/ptr1 + GLOBAL: std/heap/ptr2 + GLOBAL: std/heap/i [program.exports] - std:array/Array - std:error/Error - std:error/RangeError - std:heap/Heap - std:map/Map - std:set/Set - std:string/String + CLASS_PROTOTYPE: std:array/Array + CLASS_PROTOTYPE: std:error/Error + CLASS_PROTOTYPE: std:error/RangeError + CLASS_PROTOTYPE: std:heap/Heap + CLASS_PROTOTYPE: std:map/Map + CLASS_PROTOTYPE: std:set/Set + CLASS_PROTOTYPE: std:string/String ;) diff --git a/tests/compiler/switch.wast b/tests/compiler/switch.wast index b4b75914..908d4399 100644 --- a/tests/compiler/switch.wast +++ b/tests/compiler/switch.wast @@ -147,55 +147,55 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - switch/doSwitch - switch/doSwitchDefaultFirst - switch/doSwitchDefaultOmitted + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: switch/doSwitch + FUNCTION_PROTOTYPE: switch/doSwitchDefaultFirst + FUNCTION_PROTOTYPE: switch/doSwitchDefaultOmitted [program.exports] - switch/doSwitch - switch/doSwitchDefaultFirst - switch/doSwitchDefaultOmitted + FUNCTION_PROTOTYPE: switch/doSwitch + FUNCTION_PROTOTYPE: switch/doSwitchDefaultFirst + FUNCTION_PROTOTYPE: switch/doSwitchDefaultOmitted ;) diff --git a/tests/compiler/ternary.wast b/tests/compiler/ternary.wast index 2d016e23..bc8cd634 100644 --- a/tests/compiler/ternary.wast +++ b/tests/compiler/ternary.wast @@ -60,51 +60,51 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - ternary/a + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + GLOBAL: ternary/a [program.exports] ;) diff --git a/tests/compiler/tlsf.wast b/tests/compiler/tlsf.wast index 0c0f71df..ae3f0737 100644 --- a/tests/compiler/tlsf.wast +++ b/tests/compiler/tlsf.wast @@ -330,101 +330,101 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - tlsf/fls - tlsf/ffs - tlsf/ALIGN_SIZE_LOG2 - tlsf/ALIGN_SIZE - tlsf/SL_INDEX_COUNT_LOG2 - tlsf/FL_INDEX_MAX - tlsf/SL_INDEX_COUNT - tlsf/FL_INDEX_SHIFT - tlsf/FL_INDEX_COUNT - tlsf/SMALL_BLOCK_SIZE - tlsf/BLOCK$PREV_PHYS_BLOCK_OFFSET - tlsf/BLOCK$TAGGED_SIZE_OFFSET - tlsf/BLOCK$NEXT_FREE_OFFSET - tlsf/BLOCK$PREV_FREE_OFFSET - tlsf/BLOCK$SIZE - tlsf/BLOCK_HEADER_FREE_BIT - tlsf/BLOCK_HEADER_PREV_FREE_BIT - tlsf/BLOCK_OVERHEAD - tlsf/BLOCK_START_OFFSET - tlsf/BLOCK_SIZE_MIN - tlsf/BLOCK_SIZE_MAX - tlsf/block$get_prev_phys_block - tlsf/block$set_prev_phys_block - tlsf/block$get_tagged_size - tlsf/block$set_tagged_size - tlsf/block_size - tlsf/block_set_size - tlsf/block$get_next_free - tlsf/block$set_next_free - tlsf/block$get_prev_free - tlsf/block$set_prev_free - tlsf/block_is_last - tlsf/block_is_free - tlsf/block_set_free - tlsf/block_set_used - tlsf/block_is_prev_free - tlsf/block_set_prev_free - tlsf/block_set_prev_used - tlsf/block_from_ptr - tlsf/block_to_ptr - tlsf/CONTROL$FL_BITMAP_OFFSET - tlsf/CONTROL$SL_BITMAP_OFFSET - tlsf/CONTROL$BLOCKS_OFFSET - tlsf/CONTROL$SIZE - tlsf/control$get_fl_bitmap - tlsf/control$set_fl_bitmap - tlsf/control$get_sl_bitmap - tlsf/control$set_sl_bitmap - tlsf/control$get_block - tlsf/control$set_block - tlsf/control$construct + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: tlsf/fls + FUNCTION_PROTOTYPE: tlsf/ffs + GLOBAL: tlsf/ALIGN_SIZE_LOG2 + GLOBAL: tlsf/ALIGN_SIZE + GLOBAL: tlsf/SL_INDEX_COUNT_LOG2 + GLOBAL: tlsf/FL_INDEX_MAX + GLOBAL: tlsf/SL_INDEX_COUNT + GLOBAL: tlsf/FL_INDEX_SHIFT + GLOBAL: tlsf/FL_INDEX_COUNT + GLOBAL: tlsf/SMALL_BLOCK_SIZE + GLOBAL: tlsf/BLOCK$PREV_PHYS_BLOCK_OFFSET + GLOBAL: tlsf/BLOCK$TAGGED_SIZE_OFFSET + GLOBAL: tlsf/BLOCK$NEXT_FREE_OFFSET + GLOBAL: tlsf/BLOCK$PREV_FREE_OFFSET + GLOBAL: tlsf/BLOCK$SIZE + GLOBAL: tlsf/BLOCK_HEADER_FREE_BIT + GLOBAL: tlsf/BLOCK_HEADER_PREV_FREE_BIT + GLOBAL: tlsf/BLOCK_OVERHEAD + GLOBAL: tlsf/BLOCK_START_OFFSET + GLOBAL: tlsf/BLOCK_SIZE_MIN + GLOBAL: tlsf/BLOCK_SIZE_MAX + FUNCTION_PROTOTYPE: tlsf/block$get_prev_phys_block + FUNCTION_PROTOTYPE: tlsf/block$set_prev_phys_block + FUNCTION_PROTOTYPE: tlsf/block$get_tagged_size + FUNCTION_PROTOTYPE: tlsf/block$set_tagged_size + FUNCTION_PROTOTYPE: tlsf/block_size + FUNCTION_PROTOTYPE: tlsf/block_set_size + FUNCTION_PROTOTYPE: tlsf/block$get_next_free + FUNCTION_PROTOTYPE: tlsf/block$set_next_free + FUNCTION_PROTOTYPE: tlsf/block$get_prev_free + FUNCTION_PROTOTYPE: tlsf/block$set_prev_free + FUNCTION_PROTOTYPE: tlsf/block_is_last + FUNCTION_PROTOTYPE: tlsf/block_is_free + FUNCTION_PROTOTYPE: tlsf/block_set_free + FUNCTION_PROTOTYPE: tlsf/block_set_used + FUNCTION_PROTOTYPE: tlsf/block_is_prev_free + FUNCTION_PROTOTYPE: tlsf/block_set_prev_free + FUNCTION_PROTOTYPE: tlsf/block_set_prev_used + FUNCTION_PROTOTYPE: tlsf/block_from_ptr + FUNCTION_PROTOTYPE: tlsf/block_to_ptr + GLOBAL: tlsf/CONTROL$FL_BITMAP_OFFSET + GLOBAL: tlsf/CONTROL$SL_BITMAP_OFFSET + GLOBAL: tlsf/CONTROL$BLOCKS_OFFSET + GLOBAL: tlsf/CONTROL$SIZE + FUNCTION_PROTOTYPE: tlsf/control$get_fl_bitmap + FUNCTION_PROTOTYPE: tlsf/control$set_fl_bitmap + FUNCTION_PROTOTYPE: tlsf/control$get_sl_bitmap + FUNCTION_PROTOTYPE: tlsf/control$set_sl_bitmap + FUNCTION_PROTOTYPE: tlsf/control$get_block + FUNCTION_PROTOTYPE: tlsf/control$set_block + FUNCTION_PROTOTYPE: tlsf/control$construct [program.exports] - tlsf/control$construct + FUNCTION_PROTOTYPE: tlsf/control$construct ;) diff --git a/tests/compiler/typealias.wast b/tests/compiler/typealias.wast index 55e4cc9e..bdb4ec3c 100644 --- a/tests/compiler/typealias.wast +++ b/tests/compiler/typealias.wast @@ -17,51 +17,51 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - typealias/alias + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: typealias/alias [program.exports] - typealias/alias + FUNCTION_PROTOTYPE: typealias/alias ;) diff --git a/tests/compiler/unary.wast b/tests/compiler/unary.wast index 84b4af81..ffad74a2 100644 --- a/tests/compiler/unary.wast +++ b/tests/compiler/unary.wast @@ -623,54 +623,54 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - unary/i - unary/I - unary/f - unary/F + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + GLOBAL: unary/i + GLOBAL: unary/I + GLOBAL: unary/f + GLOBAL: unary/F [program.exports] ;) diff --git a/tests/compiler/while.wast b/tests/compiler/while.wast index 8ae47a8d..620299f0 100644 --- a/tests/compiler/while.wast +++ b/tests/compiler/while.wast @@ -62,53 +62,53 @@ ) (; [program.elements] - NaN - Infinity - isNaN - isFinite - clz - ctz - popcnt - rotl - rotr - abs - max - min - ceil - floor - copysign - nearest - reinterpret - sqrt - trunc - load - store - sizeof - select - unreachable - current_memory - grow_memory - parseInt - parseFloat - changetype - assert - i8 - i16 - i32 - i64 - u8 - u16 - u32 - u64 - bool - f32 - f64 - isize - usize - HEAP_BASE - while/loopWhile - while/loopWhileInWhile + GLOBAL: NaN + GLOBAL: Infinity + FUNCTION_PROTOTYPE: isNaN + FUNCTION_PROTOTYPE: isFinite + FUNCTION_PROTOTYPE: clz + FUNCTION_PROTOTYPE: ctz + FUNCTION_PROTOTYPE: popcnt + FUNCTION_PROTOTYPE: rotl + FUNCTION_PROTOTYPE: rotr + FUNCTION_PROTOTYPE: abs + FUNCTION_PROTOTYPE: max + FUNCTION_PROTOTYPE: min + FUNCTION_PROTOTYPE: ceil + FUNCTION_PROTOTYPE: floor + FUNCTION_PROTOTYPE: copysign + FUNCTION_PROTOTYPE: nearest + FUNCTION_PROTOTYPE: reinterpret + FUNCTION_PROTOTYPE: sqrt + FUNCTION_PROTOTYPE: trunc + FUNCTION_PROTOTYPE: load + FUNCTION_PROTOTYPE: store + FUNCTION_PROTOTYPE: sizeof + FUNCTION_PROTOTYPE: select + FUNCTION_PROTOTYPE: unreachable + FUNCTION_PROTOTYPE: current_memory + FUNCTION_PROTOTYPE: grow_memory + FUNCTION_PROTOTYPE: parseInt + FUNCTION_PROTOTYPE: parseFloat + FUNCTION_PROTOTYPE: changetype + FUNCTION_PROTOTYPE: assert + FUNCTION_PROTOTYPE: i8 + FUNCTION_PROTOTYPE: i16 + FUNCTION_PROTOTYPE: i32 + FUNCTION_PROTOTYPE: i64 + FUNCTION_PROTOTYPE: u8 + FUNCTION_PROTOTYPE: u16 + FUNCTION_PROTOTYPE: u32 + FUNCTION_PROTOTYPE: u64 + FUNCTION_PROTOTYPE: bool + FUNCTION_PROTOTYPE: f32 + FUNCTION_PROTOTYPE: f64 + FUNCTION_PROTOTYPE: isize + FUNCTION_PROTOTYPE: usize + GLOBAL: HEAP_BASE + FUNCTION_PROTOTYPE: while/loopWhile + FUNCTION_PROTOTYPE: while/loopWhileInWhile [program.exports] - while/loopWhile - while/loopWhileInWhile + FUNCTION_PROTOTYPE: while/loopWhile + FUNCTION_PROTOTYPE: while/loopWhileInWhile ;)