From 751b4554354ca95cb8c190b075f776488ffbc0c6 Mon Sep 17 00:00:00 2001 From: dcode Date: Tue, 15 Sep 2020 22:33:27 +0200 Subject: [PATCH 1/7] Update reference types support to latest Binaryen --- .github/workflows/test.yml | 4 +- cli/asc.json | 3 +- package-lock.json | 6 +- package.json | 2 +- src/builtins.ts | 51 +- src/common.ts | 7 + src/compiler.ts | 73 +- src/flow.ts | 14 + src/glue/binaryen.d.ts | 3 +- src/index.ts | 2 + src/module.ts | 11 +- src/program.ts | 18 +- src/resolver.ts | 2 +- src/types.ts | 59 +- std/assembly/index.d.ts | 12 +- std/assembly/reference.ts | 19 +- std/assembly/shared/feature.ts | 5 +- tests/compiler/abi.untouched.wat | 42 +- tests/compiler/asc-constants.ts | 1 + tests/compiler/asc-constants.untouched.wat | 7 +- tests/compiler/builtins.untouched.wat | 10 +- tests/compiler/features/reference-types.json | 4 +- .../features/reference-types.optimized.wat | 20 + tests/compiler/features/reference-types.ts | 64 +- .../features/reference-types.untouched.wat | 389 ++++++++ tests/compiler/features/simd.untouched.wat | 20 +- tests/compiler/many-locals.optimized.wat | 23 +- tests/compiler/many-locals.untouched.wat | 6 +- tests/compiler/overflow.untouched.wat | 90 +- .../portable-conversions.untouched.wat | 40 +- tests/compiler/retain-i32.optimized.wat | 228 ++++- tests/compiler/retain-i32.untouched.wat | 105 +-- tests/compiler/std/array.optimized.wat | 33 +- tests/compiler/std/array.untouched.wat | 25 +- tests/compiler/std/dataview.optimized.wat | 69 +- tests/compiler/std/dataview.untouched.wat | 85 +- tests/compiler/std/map.optimized.wat | 282 +++--- tests/compiler/std/map.untouched.wat | 180 +--- tests/compiler/std/math.optimized.wat | 8 +- tests/compiler/std/math.untouched.wat | 10 +- tests/compiler/std/polyfills.untouched.wat | 50 +- tests/compiler/std/set.optimized.wat | 178 ++-- tests/compiler/std/set.untouched.wat | 80 +- tests/compiler/std/typedarray.optimized.wat | 842 +++++++++++++----- tests/compiler/std/typedarray.untouched.wat | 262 ++---- tests/features.json | 9 +- 46 files changed, 1990 insertions(+), 1463 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60f636a26a..8e09a5a7b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -121,14 +121,14 @@ jobs: - uses: dcodeIO/setup-node-nvm@master with: node-mirror: https://nodejs.org/download/v8-canary/ - node-version: "15.0.0-v8-canary202007077c53168ead" + node-version: "node" - name: Install dependencies run: npm ci --no-audit - name: Clean distribution files run: npm run clean - name: Test experimental features env: - ASC_FEATURES: mutable-globals,threads,reference-types,bigint-integration + ASC_FEATURES: mutable-globals,threads,reference-types,bigint-integration,anyref run: | npm run test:compiler rt/flags features/js-bigint-integration features/reference-types features/threads test-runtimes: diff --git a/cli/asc.json b/cli/asc.json index b9de41a05a..28319cc3ca 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -187,11 +187,11 @@ "description": [ "Enables WebAssembly features being disabled by default.", "", - " sign-extension Sign-extension operations", " bulk-memory Bulk memory operations.", " simd SIMD types and operations.", " threads Threading and atomic operations.", " reference-types Reference types and operations.", + " anyref Anyref type (without GC).", "" ], "TODO_doesNothingYet": [ @@ -209,6 +209,7 @@ "Disables WebAssembly features being enabled by default.", "", " mutable-globals Mutable global imports and exports.", + " sign-extension Sign-extension operations", "" ], "type": "S", diff --git a/package-lock.json b/package-lock.json index 2ead3eb333..e8afafbe27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1163,9 +1163,9 @@ "optional": true }, "binaryen": { - "version": "96.0.0-nightly.20200911", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-96.0.0-nightly.20200911.tgz", - "integrity": "sha512-/mFIOMaaGsKcWZcwcrCGVVAtqI5le0rySoZSuS1a+3W878co883NLHOtbV2owDjAT7QELnsmjeKEAh+5VC+gbQ==" + "version": "96.0.0-nightly.20200915", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-96.0.0-nightly.20200915.tgz", + "integrity": "sha512-O5JxhwdxEJX7Jyx2HHzJe0ii9yDsLjoOHxakGUWn+r5cwAs8d44NjAdZQGAnEyW8+zUxRDmWX4Yk0CG2HL54Sg==" }, "bluebird": { "version": "3.7.2", diff --git a/package.json b/package.json index 8536556016..082caf87d4 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "url": "https://github.com/AssemblyScript/assemblyscript/issues" }, "dependencies": { - "binaryen": "96.0.0-nightly.20200911", + "binaryen": "96.0.0-nightly.20200915", "long": "^4.0.0", "source-map-support": "^0.5.19", "ts-node": "^6.2.0" diff --git a/src/builtins.ts b/src/builtins.ts index 8c2feadc5c..84dfb4fe08 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -968,39 +968,16 @@ function builtin_nameof(ctx: BuiltinContext): ExpressionRef { return module.unreachable(); } var value: string; - if (resultType.isReference) { + if (resultType.isInternalReference) { let classReference = resultType.getClass(); if (classReference) { value = classReference.name; } else { - let signatureReference = resultType.getSignature(); - if (signatureReference) { - value = "Function"; - } else { - assert(resultType.isExternalReference); - value = "Externref"; - } + assert(resultType.getSignature()); + value = "Function"; } } else { - switch (resultType.kind) { - case TypeKind.BOOL: { value = "bool"; break; } - case TypeKind.I8: { value = "i8"; break; } - case TypeKind.U8: { value = "u8"; break; } - case TypeKind.I16: { value = "i16"; break; } - case TypeKind.U16: { value = "u16"; break; } - case TypeKind.I32: { value = "i32"; break; } - case TypeKind.U32: { value = "u32"; break; } - case TypeKind.F32: { value = "f32"; break; } - case TypeKind.I64: { value = "i64"; break; } - case TypeKind.U64: { value = "u64"; break; } - case TypeKind.F64: { value = "f64"; break; } - case TypeKind.ISIZE: { value = "isize"; break; } - case TypeKind.USIZE: { value = "usize"; break; } - case TypeKind.V128: { value = "v128"; break; } - case TypeKind.EXTERNREF: { value = "externref"; break; } - default: assert(false); - case TypeKind.VOID: { value = "void"; break; } - } + value = resultType.toString(); } return compiler.ensureStaticString(value); } @@ -2775,6 +2752,11 @@ function builtin_assert(ctx: BuiltinContext): ExpressionRef { // TODO: also check for NaN in float assertions, as in `Boolean(NaN) -> false`? case TypeKind.F32: return module.if(module.binary(BinaryOp.EqF32, arg0, module.f32(0)), abort); case TypeKind.F64: return module.if(module.binary(BinaryOp.EqF64, arg0, module.f64(0)), abort); + case TypeKind.FUNCREF: + case TypeKind.EXTERNREF: + case TypeKind.EXNREF: + case TypeKind.ANYREF: return module.if(module.ref_is_null(arg0), abort); + } } else { compiler.currentType = type.nonNullableType; @@ -2852,6 +2834,21 @@ function builtin_assert(ctx: BuiltinContext): ExpressionRef { flow.freeTempLocal(temp); return ret; } + case TypeKind.FUNCREF: + case TypeKind.EXTERNREF: + case TypeKind.EXNREF: + case TypeKind.ANYREF: { + let temp = flow.getTempLocal(type); + let ret = module.if( + module.ref_is_null( + module.local_tee(temp.index, arg0) + ), + abort, + module.local_get(temp.index, NativeType.F64) + ); + flow.freeTempLocal(temp); + return ret; + } } } compiler.error( diff --git a/src/common.ts b/src/common.ts index 8f4373a4e0..a1ff133ba7 100644 --- a/src/common.ts +++ b/src/common.ts @@ -123,7 +123,10 @@ export namespace CommonNames { export const f32 = "f32"; export const f64 = "f64"; export const v128 = "v128"; + export const funcref = "funcref"; export const externref = "externref"; + export const exnref = "exnref"; + export const anyref = "anyref"; export const i8x16 = "i8x16"; export const u8x16 = "u8x16"; export const i16x8 = "i16x8"; @@ -170,6 +173,7 @@ export namespace CommonNames { export const ASC_FEATURE_TAIL_CALLS = "ASC_FEATURE_TAIL_CALLS"; export const ASC_FEATURE_REFERENCE_TYPES = "ASC_FEATURE_REFERENCE_TYPES"; export const ASC_FEATURE_MULTI_VALUE = "ASC_FEATURE_MULTI_VALUE"; + export const ASC_FEATURE_ANYREF = "ASC_FEATURE_ANYREF"; // classes export const I8 = "I8"; export const I16 = "I16"; @@ -185,7 +189,10 @@ export namespace CommonNames { export const F32 = "F32"; export const F64 = "F64"; export const V128 = "V128"; + export const Funcref = "Funcref"; export const Externref = "Externref"; + export const Exnref = "Exnref"; + export const Anyref = "Anyref"; export const String = "String"; export const Array = "Array"; export const StaticArray = "StaticArray"; diff --git a/src/compiler.ts b/src/compiler.ts index e63e08361c..9af329f55a 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -229,7 +229,7 @@ export class Options { /** Global aliases, mapping alias names as the key to internal names to be aliased as the value. */ globalAliases: Map | null = null; /** Features to activate by default. These are the finished proposals. */ - features: Feature = Feature.MUTABLE_GLOBALS; + features: Feature = Feature.MUTABLE_GLOBALS | Feature.SIGN_EXTENSION; /** If true, disallows unsafe features in user code. */ noUnsafe: bool = false; /** If true, enables pedantic diagnostics. */ @@ -405,6 +405,7 @@ export class Compiler extends DiagnosticEmitter { if (options.hasFeature(Feature.TAIL_CALLS)) featureFlags |= FeatureFlags.TailCall; if (options.hasFeature(Feature.REFERENCE_TYPES)) featureFlags |= FeatureFlags.ReferenceTypes; if (options.hasFeature(Feature.MULTI_VALUE)) featureFlags |= FeatureFlags.MultiValue; + if (options.hasFeature(Feature.ANYREF)) featureFlags |= FeatureFlags.Anyref; module.setFeatures(featureFlags); // set up the main start function @@ -4390,12 +4391,15 @@ export class Compiler extends DiagnosticEmitter { ); break; } - case TypeKind.EXTERNREF: { - // TODO: ref.eq + case TypeKind.FUNCREF: + case TypeKind.EXTERNREF: + case TypeKind.EXNREF: + case TypeKind.ANYREF: { this.error( - DiagnosticCode.Not_implemented_0, + DiagnosticCode.Operation_0_cannot_be_applied_to_type_1, expression.range, - "ref.eq instruction" + "ref.eq", + commonType.toString() ); expr = module.unreachable(); break; @@ -4491,12 +4495,15 @@ export class Compiler extends DiagnosticEmitter { ); break; } - case TypeKind.EXTERNREF: { - // TODO: !ref.eq + case TypeKind.FUNCREF: + case TypeKind.EXTERNREF: + case TypeKind.EXNREF: + case TypeKind.ANYREF: { this.error( - DiagnosticCode.Not_implemented_0, + DiagnosticCode.Operation_0_cannot_be_applied_to_type_1, expression.range, - "ref.eq instruction" + "ref.eq", + commonType.toString() ); expr = module.unreachable(); break; @@ -8311,13 +8318,7 @@ export class Compiler extends DiagnosticEmitter { this.currentType = signatureReference.type.asNullable(); return options.isWasm64 ? module.i64(0) : module.i32(0); } - // TODO: return null ref for externref or funcref - this.error( - DiagnosticCode.Not_implemented_0, - expression.range, - "ref.null" - ); - return module.unreachable(); + return this.makeZero(contextualType, expression); } this.currentType = options.usizeType; this.warning( @@ -8508,7 +8509,7 @@ export class Compiler extends DiagnosticEmitter { ); if (!functionInstance || !this.compileFunction(functionInstance)) return module.unreachable(); if (contextualType.isExternalReference) { - this.currentType = Type.externref; + this.currentType = Type.funcref; return module.ref_func(functionInstance.internalName); } let offset = this.ensureRuntimeFunction(functionInstance); @@ -10619,7 +10620,17 @@ export class Compiler extends DiagnosticEmitter { checkTypeSupported(type: Type, reportNode: Node): bool { switch (type.kind) { case TypeKind.V128: return this.checkFeatureEnabled(Feature.SIMD, reportNode); - case TypeKind.EXTERNREF: return this.checkFeatureEnabled(Feature.REFERENCE_TYPES, reportNode); + case TypeKind.FUNCREF: + case TypeKind.EXTERNREF: + return this.checkFeatureEnabled(Feature.REFERENCE_TYPES, reportNode); + case TypeKind.EXNREF: { + return this.checkFeatureEnabled(Feature.REFERENCE_TYPES, reportNode) + && this.checkFeatureEnabled(Feature.EXCEPTION_HANDLING, reportNode); + } + case TypeKind.ANYREF: { + return this.checkFeatureEnabled(Feature.REFERENCE_TYPES, reportNode) + && this.checkFeatureEnabled(Feature.ANYREF, reportNode); + } } let classReference = type.getClass(); if (classReference) { @@ -10712,14 +10723,11 @@ export class Compiler extends DiagnosticEmitter { case TypeKind.F32: return module.f32(0); case TypeKind.F64: return module.f64(0); case TypeKind.V128: return module.v128(v128_zero); + case TypeKind.FUNCREF: case TypeKind.EXTERNREF: - // TODO: return null ref for both externref as well as funcref - this.error( - DiagnosticCode.Not_implemented_0, - reportNode.range, - "ref.null" - ); - return module.unreachable(); + case TypeKind.EXNREF: + case TypeKind.ANYREF: + return module.ref_null(type.toNativeType()); } } @@ -10824,16 +10832,11 @@ export class Compiler extends DiagnosticEmitter { module.i64(0xFFFFFFFE, 0xFFDFFFFF) // (0x7FF0000000000000 - 1) << 1 ); } - case TypeKind.EXTERNREF: { - // TODO: non-null object might still be considered falseish - // i.e. a ref to Boolean(false), Number(0), String("") etc. - // TODO: return module.unary(UnaryOp.EqzI32, module.ref_is_null(expr)); - this.error( - DiagnosticCode.Not_implemented_0, - reportNode.range, - "ref.is_null" - ); - return module.unreachable(); + case TypeKind.FUNCREF: + case TypeKind.EXTERNREF: + case TypeKind.EXNREF: + case TypeKind.ANYREF:{ + return module.ref_is_null(expr); } default: { assert(false); diff --git a/src/flow.ts b/src/flow.ts index 94b21b82e6..f057c4426c 100644 --- a/src/flow.ts +++ b/src/flow.ts @@ -311,8 +311,10 @@ export class Flow { case NativeType.F32: { temps = parentFunction.tempF32s; break; } case NativeType.F64: { temps = parentFunction.tempF64s; break; } case NativeType.V128: { temps = parentFunction.tempV128s; break; } + case NativeType.Funcref: { temps = parentFunction.tempFuncrefs; break; } case NativeType.Externref: { temps = parentFunction.tempExternrefs; break; } case NativeType.Exnref: { temps = parentFunction.tempExnrefs; break; } + case NativeType.Anyref: { temps = parentFunction.tempAnyrefs; break; } default: throw new Error("concrete type expected"); } var local: Local; @@ -395,6 +397,12 @@ export class Flow { else parentFunction.tempV128s = temps = []; break; } + case NativeType.Funcref: { + let tempFuncrefs = parentFunction.tempFuncrefs; + if (tempFuncrefs) temps = tempFuncrefs; + else parentFunction.tempFuncrefs = temps = []; + break; + } case NativeType.Externref: { let tempExternrefs = parentFunction.tempExternrefs; if (tempExternrefs) temps = tempExternrefs; @@ -407,6 +415,12 @@ export class Flow { else parentFunction.tempExnrefs = temps = []; break; } + case NativeType.Anyref: { + let tempAnyrefs = parentFunction.tempAnyrefs; + if (tempAnyrefs) temps = tempAnyrefs; + else parentFunction.tempAnyrefs = temps = []; + break; + } default: throw new Error("concrete type expected"); } assert(local.index >= 0); diff --git a/src/glue/binaryen.d.ts b/src/glue/binaryen.d.ts index 9e703eb38a..26ba4a4f74 100644 --- a/src/glue/binaryen.d.ts +++ b/src/glue/binaryen.d.ts @@ -58,6 +58,7 @@ export declare function _BinaryenFeatureExceptionHandling(): BinaryenFeatureFlag export declare function _BinaryenFeatureTailCall(): BinaryenFeatureFlags; export declare function _BinaryenFeatureReferenceTypes(): BinaryenFeatureFlags; export declare function _BinaryenFeatureMultivalue(): BinaryenFeatureFlags; +export declare function _BinaryenFeatureAnyref(): BinaryenFeatureFlags; export declare function _BinaryenFeatureAll(): BinaryenFeatureFlags; type BinaryenExpressionId = i32; @@ -790,7 +791,7 @@ export declare function _BinaryenMemoryFillSetValue(expr: BinaryenExpressionRef, export declare function _BinaryenMemoryFillGetSize(expr: BinaryenExpressionRef): BinaryenExpressionRef; export declare function _BinaryenMemoryFillSetSize(expr: BinaryenExpressionRef, sizeExpr: BinaryenExpressionRef): void; -export declare function _BinaryenRefNull(module: BinaryenModuleRef): BinaryenExpressionRef; +export declare function _BinaryenRefNull(module: BinaryenModuleRef, type: BinaryenType): BinaryenExpressionRef; export declare function _BinaryenRefIsNull(module: BinaryenModuleRef, valueExpr: BinaryenExpressionRef): BinaryenExpressionRef; export declare function _BinaryenRefIsNullGetValue(expr: BinaryenExpressionRef): BinaryenExpressionRef; diff --git a/src/index.ts b/src/index.ts index 48cf27960f..1ed4df8a0b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -149,6 +149,8 @@ export const FEATURE_TAIL_CALLS = Feature.TAIL_CALLS; export const FEATURE_REFERENCE_TYPES = Feature.REFERENCE_TYPES; /** Multi value types. */ export const FEATURE_MULTI_VALUE = Feature.MULTI_VALUE; +/** Anyref type. */ +export const FEATURE_ANYREF = Feature.ANYREF; /** Enables a specific feature. */ export function enableFeature(options: Options, feature: Feature): void { diff --git a/src/module.ts b/src/module.ts index a26d4b84d3..1dece8f66b 100644 --- a/src/module.ts +++ b/src/module.ts @@ -39,8 +39,8 @@ export namespace NativeType { export const V128: NativeType = 6 /* _BinaryenTypeVec128 */; export const Funcref: NativeType = 7 /* _BinaryenTypeFuncref */; export const Externref: NativeType = 8 /* _BinaryenTypeExternref */; - export const Nullref: NativeType = 9 /* _BinaryenTypeNullref */; - export const Exnref: NativeType = 10 /* _BinaryenTypeExnref */; + export const Exnref: NativeType = 9 /* _BinaryenTypeExnref */; + export const Anyref: NativeType = 10 /* _BinaryenTypeAnyref */; export const Auto: NativeType = -1 /* _BinaryenTypeAuto */; } @@ -56,7 +56,8 @@ export enum FeatureFlags { TailCall = 128 /* _BinaryenFeatureTailCall */, ReferenceTypes = 256 /* _BinaryenFeatureReferenceTypes */, MultiValue = 512 /* _BinaryenFeatureMultivalue */, - All = 1023 /* _BinaryenFeatureAll */ + Anyref = 1024 /* _BinaryenFeatureAnyref */, + All = 2047 /* _BinaryenFeatureAll */ } export enum ExpressionId { @@ -559,8 +560,8 @@ export class Module { return binaryen._BinaryenConst(this.ref, out); } - ref_null(): ExpressionRef { - return binaryen._BinaryenRefNull(this.ref); + ref_null(type: NativeType): ExpressionRef { + return binaryen._BinaryenRefNull(this.ref, type); } // expressions diff --git a/src/program.ts b/src/program.ts index 05a020452c..873ed62b22 100644 --- a/src/program.ts +++ b/src/program.ts @@ -901,7 +901,10 @@ export class Program extends DiagnosticEmitter { // compiler needs to check this condition whenever such a value is created // respectively stored or loaded. this.registerNativeType(CommonNames.v128, Type.v128); + this.registerNativeType(CommonNames.funcref, Type.funcref); this.registerNativeType(CommonNames.externref, Type.externref); + this.registerNativeType(CommonNames.exnref, Type.exnref); + this.registerNativeType(CommonNames.anyref, Type.anyref); // register compiler hints this.registerConstantInteger(CommonNames.ASC_TARGET, Type.i32, @@ -940,6 +943,8 @@ export class Program extends DiagnosticEmitter { i64_new(options.hasFeature(Feature.REFERENCE_TYPES) ? 1 : 0, 0)); this.registerConstantInteger(CommonNames.ASC_FEATURE_MULTI_VALUE, Type.bool, i64_new(options.hasFeature(Feature.MULTI_VALUE) ? 1 : 0, 0)); + this.registerConstantInteger(CommonNames.ASC_FEATURE_ANYREF, Type.bool, + i64_new(options.hasFeature(Feature.ANYREF) ? 1 : 0, 0)); // remember deferred elements var queuedImports = new Array(); @@ -1151,7 +1156,16 @@ export class Program extends DiagnosticEmitter { this.registerWrapperClass(Type.f32, CommonNames.F32); this.registerWrapperClass(Type.f64, CommonNames.F64); if (options.hasFeature(Feature.SIMD)) this.registerWrapperClass(Type.v128, CommonNames.V128); - if (options.hasFeature(Feature.REFERENCE_TYPES)) this.registerWrapperClass(Type.externref, CommonNames.Externref); + if (options.hasFeature(Feature.REFERENCE_TYPES)) { + this.registerWrapperClass(Type.funcref, CommonNames.Funcref); + this.registerWrapperClass(Type.externref, CommonNames.Externref); + if (options.hasFeature(Feature.EXCEPTION_HANDLING)) { + this.registerWrapperClass(Type.exnref, CommonNames.Exnref); + } + if (options.hasFeature(Feature.ANYREF)) { + this.registerWrapperClass(Type.anyref, CommonNames.Anyref); + } + } // resolve prototypes of extended classes or interfaces var resolver = this.resolver; @@ -3601,8 +3615,10 @@ export class Function extends TypedElement { tempF32s: Local[] | null = null; tempF64s: Local[] | null = null; tempV128s: Local[] | null = null; + tempFuncrefs: Local[] | null = null; tempExternrefs: Local[] | null = null; tempExnrefs: Local[] | null = null; + tempAnyrefs: Local[] | null = null; // used by flows to keep track of break labels nextBreakId: i32 = 0; diff --git a/src/resolver.ts b/src/resolver.ts index 2fcbe9e270..c3ffdf6695 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -1195,7 +1195,7 @@ export class Resolver extends DiagnosticEmitter { if (signatureReference) { return signatureReference.type.asNullable(); } else if (ctxType.isExternalReference) { - return Type.externref.asNullable(); + return ctxType; // TODO: nullable? } } return this.program.options.usizeType; diff --git a/src/types.ts b/src/types.ts index 671daec53a..d757e8bbff 100644 --- a/src/types.ts +++ b/src/types.ts @@ -59,8 +59,14 @@ export const enum TypeKind { // references - /** Any host reference. */ + /** Function reference. */ + FUNCREF, + /** External reference. */ EXTERNREF, + /** Exception reference. */ + EXNREF, + /** Any reference. */ + ANYREF, // other @@ -319,6 +325,9 @@ export class Type { /** Gets the corresponding non-nullable type. */ get nonNullableType(): Type { + if (this.isExternalReference) { + return this; // TODO + } return assert(this._nonNullableType); // set either in ctor or asNullable } @@ -387,7 +396,7 @@ export class Type { if (targetFunction = target.getSignature()) { return currentFunction.isAssignableTo(targetFunction); } - } else if (this.kind == TypeKind.EXTERNREF && target.kind == TypeKind.EXTERNREF) { + } else if (this.isExternalReference && (this.kind == target.kind || target.kind == TypeKind.ANYREF)) { return true; } } @@ -462,16 +471,14 @@ export class Type { return this.isNullableReference ? classReference.internalName + nullablePostfix : classReference.internalName; + } else { + let signatureReference = this.getSignature(); + if (signatureReference) { + return this.isNullableReference + ? "(" + signatureReference.toString(validWat) + ")" + nullablePostfix + : signatureReference.toString(validWat); + } } - let signatureReference = this.getSignature(); - if (signatureReference) { - return this.isNullableReference - ? "(" + signatureReference.toString(validWat) + ")" + nullablePostfix - : signatureReference.toString(validWat); - } - // TODO: Reflect.apply(value, "toString", []) ? - assert(this.kind == TypeKind.EXTERNREF); - return "externref"; } switch (this.kind) { case TypeKind.I8: return "i8"; @@ -488,7 +495,10 @@ export class Type { case TypeKind.F32: return "f32"; case TypeKind.F64: return "f64"; case TypeKind.V128: return "v128"; + case TypeKind.FUNCREF: return "funcref"; case TypeKind.EXTERNREF: return "externref"; + case TypeKind.EXNREF: return "exnref"; + case TypeKind.ANYREF: return "anyref"; default: assert(false); case TypeKind.VOID: return "void"; } @@ -514,7 +524,10 @@ export class Type { case TypeKind.F32: return NativeType.F32; case TypeKind.F64: return NativeType.F64; case TypeKind.V128: return NativeType.V128; + case TypeKind.FUNCREF: return NativeType.Funcref; case TypeKind.EXTERNREF: return NativeType.Externref; + case TypeKind.EXNREF: return NativeType.Exnref; + case TypeKind.ANYREF: return NativeType.Anyref; case TypeKind.VOID: return NativeType.None; } } @@ -646,9 +659,31 @@ export class Type { TypeFlags.VALUE, 128 ); - /** Any host reference. */ + /** Function reference. */ + static readonly funcref: Type = new Type(TypeKind.FUNCREF, + TypeFlags.EXTERNAL | + TypeFlags.NULLABLE | + TypeFlags.REFERENCE, 0 + ); + + /** External reference. */ static readonly externref: Type = new Type(TypeKind.EXTERNREF, TypeFlags.EXTERNAL | + TypeFlags.NULLABLE | + TypeFlags.REFERENCE, 0 + ); + + /** Exception reference. */ + static readonly exnref: Type = new Type(TypeKind.EXNREF, + TypeFlags.EXTERNAL | + TypeFlags.NULLABLE | + TypeFlags.REFERENCE, 0 + ); + + /** Any reference. */ + static readonly anyref: Type = new Type(TypeKind.ANYREF, + TypeFlags.EXTERNAL | + TypeFlags.NULLABLE | TypeFlags.REFERENCE, 0 ); diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index b022371b24..bb04096144 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -35,8 +35,14 @@ declare type f32 = number; declare type f64 = number; /** A 128-bit vector. */ declare type v128 = object; -/** A host reference. */ -declare type externref = object; +/** Function reference. */ +declare type funcref = object | null; +/** External reference. */ +declare type externref = object | null; +/** Exception reference. */ +declare type exnref = object | null; +/** Any reference. */ +declare type anyref = object | null; // Compiler hints @@ -74,6 +80,8 @@ declare const ASC_FEATURE_TAIL_CALLS: bool; declare const ASC_FEATURE_REFERENCE_TYPES: bool; /** Whether the multi value types feature is enabled. */ declare const ASC_FEATURE_MULTI_VALUE: bool; +/** Whether the anyref feature is enabled. */ +declare const ASC_FEATURE_ANYREF: bool; // Builtins diff --git a/std/assembly/reference.ts b/std/assembly/reference.ts index b45db14403..314ed5da09 100644 --- a/std/assembly/reference.ts +++ b/std/assembly/reference.ts @@ -1,4 +1,19 @@ -/** Host reference abstraction. */ +@unmanaged +abstract class Ref { +} + +@final @unmanaged +export abstract class Funcref extends Ref { +} + +@final @unmanaged +export abstract class Externref extends Ref { +} + +@final @unmanaged +export abstract class Exnref extends Ref { +} + @final @unmanaged -export abstract class Externref { +export abstract class Anyref extends Ref { } diff --git a/std/assembly/shared/feature.ts b/std/assembly/shared/feature.ts index 0e5dcc919a..b293545e77 100644 --- a/std/assembly/shared/feature.ts +++ b/std/assembly/shared/feature.ts @@ -23,7 +23,9 @@ export const enum Feature { /** Reference types. */ REFERENCE_TYPES = 1 << 8, // see: https://github.com/WebAssembly/reference-types /** Multi value types. */ - MULTI_VALUE = 1 << 9 // see: https://github.com/WebAssembly/multi-value + MULTI_VALUE = 1 << 9, // see: https://github.com/WebAssembly/multi-value + /** Anyref. */ + ANYREF = 1 << 10 // TODO: custom pre-GC Binaryen feature } /** Gets the name of the specified feature one would specify on the command line. */ @@ -39,6 +41,7 @@ export function featureToString(feature: Feature): string { case Feature.TAIL_CALLS: return "tail-calls"; case Feature.REFERENCE_TYPES: return "reference-types"; case Feature.MULTI_VALUE: return "multi-value"; + case Feature.ANYREF: return "anyref"; } assert(false); return ""; diff --git a/tests/compiler/abi.untouched.wat b/tests/compiler/abi.untouched.wat index f540d255b1..b09618cc81 100644 --- a/tests/compiler/abi.untouched.wat +++ b/tests/compiler/abi.untouched.wat @@ -27,10 +27,7 @@ i32.const 256 local.set $0 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eqz i32.eqz if @@ -46,28 +43,19 @@ global.get $abi/condition if local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 2 i32.div_s local.set $0 else local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 2 i32.div_s local.set $0 end local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eqz i32.eqz if @@ -83,10 +71,7 @@ global.get $abi/condition if local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 24 i32.shr_s local.set $0 @@ -108,10 +93,7 @@ unreachable end i32.const 256 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s global.set $abi/y global.get $abi/y i32.eqz @@ -183,20 +165,16 @@ ) (func $abi/exported (result i32) i32.const 128 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s + i32.extend8_s ) (func $abi/exportedExported (result i32) call $abi/exported + i32.extend8_s ) (func $abi/exportedInternal (result i32) call $abi/internal - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s ) (func $~start call $start:abi diff --git a/tests/compiler/asc-constants.ts b/tests/compiler/asc-constants.ts index c8b2b59eba..5207cd051a 100644 --- a/tests/compiler/asc-constants.ts +++ b/tests/compiler/asc-constants.ts @@ -14,3 +14,4 @@ ASC_FEATURE_EXCEPTION_HANDLING; ASC_FEATURE_TAIL_CALLS; ASC_FEATURE_REFERENCE_TYPES; ASC_FEATURE_MULTI_VALUE; +ASC_FEATURE_ANYREF; diff --git a/tests/compiler/asc-constants.untouched.wat b/tests/compiler/asc-constants.untouched.wat index 0f74c055b8..ffcb35c7c0 100644 --- a/tests/compiler/asc-constants.untouched.wat +++ b/tests/compiler/asc-constants.untouched.wat @@ -7,7 +7,7 @@ (global $~lib/ASC_MEMORY_BASE i32 (i32.const 0)) (global $~lib/ASC_OPTIMIZE_LEVEL i32 (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/ASC_FEATURE_SIGN_EXTENSION i32 (i32.const 0)) + (global $~lib/ASC_FEATURE_SIGN_EXTENSION i32 (i32.const 1)) (global $~lib/ASC_FEATURE_MUTABLE_GLOBALS i32 (i32.const 1)) (global $~lib/ASC_FEATURE_NONTRAPPING_F2I i32 (i32.const 0)) (global $~lib/ASC_FEATURE_BULK_MEMORY i32 (i32.const 0)) @@ -17,6 +17,7 @@ (global $~lib/ASC_FEATURE_TAIL_CALLS i32 (i32.const 0)) (global $~lib/ASC_FEATURE_REFERENCE_TYPES i32 (i32.const 0)) (global $~lib/ASC_FEATURE_MULTI_VALUE i32 (i32.const 0)) + (global $~lib/ASC_FEATURE_ANYREF i32 (i32.const 0)) (export "memory" (memory $0)) (start $~start) (func $start:asc-constants @@ -30,7 +31,7 @@ drop i32.const 0 drop - i32.const 0 + i32.const 1 drop i32.const 1 drop @@ -50,6 +51,8 @@ drop i32.const 0 drop + i32.const 0 + drop ) (func $~start call $start:asc-constants diff --git a/tests/compiler/builtins.untouched.wat b/tests/compiler/builtins.untouched.wat index 9573100c47..75ee155610 100644 --- a/tests/compiler/builtins.untouched.wat +++ b/tests/compiler/builtins.untouched.wat @@ -1437,10 +1437,7 @@ drop global.get $~lib/builtins/i8.MIN_VALUE i32.const 128 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq drop global.get $~lib/builtins/i8.MAX_VALUE @@ -1449,10 +1446,7 @@ drop global.get $~lib/builtins/i16.MIN_VALUE i32.const 32768 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eq drop global.get $~lib/builtins/i16.MAX_VALUE diff --git a/tests/compiler/features/reference-types.json b/tests/compiler/features/reference-types.json index 6492822f55..dcdaeeaea3 100644 --- a/tests/compiler/features/reference-types.json +++ b/tests/compiler/features/reference-types.json @@ -1,6 +1,8 @@ { "features": [ - "reference-types" + "reference-types", + "exception-handling", + "anyref" ], "asc_flags": [ "--runtime none" diff --git a/tests/compiler/features/reference-types.optimized.wat b/tests/compiler/features/reference-types.optimized.wat index 8f9e7c11e3..420fa1e440 100644 --- a/tests/compiler/features/reference-types.optimized.wat +++ b/tests/compiler/features/reference-types.optimized.wat @@ -14,6 +14,7 @@ (import "reference-types" "external" (func $features/reference-types/external (param externref) (result externref))) (memory $0 1) (data (i32.const 1024) "6\00\00\00\01\00\00\00\01\00\00\006\00\00\00f\00e\00a\00t\00u\00r\00e\00s\00/\00r\00e\00f\00e\00r\00e\00n\00c\00e\00-\00t\00y\00p\00e\00s\00.\00t\00s") + (global $features/reference-types/funcGlobal (mut funcref) (ref.null func)) (export "memory" (memory $0)) (export "external" (func $features/reference-types/external)) (export "internal" (func $features/reference-types/internal)) @@ -45,4 +46,23 @@ global.get $features/reference-types/someKey call $~lib/bindings/Reflect/get call $~lib/bindings/console/log + global.get $features/reference-types/funcGlobal + ref.is_null + if + i32.const 0 + i32.const 1040 + i32.const 32 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.null func + global.set $features/reference-types/funcGlobal + i32.const 0 + i32.const 1040 + i32.const 34 + i32.const 1 + call $~lib/builtins/abort + unreachable + ) ) diff --git a/tests/compiler/features/reference-types.ts b/tests/compiler/features/reference-types.ts index fa2fa17d89..8eab60fb08 100644 --- a/tests/compiler/features/reference-types.ts +++ b/tests/compiler/features/reference-types.ts @@ -26,27 +26,57 @@ console.log(someObject); console.log(someKey); console.log(Reflect.get(someObject, someKey)); -// TODO: can represent and recognize 'null' for both externref and funcref -/* var nullGlobal: externref; -assert(!nullGlobal); -nullGlobal = null; -assert(!nullGlobal); -var nullGlobalInit: externref = null; -assert(!nullGlobalInit); -{ - let nullLocal: externref; - assert(!nullLocal); - nullLocal = null; - assert(!nullLocal); - let nullLocalInit: externref = null; - assert(!nullLocalInit); +// can represent and recognize 'null' + +var funcGlobal: funcref; +assert(!funcGlobal); +funcGlobal = null; +assert(!funcGlobal); +var funcGlobalInit: funcref = null; +assert(!funcGlobalInit); + +var externGlobal: externref; +assert(!externGlobal); +externGlobal = null; +assert(!externGlobal); +var externGlobalInit: externref = null; +assert(!externGlobalInit); + +var exnGlobal: exnref; +assert(!exnGlobal); +exnGlobal = null; +assert(!exnGlobal); +var exnGlobalInit: exnref = null; +assert(!exnGlobalInit); + +var anyGlobal: anyref; +assert(!anyGlobal); +anyGlobal = null; +assert(!anyGlobal); +var anyGlobalInit: anyref = null; +assert(!anyGlobalInit); + +function testLocal(): void { + let local: T; + assert(!local); + local = null; + assert(!local); + let localInit: T = null; + assert(!localInit); } +testLocal(); +testLocal(); +testLocal(); +testLocal(); // funcref can represent function references function someFunc(): void {} -var funcGlobal: externref = someFunc; +funcGlobal = someFunc; +assert(funcGlobalInit); +var otherFuncGlobal: funcref = someFunc; +assert(otherFuncGlobal); { - let funcLocal: externref = someFunc; + let funcLocal: funcref = someFunc; + assert(funcLocal); } -*/ \ No newline at end of file diff --git a/tests/compiler/features/reference-types.untouched.wat b/tests/compiler/features/reference-types.untouched.wat index 0f9a373a7c..509432a867 100644 --- a/tests/compiler/features/reference-types.untouched.wat +++ b/tests/compiler/features/reference-types.untouched.wat @@ -15,11 +15,200 @@ (memory $0 1) (data (i32.const 16) "6\00\00\00\01\00\00\00\01\00\00\006\00\00\00f\00e\00a\00t\00u\00r\00e\00s\00/\00r\00e\00f\00e\00r\00e\00n\00c\00e\00-\00t\00y\00p\00e\00s\00.\00t\00s\00") (table $0 1 funcref) + (global $features/reference-types/funcGlobal (mut funcref) (ref.null func)) + (global $features/reference-types/funcGlobalInit (mut funcref) (ref.null func)) + (global $features/reference-types/externGlobal (mut externref) (ref.null extern)) + (global $features/reference-types/externGlobalInit (mut externref) (ref.null extern)) + (global $features/reference-types/exnGlobal (mut exnref) (ref.null exn)) + (global $features/reference-types/exnGlobalInit (mut exnref) (ref.null exn)) + (global $features/reference-types/anyGlobal (mut anyref) (ref.null any)) + (global $features/reference-types/anyGlobalInit (mut anyref) (ref.null any)) + (global $features/reference-types/otherFuncGlobal (mut funcref) (ref.null func)) (export "memory" (memory $0)) (export "external" (func $features/reference-types/external)) (export "internal" (func $features/reference-types/internal)) (start $~start) + (func $features/reference-types/testLocal + (local $0 funcref) + (local $1 funcref) + local.get $0 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 61 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ref.null func + local.set $0 + local.get $0 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 63 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ref.null func + local.set $1 + local.get $1 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 65 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ) + (func $features/reference-types/testLocal + (local $0 externref) + (local $1 externref) + local.get $0 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 61 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ref.null extern + local.set $0 + local.get $0 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 63 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ref.null extern + local.set $1 + local.get $1 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 65 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ) + (func $features/reference-types/testLocal + (local $0 exnref) + (local $1 exnref) + local.get $0 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 61 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ref.null exn + local.set $0 + local.get $0 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 63 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ref.null exn + local.set $1 + local.get $1 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 65 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ) + (func $features/reference-types/testLocal + (local $0 anyref) + (local $1 anyref) + local.get $0 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 61 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ref.null any + local.set $0 + local.get $0 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 63 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ref.null any + local.set $1 + local.get $1 + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 65 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ) + (func $features/reference-types/someFunc + nop + ) (func $start:features/reference-types + (local $0 funcref) global.get $features/reference-types/someObject global.get $features/reference-types/someKey call $~lib/bindings/Reflect/has @@ -42,6 +231,206 @@ global.get $features/reference-types/someKey call $~lib/bindings/Reflect/get call $~lib/bindings/console/log + global.get $features/reference-types/funcGlobal + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 32 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.null func + global.set $features/reference-types/funcGlobal + global.get $features/reference-types/funcGlobal + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 34 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.null func + global.set $features/reference-types/funcGlobalInit + global.get $features/reference-types/funcGlobalInit + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 36 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $features/reference-types/externGlobal + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 39 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.null extern + global.set $features/reference-types/externGlobal + global.get $features/reference-types/externGlobal + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 41 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.null extern + global.set $features/reference-types/externGlobalInit + global.get $features/reference-types/externGlobalInit + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 43 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $features/reference-types/exnGlobal + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 46 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.null exn + global.set $features/reference-types/exnGlobal + global.get $features/reference-types/exnGlobal + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 48 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.null exn + global.set $features/reference-types/exnGlobalInit + global.get $features/reference-types/exnGlobalInit + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 50 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $features/reference-types/anyGlobal + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 53 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.null any + global.set $features/reference-types/anyGlobal + global.get $features/reference-types/anyGlobal + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 55 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.null any + global.set $features/reference-types/anyGlobalInit + global.get $features/reference-types/anyGlobalInit + ref.is_null + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 57 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + call $features/reference-types/testLocal + call $features/reference-types/testLocal + call $features/reference-types/testLocal + call $features/reference-types/testLocal + ref.func $features/reference-types/someFunc + global.set $features/reference-types/funcGlobal + global.get $features/reference-types/funcGlobalInit + ref.is_null + if + i32.const 0 + i32.const 32 + i32.const 76 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.func $features/reference-types/someFunc + global.set $features/reference-types/otherFuncGlobal + global.get $features/reference-types/otherFuncGlobal + ref.is_null + if + i32.const 0 + i32.const 32 + i32.const 78 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ref.func $features/reference-types/someFunc + local.set $0 + local.get $0 + ref.is_null + if + i32.const 0 + i32.const 32 + i32.const 81 + i32.const 3 + call $~lib/builtins/abort + unreachable + end ) (func $features/reference-types/internal (param $0 externref) (result externref) (local $1 externref) diff --git a/tests/compiler/features/simd.untouched.wat b/tests/compiler/features/simd.untouched.wat index 616a7bba44..fb3322732c 100644 --- a/tests/compiler/features/simd.untouched.wat +++ b/tests/compiler/features/simd.untouched.wat @@ -412,10 +412,7 @@ end local.get $2 i8x16.extract_lane_s 0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 2 i32.eq i32.eqz @@ -429,10 +426,7 @@ end local.get $2 i8x16.extract_lane_s 15 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const -128 i32.eq i32.eqz @@ -954,10 +948,7 @@ end local.get $2 i16x8.extract_lane_s 0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 2 i32.eq i32.eqz @@ -971,10 +962,7 @@ end local.get $2 i16x8.extract_lane_s 7 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -32768 i32.eq i32.eqz diff --git a/tests/compiler/many-locals.optimized.wat b/tests/compiler/many-locals.optimized.wat index 4c9f7826dd..13729fb302 100644 --- a/tests/compiler/many-locals.optimized.wat +++ b/tests/compiler/many-locals.optimized.wat @@ -1,36 +1,15 @@ (module (type $i32_=>_i32 (func (param i32) (result i32))) - (type $none_=>_none (func)) - (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 1024) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00m\00a\00n\00y\00-\00l\00o\00c\00a\00l\00s\00.\00t\00s") (export "memory" (memory $0)) (export "testI32" (func $many-locals/testI32)) (export "testI8" (func $many-locals/testI8)) - (start $~start) (func $many-locals/testI32 (param $0 i32) (result i32) local.get $0 ) (func $many-locals/testI8 (param $0 i32) (result i32) local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - ) - (func $~start - i32.const 42 - call $many-locals/testI8 - i32.const 42 - i32.ne - if - i32.const 0 - i32.const 1040 - i32.const 267 - i32.const 1 - call $~lib/builtins/abort - unreachable - end + i32.extend8_s ) ) diff --git a/tests/compiler/many-locals.untouched.wat b/tests/compiler/many-locals.untouched.wat index 8e2517e717..7aae338a39 100644 --- a/tests/compiler/many-locals.untouched.wat +++ b/tests/compiler/many-locals.untouched.wat @@ -783,10 +783,7 @@ local.get $127 local.set $128 local.get $128 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s ) (func $start:many-locals i32.const 42 @@ -804,6 +801,7 @@ end i32.const 42 call $many-locals/testI8 + i32.extend8_s i32.const 42 i32.eq i32.eqz diff --git a/tests/compiler/overflow.untouched.wat b/tests/compiler/overflow.untouched.wat index 4b9a74b4cb..a77b150069 100644 --- a/tests/compiler/overflow.untouched.wat +++ b/tests/compiler/overflow.untouched.wat @@ -18,10 +18,7 @@ i32.add local.set $0 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const -128 i32.eq i32.eqz @@ -38,10 +35,7 @@ i32.sub local.set $0 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 127 i32.eq i32.eqz @@ -61,10 +55,7 @@ local.get $2 local.set $1 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const -128 i32.eq i32.eqz @@ -84,10 +75,7 @@ local.get $2 local.set $1 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 127 i32.eq i32.eqz @@ -104,10 +92,7 @@ i32.add local.set $0 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const -128 i32.eq i32.eqz @@ -124,10 +109,7 @@ i32.sub local.set $0 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 127 i32.eq i32.eqz @@ -145,10 +127,7 @@ local.tee $0 local.set $1 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const -128 i32.eq i32.eqz @@ -166,10 +145,7 @@ local.tee $0 local.set $1 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 127 i32.eq i32.eqz @@ -184,10 +160,7 @@ local.get $0 i32.const 1 i32.add - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const -128 i32.eq i32.eqz @@ -206,10 +179,7 @@ i32.add local.set $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -32768 i32.eq i32.eqz @@ -226,10 +196,7 @@ i32.sub local.set $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 32767 i32.eq i32.eqz @@ -249,10 +216,7 @@ local.get $2 local.set $0 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -32768 i32.eq i32.eqz @@ -272,10 +236,7 @@ local.get $2 local.set $0 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 32767 i32.eq i32.eqz @@ -292,10 +253,7 @@ i32.add local.set $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -32768 i32.eq i32.eqz @@ -312,10 +270,7 @@ i32.sub local.set $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 32767 i32.eq i32.eqz @@ -333,10 +288,7 @@ local.tee $1 local.set $0 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -32768 i32.eq i32.eqz @@ -354,10 +306,7 @@ local.tee $1 local.set $0 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 32767 i32.eq i32.eqz @@ -372,10 +321,7 @@ local.get $1 i32.const 1 i32.add - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -32768 i32.eq i32.eqz diff --git a/tests/compiler/portable-conversions.untouched.wat b/tests/compiler/portable-conversions.untouched.wat index 6d00acc97a..0d7376bca1 100644 --- a/tests/compiler/portable-conversions.untouched.wat +++ b/tests/compiler/portable-conversions.untouched.wat @@ -13,10 +13,7 @@ (start $~start) (func $start:portable-conversions global.get $portable-conversions/i - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eqz if i32.const 0 @@ -28,10 +25,7 @@ end global.get $portable-conversions/I i32.wrap_i64 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eqz if i32.const 0 @@ -43,10 +37,7 @@ end global.get $portable-conversions/f i32.trunc_f32_s - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eqz if i32.const 0 @@ -58,10 +49,7 @@ end global.get $portable-conversions/F i32.trunc_f64_s - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eqz if i32.const 0 @@ -72,10 +60,7 @@ unreachable end global.get $portable-conversions/i - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eqz if i32.const 0 @@ -87,10 +72,7 @@ end global.get $portable-conversions/I i32.wrap_i64 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eqz if i32.const 0 @@ -102,10 +84,7 @@ end global.get $portable-conversions/f i32.trunc_f32_s - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eqz if i32.const 0 @@ -117,10 +96,7 @@ end global.get $portable-conversions/F i32.trunc_f64_s - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eqz if i32.const 0 diff --git a/tests/compiler/retain-i32.optimized.wat b/tests/compiler/retain-i32.optimized.wat index 99faa43113..37736ab94d 100644 --- a/tests/compiler/retain-i32.optimized.wat +++ b/tests/compiler/retain-i32.optimized.wat @@ -1,11 +1,198 @@ (module (type $none_=>_none (func)) + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 1024) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00r\00e\00t\00a\00i\00n\00-\00i\003\002\00.\00t\00s") (export "memory" (memory $0)) (start $~start) - (func $~start + (func $retain-i32/test (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + local.get $1 + i32.add + local.tee $2 + i32.extend8_s + local.get $2 + i32.extend8_s + i32.ne + if + i32.const 0 + i32.const 1040 + i32.const 4 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.sub + local.tee $2 + i32.extend8_s + local.get $2 + i32.extend8_s + i32.ne + if + i32.const 0 + i32.const 1040 + i32.const 5 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.mul + local.tee $2 + i32.extend8_s + local.get $2 + i32.extend8_s + i32.ne + if + i32.const 0 + i32.const 1040 + i32.const 6 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.and + local.tee $2 + i32.extend8_s + local.get $2 + i32.extend8_s + i32.ne + if + i32.const 0 + i32.const 1040 + i32.const 7 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.or + local.tee $2 + i32.extend8_s + local.get $2 + i32.extend8_s + i32.ne + if + i32.const 0 + i32.const 1040 + i32.const 8 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.xor + local.tee $2 + i32.extend8_s + local.get $2 + i32.extend8_s + i32.ne + if + i32.const 0 + i32.const 1040 + i32.const 9 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.shl + local.tee $0 + i32.extend8_s + local.get $0 + i32.extend8_s + i32.ne + if + i32.const 0 + i32.const 1040 + i32.const 10 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ) + (func $start:retain-i32 (local $0 i32) + i32.const 0 + i32.const 127 + call $retain-i32/test + i32.const 127 + i32.const 0 + call $retain-i32/test + i32.const 1 + i32.const 127 + call $retain-i32/test + i32.const 127 + i32.const 1 + call $retain-i32/test + i32.const -1 + i32.const 127 + call $retain-i32/test + i32.const 127 + i32.const -1 + call $retain-i32/test + i32.const 0 + i32.const -128 + call $retain-i32/test + i32.const -128 + i32.const 0 + call $retain-i32/test + i32.const 1 + i32.const -128 + call $retain-i32/test + i32.const -128 + i32.const 1 + call $retain-i32/test + i32.const -1 + i32.const -128 + call $retain-i32/test + i32.const -128 + i32.const -1 + call $retain-i32/test + i32.const 127 + i32.const 127 + call $retain-i32/test + i32.const -128 + i32.const -128 + call $retain-i32/test + i32.const 127 + i32.const -128 + call $retain-i32/test + i32.const -128 + i32.const 127 + call $retain-i32/test + i32.const 0 + i32.const 255 + call $retain-i32/test + i32.const 255 + i32.const 0 + call $retain-i32/test + i32.const 1 + i32.const 255 + call $retain-i32/test + i32.const 255 + i32.const 1 + call $retain-i32/test + i32.const -1 + i32.const 255 + call $retain-i32/test + i32.const 255 + i32.const -1 + call $retain-i32/test + i32.const 255 + i32.const 255 + call $retain-i32/test i32.const -128 local.set $0 loop $for-loop|0 @@ -13,6 +200,42 @@ i32.const 255 i32.le_s if + i32.const 0 + local.get $0 + call $retain-i32/test + i32.const 1 + local.get $0 + call $retain-i32/test + i32.const -1 + local.get $0 + call $retain-i32/test + i32.const -128 + local.get $0 + call $retain-i32/test + i32.const 127 + local.get $0 + call $retain-i32/test + i32.const 255 + local.get $0 + call $retain-i32/test + i32.const -32768 + local.get $0 + call $retain-i32/test + i32.const 32767 + local.get $0 + call $retain-i32/test + i32.const 65535 + local.get $0 + call $retain-i32/test + i32.const 2147483647 + local.get $0 + call $retain-i32/test + i32.const -2147483648 + local.get $0 + call $retain-i32/test + i32.const -1 + local.get $0 + call $retain-i32/test local.get $0 i32.const 1 i32.add @@ -27,4 +250,7 @@ i32.load8_s drop ) + (func $~start + call $start:retain-i32 + ) ) diff --git a/tests/compiler/retain-i32.untouched.wat b/tests/compiler/retain-i32.untouched.wat index a096fb55d4..16cd33c52b 100644 --- a/tests/compiler/retain-i32.untouched.wat +++ b/tests/compiler/retain-i32.untouched.wat @@ -24,17 +24,11 @@ local.get $0 local.get $1 i32.add - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s local.get $0 local.get $1 i32.add - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -48,17 +42,11 @@ local.get $0 local.get $1 i32.sub - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s local.get $0 local.get $1 i32.sub - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -72,17 +60,11 @@ local.get $0 local.get $1 i32.mul - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s local.get $0 local.get $1 i32.mul - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -96,17 +78,11 @@ local.get $0 local.get $1 i32.and - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s local.get $0 local.get $1 i32.and - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -120,17 +96,11 @@ local.get $0 local.get $1 i32.or - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s local.get $0 local.get $1 i32.or - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -144,17 +114,11 @@ local.get $0 local.get $1 i32.xor - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s local.get $0 local.get $1 i32.xor - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -168,17 +132,11 @@ local.get $0 local.get $1 i32.shl - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s local.get $0 local.get $1 i32.shl - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -467,10 +425,7 @@ i32.add i32.const 1 i32.add - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s global.set $retain-i32/si global.get $retain-i32/si i32.const -1 @@ -489,10 +444,7 @@ i32.sub i32.const 127 i32.sub - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s global.set $retain-i32/si global.get $retain-i32/si i32.const -1 @@ -509,10 +461,7 @@ i32.const 127 i32.const 2 i32.mul - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s global.set $retain-i32/si global.get $retain-i32/si i32.const -2 @@ -529,10 +478,7 @@ i32.const 0 i32.const -128 i32.sub - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s global.set $retain-i32/si global.get $retain-i32/si i32.const -128 @@ -549,10 +495,7 @@ i32.const -128 i32.const -1 i32.mul - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s global.set $retain-i32/si global.get $retain-i32/si i32.const -128 @@ -569,10 +512,7 @@ i32.const 127 i32.const -1 i32.div_s - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s global.set $retain-i32/si global.get $retain-i32/si i32.const -127 @@ -589,10 +529,7 @@ i32.const -128 i32.const -1 i32.div_s - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s global.set $retain-i32/si global.get $retain-i32/si i32.const -128 diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index afe414b4f6..2c5369cd70 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -9198,10 +9198,7 @@ (func $~lib/util/number/itoa_buffered (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 0 i32.lt_s local.tee $2 @@ -9215,10 +9212,7 @@ local.set $1 end local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 10 i32.lt_u if @@ -9228,10 +9222,7 @@ i32.shl i32.add local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 48 i32.or i32.store16 @@ -9240,21 +9231,17 @@ i32.add return end - local.get $2 + local.get $0 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - local.tee $2 + i32.extend8_s + local.get $1 + i32.extend8_s call $~lib/util/number/decimalCount32 - i32.add - local.set $1 - local.get $0 local.get $2 - local.get $1 + i32.add + local.tee $0 call $~lib/util/number/utoa_dec_simple - local.get $1 + local.get $0 ) (func $~lib/util/string/joinIntegerArray (param $0 i32) (param $1 i32) (result i32) (local $2 i32) diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 347bea9cff..a5231ab901 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -16751,10 +16751,7 @@ i32.const 1 drop local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 0 i32.lt_s local.set $2 @@ -16779,10 +16776,7 @@ i32.le_u drop local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 10 i32.lt_u if @@ -16792,10 +16786,7 @@ i32.shl i32.add local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 48 i32.or i32.store16 @@ -16812,20 +16803,14 @@ drop local.get $3 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/number/decimalCount32 i32.add local.set $3 local.get $0 local.set $6 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s local.set $5 local.get $3 local.set $4 diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index f710a3aca4..e7aa132790 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -1401,9 +1401,8 @@ ) (func $~lib/polyfills/bswap (param $0 i32) (result i32) local.get $0 - i32.const 16 - i32.shl - i32.const 24 + i32.extend16_s + i32.const 8 i32.shr_s i32.const 255 i32.and @@ -2149,9 +2148,8 @@ i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and - i32.const 57590 + i32.extend16_s + i32.const -7946 i32.ne if i32.const 0 @@ -2165,8 +2163,7 @@ i32.const 1 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and + i32.extend16_s i32.const 22752 i32.ne if @@ -2181,9 +2178,8 @@ i32.const 2 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and - i32.const 40792 + i32.extend16_s + i32.const -24744 i32.ne if i32.const 0 @@ -2197,9 +2193,8 @@ i32.const 3 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and - i32.const 33439 + i32.extend16_s + i32.const -32097 i32.ne if i32.const 0 @@ -2213,8 +2208,7 @@ i32.const 4 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and + i32.extend16_s i32.const 25986 i32.ne if @@ -2229,8 +2223,7 @@ i32.const 5 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and + i32.extend16_s i32.const 17253 i32.ne if @@ -2245,8 +2238,7 @@ i32.const 6 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and + i32.extend16_s i32.const 24387 i32.ne if @@ -2261,9 +2253,8 @@ i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and - i32.const 63200 + i32.extend16_s + i32.const -2336 i32.ne if i32.const 0 @@ -2277,9 +2268,8 @@ i32.const 1 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and - i32.const 57432 + i32.extend16_s + i32.const -8104 i32.ne if i32.const 0 @@ -2293,8 +2283,7 @@ i32.const 2 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and + i32.extend16_s i32.const 22687 i32.ne if @@ -2309,9 +2298,8 @@ i32.const 3 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and - i32.const 40834 + i32.extend16_s + i32.const -24702 i32.ne if i32.const 0 @@ -2325,9 +2313,8 @@ i32.const 4 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and - i32.const 33381 + i32.extend16_s + i32.const -32155 i32.ne if i32.const 0 @@ -2341,8 +2328,7 @@ i32.const 5 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and + i32.extend16_s i32.const 25923 i32.ne if @@ -2357,8 +2343,7 @@ i32.const 6 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and + i32.extend16_s i32.const 17247 i32.ne if @@ -3136,9 +3121,8 @@ i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and - i32.const 52176 + i32.extend16_s + i32.const -13360 i32.ne if i32.const 0 @@ -3156,8 +3140,7 @@ i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 65535 - i32.and + i32.extend16_s i32.const 14689 i32.ne if diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index d0b78e568f..643334b687 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -2134,10 +2134,7 @@ i32.const 8 i32.shl local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 8 i32.shr_s i32.const 255 @@ -3150,10 +3147,7 @@ i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -7946 i32.eq i32.eqz @@ -3169,10 +3163,7 @@ i32.const 1 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 22752 i32.eq i32.eqz @@ -3188,10 +3179,7 @@ i32.const 2 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -24744 i32.eq i32.eqz @@ -3207,10 +3195,7 @@ i32.const 3 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -32097 i32.eq i32.eqz @@ -3226,10 +3211,7 @@ i32.const 4 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 25986 i32.eq i32.eqz @@ -3245,10 +3227,7 @@ i32.const 5 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 17253 i32.eq i32.eqz @@ -3264,10 +3243,7 @@ i32.const 6 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 24387 i32.eq i32.eqz @@ -3283,10 +3259,7 @@ i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -2336 i32.eq i32.eqz @@ -3302,10 +3275,7 @@ i32.const 1 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -8104 i32.eq i32.eqz @@ -3321,10 +3291,7 @@ i32.const 2 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 22687 i32.eq i32.eqz @@ -3340,10 +3307,7 @@ i32.const 3 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -24702 i32.eq i32.eqz @@ -3359,10 +3323,7 @@ i32.const 4 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -32155 i32.eq i32.eqz @@ -3378,10 +3339,7 @@ i32.const 5 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 25923 i32.eq i32.eqz @@ -3397,10 +3355,7 @@ i32.const 6 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 17247 i32.eq i32.eqz @@ -4229,10 +4184,7 @@ i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const -13360 i32.eq i32.eqz @@ -4253,10 +4205,7 @@ i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 14689 i32.eq i32.eqz diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index ca6ae81d81..b2694a99f4 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -1333,10 +1333,9 @@ i32.const 0 else local.get $0 - i32.load8_u + i32.load8_s local.get $1 - i32.const 255 - i32.and + i32.extend8_s i32.eq end if @@ -1357,10 +1356,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 call $~lib/map/Map#find i32.const 0 @@ -1506,10 +1502,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 local.tee $5 call $~lib/map/Map#find @@ -1602,10 +1595,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 call $~lib/map/Map#find local.tee $0 @@ -2530,10 +2520,7 @@ (local $5 i32) local.get $1 local.tee $3 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 local.set $4 local.get $0 @@ -2559,10 +2546,9 @@ i32.const 0 else local.get $1 - i32.load8_u + i32.load8_s local.get $3 - i32.const 255 - i32.and + i32.extend8_s i32.eq end br_if $__inlined_func$~lib/map/Map#find @@ -2967,10 +2953,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 call $~lib/map/Map#find local.tee $1 @@ -3093,10 +3076,7 @@ i32.store offset=20 loop $for-loop|1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 100 i32.lt_s if @@ -3114,10 +3094,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 10 i32.add call $~lib/map/Map#set @@ -3138,10 +3115,7 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 10 i32.add i32.ne @@ -3176,10 +3150,7 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 100 i32.lt_s if @@ -3199,10 +3170,7 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 10 i32.add i32.ne @@ -3217,10 +3185,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 20 i32.add call $~lib/map/Map#set @@ -3241,10 +3206,7 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 20 i32.add i32.ne @@ -3409,10 +3371,7 @@ local.set $2 loop $for-loop|6 local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 50 i32.lt_s if @@ -3432,10 +3391,7 @@ local.get $2 call $~lib/map/Map#get local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 20 i32.add i32.ne @@ -3484,10 +3440,7 @@ local.set $2 loop $for-loop|8 local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 50 i32.lt_s if @@ -3505,10 +3458,7 @@ local.get $0 local.get $2 local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 10 i32.add call $~lib/map/Map#set @@ -3581,6 +3531,49 @@ local.get $0 call $~lib/rt/pure/__release ) + (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + i32.load + local.get $2 + local.get $0 + i32.load offset=4 + i32.and + i32.const 2 + i32.shl + i32.add + i32.load + local.set $0 + loop $while-continue|0 + local.get $0 + if + local.get $0 + i32.load offset=8 + i32.const 1 + i32.and + if (result i32) + i32.const 0 + else + local.get $0 + i32.load8_u + local.get $1 + i32.const 255 + i32.and + i32.eq + end + if + local.get $0 + return + end + local.get $0 + i32.load offset=8 + i32.const -2 + i32.and + local.set $0 + br $while-continue|0 + end + end + i32.const 0 + ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 @@ -3588,7 +3581,7 @@ i32.const 255 i32.and call $~lib/util/hash/hash8 - call $~lib/map/Map#find + call $~lib/map/Map#find i32.const 0 i32.ne ) @@ -3736,7 +3729,7 @@ i32.and call $~lib/util/hash/hash8 local.tee $5 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $3 if local.get $3 @@ -3829,7 +3822,7 @@ i32.const 255 i32.and call $~lib/util/hash/hash8 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $0 i32.eqz if @@ -4233,7 +4226,7 @@ i32.const 255 i32.and call $~lib/util/hash/hash8 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $1 i32.eqz if @@ -4825,10 +4818,9 @@ i32.const 0 else local.get $0 - i32.load16_u + i32.load16_s local.get $1 - i32.const 65535 - i32.and + i32.extend16_s i32.eq end if @@ -4849,10 +4841,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 call $~lib/map/Map#find i32.const 0 @@ -4998,10 +4987,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 local.tee $5 call $~lib/map/Map#find @@ -5094,10 +5080,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 call $~lib/map/Map#find local.tee $0 @@ -5419,10 +5402,7 @@ (local $5 i32) local.get $1 local.tee $3 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 local.set $4 local.get $0 @@ -5448,10 +5428,9 @@ i32.const 0 else local.get $1 - i32.load16_u + i32.load16_s local.get $3 - i32.const 65535 - i32.and + i32.extend16_s i32.eq end br_if $__inlined_func$~lib/map/Map#find @@ -5556,10 +5535,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 call $~lib/map/Map#find local.tee $1 @@ -5649,10 +5625,7 @@ i32.store offset=20 loop $for-loop|1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 100 i32.lt_s if @@ -5670,10 +5643,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 10 i32.add call $~lib/map/Map#set @@ -5694,10 +5664,7 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 10 i32.add i32.ne @@ -5732,10 +5699,7 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 100 i32.lt_s if @@ -5755,10 +5719,7 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 10 i32.add i32.ne @@ -5773,10 +5734,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 20 i32.add call $~lib/map/Map#set @@ -5797,10 +5755,7 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 20 i32.add i32.ne @@ -5967,10 +5922,7 @@ local.set $2 loop $for-loop|6 local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 50 i32.lt_s if @@ -5990,10 +5942,7 @@ local.get $2 call $~lib/map/Map#get local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 20 i32.add i32.ne @@ -6042,10 +5991,7 @@ local.set $2 loop $for-loop|8 local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 50 i32.lt_s if @@ -6063,10 +6009,7 @@ local.get $0 local.get $2 local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 10 i32.add call $~lib/map/Map#set @@ -6139,6 +6082,49 @@ local.get $0 call $~lib/rt/pure/__release ) + (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + i32.load + local.get $2 + local.get $0 + i32.load offset=4 + i32.and + i32.const 2 + i32.shl + i32.add + i32.load + local.set $0 + loop $while-continue|0 + local.get $0 + if + local.get $0 + i32.load offset=8 + i32.const 1 + i32.and + if (result i32) + i32.const 0 + else + local.get $0 + i32.load16_u + local.get $1 + i32.const 65535 + i32.and + i32.eq + end + if + local.get $0 + return + end + local.get $0 + i32.load offset=8 + i32.const -2 + i32.and + local.set $0 + br $while-continue|0 + end + end + i32.const 0 + ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 @@ -6146,7 +6132,7 @@ i32.const 65535 i32.and call $~lib/util/hash/hash16 - call $~lib/map/Map#find + call $~lib/map/Map#find i32.const 0 i32.ne ) @@ -6294,7 +6280,7 @@ i32.and call $~lib/util/hash/hash16 local.tee $5 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $3 if local.get $3 @@ -6387,7 +6373,7 @@ i32.const 65535 i32.and call $~lib/util/hash/hash16 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $0 i32.eqz if @@ -6795,7 +6781,7 @@ i32.const 65535 i32.and call $~lib/util/hash/hash16 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $1 i32.eqz if diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index 0d84e733ec..3cd5a53b19 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -1871,10 +1871,7 @@ local.get $3 i32.load8_s local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq else i32.const 0 @@ -1913,10 +1910,7 @@ i32.eq drop local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.0 end @@ -2110,10 +2104,7 @@ i32.eq drop local.get $3 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.1 end @@ -2231,10 +2222,7 @@ i32.eq drop local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.3 end @@ -4356,10 +4344,7 @@ local.get $3 i32.load8_s local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq else i32.const 0 @@ -4566,10 +4551,7 @@ i32.eq drop local.get $3 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.4 end @@ -5087,10 +5069,7 @@ i32.eq drop local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.6 end @@ -5219,10 +5198,7 @@ local.set $1 loop $for-loop|1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 100 i32.lt_s local.set $3 @@ -5245,10 +5221,7 @@ local.get $1 i32.const 10 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release @@ -5269,10 +5242,7 @@ call $~lib/map/Map#get i32.const 10 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.add i32.eq i32.eqz @@ -5308,10 +5278,7 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 100 i32.lt_s local.set $4 @@ -5334,10 +5301,7 @@ call $~lib/map/Map#get i32.const 10 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.add i32.eq i32.eqz @@ -5353,10 +5317,7 @@ local.get $1 i32.const 20 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release @@ -5377,10 +5338,7 @@ call $~lib/map/Map#get i32.const 20 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.add i32.eq i32.eqz @@ -5519,10 +5477,7 @@ local.set $7 loop $for-loop|6 local.get $7 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 50 i32.lt_s local.set $10 @@ -5545,10 +5500,7 @@ call $~lib/map/Map#get i32.const 20 local.get $7 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.add i32.eq i32.eqz @@ -5601,10 +5553,7 @@ local.set $7 loop $for-loop|8 local.get $7 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 50 i32.lt_s local.set $9 @@ -5627,10 +5576,7 @@ local.get $7 i32.const 10 local.get $7 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release @@ -7550,10 +7496,7 @@ local.get $3 i32.load16_s local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eq else i32.const 0 @@ -7596,10 +7539,7 @@ i32.eq drop local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.0 end @@ -7801,10 +7741,7 @@ i32.eq drop local.get $3 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.1 end @@ -7926,10 +7863,7 @@ i32.eq drop local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.3 end @@ -8326,10 +8260,7 @@ local.get $3 i32.load16_s local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eq else i32.const 0 @@ -8544,10 +8475,7 @@ i32.eq drop local.get $3 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.4 end @@ -8675,10 +8603,7 @@ i32.eq drop local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.6 end @@ -8807,10 +8732,7 @@ local.set $1 loop $for-loop|1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 100 i32.lt_s local.set $3 @@ -8833,10 +8755,7 @@ local.get $1 i32.const 10 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release @@ -8857,10 +8776,7 @@ call $~lib/map/Map#get i32.const 10 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.add i32.eq i32.eqz @@ -8896,10 +8812,7 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 100 i32.lt_s local.set $4 @@ -8922,10 +8835,7 @@ call $~lib/map/Map#get i32.const 10 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.add i32.eq i32.eqz @@ -8941,10 +8851,7 @@ local.get $1 i32.const 20 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release @@ -8965,10 +8872,7 @@ call $~lib/map/Map#get i32.const 20 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.add i32.eq i32.eqz @@ -9107,10 +9011,7 @@ local.set $7 loop $for-loop|6 local.get $7 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 50 i32.lt_s local.set $10 @@ -9133,10 +9034,7 @@ call $~lib/map/Map#get i32.const 20 local.get $7 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.add i32.eq i32.eqz @@ -9189,10 +9087,7 @@ local.set $7 loop $for-loop|8 local.get $7 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 50 i32.lt_s local.set $9 @@ -9215,10 +9110,7 @@ local.get $7 i32.const 10 local.get $7 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release diff --git a/tests/compiler/std/math.optimized.wat b/tests/compiler/std/math.optimized.wat index c28d5fba12..2fed243e6f 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -48397,8 +48397,7 @@ i32.const 1 i32.const 3 call $~lib/math/ipow32 - i32.const 255 - i32.and + i32.extend8_s i32.const 1 i32.ne if @@ -48412,9 +48411,8 @@ i32.const -2 i32.const 3 call $~lib/math/ipow32 - i32.const 255 - i32.and - i32.const 248 + i32.extend8_s + i32.const -8 i32.ne if i32.const 0 diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index 7becd266bf..c953dd3369 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -59088,10 +59088,7 @@ i32.const 1 i32.const 3 call $~lib/math/ipow32 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 1 i32.eq i32.eqz @@ -59106,10 +59103,7 @@ i32.const -2 i32.const 3 call $~lib/math/ipow32 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const -8 i32.eq i32.eqz diff --git a/tests/compiler/std/polyfills.untouched.wat b/tests/compiler/std/polyfills.untouched.wat index 966b7ef0aa..ddedc3d41c 100644 --- a/tests/compiler/std/polyfills.untouched.wat +++ b/tests/compiler/std/polyfills.untouched.wat @@ -76,10 +76,7 @@ i32.const 8 i32.shl local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 8 i32.shr_s i32.const 255 @@ -376,10 +373,7 @@ i32.const 8 i32.shl local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 8 i32.shr_s i32.const 255 @@ -475,15 +469,9 @@ end i32.const 170 call $~lib/polyfills/bswap - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 170 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -511,15 +499,9 @@ end i32.const 43707 call $~lib/polyfills/bswap - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 48042 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eq i32.eqz if @@ -625,15 +607,9 @@ end i32.const 170 call $~lib/polyfills/bswap16 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 170 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -661,15 +637,9 @@ end i32.const 43707 call $~lib/polyfills/bswap16 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 48042 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eq i32.eqz if diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index a3e5c8a21d..b28956c436 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -1358,10 +1358,9 @@ i32.const 0 else local.get $0 - i32.load8_u + i32.load8_s local.get $1 - i32.const 255 - i32.and + i32.extend8_s i32.eq end if @@ -1382,10 +1381,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 call $~lib/set/Set#find i32.const 0 @@ -1526,10 +1522,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 local.tee $3 call $~lib/set/Set#find @@ -2179,10 +2172,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 call $~lib/set/Set#find local.tee $1 @@ -2279,10 +2269,7 @@ local.set $0 loop $for-loop|1 local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 100 i32.lt_s if @@ -2336,10 +2323,7 @@ local.set $2 loop $for-loop|3 local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 100 i32.lt_s if @@ -2445,10 +2429,7 @@ local.set $1 loop $for-loop|6 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 50 i32.lt_s if @@ -2501,10 +2482,7 @@ local.set $1 loop $for-loop|8 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 50 i32.lt_s if @@ -2615,6 +2593,49 @@ i32.store offset=20 local.get $0 ) + (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + i32.load + local.get $2 + local.get $0 + i32.load offset=4 + i32.and + i32.const 2 + i32.shl + i32.add + i32.load + local.set $0 + loop $while-continue|0 + local.get $0 + if + local.get $0 + i32.load offset=4 + i32.const 1 + i32.and + if (result i32) + i32.const 0 + else + local.get $0 + i32.load8_u + local.get $1 + i32.const 255 + i32.and + i32.eq + end + if + local.get $0 + return + end + local.get $0 + i32.load offset=4 + i32.const -2 + i32.and + local.set $0 + br $while-continue|0 + end + end + i32.const 0 + ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 @@ -2622,7 +2643,7 @@ i32.const 255 i32.and call $~lib/util/hash/hash8 - call $~lib/set/Set#find + call $~lib/set/Set#find i32.const 0 i32.ne ) @@ -2765,7 +2786,7 @@ i32.and call $~lib/util/hash/hash8 local.tee $3 - call $~lib/set/Set#find + call $~lib/set/Set#find i32.eqz if local.get $0 @@ -2979,7 +3000,7 @@ i32.const 255 i32.and call $~lib/util/hash/hash8 - call $~lib/set/Set#find + call $~lib/set/Set#find local.tee $1 i32.eqz if @@ -3407,10 +3428,9 @@ i32.const 0 else local.get $0 - i32.load16_u + i32.load16_s local.get $1 - i32.const 65535 - i32.and + i32.extend16_s i32.eq end if @@ -3431,10 +3451,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 call $~lib/set/Set#find i32.const 0 @@ -3575,10 +3592,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 local.tee $3 call $~lib/set/Set#find @@ -3848,10 +3862,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 call $~lib/set/Set#find local.tee $1 @@ -3915,10 +3926,7 @@ local.set $0 loop $for-loop|1 local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 100 i32.lt_s if @@ -3972,10 +3980,7 @@ local.set $2 loop $for-loop|3 local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 100 i32.lt_s if @@ -4081,10 +4086,7 @@ local.set $1 loop $for-loop|6 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 50 i32.lt_s if @@ -4137,10 +4139,7 @@ local.set $1 loop $for-loop|8 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 50 i32.lt_s if @@ -4251,6 +4250,49 @@ i32.store offset=20 local.get $0 ) + (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + i32.load + local.get $2 + local.get $0 + i32.load offset=4 + i32.and + i32.const 2 + i32.shl + i32.add + i32.load + local.set $0 + loop $while-continue|0 + local.get $0 + if + local.get $0 + i32.load offset=4 + i32.const 1 + i32.and + if (result i32) + i32.const 0 + else + local.get $0 + i32.load16_u + local.get $1 + i32.const 65535 + i32.and + i32.eq + end + if + local.get $0 + return + end + local.get $0 + i32.load offset=4 + i32.const -2 + i32.and + local.set $0 + br $while-continue|0 + end + end + i32.const 0 + ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 @@ -4258,7 +4300,7 @@ i32.const 65535 i32.and call $~lib/util/hash/hash16 - call $~lib/set/Set#find + call $~lib/set/Set#find i32.const 0 i32.ne ) @@ -4401,7 +4443,7 @@ i32.and call $~lib/util/hash/hash16 local.tee $3 - call $~lib/set/Set#find + call $~lib/set/Set#find i32.eqz if local.get $0 @@ -4621,7 +4663,7 @@ i32.const 65535 i32.and call $~lib/util/hash/hash16 - call $~lib/set/Set#find + call $~lib/set/Set#find local.tee $1 i32.eqz if diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index b867f31859..e9bbc582fa 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -1866,10 +1866,7 @@ local.get $3 i32.load8_s local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq else i32.const 0 @@ -1908,10 +1905,7 @@ i32.eq drop local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.0 end @@ -2100,10 +2094,7 @@ i32.eq drop local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.1 end @@ -3968,10 +3959,7 @@ i32.eq drop local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.3 end @@ -4096,10 +4084,7 @@ local.set $1 loop $for-loop|1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 100 i32.lt_s local.set $3 @@ -4158,10 +4143,7 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 100 i32.lt_s local.set $4 @@ -4276,10 +4258,7 @@ local.set $5 loop $for-loop|6 local.get $5 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 50 i32.lt_s local.set $7 @@ -4338,10 +4317,7 @@ local.set $5 loop $for-loop|8 local.get $5 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 50 i32.lt_s local.set $8 @@ -5633,10 +5609,7 @@ local.get $3 i32.load16_s local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eq else i32.const 0 @@ -5679,10 +5652,7 @@ i32.eq drop local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.0 end @@ -5879,10 +5849,7 @@ i32.eq drop local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.1 end @@ -6238,10 +6205,7 @@ i32.eq drop local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.3 end @@ -6366,10 +6330,7 @@ local.set $1 loop $for-loop|1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 100 i32.lt_s local.set $3 @@ -6428,10 +6389,7 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 100 i32.lt_s local.set $4 @@ -6546,10 +6504,7 @@ local.set $5 loop $for-loop|6 local.get $5 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 50 i32.lt_s local.set $7 @@ -6608,10 +6563,7 @@ local.set $5 loop $for-loop|8 local.get $5 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 50 i32.lt_s local.set $8 diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 3d7a75457b..27c2c9e448 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -314,7 +314,7 @@ (data (i32.const 12464) "\n\00\00\00\01\00\00\00\00\00\00\00\n\00\00\00\00\ff\00\00\00d\n\ff\ff") (data (i32.const 12496) "\n\00\00\00\01\00\00\00\00\00\00\00\n\00\00\00\01\ffd\ff\00\00d\n\ff") (table $0 123 funcref) - (elem (i32.const 1) $~lib/util/sort/COMPARATOR~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float64Array,f64>~anonymous|0) + (elem (i32.const 1) $~lib/util/sort/COMPARATOR~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint16Array,u16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float64Array,f64>~anonymous|0) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) (global $~argumentsLength (mut i32) (i32.const 0)) @@ -5525,10 +5525,7 @@ ) (func $std/typedarray/testArrayFilter<~lib/typedarray/Int8Array,i8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 2 i32.gt_s ) @@ -6208,10 +6205,7 @@ ) (func $std/typedarray/testArrayFilter<~lib/typedarray/Int16Array,i16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 2 i32.gt_s ) @@ -7838,8 +7832,7 @@ ) (func $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.const 255 - i32.and + i32.extend8_s i32.const 2 i32.eq ) @@ -7906,10 +7899,16 @@ call $~lib/rt/pure/__release ) (func $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + i32.extend8_s + i32.eqz + ) + (func $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 i32.const 255 i32.and - i32.eqz + i32.const 2 + i32.eq ) (func $~lib/typedarray/Uint8Array#some (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -7973,10 +7972,15 @@ local.get $3 call $~lib/rt/pure/__release ) - (func $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.const 65535 + i32.const 255 i32.and + i32.eqz + ) + (func $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + i32.extend16_s i32.const 2 i32.eq ) @@ -8047,10 +8051,16 @@ call $~lib/rt/pure/__release ) (func $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + i32.extend16_s + i32.eqz + ) + (func $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 i32.const 65535 i32.and - i32.eqz + i32.const 2 + i32.eq ) (func $~lib/typedarray/Uint16Array#some (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -8118,6 +8128,12 @@ local.get $3 call $~lib/rt/pure/__release ) + (func $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + i32.const 65535 + i32.and + i32.eqz + ) (func $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 i32.const 2 @@ -8485,8 +8501,7 @@ ) (func $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.const 255 - i32.and + i32.extend8_s i32.const 4 i32.eq ) @@ -8553,6 +8568,13 @@ call $~lib/rt/pure/__release local.get $2 ) + (func $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint8Array,u8>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + i32.const 255 + i32.and + i32.const 4 + i32.eq + ) (func $~lib/typedarray/Int16Array#findIndex (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) @@ -8622,8 +8644,7 @@ ) (func $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.const 65535 - i32.and + i32.extend16_s i32.const 4 i32.eq ) @@ -8694,6 +8715,13 @@ call $~lib/rt/pure/__release local.get $2 ) + (func $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint16Array,u16>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $0 + i32.const 65535 + i32.and + i32.const 4 + i32.eq + ) (func $~lib/typedarray/Int32Array#findIndex (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) @@ -8986,12 +9014,10 @@ local.get $2 call $~lib/rt/pure/__retain local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 2 i32.rem_s + i32.extend8_s i32.eqz local.set $0 call $~lib/rt/pure/__release @@ -9133,12 +9159,10 @@ local.get $2 call $~lib/rt/pure/__retain local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 2 i32.rem_s + i32.extend16_s i32.eqz local.set $0 call $~lib/rt/pure/__release @@ -9892,6 +9916,54 @@ call $~lib/rt/pure/__release ) (func $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) + local.get $2 + call $~lib/rt/pure/__retain + local.set $2 + local.get $0 + i32.extend8_s + i32.const 6256 + local.get $1 + call $~lib/array/Array#__get + i32.extend8_s + i32.ne + if + i32.const 0 + i32.const 1312 + i32.const 490 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $1 + global.get $std/typedarray/forEachCallCount + i32.ne + if + i32.const 0 + i32.const 1312 + i32.const 491 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $2 + global.get $std/typedarray/forEachSelf + i32.ne + if + i32.const 0 + i32.const 1312 + i32.const 492 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + global.get $std/typedarray/forEachCallCount + i32.const 1 + i32.add + global.set $std/typedarray/forEachCallCount + local.get $2 + call $~lib/rt/pure/__release + ) + (func $std/typedarray/testArrayForEach<~lib/typedarray/Uint8Array,u8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) local.get $2 call $~lib/rt/pure/__retain local.set $2 @@ -9993,6 +10065,54 @@ call $~lib/rt/pure/__release ) (func $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) + local.get $2 + call $~lib/rt/pure/__retain + local.set $2 + local.get $0 + i32.extend16_s + i32.const 6256 + local.get $1 + call $~lib/array/Array#__get + i32.extend16_s + i32.ne + if + i32.const 0 + i32.const 1312 + i32.const 490 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $1 + global.get $std/typedarray/forEachCallCount + i32.ne + if + i32.const 0 + i32.const 1312 + i32.const 491 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $2 + global.get $std/typedarray/forEachSelf + i32.ne + if + i32.const 0 + i32.const 1312 + i32.const 492 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + global.get $std/typedarray/forEachCallCount + i32.const 1 + i32.add + global.set $std/typedarray/forEachCallCount + local.get $2 + call $~lib/rt/pure/__release + ) + (func $std/typedarray/testArrayForEach<~lib/typedarray/Uint16Array,u16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) local.get $2 call $~lib/rt/pure/__retain local.set $2 @@ -10418,20 +10538,14 @@ i32.const 6704 local.get $0 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $3 local.get $0 i32.const 6704 local.get $0 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $0 i32.const 1 @@ -10460,10 +10574,7 @@ local.get $0 i32.sub call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.ne if i32.const 0 @@ -11203,20 +11314,14 @@ i32.const 6704 local.get $0 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $3 local.get $0 i32.const 6704 local.get $0 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $0 i32.const 1 @@ -11245,10 +11350,7 @@ local.get $0 i32.sub call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.ne if i32.const 0 @@ -13096,10 +13198,9 @@ local.get $2 local.get $4 i32.add - i32.load8_u + i32.load8_s local.get $1 - i32.const 255 - i32.and + i32.extend8_s i32.eq if local.get $0 @@ -13163,10 +13264,9 @@ local.get $2 local.get $3 i32.add - i32.load8_u + i32.load8_s local.get $1 - i32.const 255 - i32.and + i32.extend8_s i32.eq if local.get $0 @@ -13232,10 +13332,7 @@ i32.const 6800 local.get $1 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $1 i32.const 1 @@ -13633,6 +13730,165 @@ local.get $1 call $~lib/rt/pure/__release ) + (func $~lib/typedarray/Uint8Array#indexOf (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + block $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 + local.get $2 + local.get $0 + call $~lib/rt/pure/__retain + local.tee $0 + i32.load offset=8 + local.tee $3 + i32.ge_s + i32.const 1 + local.get $3 + select + if + local.get $0 + call $~lib/rt/pure/__release + i32.const -1 + local.set $2 + br $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 + end + local.get $2 + i32.const 0 + i32.lt_s + if + local.get $2 + local.get $3 + i32.add + local.tee $2 + i32.const 0 + local.get $2 + i32.const 0 + i32.gt_s + select + local.set $2 + end + local.get $0 + i32.load offset=4 + local.set $4 + loop $while-continue|0 + local.get $2 + local.get $3 + i32.lt_s + if + local.get $2 + local.get $4 + i32.add + i32.load8_u + local.get $1 + i32.const 255 + i32.and + i32.eq + if + local.get $0 + call $~lib/rt/pure/__release + br $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 + end + local.get $2 + i32.const 1 + i32.add + local.set $2 + br $while-continue|0 + end + end + local.get $0 + call $~lib/rt/pure/__release + i32.const -1 + local.set $2 + end + local.get $2 + ) + (func $~lib/typedarray/Uint8Array#lastIndexOf (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + block $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 + local.get $0 + call $~lib/rt/pure/__retain + local.tee $0 + i32.load offset=8 + local.tee $3 + i32.eqz + if + local.get $0 + call $~lib/rt/pure/__release + i32.const -1 + local.set $2 + br $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 + end + local.get $2 + local.get $3 + i32.add + local.get $3 + i32.const 1 + i32.sub + local.get $2 + local.get $2 + local.get $3 + i32.ge_s + select + local.get $2 + i32.const 0 + i32.lt_s + select + local.set $2 + local.get $0 + i32.load offset=4 + local.set $3 + loop $while-continue|0 + local.get $2 + i32.const 0 + i32.ge_s + if + local.get $2 + local.get $3 + i32.add + i32.load8_u + local.get $1 + i32.const 255 + i32.and + i32.eq + if + local.get $0 + call $~lib/rt/pure/__release + br $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 + end + local.get $2 + i32.const 1 + i32.sub + local.set $2 + br $while-continue|0 + end + end + local.get $0 + call $~lib/rt/pure/__release + i32.const -1 + local.set $2 + end + local.get $2 + ) + (func $~lib/typedarray/Uint8Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + block $1of1 + block $0of1 + block $outOfRange + global.get $~argumentsLength + i32.const 1 + i32.sub + br_table $0of1 $1of1 $outOfRange + end + unreachable + end + local.get $0 + i32.load offset=8 + local.set $2 + end + local.get $0 + local.get $1 + local.get $2 + call $~lib/typedarray/Uint8Array#lastIndexOf + ) (func $std/typedarray/testArrayIndexOfAndLastIndexOf<~lib/typedarray/Uint8Array,u8> (local $0 i32) (local $1 i32) @@ -13670,7 +13926,7 @@ local.get $0 i32.const 0 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf if i32.const 0 i32.const 1312 @@ -13682,7 +13938,7 @@ local.get $0 i32.const 11 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -13696,7 +13952,7 @@ local.get $0 i32.const -1 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -13710,7 +13966,7 @@ local.get $0 i32.const 3 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 3 i32.ne if @@ -13724,7 +13980,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 3 i32.ne if @@ -13738,7 +13994,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 3 i32.ne if @@ -13752,7 +14008,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -13766,7 +14022,7 @@ local.get $0 i32.const 1 i32.const 10 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -13780,7 +14036,7 @@ local.get $0 i32.const 1 i32.const -100 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 1 i32.ne if @@ -13795,7 +14051,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Int8Array#lastIndexOf@varargs + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -13808,7 +14064,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Int8Array#lastIndexOf@varargs + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -13823,7 +14079,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Int8Array#lastIndexOf@varargs + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -13838,7 +14094,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Int8Array#lastIndexOf@varargs + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -13852,7 +14108,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const 3 i32.ne if @@ -13866,7 +14122,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const 3 i32.ne if @@ -13880,7 +14136,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const -1 i32.ne if @@ -13894,7 +14150,7 @@ local.get $0 i32.const 1 i32.const 100 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const 1 i32.ne if @@ -13908,7 +14164,7 @@ local.get $0 i32.const 1 i32.const -10 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const 1 i32.ne if @@ -13922,7 +14178,7 @@ local.get $0 i32.const 1 i32.const -11 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const -1 i32.ne if @@ -13939,7 +14195,7 @@ local.tee $1 i32.const 3 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -13953,7 +14209,7 @@ local.get $1 i32.const 4 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf if i32.const 0 i32.const 1312 @@ -13965,7 +14221,7 @@ local.get $1 i32.const 5 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 1 i32.ne if @@ -13979,7 +14235,7 @@ local.get $1 i32.const 9 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -13993,7 +14249,7 @@ local.get $1 i32.const 10 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14007,7 +14263,7 @@ local.get $1 i32.const 11 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14021,7 +14277,7 @@ local.get $1 i32.const 5 i32.const 1 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 1 i32.ne if @@ -14035,7 +14291,7 @@ local.get $1 i32.const 5 i32.const 2 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14092,7 +14348,7 @@ local.get $0 i32.const 0 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf if i32.const 0 i32.const 1312 @@ -14104,7 +14360,7 @@ local.get $0 i32.const 11 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14118,7 +14374,7 @@ local.get $0 i32.const -1 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14132,7 +14388,7 @@ local.get $0 i32.const 3 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 3 i32.ne if @@ -14146,7 +14402,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 3 i32.ne if @@ -14160,7 +14416,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 3 i32.ne if @@ -14174,7 +14430,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14188,7 +14444,7 @@ local.get $0 i32.const 1 i32.const 10 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14202,7 +14458,7 @@ local.get $0 i32.const 1 i32.const -100 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 1 i32.ne if @@ -14217,7 +14473,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Int8Array#lastIndexOf@varargs + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -14230,7 +14486,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Int8Array#lastIndexOf@varargs + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -14245,7 +14501,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Int8Array#lastIndexOf@varargs + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -14260,7 +14516,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Int8Array#lastIndexOf@varargs + call $~lib/typedarray/Uint8Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -14274,7 +14530,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const 3 i32.ne if @@ -14288,7 +14544,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const 3 i32.ne if @@ -14302,7 +14558,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const -1 i32.ne if @@ -14316,7 +14572,7 @@ local.get $0 i32.const 1 i32.const 100 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const 1 i32.ne if @@ -14330,7 +14586,7 @@ local.get $0 i32.const 1 i32.const -10 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const 1 i32.ne if @@ -14344,7 +14600,7 @@ local.get $0 i32.const 1 i32.const -11 - call $~lib/typedarray/Int8Array#lastIndexOf + call $~lib/typedarray/Uint8Array#lastIndexOf i32.const -1 i32.ne if @@ -14361,7 +14617,7 @@ local.tee $1 i32.const 3 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14375,7 +14631,7 @@ local.get $1 i32.const 4 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf if i32.const 0 i32.const 1312 @@ -14387,7 +14643,7 @@ local.get $1 i32.const 5 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 1 i32.ne if @@ -14401,7 +14657,7 @@ local.get $1 i32.const 9 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14415,7 +14671,7 @@ local.get $1 i32.const 10 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14429,7 +14685,7 @@ local.get $1 i32.const 11 i32.const 0 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14443,7 +14699,7 @@ local.get $1 i32.const 5 i32.const 1 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const 1 i32.ne if @@ -14457,7 +14713,7 @@ local.get $1 i32.const 5 i32.const 2 - call $~lib/typedarray/Int8Array#indexOf + call $~lib/typedarray/Uint8Array#indexOf i32.const -1 i32.ne if @@ -14528,10 +14784,9 @@ i32.const 1 i32.shl i32.add - i32.load16_u + i32.load16_s local.get $1 - i32.const 65535 - i32.and + i32.extend16_s i32.eq if local.get $0 @@ -14599,10 +14854,9 @@ i32.const 1 i32.shl i32.add - i32.load16_u + i32.load16_s local.get $1 - i32.const 65535 - i32.and + i32.extend16_s i32.eq if local.get $0 @@ -14670,10 +14924,7 @@ i32.const 6800 local.get $1 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $1 i32.const 1 @@ -15070,6 +15321,175 @@ local.get $1 call $~lib/rt/pure/__release ) + (func $~lib/typedarray/Uint16Array#indexOf (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + block $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 + local.get $2 + local.get $0 + call $~lib/rt/pure/__retain + local.tee $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + local.tee $3 + i32.ge_s + i32.const 1 + local.get $3 + select + if + local.get $0 + call $~lib/rt/pure/__release + i32.const -1 + local.set $2 + br $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 + end + local.get $2 + i32.const 0 + i32.lt_s + if + local.get $2 + local.get $3 + i32.add + local.tee $2 + i32.const 0 + local.get $2 + i32.const 0 + i32.gt_s + select + local.set $2 + end + local.get $0 + i32.load offset=4 + local.set $4 + loop $while-continue|0 + local.get $2 + local.get $3 + i32.lt_s + if + local.get $4 + local.get $2 + i32.const 1 + i32.shl + i32.add + i32.load16_u + local.get $1 + i32.const 65535 + i32.and + i32.eq + if + local.get $0 + call $~lib/rt/pure/__release + br $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 + end + local.get $2 + i32.const 1 + i32.add + local.set $2 + br $while-continue|0 + end + end + local.get $0 + call $~lib/rt/pure/__release + i32.const -1 + local.set $2 + end + local.get $2 + ) + (func $~lib/typedarray/Uint16Array#lastIndexOf (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + block $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 + local.get $0 + call $~lib/rt/pure/__retain + local.tee $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + local.tee $3 + i32.eqz + if + local.get $0 + call $~lib/rt/pure/__release + i32.const -1 + local.set $2 + br $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 + end + local.get $2 + local.get $3 + i32.add + local.get $3 + i32.const 1 + i32.sub + local.get $2 + local.get $2 + local.get $3 + i32.ge_s + select + local.get $2 + i32.const 0 + i32.lt_s + select + local.set $2 + local.get $0 + i32.load offset=4 + local.set $3 + loop $while-continue|0 + local.get $2 + i32.const 0 + i32.ge_s + if + local.get $3 + local.get $2 + i32.const 1 + i32.shl + i32.add + i32.load16_u + local.get $1 + i32.const 65535 + i32.and + i32.eq + if + local.get $0 + call $~lib/rt/pure/__release + br $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 + end + local.get $2 + i32.const 1 + i32.sub + local.set $2 + br $while-continue|0 + end + end + local.get $0 + call $~lib/rt/pure/__release + i32.const -1 + local.set $2 + end + local.get $2 + ) + (func $~lib/typedarray/Uint16Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + block $1of1 + block $0of1 + block $outOfRange + global.get $~argumentsLength + i32.const 1 + i32.sub + br_table $0of1 $1of1 $outOfRange + end + unreachable + end + local.get $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + local.set $2 + end + local.get $0 + local.get $1 + local.get $2 + call $~lib/typedarray/Uint16Array#lastIndexOf + ) (func $std/typedarray/testArrayIndexOfAndLastIndexOf<~lib/typedarray/Uint16Array,u16> (local $0 i32) (local $1 i32) @@ -15107,7 +15527,7 @@ local.get $0 i32.const 0 i32.const 0 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf if i32.const 0 i32.const 1312 @@ -15119,7 +15539,7 @@ local.get $0 i32.const 11 i32.const 0 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const -1 i32.ne if @@ -15133,7 +15553,7 @@ local.get $0 i32.const -1 i32.const 0 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const -1 i32.ne if @@ -15147,7 +15567,7 @@ local.get $0 i32.const 3 i32.const 0 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const 3 i32.ne if @@ -15161,7 +15581,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const 3 i32.ne if @@ -15175,7 +15595,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const 3 i32.ne if @@ -15189,7 +15609,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const -1 i32.ne if @@ -15203,7 +15623,7 @@ local.get $0 i32.const 1 i32.const 10 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const -1 i32.ne if @@ -15217,7 +15637,7 @@ local.get $0 i32.const 1 i32.const -100 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const 1 i32.ne if @@ -15232,7 +15652,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Int16Array#lastIndexOf@varargs + call $~lib/typedarray/Uint16Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -15245,7 +15665,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Int16Array#lastIndexOf@varargs + call $~lib/typedarray/Uint16Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -15260,7 +15680,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Int16Array#lastIndexOf@varargs + call $~lib/typedarray/Uint16Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -15275,7 +15695,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Int16Array#lastIndexOf@varargs + call $~lib/typedarray/Uint16Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -15289,7 +15709,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Int16Array#lastIndexOf + call $~lib/typedarray/Uint16Array#lastIndexOf i32.const 3 i32.ne if @@ -15303,7 +15723,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Int16Array#lastIndexOf + call $~lib/typedarray/Uint16Array#lastIndexOf i32.const 3 i32.ne if @@ -15317,7 +15737,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Int16Array#lastIndexOf + call $~lib/typedarray/Uint16Array#lastIndexOf i32.const -1 i32.ne if @@ -15331,7 +15751,7 @@ local.get $0 i32.const 1 i32.const 100 - call $~lib/typedarray/Int16Array#lastIndexOf + call $~lib/typedarray/Uint16Array#lastIndexOf i32.const 1 i32.ne if @@ -15345,7 +15765,7 @@ local.get $0 i32.const 1 i32.const -10 - call $~lib/typedarray/Int16Array#lastIndexOf + call $~lib/typedarray/Uint16Array#lastIndexOf i32.const 1 i32.ne if @@ -15359,7 +15779,7 @@ local.get $0 i32.const 1 i32.const -11 - call $~lib/typedarray/Int16Array#lastIndexOf + call $~lib/typedarray/Uint16Array#lastIndexOf i32.const -1 i32.ne if @@ -15376,7 +15796,7 @@ local.tee $1 i32.const 3 i32.const 0 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const -1 i32.ne if @@ -15390,7 +15810,7 @@ local.get $1 i32.const 4 i32.const 0 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf if i32.const 0 i32.const 1312 @@ -15402,7 +15822,7 @@ local.get $1 i32.const 5 i32.const 0 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const 1 i32.ne if @@ -15416,7 +15836,7 @@ local.get $1 i32.const 9 i32.const 0 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const -1 i32.ne if @@ -15430,7 +15850,7 @@ local.get $1 i32.const 10 i32.const 0 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const -1 i32.ne if @@ -15444,7 +15864,7 @@ local.get $1 i32.const 11 i32.const 0 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const -1 i32.ne if @@ -15458,7 +15878,7 @@ local.get $1 i32.const 5 i32.const 1 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const 1 i32.ne if @@ -15472,7 +15892,7 @@ local.get $1 i32.const 5 i32.const 2 - call $~lib/typedarray/Int16Array#indexOf + call $~lib/typedarray/Uint16Array#indexOf i32.const -1 i32.ne if @@ -18800,10 +19220,7 @@ (func $~lib/util/number/itoa_buffered (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 0 i32.lt_s local.tee $2 @@ -18817,10 +19234,7 @@ local.set $1 end local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 10 i32.lt_u if @@ -18830,10 +19244,7 @@ i32.shl i32.add local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 48 i32.or i32.store16 @@ -18842,21 +19253,17 @@ i32.add return end - local.get $2 + local.get $0 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - local.tee $2 + i32.extend8_s + local.get $1 + i32.extend8_s call $~lib/util/number/decimalCount32 - i32.add - local.set $1 - local.get $0 local.get $2 - local.get $1 + i32.add + local.tee $0 call $~lib/util/number/utoa_dec_simple - local.get $1 + local.get $0 ) (func $~lib/string/String#substring (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -19384,10 +19791,7 @@ (func $~lib/util/number/itoa_buffered (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 0 i32.lt_s local.tee $2 @@ -19401,10 +19805,7 @@ local.set $1 end local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 10 i32.lt_u if @@ -19414,10 +19815,7 @@ i32.shl i32.add local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 48 i32.or i32.store16 @@ -19426,21 +19824,17 @@ i32.add return end - local.get $2 + local.get $0 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - local.tee $2 + i32.extend16_s + local.get $1 + i32.extend16_s call $~lib/util/number/decimalCount32 - i32.add - local.set $1 - local.get $0 local.get $2 - local.get $1 + i32.add + local.tee $0 call $~lib/util/number/utoa_dec_simple - local.get $1 + local.get $0 ) (func $~lib/util/string/joinIntegerArray (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -22143,10 +22537,7 @@ i32.const 8432 local.get $0 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $0 i32.const 1 @@ -22496,10 +22887,7 @@ i32.const 8432 local.get $0 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $0 i32.const 1 @@ -31869,8 +32257,7 @@ block $folding-inner3 block $folding-inner2 local.get $3 - i32.const 255 - i32.and + i32.extend8_s i32.const 6 i32.ne br_if $folding-inner2 @@ -32004,8 +32391,7 @@ i32.const 2800 call $~lib/rt/pure/__release local.get $3 - i32.const 65535 - i32.and + i32.extend16_s i32.const 6 i32.ne br_if $folding-inner2 @@ -32412,8 +32798,7 @@ i32.const 3056 call $~lib/rt/pure/__release local.get $3 - i32.const 255 - i32.and + i32.extend8_s i32.const 6 i32.ne br_if $folding-inner3 @@ -32547,8 +32932,7 @@ i32.const 3152 call $~lib/rt/pure/__release local.get $3 - i32.const 65535 - i32.and + i32.extend16_s i32.const 6 i32.ne br_if $folding-inner3 @@ -34370,30 +34754,21 @@ i32.const 6256 i32.const 0 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $0 i32.const 1 i32.const 6256 i32.const 1 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $0 i32.const 2 i32.const 6256 i32.const 2 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set i32.const 0 local.set $1 @@ -34545,30 +34920,21 @@ i32.const 6256 i32.const 0 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $0 i32.const 1 i32.const 6256 i32.const 1 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $0 i32.const 2 i32.const 6256 i32.const 2 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set i32.const 0 local.set $1 diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 09e9e6da94..183f5399f9 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -6126,10 +6126,7 @@ call $~lib/typedarray/Int8Array#reduce local.set $2 local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 6 i32.eq i32.eqz @@ -6553,10 +6550,7 @@ call $~lib/typedarray/Int16Array#reduce local.set $2 local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 6 i32.eq i32.eqz @@ -7682,10 +7676,7 @@ call $~lib/typedarray/Int8Array#reduceRight local.set $2 local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 6 i32.eq i32.eqz @@ -8062,10 +8053,7 @@ call $~lib/typedarray/Int16Array#reduceRight local.set $2 local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 6 i32.eq i32.eqz @@ -11132,10 +11120,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 2 i32.gt_s local.set $3 @@ -11983,10 +11968,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 2 i32.gt_s local.set $3 @@ -13885,10 +13867,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 2 i32.eq local.set $3 @@ -13978,10 +13957,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 0 i32.eq local.set $3 @@ -14384,10 +14360,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 2 i32.eq local.set $3 @@ -14477,10 +14450,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 0 i32.eq local.set $3 @@ -15684,10 +15654,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 2 i32.eq local.set $3 @@ -15777,10 +15744,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 4 i32.eq local.set $3 @@ -16186,10 +16150,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 2 i32.eq local.set $3 @@ -16279,10 +16240,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 4 i32.eq local.set $3 @@ -17494,12 +17452,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 2 i32.rem_s + i32.extend8_s i32.const 0 i32.eq local.set $3 @@ -17592,10 +17548,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 2 i32.eq local.set $3 @@ -18008,12 +17961,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 2 i32.rem_s + i32.extend16_s i32.const 0 i32.eq local.set $3 @@ -18106,10 +18057,7 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 2 i32.eq local.set $3 @@ -19880,15 +19828,9 @@ call $~lib/array/Array#__get local.set $3 local.get $0 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s local.get $3 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -20006,30 +19948,21 @@ global.get $std/typedarray/forEachValues i32.const 0 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $1 i32.const 1 global.get $std/typedarray/forEachValues i32.const 1 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $1 i32.const 2 global.get $std/typedarray/forEachValues i32.const 2 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $1 i32.const 5280 @@ -20403,15 +20336,9 @@ call $~lib/array/Array#__get local.set $3 local.get $0 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s local.get $3 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eq i32.eqz if @@ -20529,30 +20456,21 @@ global.get $std/typedarray/forEachValues i32.const 0 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $1 i32.const 1 global.get $std/typedarray/forEachValues i32.const 1 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $1 i32.const 2 global.get $std/typedarray/forEachValues i32.const 2 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $1 i32.const 5376 @@ -21833,20 +21751,14 @@ local.get $0 local.get $6 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $5 local.get $6 local.get $0 local.get $6 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $6 i32.const 1 @@ -21877,10 +21789,7 @@ local.get $6 i32.sub call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq i32.eqz if @@ -22889,20 +22798,14 @@ local.get $0 local.get $6 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $5 local.get $6 local.get $0 local.get $6 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $6 i32.const 1 @@ -22933,10 +22836,7 @@ local.get $6 i32.sub call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eq i32.eqz if @@ -25317,10 +25217,7 @@ i32.add i32.load8_s local.get $4 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq if local.get $6 @@ -25413,10 +25310,7 @@ i32.add i32.load8_s local.get $4 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.eq if local.get $6 @@ -25494,10 +25388,7 @@ local.get $0 local.get $4 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $4 i32.const 1 @@ -27390,10 +27281,7 @@ i32.add i32.load16_s local.get $4 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eq if local.get $6 @@ -27486,10 +27374,7 @@ i32.add i32.load16_s local.get $4 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.eq if local.get $6 @@ -27567,10 +27452,7 @@ local.get $0 local.get $4 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $4 i32.const 1 @@ -33608,10 +33490,7 @@ i32.const 1 drop local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 0 i32.lt_s local.set $2 @@ -33636,10 +33515,7 @@ i32.le_u drop local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 10 i32.lt_u if @@ -33649,10 +33525,7 @@ i32.shl i32.add local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s i32.const 48 i32.or i32.store16 @@ -33669,20 +33542,14 @@ drop local.get $3 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/util/number/decimalCount32 i32.add local.set $3 local.get $0 local.set $6 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s local.set $5 local.get $3 local.set $4 @@ -34787,10 +34654,7 @@ i32.const 1 drop local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 0 i32.lt_s local.set $2 @@ -34815,10 +34679,7 @@ i32.le_u drop local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 10 i32.lt_u if @@ -34828,10 +34689,7 @@ i32.shl i32.add local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s i32.const 48 i32.or i32.store16 @@ -34848,20 +34706,14 @@ drop local.get $3 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/util/number/decimalCount32 i32.add local.set $3 local.get $0 local.set $6 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s local.set $5 local.get $3 local.set $4 @@ -39583,10 +39435,7 @@ local.get $0 local.get $4 call $~lib/array/Array#__get - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s + i32.extend8_s call $~lib/typedarray/Int8Array#__set local.get $4 i32.const 1 @@ -40205,10 +40054,7 @@ local.get $0 local.get $4 call $~lib/array/Array#__get - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s + i32.extend16_s call $~lib/typedarray/Int16Array#__set local.get $4 i32.const 1 diff --git a/tests/features.json b/tests/features.json index aa20113fe6..d769b2257d 100644 --- a/tests/features.json +++ b/tests/features.json @@ -22,7 +22,14 @@ "--enable reference-types" ], "v8_flags": [ - "--experimental-wasm-reftypes" + ] + }, + "anyref": { + "asc_flags": [ + "--enable anyref" + ], + "v8_flags": [ + "--experimental-wasm-anyref" ] }, "bigint-integration": { From 3c4dcd72e5bad8a0ecbb425648c7843b4fd194e5 Mon Sep 17 00:00:00 2001 From: dcode Date: Wed, 16 Sep 2020 07:46:09 +0200 Subject: [PATCH 2/7] assignability --- src/compiler.ts | 11 ++++++++++- tests/compiler/features/reference-types.ts | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/compiler.ts b/src/compiler.ts index 9af329f55a..c8d0e8f074 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -3625,12 +3625,21 @@ export class Compiler extends DiagnosticEmitter { fromType = fromType.nonNullableType; } if (fromType.isAssignableTo(toType)) { // downcast or same - assert(fromType.kind == toType.kind); + assert(toType.isExternalReference || fromType.kind == toType.kind); this.currentType = toType; return expr; } if (explicit && toType.nonNullableType.isAssignableTo(fromType)) { // upcast // (maybeCat) + if (toType.isExternalReference) { + this.error( + DiagnosticCode.Not_implemented_0, + reportNode.range, + "ref.cast" + ); + this.currentType = toType; + return module.unreachable(); + } assert(fromType.kind == toType.kind); if (!this.options.noAssert) { expr = this.makeRuntimeUpcastCheck(expr, fromType, toType, reportNode); diff --git a/tests/compiler/features/reference-types.ts b/tests/compiler/features/reference-types.ts index 8eab60fb08..9077879553 100644 --- a/tests/compiler/features/reference-types.ts +++ b/tests/compiler/features/reference-types.ts @@ -80,3 +80,12 @@ assert(otherFuncGlobal); let funcLocal: funcref = someFunc; assert(funcLocal); } + +// can assign any reference type to anyref + +anyGlobal = funcGlobal; +anyGlobal = externGlobal; +anyGlobal = exnGlobal; + +// TODO: Not implemented: ref.cast +// exnGlobal = anyGlobal; From 270a3311467731fcdadd315801ceb69d00ddf38e Mon Sep 17 00:00:00 2001 From: dcode Date: Wed, 16 Sep 2020 11:03:17 +0200 Subject: [PATCH 3/7] forward --- package-lock.json | 6 +- package.json | 2 +- tests/compiler/number.optimized.wat | 8 +- .../resolve-elementaccess.optimized.wat | 2 +- tests/compiler/std/array.optimized.wat | 2 +- tests/compiler/std/map.optimized.wat | 6 +- tests/compiler/std/math.optimized.wat | 614 +++++++++--------- tests/compiler/std/mod.optimized.wat | 4 +- tests/compiler/std/set.optimized.wat | 4 +- tests/compiler/std/string.optimized.wat | 6 +- tests/compiler/std/typedarray.optimized.wat | 14 +- tests/compiler/wasi/trace.optimized.wat | 2 +- 12 files changed, 335 insertions(+), 335 deletions(-) diff --git a/package-lock.json b/package-lock.json index e8afafbe27..416c315d85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1163,9 +1163,9 @@ "optional": true }, "binaryen": { - "version": "96.0.0-nightly.20200915", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-96.0.0-nightly.20200915.tgz", - "integrity": "sha512-O5JxhwdxEJX7Jyx2HHzJe0ii9yDsLjoOHxakGUWn+r5cwAs8d44NjAdZQGAnEyW8+zUxRDmWX4Yk0CG2HL54Sg==" + "version": "96.0.0-nightly.20200916", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-96.0.0-nightly.20200916.tgz", + "integrity": "sha512-fn6HZVsCRYR6i4xX/8MKyhQ08EqxRITQGy1vny9yM5MOdSB+EiMpJ1DTL0vjwpY53Lfk8P3mf6q8hQUm5nE0yA==" }, "bluebird": { "version": "3.7.2", diff --git a/package.json b/package.json index 082caf87d4..ecb2d37065 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "url": "https://github.com/AssemblyScript/assemblyscript/issues" }, "dependencies": { - "binaryen": "96.0.0-nightly.20200915", + "binaryen": "96.0.0-nightly.20200916", "long": "^4.0.0", "source-map-support": "^0.5.19", "ts-node": "^6.2.0" diff --git a/tests/compiler/number.optimized.wat b/tests/compiler/number.optimized.wat index 91bd1ef485..6d8c3d16e2 100644 --- a/tests/compiler/number.optimized.wat +++ b/tests/compiler/number.optimized.wat @@ -1346,8 +1346,8 @@ ) (func $~lib/number/F32.isSafeInteger (param $0 f32) (result i32) local.get $0 - f32.trunc local.get $0 + f32.trunc f32.eq i32.const 0 local.get $0 @@ -1358,8 +1358,8 @@ ) (func $~lib/number/F32.isInteger (param $0 f32) (result i32) local.get $0 - f32.trunc local.get $0 + f32.trunc f32.eq i32.const 0 local.get $0 @@ -1371,8 +1371,8 @@ ) (func $~lib/number/F64.isSafeInteger (param $0 f64) (result i32) local.get $0 - f64.trunc local.get $0 + f64.trunc f64.eq i32.const 0 local.get $0 @@ -1383,8 +1383,8 @@ ) (func $~lib/number/F64.isInteger (param $0 f64) (result i32) local.get $0 - f64.trunc local.get $0 + f64.trunc f64.eq i32.const 0 local.get $0 diff --git a/tests/compiler/resolve-elementaccess.optimized.wat b/tests/compiler/resolve-elementaccess.optimized.wat index 7b40aaa0fe..b36e1a3f7a 100644 --- a/tests/compiler/resolve-elementaccess.optimized.wat +++ b/tests/compiler/resolve-elementaccess.optimized.wat @@ -1360,9 +1360,9 @@ local.tee $1 i32.trunc_f64_s local.tee $4 + local.get $1 local.get $4 f64.convert_i32_s - local.get $1 f64.ne i32.add i32.const 3 diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 2c5369cd70..3af5f13c15 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -8403,9 +8403,9 @@ local.tee $1 i32.trunc_f64_s local.tee $4 + local.get $1 local.get $4 f64.convert_i32_s - local.get $1 f64.ne i32.add i32.const 3 diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index b2694a99f4..9f2064769b 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -10513,9 +10513,9 @@ if (result i32) i32.const 0 else + local.get $1 local.get $0 f32.load - local.get $1 f32.eq end if @@ -11745,9 +11745,9 @@ if (result i32) i32.const 0 else + local.get $1 local.get $0 f64.load - local.get $1 f64.eq end if @@ -12339,9 +12339,9 @@ if (result i32) i32.const 0 else + local.get $1 local.get $3 f64.load - local.get $1 f64.eq end br_if $__inlined_func$~lib/map/Map#find diff --git a/tests/compiler/std/math.optimized.wat b/tests/compiler/std/math.optimized.wat index 2fed243e6f..67ca910887 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -517,44 +517,44 @@ ) (func $~lib/math/R (param $0 f64) (result f64) local.get $0 - f64.const 0.16666666666666666 local.get $0 - f64.const -0.3255658186224009 local.get $0 - f64.const 0.20121253213486293 local.get $0 - f64.const -0.04005553450067941 local.get $0 - f64.const 7.915349942898145e-04 local.get $0 f64.const 3.479331075960212e-05 f64.mul + f64.const 7.915349942898145e-04 f64.add f64.mul + f64.const -0.04005553450067941 f64.add f64.mul + f64.const 0.20121253213486293 f64.add f64.mul + f64.const -0.3255658186224009 f64.add f64.mul + f64.const 0.16666666666666666 f64.add f64.mul - f64.const 1 local.get $0 - f64.const -2.403394911734414 local.get $0 - f64.const 2.0209457602335057 local.get $0 - f64.const -0.6882839716054533 local.get $0 f64.const 0.07703815055590194 f64.mul + f64.const -0.6882839716054533 f64.add f64.mul + f64.const 2.0209457602335057 f64.add f64.mul + f64.const -2.403394911734414 f64.add f64.mul + f64.const 1 f64.add f64.div ) @@ -630,12 +630,11 @@ i32.const 31 i32.shr_u if - f64.const 2 f64.const 1.5707963267948966 - f64.const 0.5 local.get $0 f64.const 0.5 f64.mul + f64.const 0.5 f64.add local.tee $0 f64.sqrt @@ -648,10 +647,10 @@ f64.sub f64.add f64.sub + f64.const 2 f64.mul return end - f64.const 2 f64.const 0.5 local.get $0 f64.const 0.5 @@ -680,6 +679,7 @@ f64.div f64.add f64.add + f64.const 2 f64.mul ) (func $std/math/test_acos (param $0 f64) (param $1 f64) (param $2 f64) (result i32) @@ -700,20 +700,20 @@ ) (func $~lib/math/Rf (param $0 f32) (result f32) local.get $0 - f32.const 0.16666586697101593 local.get $0 - f32.const -0.04274342209100723 local.get $0 f32.const -0.008656363002955914 f32.mul + f32.const -0.04274342209100723 f32.add f32.mul + f32.const 0.16666586697101593 f32.add f32.mul - f32.const 1 local.get $0 f32.const -0.7066296339035034 f32.mul + f32.const 1 f32.add f32.div ) @@ -781,12 +781,11 @@ i32.const 31 i32.shr_u if - f32.const 2 f32.const 1.570796251296997 - f32.const 0.5 local.get $0 f32.const 0.5 f32.mul + f32.const 0.5 f32.add local.tee $0 f32.sqrt @@ -799,10 +798,10 @@ f32.sub f32.add f32.sub + f32.const 2 f32.mul return end - f32.const 2 f32.const 0.5 local.get $0 f32.const 0.5 @@ -831,6 +830,7 @@ f32.div f32.add f32.add + f32.const 2 f32.mul ) (func $std/math/test_acosf (param $0 f32) (param $1 f32) (param $2 f32) (result i32) @@ -915,8 +915,8 @@ end local.get $3 if - f64.const 1 local.get $0 + f64.const 1 f64.add i64.reinterpret_f64 local.tee $5 @@ -974,8 +974,8 @@ local.set $1 end local.get $1 - f64.const 2 local.get $1 + f64.const 2 f64.add f64.div local.tee $4 @@ -986,36 +986,36 @@ f64.mul local.set $0 local.get $4 - f64.const 0.5 local.get $1 + f64.const 0.5 f64.mul local.get $1 f64.mul local.tee $4 local.get $7 - f64.const 0.6666666666666735 local.get $0 - f64.const 0.2857142874366239 local.get $0 - f64.const 0.1818357216161805 local.get $0 f64.const 0.14798198605116586 f64.mul + f64.const 0.1818357216161805 f64.add f64.mul + f64.const 0.2857142874366239 f64.add f64.mul + f64.const 0.6666666666666735 f64.add f64.mul local.get $0 - f64.const 0.3999999999940942 local.get $0 - f64.const 0.22222198432149784 local.get $0 f64.const 0.15313837699209373 f64.mul + f64.const 0.22222198432149784 f64.add f64.mul + f64.const 0.3999999999940942 f64.add f64.mul f64.add @@ -1135,8 +1135,8 @@ f64.const 1 f64.sub local.tee $3 - f64.const 2 local.get $3 + f64.const 2 f64.add f64.div local.tee $4 @@ -1144,39 +1144,39 @@ f64.mul local.set $0 local.get $4 - f64.const 0.5 local.get $3 + f64.const 0.5 f64.mul local.get $3 f64.mul local.tee $4 local.get $0 - f64.const 0.6666666666666735 local.get $0 local.get $0 f64.mul local.tee $0 - f64.const 0.2857142874366239 local.get $0 - f64.const 0.1818357216161805 local.get $0 f64.const 0.14798198605116586 f64.mul + f64.const 0.1818357216161805 f64.add f64.mul + f64.const 0.2857142874366239 f64.add f64.mul + f64.const 0.6666666666666735 f64.add f64.mul local.get $0 - f64.const 0.3999999999940942 local.get $0 - f64.const 0.22222198432149784 local.get $0 f64.const 0.15313837699209373 f64.mul + f64.const 0.22222198432149784 f64.add f64.mul + f64.const 0.3999999999940942 f64.add f64.mul f64.add @@ -1224,8 +1224,8 @@ local.get $3 local.get $3 f64.mul - f64.const 2 local.get $3 + f64.const 2 f64.mul f64.add f64.sqrt @@ -1237,8 +1237,8 @@ i64.const 1049 i64.lt_u if - f64.const 2 local.get $0 + f64.const 2 f64.mul f64.const 1 local.get $0 @@ -1343,8 +1343,8 @@ end local.get $3 if - f32.const 1 local.get $0 + f32.const 1 f32.add local.tee $1 i32.reinterpret_f32 @@ -1390,8 +1390,8 @@ local.set $1 end local.get $1 - f32.const 2 local.get $1 + f32.const 2 f32.add f32.div local.tee $4 @@ -1402,24 +1402,24 @@ f32.mul local.set $0 local.get $4 - f32.const 0.5 local.get $1 + f32.const 0.5 f32.mul local.get $1 f32.mul local.tee $4 local.get $6 - f32.const 0.6666666269302368 local.get $0 f32.const 0.2849878668785095 f32.mul + f32.const 0.6666666269302368 f32.add f32.mul local.get $0 - f32.const 0.40000972151756287 local.get $0 f32.const 0.24279078841209412 f32.mul + f32.const 0.40000972151756287 f32.add f32.mul f32.add @@ -1517,8 +1517,8 @@ f32.const 1 f32.sub local.tee $0 - f32.const 2 local.get $0 + f32.const 2 f32.add f32.div local.tee $3 @@ -1526,27 +1526,27 @@ f32.mul local.set $2 local.get $3 - f32.const 0.5 local.get $0 + f32.const 0.5 f32.mul local.get $0 f32.mul local.tee $3 local.get $2 - f32.const 0.6666666269302368 local.get $2 local.get $2 f32.mul local.tee $2 f32.const 0.2849878668785095 f32.mul + f32.const 0.6666666269302368 f32.add f32.mul local.get $2 - f32.const 0.40000972151756287 local.get $2 f32.const 0.24279078841209412 f32.mul + f32.const 0.40000972151756287 f32.add f32.mul f32.add @@ -1602,8 +1602,8 @@ i32.const 1166016512 i32.lt_u if - f32.const 2 local.get $0 + f32.const 2 f32.mul f32.const 1 local.get $0 @@ -1711,25 +1711,24 @@ i32.ge_u if (result f64) f64.const 1.5707963267948966 - f64.const 2 local.get $0 local.get $0 local.get $3 f64.mul f64.add + f64.const 2 f64.mul f64.const 6.123233995736766e-17 f64.sub f64.sub else f64.const 0.7853981633974483 - f64.const 2 local.get $0 + f64.const 2 f64.mul local.get $3 f64.mul f64.const 6.123233995736766e-17 - f64.const 2 local.get $1 local.get $0 i64.reinterpret_f64 @@ -1744,12 +1743,13 @@ local.get $1 f64.add f64.div + f64.const 2 f64.mul f64.sub f64.sub f64.const 0.7853981633974483 - f64.const 2 local.get $1 + f64.const 2 f64.mul f64.sub f64.sub @@ -1840,7 +1840,6 @@ return end f64.const 1.5707963705062866 - f64.const 2 f32.const 0.5 local.get $1 f32.abs @@ -1857,6 +1856,7 @@ f64.promote_f32 f64.mul f64.add + f64.const 2 f64.mul f64.sub f32.demote_f64 @@ -1899,8 +1899,8 @@ i64.const 1024 i64.ge_u if (result f64) - f64.const 2 local.get $0 + f64.const 2 f64.mul f64.const 1 local.get $0 @@ -1977,8 +1977,8 @@ i32.const 1073741824 i32.ge_u if (result f32) - f32.const 2 local.get $0 + f32.const 2 f32.mul f32.const 1 local.get $0 @@ -2078,13 +2078,13 @@ i32.const 1072037888 i32.lt_u if (result f64) - f64.const 2 local.get $0 + f64.const 2 f64.mul f64.const 1 f64.sub - f64.const 2 local.get $0 + f64.const 2 f64.add f64.div else @@ -2108,10 +2108,10 @@ local.get $0 f64.const 1.5 f64.sub - f64.const 1 - f64.const 1.5 local.get $0 + f64.const 1.5 f64.mul + f64.const 1 f64.add f64.div else @@ -2133,45 +2133,45 @@ local.set $2 local.get $0 local.get $5 - f64.const 0.3333333333333293 local.get $2 - f64.const 0.14285714272503466 local.get $2 - f64.const 0.09090887133436507 local.get $2 - f64.const 0.06661073137387531 local.get $2 - f64.const 0.049768779946159324 local.get $2 f64.const 0.016285820115365782 f64.mul + f64.const 0.049768779946159324 f64.add f64.mul + f64.const 0.06661073137387531 f64.add f64.mul + f64.const 0.09090887133436507 f64.add f64.mul + f64.const 0.14285714272503466 f64.add f64.mul + f64.const 0.3333333333333293 f64.add f64.mul local.get $2 - f64.const -0.19999999999876483 local.get $2 - f64.const -0.11111110405462356 local.get $2 - f64.const -0.0769187620504483 local.get $2 - f64.const -0.058335701337905735 local.get $2 f64.const -0.036531572744216916 f64.mul + f64.const -0.058335701337905735 f64.add f64.mul + f64.const -0.0769187620504483 f64.add f64.mul + f64.const -0.11111110405462356 f64.add f64.mul + f64.const -0.19999999999876483 f64.add f64.mul f64.add @@ -2310,13 +2310,13 @@ i32.const 1060110336 i32.lt_u if (result f32) - f32.const 2 local.get $0 + f32.const 2 f32.mul f32.const 1 f32.sub - f32.const 2 local.get $0 + f32.const 2 f32.add f32.div else @@ -2340,10 +2340,10 @@ local.get $0 f32.const 1.5 f32.sub - f32.const 1 - f32.const 1.5 local.get $0 + f32.const 1.5 f32.mul + f32.const 1 f32.add f32.div else @@ -2365,21 +2365,21 @@ local.set $2 local.get $0 local.get $5 - f32.const 0.333333283662796 local.get $2 - f32.const 0.14253635704517365 local.get $2 f32.const 0.06168760731816292 f32.mul + f32.const 0.14253635704517365 f32.add f32.mul + f32.const 0.333333283662796 f32.add f32.mul local.get $2 - f32.const -0.19999158382415771 local.get $2 f32.const -0.106480173766613 f32.mul + f32.const -0.19999158382415771 f32.add f32.mul f32.add @@ -2478,9 +2478,8 @@ i64.const 991 i64.ge_u if (result f64) - f64.const 0.5 - f64.const 2 local.get $0 + f64.const 2 f64.mul local.tee $5 local.get $5 @@ -2492,20 +2491,21 @@ f64.div f64.add call $~lib/math/NativeMath.log1p + f64.const 0.5 f64.mul else local.get $0 end else - f64.const 0.5 - f64.const 2 local.get $0 f64.const 1 local.get $0 f64.sub f64.div + f64.const 2 f64.mul call $~lib/math/NativeMath.log1p + f64.const 0.5 f64.mul end local.get $3 @@ -2540,33 +2540,33 @@ i32.const 796917760 i32.ge_u if (result f32) - f32.const 0.5 - f32.const 2 local.get $0 + f32.const 2 f32.mul - f32.const 1 local.get $0 f32.const 1 local.get $0 f32.sub f32.div + f32.const 1 f32.add f32.mul call $~lib/math/NativeMathf.log1p + f32.const 0.5 f32.mul else local.get $0 end else - f32.const 0.5 - f32.const 2 local.get $0 f32.const 1 local.get $0 f32.sub f32.div + f32.const 2 f32.mul call $~lib/math/NativeMathf.log1p + f32.const 0.5 f32.mul end local.get $3 @@ -3079,24 +3079,24 @@ local.set $1 local.get $0 local.get $3 - f64.const 1.87595182427177 local.get $1 - f64.const -1.8849797954337717 local.get $1 f64.const 1.6214297201053545 f64.mul + f64.const -1.8849797954337717 f64.add f64.mul + f64.const 1.87595182427177 f64.add local.get $1 local.get $1 f64.mul local.get $1 f64.mul - f64.const -0.758397934778766 local.get $1 f64.const 0.14599619288661245 f64.mul + f64.const -0.758397934778766 f64.add f64.mul f64.add @@ -3117,8 +3117,8 @@ local.get $1 local.get $0 f64.sub - f64.const 2 local.get $0 + f64.const 2 f64.mul local.get $1 f64.add @@ -3495,15 +3495,15 @@ i64.shl i64.add local.tee $3 - f64.const 3.753184150245214e-04 local.get $2 f64.convert_i64_u + f64.const 3.753184150245214e-04 f64.mul - f64.const 3.834951969714103e-04 local.get $5 local.get $4 i64.shl f64.convert_i64_u + f64.const 3.834951969714103e-04 f64.mul f64.add i64.trunc_f64_u @@ -3517,7 +3517,6 @@ i64.add f64.convert_i64_u global.set $~lib/math/rempio2_y0 - f64.const 5.421010862427522e-20 local.get $2 local.get $5 i64.const 53 @@ -3528,6 +3527,7 @@ i64.or i64.add f64.convert_i64_u + f64.const 5.421010862427522e-20 f64.mul global.set $~lib/math/rempio2_y1 global.get $~lib/math/rempio2_y0 @@ -3590,11 +3590,11 @@ return end f64.const 1 - f64.const 0.5 local.get $0 local.get $0 f64.mul local.tee $3 + f64.const 0.5 f64.mul local.tee $4 f64.sub @@ -3606,14 +3606,14 @@ f64.sub local.get $3 local.get $3 - f64.const 0.0416666666666666 local.get $3 - f64.const -0.001388888888887411 local.get $3 f64.const 2.480158728947673e-05 f64.mul + f64.const -0.001388888888887411 f64.add f64.mul + f64.const 0.0416666666666666 f64.add f64.mul local.get $3 @@ -3622,14 +3622,14 @@ local.tee $4 local.get $4 f64.mul - f64.const -2.7557314351390663e-07 local.get $3 - f64.const 2.087572321298175e-09 local.get $3 f64.const -1.1359647557788195e-11 f64.mul + f64.const 2.087572321298175e-09 f64.add f64.mul + f64.const -2.7557314351390663e-07 f64.add f64.mul f64.add @@ -3788,38 +3788,38 @@ local.get $0 f64.mul local.tee $1 - f64.const -0.16666666666666632 local.get $3 - f64.const 0.00833333333332249 local.get $3 - f64.const -1.984126982985795e-04 local.get $3 f64.const 2.7557313707070068e-06 f64.mul + f64.const -1.984126982985795e-04 f64.add f64.mul + f64.const 0.00833333333332249 f64.add local.get $3 local.get $3 local.get $3 f64.mul f64.mul - f64.const -2.5050760253406863e-08 local.get $3 f64.const 1.58969099521155e-10 f64.mul + f64.const -2.5050760253406863e-08 f64.add f64.mul f64.add local.tee $7 f64.mul + f64.const -0.16666666666666632 f64.add f64.mul drop local.get $0 local.get $3 - f64.const 0.5 local.get $4 + f64.const 0.5 f64.mul local.get $1 local.get $7 @@ -3835,11 +3835,11 @@ f64.sub else f64.const 1 - f64.const 0.5 local.get $0 local.get $0 f64.mul local.tee $3 + f64.const 0.5 f64.mul local.tee $1 f64.sub @@ -3851,14 +3851,14 @@ f64.sub local.get $3 local.get $3 - f64.const 0.0416666666666666 local.get $3 - f64.const -0.001388888888887411 local.get $3 f64.const 2.480158728947673e-05 f64.mul + f64.const -0.001388888888887411 f64.add f64.mul + f64.const 0.0416666666666666 f64.add f64.mul local.get $3 @@ -3867,14 +3867,14 @@ local.tee $1 local.get $1 f64.mul - f64.const -2.7557314351390663e-07 local.get $3 - f64.const 2.087572321298175e-09 local.get $3 f64.const -1.1359647557788195e-11 f64.mul + f64.const 2.087572321298175e-09 f64.add f64.mul + f64.const -2.7557314351390663e-07 f64.add f64.mul f64.add @@ -3953,10 +3953,10 @@ local.get $4 f64.mul local.set $3 - f64.const 1 local.get $4 f64.const -0.499999997251031 f64.mul + f64.const 1 f64.add local.get $3 f64.const 0.04166662332373906 @@ -3965,10 +3965,10 @@ local.get $3 local.get $4 f64.mul - f64.const -0.001388676377460993 local.get $4 f64.const 2.439044879627741e-05 f64.mul + f64.const -0.001388676377460993 f64.add f64.mul f64.add @@ -4119,10 +4119,10 @@ local.get $3 f64.mul local.tee $3 - f64.const -0.16666666641626524 local.get $4 f64.const 0.008333329385889463 f64.mul + f64.const -0.16666666641626524 f64.add f64.mul f64.add @@ -4131,10 +4131,10 @@ local.get $4 f64.mul f64.mul - f64.const -1.9839334836096632e-04 local.get $4 f64.const 2.718311493989822e-06 f64.mul + f64.const -1.9839334836096632e-04 f64.add f64.mul f64.add @@ -4147,10 +4147,10 @@ local.get $4 f64.mul local.set $3 - f64.const 1 local.get $4 f64.const -0.499999997251031 f64.mul + f64.const 1 f64.add local.get $3 f64.const 0.04166662332373906 @@ -4159,10 +4159,10 @@ local.get $3 local.get $4 f64.mul - f64.const -0.001388676377460993 local.get $4 f64.const 2.439044879627741e-05 f64.mul + f64.const -0.001388676377460993 f64.add f64.mul f64.add @@ -4243,8 +4243,8 @@ i32.const 1 i32.shl i32.sub - f64.const 1.4426950408889634 local.get $0 + f64.const 1.4426950408889634 f64.mul f64.const 0.5 local.get $0 @@ -4283,8 +4283,8 @@ end end local.get $0 - f64.const 0.5 local.get $0 + f64.const 0.5 f64.mul local.tee $4 f64.mul @@ -4293,22 +4293,22 @@ f64.mul local.set $1 f64.const 3 - f64.const 1 local.get $5 f64.const -0.03333333333333313 f64.mul + f64.const 1 f64.add local.get $1 - f64.const 1.5873015872548146e-03 local.get $5 f64.const -7.93650757867488e-05 f64.mul + f64.const 1.5873015872548146e-03 f64.add local.get $1 - f64.const 4.008217827329362e-06 local.get $5 f64.const -2.0109921818362437e-07 f64.mul + f64.const 4.008217827329362e-06 f64.add f64.mul f64.add @@ -4357,10 +4357,10 @@ i32.const -1 i32.eq if - f64.const 0.5 local.get $0 local.get $3 f64.sub + f64.const 0.5 f64.mul f64.const 0.5 f64.sub @@ -4374,21 +4374,21 @@ f64.const -0.25 f64.lt if - f64.const -2 local.get $3 local.get $0 f64.const 0.5 f64.add f64.sub + f64.const -2 f64.mul return end - f64.const 1 - f64.const 2 local.get $0 local.get $3 f64.sub + f64.const 2 f64.mul + f64.const 1 f64.add return end @@ -4513,8 +4513,8 @@ i32.const 1072734898 i32.ge_u if (result i32) - f64.const 1.4426950408889634 local.get $0 + f64.const 1.4426950408889634 f64.mul f64.const 0.5 local.get $0 @@ -4548,8 +4548,8 @@ if (result f64) local.get $0 else - f64.const 1 local.get $0 + f64.const 1 f64.add return end @@ -4562,23 +4562,22 @@ local.get $3 f64.mul local.set $5 - f64.const 1 local.get $0 local.get $0 local.get $3 f64.const 0.16666666666666602 f64.mul local.get $5 - f64.const -2.7777777777015593e-03 local.get $3 f64.const 6.613756321437934e-05 f64.mul + f64.const -2.7777777777015593e-03 f64.add local.get $5 - f64.const -1.6533902205465252e-06 local.get $3 f64.const 4.1381367970572385e-08 f64.mul + f64.const -1.6533902205465252e-06 f64.add f64.mul f64.add @@ -4595,6 +4594,7 @@ f64.sub local.get $1 f64.add + f64.const 1 f64.add local.set $0 local.get $4 @@ -4632,18 +4632,18 @@ i32.lt_u br_if $__inlined_func$~lib/math/NativeMath.cosh drop - f64.const 1 local.get $3 call $~lib/math/NativeMath.expm1 local.tee $3 local.get $3 f64.mul - f64.const 2 - f64.const 2 local.get $3 + f64.const 2 f64.mul + f64.const 2 f64.add f64.div + f64.const 1 f64.add br $__inlined_func$~lib/math/NativeMath.cosh end @@ -4651,7 +4651,6 @@ i32.const 1082535490 i32.lt_u if - f64.const 0.5 local.get $3 call $~lib/math/NativeMath.exp local.tee $3 @@ -4659,6 +4658,7 @@ local.get $3 f64.div f64.add + f64.const 0.5 f64.mul br $__inlined_func$~lib/math/NativeMath.cosh end @@ -4737,8 +4737,8 @@ i32.const 1 i32.shl i32.sub - f32.const 1.4426950216293335 local.get $0 + f32.const 1.4426950216293335 f32.mul f32.const 0.5 local.get $0 @@ -4777,20 +4777,20 @@ end end f32.const 3 - f32.const 1 local.get $0 - f32.const 0.5 local.get $0 + f32.const 0.5 f32.mul local.tee $2 f32.mul local.tee $1 - f32.const -0.03333321213722229 local.get $1 f32.const 1.5807170420885086e-03 f32.mul + f32.const -0.03333321213722229 f32.add f32.mul + f32.const 1 f32.add local.tee $7 local.get $2 @@ -4835,10 +4835,10 @@ i32.const -1 i32.eq if - f32.const 0.5 local.get $0 local.get $1 f32.sub + f32.const 0.5 f32.mul f32.const 0.5 f32.sub @@ -4852,21 +4852,21 @@ f32.const -0.25 f32.lt if - f32.const -2 local.get $1 local.get $0 f32.const 0.5 f32.add f32.sub + f32.const -2 f32.mul return end - f32.const 1 - f32.const 2 local.get $0 local.get $1 f32.sub + f32.const 2 f32.mul + f32.const 1 f32.add return end @@ -4988,8 +4988,8 @@ i32.const 1065686418 i32.gt_u if (result i32) - f32.const 1.4426950216293335 local.get $0 + f32.const 1.4426950216293335 f32.mul f32.const 0.5 local.get $0 @@ -5023,24 +5023,23 @@ if (result f32) local.get $0 else - f32.const 1 local.get $0 + f32.const 1 f32.add return end local.set $1 end - f32.const 1 local.get $0 local.get $0 local.get $0 local.get $0 f32.mul local.tee $0 - f32.const 0.16666625440120697 local.get $0 f32.const -2.7667332906275988e-03 f32.mul + f32.const 0.16666625440120697 f32.add f32.mul f32.sub @@ -5054,6 +5053,7 @@ f32.sub local.get $1 f32.add + f32.const 1 f32.add local.set $0 local.get $3 @@ -5085,18 +5085,18 @@ i32.lt_u br_if $__inlined_func$~lib/math/NativeMathf.cosh drop - f32.const 1 local.get $0 call $~lib/math/NativeMathf.expm1 local.tee $0 local.get $0 f32.mul - f32.const 2 - f32.const 2 local.get $0 + f32.const 2 f32.mul + f32.const 2 f32.add f32.div + f32.const 1 f32.add br $__inlined_func$~lib/math/NativeMathf.cosh end @@ -5104,10 +5104,10 @@ i32.const 1118925335 i32.lt_u if - f32.const 0.5 local.get $0 call $~lib/math/NativeMathf.exp local.tee $0 + f32.const 0.5 f32.mul f32.const 0.5 local.get $0 @@ -5216,8 +5216,8 @@ i64.eq br_if $~lib/util/math/exp2_lut|inlined.0 drop - f64.const 1 local.get $2 + f64.const 1 f64.add local.get $1 i32.const 2047 @@ -5287,20 +5287,20 @@ f64.mul f64.add local.get $2 - f64.const 0.24022650695909065 local.get $0 f64.const 0.0555041086686087 f64.mul + f64.const 0.24022650695909065 f64.add f64.mul f64.add local.get $2 local.get $2 f64.mul - f64.const 0.009618131975721055 local.get $0 f64.const 1.3332074570119598e-03 f64.mul + f64.const 0.009618131975721055 f64.add f64.mul f64.add @@ -5314,7 +5314,6 @@ i64.and i64.eqz if - f64.const 2 local.get $3 i64.const 4503599627370496 i64.sub @@ -5324,6 +5323,7 @@ f64.mul local.get $2 f64.add + f64.const 2 f64.mul br $~lib/util/math/specialcase2|inlined.0 end @@ -5340,8 +5340,8 @@ f64.const 1 f64.lt if (result f64) - f64.const 1 local.get $2 + f64.const 1 f64.add local.tee $7 f64.const 1 @@ -5444,7 +5444,6 @@ br_if $~lib/util/math/exp2f_lut|inlined.0 drop end - f64.const 0.6931471806916203 local.get $1 local.get $1 f64.const 211106232532992 @@ -5454,11 +5453,12 @@ f64.sub f64.sub local.tee $1 + f64.const 0.6931471806916203 f64.mul f64.const 1 f64.add - f64.const 0.05550361559341535 local.get $1 + f64.const 0.05550361559341535 f64.mul f64.const 0.2402284522445722 f64.add @@ -5655,8 +5655,8 @@ f64.mul local.tee $1 f64.sub - f64.const 2 local.get $8 + f64.const 2 f64.mul local.get $5 f64.add @@ -5671,8 +5671,8 @@ f64.mul local.tee $0 f64.sub - f64.const 2 local.get $7 + f64.const 2 f64.mul local.get $11 f64.add @@ -5934,8 +5934,8 @@ f64.const 1 f64.sub local.tee $0 - f64.const 2 local.get $0 + f64.const 2 f64.add f64.div local.tee $4 @@ -5955,8 +5955,8 @@ f64.mul local.tee $10 local.get $0 - f64.const 0.5 local.get $0 + f64.const 0.5 f64.mul local.get $0 f64.mul @@ -5983,32 +5983,32 @@ local.get $4 local.get $5 local.get $3 - f64.const 0.6666666666666735 local.get $3 local.get $3 f64.mul local.tee $0 - f64.const 0.2857142874366239 local.get $0 - f64.const 0.1818357216161805 local.get $0 f64.const 0.14798198605116586 f64.mul + f64.const 0.1818357216161805 f64.add f64.mul + f64.const 0.2857142874366239 f64.add f64.mul + f64.const 0.6666666666666735 f64.add f64.mul local.get $0 - f64.const 0.3999999999940942 local.get $0 - f64.const 0.22222198432149784 local.get $0 f64.const 0.15313837699209373 f64.mul + f64.const 0.22222198432149784 f64.add f64.mul + f64.const 0.3999999999940942 f64.add f64.mul f64.add @@ -6127,8 +6127,8 @@ f32.const 1 f32.sub local.tee $0 - f32.const 2 local.get $0 + f32.const 2 f32.add f32.div local.tee $3 @@ -6148,8 +6148,8 @@ f32.mul local.get $0 local.get $0 - f32.const 0.5 local.get $0 + f32.const 0.5 f32.mul local.get $0 f32.mul @@ -6166,20 +6166,20 @@ local.get $3 local.get $0 local.get $2 - f32.const 0.6666666269302368 local.get $2 local.get $2 f32.mul local.tee $0 f32.const 0.2849878668785095 f32.mul + f32.const 0.6666666269302368 f32.add f32.mul local.get $0 - f32.const 0.40000972151756287 local.get $0 f32.const 0.24279078841209412 f32.mul + f32.const 0.40000972151756287 f32.add f32.mul f32.add @@ -6337,8 +6337,8 @@ f64.const 1 f64.sub local.tee $0 - f64.const 2 local.get $0 + f64.const 2 f64.add f64.div local.tee $4 @@ -6355,8 +6355,8 @@ f64.convert_i32_s local.tee $9 local.get $0 - f64.const 0.5 local.get $0 + f64.const 0.5 f64.mul local.get $0 f64.mul @@ -6380,32 +6380,32 @@ local.get $4 local.get $5 local.get $3 - f64.const 0.6666666666666735 local.get $3 local.get $3 f64.mul local.tee $0 - f64.const 0.2857142874366239 local.get $0 - f64.const 0.1818357216161805 local.get $0 f64.const 0.14798198605116586 f64.mul + f64.const 0.1818357216161805 f64.add f64.mul + f64.const 0.2857142874366239 f64.add f64.mul + f64.const 0.6666666666666735 f64.add f64.mul local.get $0 - f64.const 0.3999999999940942 local.get $0 - f64.const 0.22222198432149784 local.get $0 f64.const 0.15313837699209373 f64.mul + f64.const 0.22222198432149784 f64.add f64.mul + f64.const 0.3999999999940942 f64.add f64.mul f64.add @@ -6522,8 +6522,8 @@ f32.const 1 f32.sub local.tee $0 - f32.const 2 local.get $0 + f32.const 2 f32.add f32.div local.tee $3 @@ -6532,8 +6532,8 @@ local.set $2 local.get $0 local.get $0 - f32.const 0.5 local.get $0 + f32.const 0.5 f32.mul local.get $0 f32.mul @@ -6550,20 +6550,20 @@ local.get $3 local.get $0 local.get $2 - f32.const 0.6666666269302368 local.get $2 local.get $2 f32.mul local.tee $0 f32.const 0.2849878668785095 f32.mul + f32.const 0.6666666269302368 f32.add f32.mul local.get $0 - f32.const 0.40000972151756287 local.get $0 f32.const 0.24279078841209412 f32.mul + f32.const 0.40000972151756287 f32.add f32.mul f32.add @@ -6859,8 +6859,8 @@ f64.reinterpret_i64 return end - f64.const 0 local.get $0 + f64.const 0 f64.mul ) (func $std/math/test_mod (param $0 f64) (param $1 f64) (param $2 f64) (result i32) @@ -7077,8 +7077,8 @@ f32.reinterpret_i32 return end - f32.const 0 local.get $0 + f32.const 0 f32.mul ) (func $std/math/test_modf (param $0 f32) (param $1 f32) (param $2 f32) (result i32) @@ -7514,11 +7514,11 @@ select return end - f64.const 1.4426950216293335 local.get $3 f64.const 1 f64.sub local.tee $0 + f64.const 1.4426950216293335 f64.mul local.tee $3 local.get $0 @@ -7608,7 +7608,6 @@ end end local.set $5 - f64.const 0.9617967009544373 local.get $3 i64.reinterpret_f64 i64.const 4294967295 @@ -7640,11 +7639,11 @@ i64.and f64.reinterpret_i64 local.tee $15 - f64.const 3 local.get $15 local.get $15 f64.mul local.tee $19 + f64.const 3 f64.add local.get $17 local.get $17 @@ -7652,26 +7651,26 @@ local.tee $13 local.get $13 f64.mul - f64.const 0.5999999999999946 local.get $13 - f64.const 0.4285714285785502 local.get $13 - f64.const 0.33333332981837743 local.get $13 - f64.const 0.272728123808534 local.get $13 - f64.const 0.23066074577556175 local.get $13 f64.const 0.20697501780033842 f64.mul + f64.const 0.23066074577556175 f64.add f64.mul + f64.const 0.272728123808534 f64.add f64.mul + f64.const 0.33333332981837743 f64.add f64.mul + f64.const 0.4285714285785502 f64.add f64.mul + f64.const 0.5999999999999946 f64.add f64.mul local.get $0 @@ -7739,10 +7738,11 @@ i64.and f64.reinterpret_i64 local.tee $2 + f64.const 0.9617967009544373 f64.mul local.tee $19 - f64.const -7.028461650952758e-09 local.get $2 + f64.const -7.028461650952758e-09 f64.mul local.get $0 local.get $2 @@ -7952,22 +7952,22 @@ local.get $2 local.get $2 local.get $0 - f64.const 0.16666666666666602 local.get $0 - f64.const -2.7777777777015593e-03 local.get $0 - f64.const 6.613756321437934e-05 local.get $0 - f64.const -1.6533902205465252e-06 local.get $0 f64.const 4.1381367970572385e-08 f64.mul + f64.const -1.6533902205465252e-06 f64.add f64.mul + f64.const 6.613756321437934e-05 f64.add f64.mul + f64.const -2.7777777777015593e-03 f64.add f64.mul + f64.const 0.16666666666666602 f64.add f64.mul f64.sub @@ -8143,8 +8143,8 @@ i32.and local.set $6 local.get $1 - f32.nearest local.get $1 + f32.nearest f32.eq i32.const 0 local.get $4 @@ -8159,8 +8159,8 @@ f32.const 0.5 f32.mul local.tee $8 - f32.nearest local.get $8 + f32.nearest f32.ne i32.const 31 i32.shl @@ -8234,20 +8234,19 @@ f64.const 0 local.get $1 f64.promote_f32 - f64.const 2.8853900817779268 local.get $3 local.get $3 local.get $2 f64.mul - f64.const 0.3333333282272823 - f64.const 0.20000167595436263 local.get $2 + f64.const 0.20000167595436263 f64.mul + f64.const 0.3333333282272823 f64.add - f64.const 0.14268654271188685 - f64.const 0.11791075649681414 local.get $2 + f64.const 0.11791075649681414 f64.mul + f64.const 0.14268654271188685 f64.add local.get $2 local.get $2 @@ -8256,6 +8255,7 @@ f64.add f64.mul f64.add + f64.const 2.8853900817779268 f64.mul local.get $7 f64.convert_i64_s @@ -8281,25 +8281,24 @@ local.get $2 f64.mul local.set $3 - f64.const 1 local.get $2 - f64.const 0.6931471880289533 - f64.const 0.24022651084211735 local.get $2 + f64.const 0.24022651084211735 f64.mul + f64.const 0.6931471880289533 f64.add - f64.const 0.055503571054988744 - f64.const 0.009618030771171498 local.get $2 + f64.const 0.009618030771171498 f64.mul + f64.const 0.055503571054988744 f64.add local.get $3 f64.mul f64.add - f64.const 0.001339086685300951 - f64.const 1.5469734999890288e-04 local.get $2 + f64.const 1.5469734999890288e-04 f64.mul + f64.const 0.001339086685300951 f64.add local.get $3 local.get $3 @@ -8307,6 +8306,7 @@ f64.mul f64.add f64.mul + f64.const 1 f64.add i64.reinterpret_f64 local.get $11 @@ -8690,6 +8690,9 @@ i32.const 1 i32.and i32.const 0 + local.get $1 + f64.abs + local.tee $1 local.get $2 i64.const 4503599627370496 i64.sub @@ -8713,9 +8716,6 @@ local.get $0 f64.add local.tee $8 - local.get $1 - f64.abs - local.tee $1 f64.eq select local.get $8 @@ -8939,6 +8939,9 @@ i32.const 1 i32.and i32.const 0 + local.get $1 + f32.abs + local.tee $1 local.get $2 i32.const 8388608 i32.sub @@ -8960,9 +8963,6 @@ local.get $0 f32.add local.tee $4 - local.get $1 - f32.abs - local.tee $1 f32.eq select local.get $4 @@ -9039,30 +9039,30 @@ local.tee $3 local.get $0 f64.mul - f64.const -0.16666666666666632 local.get $3 - f64.const 0.00833333333332249 local.get $3 - f64.const -1.984126982985795e-04 local.get $3 f64.const 2.7557313707070068e-06 f64.mul + f64.const -1.984126982985795e-04 f64.add f64.mul + f64.const 0.00833333333332249 f64.add local.get $3 local.get $3 local.get $3 f64.mul f64.mul - f64.const -2.5050760253406863e-08 local.get $3 f64.const 1.58969099521155e-10 f64.mul + f64.const -2.5050760253406863e-08 f64.add f64.mul f64.add f64.mul + f64.const -0.16666666666666632 f64.add f64.mul f64.add @@ -9208,11 +9208,11 @@ i32.and if (result f64) f64.const 1 - f64.const 0.5 local.get $0 local.get $0 f64.mul local.tee $3 + f64.const 0.5 f64.mul local.tee $1 f64.sub @@ -9224,14 +9224,14 @@ f64.sub local.get $3 local.get $3 - f64.const 0.0416666666666666 local.get $3 - f64.const -0.001388888888887411 local.get $3 f64.const 2.480158728947673e-05 f64.mul + f64.const -0.001388888888887411 f64.add f64.mul + f64.const 0.0416666666666666 f64.add f64.mul local.get $3 @@ -9240,14 +9240,14 @@ local.tee $1 local.get $1 f64.mul - f64.const -2.7557314351390663e-07 local.get $3 - f64.const 2.087572321298175e-09 local.get $3 f64.const -1.1359647557788195e-11 f64.mul + f64.const 2.087572321298175e-09 f64.add f64.mul + f64.const -2.7557314351390663e-07 f64.add f64.mul f64.add @@ -9266,38 +9266,38 @@ local.get $0 f64.mul local.tee $1 - f64.const -0.16666666666666632 local.get $3 - f64.const 0.00833333333332249 local.get $3 - f64.const -1.984126982985795e-04 local.get $3 f64.const 2.7557313707070068e-06 f64.mul + f64.const -1.984126982985795e-04 f64.add f64.mul + f64.const 0.00833333333332249 f64.add local.get $3 local.get $3 local.get $3 f64.mul f64.mul - f64.const -2.5050760253406863e-08 local.get $3 f64.const 1.58969099521155e-10 f64.mul + f64.const -2.5050760253406863e-08 f64.add f64.mul f64.add local.tee $7 f64.mul + f64.const -0.16666666666666632 f64.add f64.mul drop local.get $0 local.get $3 - f64.const 0.5 local.get $4 + f64.const 0.5 f64.mul local.get $1 local.get $7 @@ -9380,10 +9380,10 @@ local.set $3 local.get $4 local.get $3 - f64.const -0.16666666641626524 local.get $6 f64.const 0.008333329385889463 f64.mul + f64.const -0.16666666641626524 f64.add f64.mul f64.add @@ -9392,10 +9392,10 @@ local.get $6 f64.mul f64.mul - f64.const -1.9839334836096632e-04 local.get $6 f64.const 2.718311493989822e-06 f64.mul + f64.const -1.9839334836096632e-04 f64.add f64.mul f64.add @@ -9545,10 +9545,10 @@ local.get $4 f64.mul local.set $3 - f64.const 1 local.get $4 f64.const -0.499999997251031 f64.mul + f64.const 1 f64.add local.get $3 f64.const 0.04166662332373906 @@ -9557,10 +9557,10 @@ local.get $3 local.get $4 f64.mul - f64.const -0.001388676377460993 local.get $4 f64.const 2.439044879627741e-05 f64.mul + f64.const -0.001388676377460993 f64.add f64.mul f64.add @@ -9574,10 +9574,10 @@ local.get $3 f64.mul local.tee $3 - f64.const -0.16666666641626524 local.get $4 f64.const 0.008333329385889463 f64.mul + f64.const -0.16666666641626524 f64.add f64.mul f64.add @@ -9586,10 +9586,10 @@ local.get $4 f64.mul f64.mul - f64.const -1.9839334836096632e-04 local.get $4 f64.const 2.718311493989822e-06 f64.mul + f64.const -1.9839334836096632e-04 f64.add f64.mul f64.add @@ -9649,8 +9649,8 @@ return end local.get $2 - f64.const 2 local.get $1 + f64.const 2 f64.mul local.get $1 local.get $1 @@ -9678,8 +9678,8 @@ f64.const 1416.0996898839683 f64.sub call $~lib/math/NativeMath.exp - f64.const 2 local.get $2 + f64.const 2 f64.mul f64.const 2247116418577894884661631e283 f64.mul @@ -9737,8 +9737,8 @@ return end local.get $3 - f32.const 2 local.get $1 + f32.const 2 f32.mul local.get $1 local.get $1 @@ -9766,8 +9766,8 @@ f32.const 162.88958740234375 f32.sub call $~lib/math/NativeMathf.exp - f32.const 2 local.get $3 + f32.const 2 f32.mul f32.const 1661534994731144841129758e11 f32.mul @@ -9856,51 +9856,51 @@ local.get $1 local.get $4 local.get $5 - f64.const 0.13333333333320124 local.get $4 local.get $4 f64.mul local.tee $3 - f64.const 0.021869488294859542 local.get $3 - f64.const 3.5920791075913124e-03 local.get $3 - f64.const 5.880412408202641e-04 local.get $3 - f64.const 7.817944429395571e-05 local.get $3 f64.const -1.8558637485527546e-05 f64.mul + f64.const 7.817944429395571e-05 f64.add f64.mul + f64.const 5.880412408202641e-04 f64.add f64.mul + f64.const 3.5920791075913124e-03 f64.add f64.mul + f64.const 0.021869488294859542 f64.add f64.mul + f64.const 0.13333333333320124 f64.add local.get $4 - f64.const 0.05396825397622605 local.get $3 - f64.const 0.0088632398235993 local.get $3 - f64.const 1.4562094543252903e-03 local.get $3 - f64.const 2.464631348184699e-04 local.get $3 - f64.const 7.140724913826082e-05 local.get $3 f64.const 2.590730518636337e-05 f64.mul + f64.const 7.140724913826082e-05 f64.add f64.mul + f64.const 2.464631348184699e-04 f64.add f64.mul + f64.const 1.4562094543252903e-03 f64.add f64.mul + f64.const 0.0088632398235993 f64.add f64.mul + f64.const 0.05396825397622605 f64.add f64.mul f64.add @@ -9909,8 +9909,8 @@ f64.add f64.mul f64.add - f64.const 0.3333333333333341 local.get $5 + f64.const 0.3333333333333341 f64.mul f64.add local.tee $3 @@ -9929,7 +9929,6 @@ local.get $2 f64.convert_i32_s local.tee $4 - f64.const 2 local.get $0 local.get $1 local.get $1 @@ -9941,6 +9940,7 @@ local.get $3 f64.sub f64.sub + f64.const 2 f64.mul f64.sub f64.mul @@ -9963,7 +9963,6 @@ f64.reinterpret_i64 local.tee $4 local.get $5 - f64.const 1 local.get $4 local.get $1 i64.reinterpret_f64 @@ -9972,6 +9971,7 @@ f64.reinterpret_i64 local.tee $1 f64.mul + f64.const 1 f64.add local.get $4 local.get $3 @@ -10223,10 +10223,10 @@ local.set $3 local.get $5 local.get $3 - f64.const 0.3333313950307914 local.get $4 f64.const 0.13339200271297674 f64.mul + f64.const 0.3333313950307914 f64.add f64.mul f64.add @@ -10236,16 +10236,16 @@ f64.mul local.tee $3 f64.mul - f64.const 0.05338123784456704 local.get $4 f64.const 0.024528318116654728 f64.mul + f64.const 0.05338123784456704 f64.add local.get $3 - f64.const 0.002974357433599673 local.get $4 f64.const 0.009465647849436732 f64.mul + f64.const 0.002974357433599673 f64.add f64.mul f64.add @@ -10395,10 +10395,10 @@ f64.const -1 local.get $5 local.get $3 - f64.const 0.3333313950307914 local.get $4 f64.const 0.13339200271297674 f64.mul + f64.const 0.3333313950307914 f64.add f64.mul f64.add @@ -10408,16 +10408,16 @@ f64.mul local.tee $3 f64.mul - f64.const 0.05338123784456704 local.get $4 f64.const 0.024528318116654728 f64.mul + f64.const 0.05338123784456704 f64.add local.get $3 - f64.const 0.002974357433599673 local.get $4 f64.const 0.009465647849436732 f64.mul + f64.const 0.002974357433599673 f64.add f64.mul f64.add @@ -10470,8 +10470,8 @@ else f64.const 1 f64.const 2 - f64.const 2 local.get $1 + f64.const 2 f64.mul call $~lib/math/NativeMath.expm1 f64.const 2 @@ -10484,8 +10484,8 @@ i32.const 1070618798 i32.gt_u if (result f64) - f64.const 2 local.get $1 + f64.const 2 f64.mul call $~lib/math/NativeMath.expm1 local.tee $1 @@ -10498,8 +10498,8 @@ i32.const 1048576 i32.ge_u if (result f64) - f64.const -2 local.get $1 + f64.const -2 f64.mul call $~lib/math/NativeMath.expm1 local.tee $1 @@ -10550,16 +10550,16 @@ i32.const 1092616192 i32.gt_u if (result f32) - f32.const 1 f32.const 0 local.get $3 f32.div + f32.const 1 f32.add else f32.const 1 f32.const 2 - f32.const 2 local.get $3 + f32.const 2 f32.mul call $~lib/math/NativeMathf.expm1 f32.const 2 @@ -10572,8 +10572,8 @@ i32.const 1048757624 i32.gt_u if (result f32) - f32.const 2 local.get $3 + f32.const 2 f32.mul call $~lib/math/NativeMathf.expm1 local.tee $3 @@ -10586,8 +10586,8 @@ i32.const 8388608 i32.ge_u if (result f32) - f32.const -2 local.get $3 + f32.const -2 f32.mul call $~lib/math/NativeMathf.expm1 local.tee $3 @@ -10675,16 +10675,15 @@ local.tee $2 local.get $0 f64.mul - f64.const -0.16666666666666632 local.get $2 - f64.const 0.00833333333332249 local.get $2 - f64.const -1.984126982985795e-04 local.get $2 f64.const 2.7557313707070068e-06 f64.mul + f64.const -1.984126982985795e-04 f64.add f64.mul + f64.const 0.00833333333332249 f64.add local.get $2 local.get $2 @@ -10692,21 +10691,22 @@ f64.mul local.tee $4 f64.mul - f64.const -2.5050760253406863e-08 local.get $2 f64.const 1.58969099521155e-10 f64.mul + f64.const -2.5050760253406863e-08 f64.add f64.mul f64.add f64.mul + f64.const -0.16666666666666632 f64.add f64.mul f64.add global.set $~lib/math/NativeMath.sincos_sin f64.const 1 - f64.const 0.5 local.get $2 + f64.const 0.5 f64.mul local.tee $1 f64.sub @@ -10718,27 +10718,27 @@ f64.sub local.get $2 local.get $2 - f64.const 0.0416666666666666 local.get $2 - f64.const -0.001388888888887411 local.get $2 f64.const 2.480158728947673e-05 f64.mul + f64.const -0.001388888888887411 f64.add f64.mul + f64.const 0.0416666666666666 f64.add f64.mul local.get $4 local.get $4 f64.mul - f64.const -2.7557314351390663e-07 local.get $2 - f64.const 2.087572321298175e-09 local.get $2 f64.const -1.1359647557788195e-11 f64.mul + f64.const 2.087572321298175e-09 f64.add f64.mul + f64.const -2.7557314351390663e-07 f64.add f64.mul f64.add @@ -10897,19 +10897,19 @@ local.set $0 local.get $4 local.get $2 - f64.const 0.5 global.get $~lib/math/rempio2_y1 local.tee $7 + f64.const 0.5 f64.mul local.get $0 - f64.const 0.00833333333332249 local.get $2 - f64.const -1.984126982985795e-04 local.get $2 f64.const 2.7557313707070068e-06 f64.mul + f64.const -1.984126982985795e-04 f64.add f64.mul + f64.const 0.00833333333332249 f64.add local.get $2 local.get $2 @@ -10917,10 +10917,10 @@ f64.mul local.tee $1 f64.mul - f64.const -2.5050760253406863e-08 local.get $2 f64.const 1.58969099521155e-10 f64.mul + f64.const -2.5050760253406863e-08 f64.add f64.mul f64.add @@ -10937,8 +10937,8 @@ local.tee $8 local.set $0 f64.const 1 - f64.const 0.5 local.get $2 + f64.const 0.5 f64.mul local.tee $9 f64.sub @@ -10950,27 +10950,27 @@ f64.sub local.get $2 local.get $2 - f64.const 0.0416666666666666 local.get $2 - f64.const -0.001388888888887411 local.get $2 f64.const 2.480158728947673e-05 f64.mul + f64.const -0.001388888888887411 f64.add f64.mul + f64.const 0.0416666666666666 f64.add f64.mul local.get $1 local.get $1 f64.mul - f64.const -2.7557314351390663e-07 local.get $2 - f64.const 2.087572321298175e-09 local.get $2 f64.const -1.1359647557788195e-11 f64.mul + f64.const 2.087572321298175e-09 f64.add f64.mul + f64.const -2.7557314351390663e-07 f64.add f64.mul f64.add @@ -11037,11 +11037,11 @@ ) (func $~lib/math/dtoi32 (param $0 f64) (result i32) local.get $0 - f64.const 4294967296 local.get $0 f64.const 2.3283064365386963e-10 f64.mul f64.floor + f64.const 4294967296 f64.mul f64.sub i64.trunc_f64_s @@ -20189,9 +20189,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.9238795325112867 f64.const 0.39269908169872414 call $~lib/math/NativeMath.cos + f64.const 0.9238795325112867 f64.ne if i32.const 0 @@ -20201,9 +20201,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.9238795325112867 f64.const -0.39269908169872414 call $~lib/math/NativeMath.cos + f64.const 0.9238795325112867 f64.ne if i32.const 0 @@ -20225,9 +20225,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.9689124217106447 f64.const 0.25 call $~lib/math/NativeMath.cos + f64.const 0.9689124217106447 f64.ne if i32.const 0 @@ -20237,9 +20237,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.8775825618903728 f64.const 0.5 call $~lib/math/NativeMath.cos + f64.const 0.8775825618903728 f64.ne if i32.const 0 @@ -20249,9 +20249,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.7073882691671998 f64.const 0.785 call $~lib/math/NativeMath.cos + f64.const 0.7073882691671998 f64.ne if i32.const 0 @@ -20261,9 +20261,9 @@ call $~lib/builtins/abort unreachable end - f64.const 6.123233995736766e-17 f64.const 1.5707963267948966 call $~lib/math/NativeMath.cos + f64.const 6.123233995736766e-17 f64.ne if i32.const 0 @@ -20273,9 +20273,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.7071067811865474 f64.const 5.497787143782138 call $~lib/math/NativeMath.cos + f64.const 0.7071067811865474 f64.ne if i32.const 0 @@ -20285,9 +20285,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.7071067811865477 f64.const 7.0685834705770345 call $~lib/math/NativeMath.cos + f64.const 0.7071067811865477 f64.ne if i32.const 0 @@ -20297,9 +20297,9 @@ call $~lib/builtins/abort unreachable end - f64.const -0.7071067811865467 f64.const 8.63937979737193 call $~lib/math/NativeMath.cos + f64.const -0.7071067811865467 f64.ne if i32.const 0 @@ -20309,9 +20309,9 @@ call $~lib/builtins/abort unreachable end - f64.const -0.7071067811865471 f64.const 10.210176124166829 call $~lib/math/NativeMath.cos + f64.const -0.7071067811865471 f64.ne if i32.const 0 @@ -20321,9 +20321,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.9367521275331447 f64.const 1e6 call $~lib/math/NativeMath.cos + f64.const 0.9367521275331447 f64.ne if i32.const 0 @@ -20333,9 +20333,9 @@ call $~lib/builtins/abort unreachable end - f64.const -3.435757038074824e-12 f64.const 1647097.7583689587 call $~lib/math/NativeMath.cos + f64.const -3.435757038074824e-12 f64.ne if i32.const 0 @@ -41963,8 +41963,8 @@ unreachable end f64.const 2.3283064365386963e-10 - f64.const 2.3283064365386963e-10 call $~lib/math/NativeMath.sin + f64.const 2.3283064365386963e-10 f64.ne if i32.const 0 @@ -41975,8 +41975,8 @@ unreachable end f64.const -2.3283064365386963e-10 - f64.const -2.3283064365386963e-10 call $~lib/math/NativeMath.sin + f64.const -2.3283064365386963e-10 f64.ne if i32.const 0 @@ -41986,9 +41986,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.3826834323650898 f64.const 0.39269908169872414 call $~lib/math/NativeMath.sin + f64.const 0.3826834323650898 f64.ne if i32.const 0 @@ -41998,9 +41998,9 @@ call $~lib/builtins/abort unreachable end - f64.const -0.3826834323650898 f64.const -0.39269908169872414 call $~lib/math/NativeMath.sin + f64.const -0.3826834323650898 f64.ne if i32.const 0 @@ -42010,9 +42010,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.479425538604203 f64.const 0.5 call $~lib/math/NativeMath.sin + f64.const 0.479425538604203 f64.ne if i32.const 0 @@ -42022,9 +42022,9 @@ call $~lib/builtins/abort unreachable end - f64.const -0.479425538604203 f64.const -0.5 call $~lib/math/NativeMath.sin + f64.const -0.479425538604203 f64.ne if i32.const 0 @@ -42034,9 +42034,9 @@ call $~lib/builtins/abort unreachable end - f64.const 1 f64.const 1.5707963267948966 call $~lib/math/NativeMath.sin + f64.const 1 f64.ne if i32.const 0 @@ -42046,9 +42046,9 @@ call $~lib/builtins/abort unreachable end - f64.const -1 f64.const -1.5707963267948966 call $~lib/math/NativeMath.sin + f64.const -1 f64.ne if i32.const 0 @@ -42058,9 +42058,9 @@ call $~lib/builtins/abort unreachable end - f64.const 1.2246467991473532e-16 f64.const 3.141592653589793 call $~lib/math/NativeMath.sin + f64.const 1.2246467991473532e-16 f64.ne if i32.const 0 @@ -42070,9 +42070,9 @@ call $~lib/builtins/abort unreachable end - f64.const -7.047032979958965e-14 f64.const 6911.503837897545 call $~lib/math/NativeMath.sin + f64.const -7.047032979958965e-14 f64.ne if i32.const 0 @@ -42082,9 +42082,9 @@ call $~lib/builtins/abort unreachable end - f64.const -0.7071067811865477 f64.const 5.497787143782138 call $~lib/math/NativeMath.sin + f64.const -0.7071067811865477 f64.ne if i32.const 0 @@ -42094,9 +42094,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.7071067811865474 f64.const 7.0685834705770345 call $~lib/math/NativeMath.sin + f64.const 0.7071067811865474 f64.ne if i32.const 0 @@ -42106,9 +42106,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.7071067811865483 f64.const 8.63937979737193 call $~lib/math/NativeMath.sin + f64.const 0.7071067811865483 f64.ne if i32.const 0 @@ -42118,9 +42118,9 @@ call $~lib/builtins/abort unreachable end - f64.const -0.7071067811865479 f64.const 10.210176124166829 call $~lib/math/NativeMath.sin + f64.const -0.7071067811865479 f64.ne if i32.const 0 @@ -42130,9 +42130,9 @@ call $~lib/builtins/abort unreachable end - f64.const -3.2103381051568376e-11 f64.const 823549.6645826427 call $~lib/math/NativeMath.sin + f64.const -3.2103381051568376e-11 f64.ne if i32.const 0 @@ -42142,9 +42142,9 @@ call $~lib/builtins/abort unreachable end - f64.const 0.377820109360752 f64.const 1329227995784915872903807e12 call $~lib/math/NativeMath.sin + f64.const 0.377820109360752 f64.ne if i32.const 0 @@ -42154,9 +42154,9 @@ call $~lib/builtins/abort unreachable end - f64.const -0.377820109360752 f64.const -1329227995784915872903807e12 call $~lib/math/NativeMath.sin + f64.const -0.377820109360752 f64.ne if i32.const 0 diff --git a/tests/compiler/std/mod.optimized.wat b/tests/compiler/std/mod.optimized.wat index 17c732c475..74e16f90d7 100644 --- a/tests/compiler/std/mod.optimized.wat +++ b/tests/compiler/std/mod.optimized.wat @@ -220,8 +220,8 @@ f64.reinterpret_i64 return end - f64.const 0 local.get $0 + f64.const 0 f64.mul ) (func $std/mod/check (param $0 f64) (param $1 f64) (result i32) @@ -463,8 +463,8 @@ f32.reinterpret_i32 return end - f32.const 0 local.get $0 + f32.const 0 f32.mul ) (func $std/mod/test_fmodf (param $0 f32) (param $1 f32) (param $2 f32) (result i32) diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index b28956c436..e85922beca 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -7774,9 +7774,9 @@ if (result i32) i32.const 0 else + local.get $1 local.get $0 f32.load - local.get $1 f32.eq end if @@ -8601,9 +8601,9 @@ if (result i32) i32.const 0 else + local.get $1 local.get $0 f64.load - local.get $1 f64.eq end if diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index c156b0630c..74e388f9bd 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -3546,8 +3546,8 @@ if local.get $3 call $~lib/rt/pure/__release - f64.const inf local.get $7 + f64.const inf f64.mul return end @@ -3979,7 +3979,6 @@ i32.const -14 i32.le_s if - f64.const 0.00004294967296 local.get $14 i64.const 6103515625 i64.rem_u @@ -3993,6 +3992,7 @@ i64.sub i64.shl f64.convert_i64_u + f64.const 0.00004294967296 f64.mul f64.nearest i64.trunc_f64_u @@ -7331,9 +7331,9 @@ local.tee $1 i32.trunc_f64_s local.tee $4 + local.get $1 local.get $4 f64.convert_i32_s - local.get $1 f64.ne i32.add i32.const 3 diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 27c2c9e448..98bc9ff4e6 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -9604,8 +9604,8 @@ f32.reinterpret_i32 return end - f32.const 0 local.get $0 + f32.const 0 f32.mul ) (func $std/typedarray/testArrayEvery<~lib/typedarray/Float32Array,f32>~anonymous|0 (param $0 f32) (param $1 i32) (param $2 i32) (result i32) @@ -9833,8 +9833,8 @@ f64.reinterpret_i64 return end - f64.const 0 local.get $0 + f64.const 0 f64.mul ) (func $std/typedarray/testArrayEvery<~lib/typedarray/Float64Array,f64>~anonymous|0 (param $0 f64) (param $1 i32) (param $2 i32) (result i32) @@ -17971,13 +17971,13 @@ local.get $3 i32.lt_s if + local.get $1 local.get $4 local.get $2 i32.const 2 i32.shl i32.add f32.load - local.get $1 f32.eq if local.get $0 @@ -18040,13 +18040,13 @@ i32.const 0 i32.ge_s if + local.get $1 local.get $3 local.get $2 i32.const 2 i32.shl i32.add f32.load - local.get $1 f32.eq if local.get $0 @@ -18557,13 +18557,13 @@ local.get $3 i32.lt_s if + local.get $1 local.get $4 local.get $2 i32.const 3 i32.shl i32.add f64.load - local.get $1 f64.eq if local.get $0 @@ -18626,13 +18626,13 @@ i32.const 0 i32.ge_s if + local.get $1 local.get $3 local.get $2 i32.const 3 i32.shl i32.add f64.load - local.get $1 f64.eq if local.get $0 @@ -21736,9 +21736,9 @@ local.tee $1 i32.trunc_f64_s local.tee $4 + local.get $1 local.get $4 f64.convert_i32_s - local.get $1 f64.ne i32.add i32.const 3 diff --git a/tests/compiler/wasi/trace.optimized.wat b/tests/compiler/wasi/trace.optimized.wat index 2b9679f067..264ec7194d 100644 --- a/tests/compiler/wasi/trace.optimized.wat +++ b/tests/compiler/wasi/trace.optimized.wat @@ -1341,9 +1341,9 @@ local.tee $1 i32.trunc_f64_s local.tee $4 + local.get $1 local.get $4 f64.convert_i32_s - local.get $1 f64.ne i32.add i32.const 3 From f14bdb9f29fa43ab125e97f7a8b606ceca0f2dd4 Mon Sep 17 00:00:00 2001 From: dcode Date: Fri, 18 Sep 2020 08:53:20 +0200 Subject: [PATCH 4/7] forward --- cli/asc.json | 2 +- package-lock.json | 6 +- package.json | 2 +- src/builtins.ts | 8 +- src/common.ts | 2 +- src/compiler.ts | 4 +- src/glue/binaryen.d.ts | 24 ++-- src/index.ts | 4 +- src/module.ts | 107 +++++++----------- src/program.ts | 6 +- std/assembly/index.d.ts | 4 +- std/assembly/shared/feature.ts | 6 +- tests/compiler/asc-constants.ts | 2 +- tests/compiler/asc-constants.untouched.wat | 2 +- tests/compiler/features/reference-types.json | 2 +- .../features/reference-types.untouched.wat | 6 + tests/features.json | 7 +- 17 files changed, 83 insertions(+), 111 deletions(-) diff --git a/cli/asc.json b/cli/asc.json index 28319cc3ca..443d379fa5 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -191,7 +191,7 @@ " simd SIMD types and operations.", " threads Threading and atomic operations.", " reference-types Reference types and operations.", - " anyref Anyref type (without GC).", + " gc Garbage collection (anyref, WIP).", "" ], "TODO_doesNothingYet": [ diff --git a/package-lock.json b/package-lock.json index 416c315d85..b218625d67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1163,9 +1163,9 @@ "optional": true }, "binaryen": { - "version": "96.0.0-nightly.20200916", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-96.0.0-nightly.20200916.tgz", - "integrity": "sha512-fn6HZVsCRYR6i4xX/8MKyhQ08EqxRITQGy1vny9yM5MOdSB+EiMpJ1DTL0vjwpY53Lfk8P3mf6q8hQUm5nE0yA==" + "version": "97.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0.tgz", + "integrity": "sha512-ovRt8PeD0/kD4LqJc5Mp7T9P9gc5EBJT2seVgXoRZdKm9xpIIYPHIjDBOW8jQBjQp93LtG2sFE6QE5VftFyhOQ==" }, "bluebird": { "version": "3.7.2", diff --git a/package.json b/package.json index ecb2d37065..135fde460f 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "url": "https://github.com/AssemblyScript/assemblyscript/issues" }, "dependencies": { - "binaryen": "96.0.0-nightly.20200916", + "binaryen": "97.0.0", "long": "^4.0.0", "source-map-support": "^0.5.19", "ts-node": "^6.2.0" diff --git a/src/builtins.ts b/src/builtins.ts index 84dfb4fe08..7abdf6eb2e 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -53,7 +53,6 @@ import { import { BinaryOp, UnaryOp, - HostOp, AtomicRMWOp, SIMDExtractOp, SIMDReplaceOp, @@ -2449,7 +2448,7 @@ function builtin_memory_size(ctx: BuiltinContext): ExpressionRef { checkTypeAbsent(ctx) | checkArgsRequired(ctx, 0) ) return module.unreachable(); - return module.host(HostOp.MemorySize); + return module.memory_size(); } builtins.set(BuiltinNames.memory_size, builtin_memory_size); @@ -2462,10 +2461,7 @@ function builtin_memory_grow(ctx: BuiltinContext): ExpressionRef { checkTypeAbsent(ctx) | checkArgsRequired(ctx, 1) ) return module.unreachable(); - var operands = ctx.operands; - return module.host(HostOp.MemoryGrow, null, [ - compiler.compileExpression(operands[0], Type.i32, Constraints.CONV_IMPLICIT) - ]); + return module.memory_grow(compiler.compileExpression(ctx.operands[0], Type.i32, Constraints.CONV_IMPLICIT)); } builtins.set(BuiltinNames.memory_grow, builtin_memory_grow); diff --git a/src/common.ts b/src/common.ts index a1ff133ba7..c9ab5dc5e8 100644 --- a/src/common.ts +++ b/src/common.ts @@ -173,7 +173,7 @@ export namespace CommonNames { export const ASC_FEATURE_TAIL_CALLS = "ASC_FEATURE_TAIL_CALLS"; export const ASC_FEATURE_REFERENCE_TYPES = "ASC_FEATURE_REFERENCE_TYPES"; export const ASC_FEATURE_MULTI_VALUE = "ASC_FEATURE_MULTI_VALUE"; - export const ASC_FEATURE_ANYREF = "ASC_FEATURE_ANYREF"; + export const ASC_FEATURE_GC = "ASC_FEATURE_GC"; // classes export const I8 = "I8"; export const I16 = "I16"; diff --git a/src/compiler.ts b/src/compiler.ts index c8d0e8f074..cbd113bfce 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -405,7 +405,7 @@ export class Compiler extends DiagnosticEmitter { if (options.hasFeature(Feature.TAIL_CALLS)) featureFlags |= FeatureFlags.TailCall; if (options.hasFeature(Feature.REFERENCE_TYPES)) featureFlags |= FeatureFlags.ReferenceTypes; if (options.hasFeature(Feature.MULTI_VALUE)) featureFlags |= FeatureFlags.MultiValue; - if (options.hasFeature(Feature.ANYREF)) featureFlags |= FeatureFlags.Anyref; + if (options.hasFeature(Feature.GC)) featureFlags |= FeatureFlags.GC; module.setFeatures(featureFlags); // set up the main start function @@ -10638,7 +10638,7 @@ export class Compiler extends DiagnosticEmitter { } case TypeKind.ANYREF: { return this.checkFeatureEnabled(Feature.REFERENCE_TYPES, reportNode) - && this.checkFeatureEnabled(Feature.ANYREF, reportNode); + && this.checkFeatureEnabled(Feature.GC, reportNode); } } let classReference = type.getClass(); diff --git a/src/glue/binaryen.d.ts b/src/glue/binaryen.d.ts index 26ba4a4f74..84db410bd1 100644 --- a/src/glue/binaryen.d.ts +++ b/src/glue/binaryen.d.ts @@ -58,7 +58,7 @@ export declare function _BinaryenFeatureExceptionHandling(): BinaryenFeatureFlag export declare function _BinaryenFeatureTailCall(): BinaryenFeatureFlags; export declare function _BinaryenFeatureReferenceTypes(): BinaryenFeatureFlags; export declare function _BinaryenFeatureMultivalue(): BinaryenFeatureFlags; -export declare function _BinaryenFeatureAnyref(): BinaryenFeatureFlags; +export declare function _BinaryenFeatureGC(): BinaryenFeatureFlags; export declare function _BinaryenFeatureAll(): BinaryenFeatureFlags; type BinaryenExpressionId = i32; @@ -83,7 +83,8 @@ export declare function _BinaryenBinaryId(): BinaryenExpressionId; export declare function _BinaryenSelectId(): BinaryenExpressionId; export declare function _BinaryenDropId(): BinaryenExpressionId; export declare function _BinaryenReturnId(): BinaryenExpressionId; -export declare function _BinaryenHostId(): BinaryenExpressionId; +export declare function _BinaryenMemorySizeId(): BinaryenExpressionId; +export declare function _BinaryenMemoryGrowId(): BinaryenExpressionId; export declare function _BinaryenNopId(): BinaryenExpressionId; export declare function _BinaryenUnreachableId(): BinaryenExpressionId; export declare function _BinaryenAtomicCmpxchgId(): BinaryenExpressionId; @@ -267,9 +268,6 @@ export declare function _BinaryenLeFloat64(): BinaryenOp; export declare function _BinaryenGtFloat64(): BinaryenOp; export declare function _BinaryenGeFloat64(): BinaryenOp; -export declare function _BinaryenMemorySize(): BinaryenOp; -export declare function _BinaryenMemoryGrow(): BinaryenOp; - export declare function _BinaryenAtomicRMWAdd(): BinaryenOp; export declare function _BinaryenAtomicRMWSub(): BinaryenOp; export declare function _BinaryenAtomicRMWAnd(): BinaryenOp; @@ -569,17 +567,11 @@ export declare function _BinaryenGlobalSetSetName(expr: BinaryenExpressionRef, n export declare function _BinaryenGlobalSetGetValue(expr: BinaryenExpressionRef): BinaryenExpressionRef; export declare function _BinaryenGlobalSetSetValue(expr: BinaryenExpressionRef, valueExpr: BinaryenExpressionRef): void; -export declare function _BinaryenHost(module: BinaryenModuleRef, op: BinaryenOp, nameOperand: BinaryenString, operandExprs: BinaryenArray, numOperands: BinaryenIndex): BinaryenExpressionRef; -export declare function _BinaryenHostGetOp(expr: BinaryenExpressionRef): BinaryenOp; -export declare function _BinaryenHostSetOp(expr: BinaryenExpressionRef, op: BinaryenOp): void; -export declare function _BinaryenHostGetNameOperand(expr: BinaryenExpressionRef): BinaryenString; -export declare function _BinaryenHostSetNameOperand(expr: BinaryenExpressionRef, nameOperand: BinaryenString): void; -export declare function _BinaryenHostGetNumOperands(expr: BinaryenExpressionRef): BinaryenIndex; -export declare function _BinaryenHostGetOperandAt(expr: BinaryenExpressionRef, index: BinaryenIndex): BinaryenExpressionRef; -export declare function _BinaryenHostSetOperandAt(expr: BinaryenExpressionRef, index: BinaryenIndex, operandExpr: BinaryenExpressionRef): void; -export declare function _BinaryenHostAppendOperand(expr: BinaryenExpressionRef, operandExpr: BinaryenExpressionRef): BinaryenIndex; -export declare function _BinaryenHostInsertOperandAt(expr: BinaryenExpressionRef, index: BinaryenIndex, operandExpr: BinaryenExpressionRef): void; -export declare function _BinaryenHostRemoveOperandAt(expr: BinaryenExpressionRef, index: BinaryenIndex): BinaryenExpressionRef; +export declare function _BinaryenMemorySize(module: BinaryenModuleRef): BinaryenExpressionRef; + +export declare function _BinaryenMemoryGrow(module: BinaryenModuleRef, delta: BinaryenExpressionRef): BinaryenExpressionRef; +export declare function _BinaryenMemoryGrowGetDelta(expr: BinaryenExpressionRef): BinaryenExpressionRef; +export declare function _BinaryenMemoryGrowSetDelta(expr: BinaryenExpressionRef, delta: BinaryenExpressionRef): void; export declare function _BinaryenLoad(module: BinaryenModuleRef, bytes: u32, signed: bool, offset: u32, align: u32, type: BinaryenType, ptrExpr: BinaryenExpressionRef): BinaryenExpressionRef; export declare function _BinaryenLoadIsAtomic(expr: BinaryenExpressionRef): bool; diff --git a/src/index.ts b/src/index.ts index 1ed4df8a0b..3e2cce084f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -149,8 +149,8 @@ export const FEATURE_TAIL_CALLS = Feature.TAIL_CALLS; export const FEATURE_REFERENCE_TYPES = Feature.REFERENCE_TYPES; /** Multi value types. */ export const FEATURE_MULTI_VALUE = Feature.MULTI_VALUE; -/** Anyref type. */ -export const FEATURE_ANYREF = Feature.ANYREF; +/** Garbage collection. */ +export const FEATURE_GC = Feature.GC; /** Enables a specific feature. */ export function enableFeature(options: Options, feature: Feature): void { diff --git a/src/module.ts b/src/module.ts index 1dece8f66b..19ade164f3 100644 --- a/src/module.ts +++ b/src/module.ts @@ -56,7 +56,7 @@ export enum FeatureFlags { TailCall = 128 /* _BinaryenFeatureTailCall */, ReferenceTypes = 256 /* _BinaryenFeatureReferenceTypes */, MultiValue = 512 /* _BinaryenFeatureMultivalue */, - Anyref = 1024 /* _BinaryenFeatureAnyref */, + GC = 1024 /* _BinaryenFeatureGC */, All = 2047 /* _BinaryenFeatureAll */ } @@ -81,34 +81,35 @@ export enum ExpressionId { Select = 17 /* _BinaryenSelectId */, Drop = 18 /* _BinaryenDropId */, Return = 19 /* _BinaryenReturnId */, - Host = 20 /* _BinaryenHostId */, - Nop = 21 /* _BinaryenNopId */, - Unreachable = 22 /* _BinaryenUnreachableId */, - AtomicCmpxchg = 24 /* _BinaryenAtomicCmpxchgId */, - AtomicRMW = 23 /* _BinaryenAtomicRMWId */, - AtomicWait = 25 /* _BinaryenAtomicWaitId */, - AtomicNotify = 26 /* _BinaryenAtomicNotifyId */, - AtomicFence = 27 /* _BinaryenAtomicFenceId */, - SIMDExtract = 28 /* _BinaryenSIMDExtractId */, - SIMDReplace = 29 /* _BinaryenSIMDReplaceId */, - SIMDShuffle = 30 /* _BinaryenSIMDShuffleId */, - SIMDTernary = 31 /* _BinaryenSIMDTernaryId */, - SIMDShift = 32 /* _BinaryenSIMDShiftId */, - SIMDLoad = 33 /* _BinaryenSIMDLoadId */, - MemoryInit = 34 /* _BinaryenMemoryInitId */, - DataDrop = 35 /* _BinaryenDataDropId */, - MemoryCopy = 36 /* _BinaryenMemoryCopyId */, - MemoryFill = 37 /* _BinaryenMemoryFillId */, - Pop = 38 /* _BinaryenPopId */, - RefNull = 39 /* _BinaryenRefNullId */, - RefIsNull = 40 /* _BinaryenRefIsNullId */, - RefFunc = 41 /* _BinaryenRefFuncId */, - Try = 42 /* _BinaryenTryId */, - Throw = 43 /* _BinaryenThrowId */, - Rethrow = 44 /* _BinaryenRethrowId */, - BrOnExn = 45 /* _BinaryenBrOnExnId */, - TupleMake = 46 /* _BinaryenTupleMakeId */, - TupleExtract = 47 /* _BinaryenTupleExtractId */ + MemorySize = 20 /* _BinaryenMemorySizeId */, + MemoryGrow = 21 /* _BinaryenMemoryGrowId */, + Nop = 22 /* _BinaryenNopId */, + Unreachable = 23 /* _BinaryenUnreachableId */, + AtomicCmpxchg = 25 /* _BinaryenAtomicCmpxchgId */, + AtomicRMW = 24 /* _BinaryenAtomicRMWId */, + AtomicWait = 26 /* _BinaryenAtomicWaitId */, + AtomicNotify = 27 /* _BinaryenAtomicNotifyId */, + AtomicFence = 28 /* _BinaryenAtomicFenceId */, + SIMDExtract = 29 /* _BinaryenSIMDExtractId */, + SIMDReplace = 30 /* _BinaryenSIMDReplaceId */, + SIMDShuffle = 31 /* _BinaryenSIMDShuffleId */, + SIMDTernary = 32 /* _BinaryenSIMDTernaryId */, + SIMDShift = 33 /* _BinaryenSIMDShiftId */, + SIMDLoad = 34 /* _BinaryenSIMDLoadId */, + MemoryInit = 35 /* _BinaryenMemoryInitId */, + DataDrop = 36 /* _BinaryenDataDropId */, + MemoryCopy = 37 /* _BinaryenMemoryCopyId */, + MemoryFill = 38 /* _BinaryenMemoryFillId */, + Pop = 39 /* _BinaryenPopId */, + RefNull = 40 /* _BinaryenRefNullId */, + RefIsNull = 41 /* _BinaryenRefIsNullId */, + RefFunc = 42 /* _BinaryenRefFuncId */, + Try = 43 /* _BinaryenTryId */, + Throw = 44 /* _BinaryenThrowId */, + Rethrow = 45 /* _BinaryenRethrowId */, + BrOnExn = 46 /* _BinaryenBrOnExnId */, + TupleMake = 47 /* _BinaryenTupleMakeId */, + TupleExtract = 48 /* _BinaryenTupleExtractId */ } export enum UnaryOp { @@ -418,11 +419,6 @@ export enum BinaryOp { SwizzleV8x16 = 177 /* _BinaryenSwizzleVec8x16 */ } -export enum HostOp { - MemorySize = 0 /* _BinaryenMemorySize */, - MemoryGrow = 1 /* _BinaryenMemoryGrow */, -} - export enum AtomicRMWOp { Add = 0 /* _BinaryenAtomicRMWAdd */, Sub = 1 /* _BinaryenAtomicRMWSub */, @@ -581,18 +577,12 @@ export class Module { return binaryen._BinaryenBinary(this.ref, op, left, right); } - host( - op: HostOp, - name: string | null = null, - operands: ExpressionRef[] | null = null - ): ExpressionRef { - var cStr = this.allocStringCached(name); - var cArr = allocPtrArray(operands); - var ret = binaryen._BinaryenHost( - this.ref, op, cStr, cArr, operands ? (operands).length : 0 - ); - binaryen._free(cArr); - return ret; + memory_size(): ExpressionRef { + return binaryen._BinaryenMemorySize(this.ref); + } + + memory_grow(delta: ExpressionRef): ExpressionRef { + return binaryen._BinaryenMemoryGrow(this.ref, delta); } local_get( @@ -2091,20 +2081,8 @@ export function getCallOperandAt(expr: ExpressionRef, index: Index): ExpressionR return binaryen._BinaryenCallGetOperandAt(expr, index); } -export function getHostOp(expr: ExpressionRef): ExpressionRef { - return binaryen._BinaryenHostGetOp(expr); -} - -export function getHostOperandCount(expr: ExpressionRef): Index { - return binaryen._BinaryenHostGetNumOperands(expr); -} - -export function getHostOperandAt(expr: ExpressionRef, index: Index): ExpressionRef { - return binaryen._BinaryenHostGetOperandAt(expr, index); -} - -export function getHostName(expr: ExpressionRef): string | null { - return readString(binaryen._BinaryenHostGetNameOperand(expr)); +export function getMemoryGrowDelta(expr: ExpressionRef): ExpressionRef { + return binaryen._BinaryenMemoryGrowGetDelta(expr); } // functions @@ -2611,12 +2589,11 @@ export function traverse( visit(binaryen._BinaryenReturnGetValue(expr), data); break; } - case ExpressionId.Host: { - for (let i: Index = 0, n = binaryen._BinaryenHostGetNumOperands(expr); i < n; ++i) { - visit(binaryen._BinaryenHostGetOperandAt(expr, i), data); - } + case ExpressionId.MemorySize: + break; + case ExpressionId.MemoryGrow: + visit(binaryen._BinaryenMemoryGrowGetDelta(expr), data); break; - } case ExpressionId.Nop: { break; } diff --git a/src/program.ts b/src/program.ts index 873ed62b22..5d8c165bcc 100644 --- a/src/program.ts +++ b/src/program.ts @@ -943,8 +943,8 @@ export class Program extends DiagnosticEmitter { i64_new(options.hasFeature(Feature.REFERENCE_TYPES) ? 1 : 0, 0)); this.registerConstantInteger(CommonNames.ASC_FEATURE_MULTI_VALUE, Type.bool, i64_new(options.hasFeature(Feature.MULTI_VALUE) ? 1 : 0, 0)); - this.registerConstantInteger(CommonNames.ASC_FEATURE_ANYREF, Type.bool, - i64_new(options.hasFeature(Feature.ANYREF) ? 1 : 0, 0)); + this.registerConstantInteger(CommonNames.ASC_FEATURE_GC, Type.bool, + i64_new(options.hasFeature(Feature.GC) ? 1 : 0, 0)); // remember deferred elements var queuedImports = new Array(); @@ -1162,7 +1162,7 @@ export class Program extends DiagnosticEmitter { if (options.hasFeature(Feature.EXCEPTION_HANDLING)) { this.registerWrapperClass(Type.exnref, CommonNames.Exnref); } - if (options.hasFeature(Feature.ANYREF)) { + if (options.hasFeature(Feature.GC)) { this.registerWrapperClass(Type.anyref, CommonNames.Anyref); } } diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index bb04096144..17958016e9 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -80,8 +80,8 @@ declare const ASC_FEATURE_TAIL_CALLS: bool; declare const ASC_FEATURE_REFERENCE_TYPES: bool; /** Whether the multi value types feature is enabled. */ declare const ASC_FEATURE_MULTI_VALUE: bool; -/** Whether the anyref feature is enabled. */ -declare const ASC_FEATURE_ANYREF: bool; +/** Whether the garbage collection feature is enabled. */ +declare const ASC_FEATURE_GC: bool; // Builtins diff --git a/std/assembly/shared/feature.ts b/std/assembly/shared/feature.ts index b293545e77..df69f166d7 100644 --- a/std/assembly/shared/feature.ts +++ b/std/assembly/shared/feature.ts @@ -24,8 +24,8 @@ export const enum Feature { REFERENCE_TYPES = 1 << 8, // see: https://github.com/WebAssembly/reference-types /** Multi value types. */ MULTI_VALUE = 1 << 9, // see: https://github.com/WebAssembly/multi-value - /** Anyref. */ - ANYREF = 1 << 10 // TODO: custom pre-GC Binaryen feature + /** Garbage collection. */ + GC = 1 << 10 // see: https://github.com/WebAssembly/gc } /** Gets the name of the specified feature one would specify on the command line. */ @@ -41,7 +41,7 @@ export function featureToString(feature: Feature): string { case Feature.TAIL_CALLS: return "tail-calls"; case Feature.REFERENCE_TYPES: return "reference-types"; case Feature.MULTI_VALUE: return "multi-value"; - case Feature.ANYREF: return "anyref"; + case Feature.GC: return "gc"; } assert(false); return ""; diff --git a/tests/compiler/asc-constants.ts b/tests/compiler/asc-constants.ts index 5207cd051a..a355b602bc 100644 --- a/tests/compiler/asc-constants.ts +++ b/tests/compiler/asc-constants.ts @@ -14,4 +14,4 @@ ASC_FEATURE_EXCEPTION_HANDLING; ASC_FEATURE_TAIL_CALLS; ASC_FEATURE_REFERENCE_TYPES; ASC_FEATURE_MULTI_VALUE; -ASC_FEATURE_ANYREF; +ASC_FEATURE_GC; diff --git a/tests/compiler/asc-constants.untouched.wat b/tests/compiler/asc-constants.untouched.wat index ffcb35c7c0..e548fa7c07 100644 --- a/tests/compiler/asc-constants.untouched.wat +++ b/tests/compiler/asc-constants.untouched.wat @@ -17,7 +17,7 @@ (global $~lib/ASC_FEATURE_TAIL_CALLS i32 (i32.const 0)) (global $~lib/ASC_FEATURE_REFERENCE_TYPES i32 (i32.const 0)) (global $~lib/ASC_FEATURE_MULTI_VALUE i32 (i32.const 0)) - (global $~lib/ASC_FEATURE_ANYREF i32 (i32.const 0)) + (global $~lib/ASC_FEATURE_GC i32 (i32.const 0)) (export "memory" (memory $0)) (start $~start) (func $start:asc-constants diff --git a/tests/compiler/features/reference-types.json b/tests/compiler/features/reference-types.json index dcdaeeaea3..e63bf2973f 100644 --- a/tests/compiler/features/reference-types.json +++ b/tests/compiler/features/reference-types.json @@ -2,7 +2,7 @@ "features": [ "reference-types", "exception-handling", - "anyref" + "gc" ], "asc_flags": [ "--runtime none" diff --git a/tests/compiler/features/reference-types.untouched.wat b/tests/compiler/features/reference-types.untouched.wat index 509432a867..7aa89eed8b 100644 --- a/tests/compiler/features/reference-types.untouched.wat +++ b/tests/compiler/features/reference-types.untouched.wat @@ -431,6 +431,12 @@ call $~lib/builtins/abort unreachable end + global.get $features/reference-types/funcGlobal + global.set $features/reference-types/anyGlobal + global.get $features/reference-types/externGlobal + global.set $features/reference-types/anyGlobal + global.get $features/reference-types/exnGlobal + global.set $features/reference-types/anyGlobal ) (func $features/reference-types/internal (param $0 externref) (result externref) (local $1 externref) diff --git a/tests/features.json b/tests/features.json index d769b2257d..1b6955a32d 100644 --- a/tests/features.json +++ b/tests/features.json @@ -24,12 +24,13 @@ "v8_flags": [ ] }, - "anyref": { + "gc": { "asc_flags": [ - "--enable anyref" + "--enable gc" ], "v8_flags": [ - "--experimental-wasm-anyref" + "--experimental-wasm-anyref", + "--experimental-wasm-gc" ] }, "bigint-integration": { From d9de7ed6b29141e4139f955558620405ad8dd45c Mon Sep 17 00:00:00 2001 From: dcode Date: Fri, 18 Sep 2020 09:06:44 +0200 Subject: [PATCH 5/7] anyref->gc --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e09a5a7b3..1b494574a8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -128,7 +128,7 @@ jobs: run: npm run clean - name: Test experimental features env: - ASC_FEATURES: mutable-globals,threads,reference-types,bigint-integration,anyref + ASC_FEATURES: mutable-globals,threads,reference-types,bigint-integration,gc run: | npm run test:compiler rt/flags features/js-bigint-integration features/reference-types features/threads test-runtimes: From d062e64f6a5385b895f3b86a8b4c8c86354fb1f9 Mon Sep 17 00:00:00 2001 From: dcode Date: Sat, 19 Sep 2020 14:50:02 +0200 Subject: [PATCH 6/7] forward --- cli/asc.json | 5 +- package-lock.json | 6 +- package.json | 2 +- src/common.ts | 1 + src/compiler.ts | 3 +- src/index.ts | 2 + src/module.ts | 3 +- src/program.ts | 2 + std/assembly/index.d.ts | 2 + std/assembly/shared/feature.ts | 5 +- tests/compiler/abi.untouched.wat | 42 +- tests/compiler/asc-constants.ts | 1 + tests/compiler/asc-constants.untouched.wat | 7 +- tests/compiler/builtins.untouched.wat | 10 +- tests/compiler/features/simd.untouched.wat | 20 +- tests/compiler/many-locals.optimized.wat | 23 +- tests/compiler/many-locals.untouched.wat | 6 +- tests/compiler/overflow.untouched.wat | 90 +- .../portable-conversions.untouched.wat | 40 +- tests/compiler/retain-i32.optimized.wat | 228 +---- tests/compiler/retain-i32.untouched.wat | 105 ++- tests/compiler/std/array.optimized.wat | 43 +- tests/compiler/std/array.untouched.wat | 25 +- tests/compiler/std/dataview.optimized.wat | 69 +- tests/compiler/std/dataview.untouched.wat | 85 +- tests/compiler/std/map.optimized.wat | 282 +++--- tests/compiler/std/map.untouched.wat | 180 +++- tests/compiler/std/math.optimized.wat | 8 +- tests/compiler/std/math.untouched.wat | 10 +- tests/compiler/std/polyfills.untouched.wat | 50 +- tests/compiler/std/set.optimized.wat | 178 ++-- tests/compiler/std/set.untouched.wat | 80 +- tests/compiler/std/string.optimized.wat | 6 - tests/compiler/std/typedarray.optimized.wat | 852 +++++------------- tests/compiler/std/typedarray.untouched.wat | 262 ++++-- 35 files changed, 1380 insertions(+), 1353 deletions(-) diff --git a/cli/asc.json b/cli/asc.json index 443d379fa5..948fdcc19e 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -187,6 +187,7 @@ "description": [ "Enables WebAssembly features being disabled by default.", "", + " sign-extension Sign-extension operations", " bulk-memory Bulk memory operations.", " simd SIMD types and operations.", " threads Threading and atomic operations.", @@ -198,7 +199,8 @@ " nontrapping-f2i Non-trapping float to integer ops.", " exception-handling Exception handling.", " tail-calls Tail call operations.", - " multi-value Multi value types." + " multi-value Multi value types.", + " memory64 Memory64 operations." ], "type": "S", "mutuallyExclusive": "disable" @@ -209,7 +211,6 @@ "Disables WebAssembly features being enabled by default.", "", " mutable-globals Mutable global imports and exports.", - " sign-extension Sign-extension operations", "" ], "type": "S", diff --git a/package-lock.json b/package-lock.json index b218625d67..1cf7d8084d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1163,9 +1163,9 @@ "optional": true }, "binaryen": { - "version": "97.0.0", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0.tgz", - "integrity": "sha512-ovRt8PeD0/kD4LqJc5Mp7T9P9gc5EBJT2seVgXoRZdKm9xpIIYPHIjDBOW8jQBjQp93LtG2sFE6QE5VftFyhOQ==" + "version": "97.0.0-nightly.20200919", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0-nightly.20200919.tgz", + "integrity": "sha512-BqKZxONTh53SVl2QUqVidoSo/nvL6FMKUG21SvB6V46M1Y6EbJrXES5Nt2c9XYveWpJjA297zIoxTUdI/PMDSA==" }, "bluebird": { "version": "3.7.2", diff --git a/package.json b/package.json index 135fde460f..790cf11f27 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "url": "https://github.com/AssemblyScript/assemblyscript/issues" }, "dependencies": { - "binaryen": "97.0.0", + "binaryen": "97.0.0-nightly.20200919", "long": "^4.0.0", "source-map-support": "^0.5.19", "ts-node": "^6.2.0" diff --git a/src/common.ts b/src/common.ts index c9ab5dc5e8..5a8d66769b 100644 --- a/src/common.ts +++ b/src/common.ts @@ -174,6 +174,7 @@ export namespace CommonNames { export const ASC_FEATURE_REFERENCE_TYPES = "ASC_FEATURE_REFERENCE_TYPES"; export const ASC_FEATURE_MULTI_VALUE = "ASC_FEATURE_MULTI_VALUE"; export const ASC_FEATURE_GC = "ASC_FEATURE_GC"; + export const ASC_FEATURE_MEMORY64 = "ASC_FEATURE_MEMORY64"; // classes export const I8 = "I8"; export const I16 = "I16"; diff --git a/src/compiler.ts b/src/compiler.ts index cbd113bfce..7063a56113 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -229,7 +229,7 @@ export class Options { /** Global aliases, mapping alias names as the key to internal names to be aliased as the value. */ globalAliases: Map | null = null; /** Features to activate by default. These are the finished proposals. */ - features: Feature = Feature.MUTABLE_GLOBALS | Feature.SIGN_EXTENSION; + features: Feature = Feature.MUTABLE_GLOBALS; /** If true, disallows unsafe features in user code. */ noUnsafe: bool = false; /** If true, enables pedantic diagnostics. */ @@ -406,6 +406,7 @@ export class Compiler extends DiagnosticEmitter { if (options.hasFeature(Feature.REFERENCE_TYPES)) featureFlags |= FeatureFlags.ReferenceTypes; if (options.hasFeature(Feature.MULTI_VALUE)) featureFlags |= FeatureFlags.MultiValue; if (options.hasFeature(Feature.GC)) featureFlags |= FeatureFlags.GC; + if (options.hasFeature(Feature.MEMORY64)) featureFlags |= FeatureFlags.Memory64; module.setFeatures(featureFlags); // set up the main start function diff --git a/src/index.ts b/src/index.ts index 3e2cce084f..6082cfc53c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -151,6 +151,8 @@ export const FEATURE_REFERENCE_TYPES = Feature.REFERENCE_TYPES; export const FEATURE_MULTI_VALUE = Feature.MULTI_VALUE; /** Garbage collection. */ export const FEATURE_GC = Feature.GC; +/** Memory64. */ +export const FEATURE_MEMORY64 = Feature.MEMORY64; /** Enables a specific feature. */ export function enableFeature(options: Options, feature: Feature): void { diff --git a/src/module.ts b/src/module.ts index 19ade164f3..a265f28b20 100644 --- a/src/module.ts +++ b/src/module.ts @@ -57,7 +57,8 @@ export enum FeatureFlags { ReferenceTypes = 256 /* _BinaryenFeatureReferenceTypes */, MultiValue = 512 /* _BinaryenFeatureMultivalue */, GC = 1024 /* _BinaryenFeatureGC */, - All = 2047 /* _BinaryenFeatureAll */ + Memory64 = 2048, // TODO: missing in Binaryen API + All = 4095 /* _BinaryenFeatureAll */ } export enum ExpressionId { diff --git a/src/program.ts b/src/program.ts index 5d8c165bcc..41e36e7f1b 100644 --- a/src/program.ts +++ b/src/program.ts @@ -945,6 +945,8 @@ export class Program extends DiagnosticEmitter { i64_new(options.hasFeature(Feature.MULTI_VALUE) ? 1 : 0, 0)); this.registerConstantInteger(CommonNames.ASC_FEATURE_GC, Type.bool, i64_new(options.hasFeature(Feature.GC) ? 1 : 0, 0)); + this.registerConstantInteger(CommonNames.ASC_FEATURE_MEMORY64, Type.bool, + i64_new(options.hasFeature(Feature.MEMORY64) ? 1 : 0, 0)); // remember deferred elements var queuedImports = new Array(); diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 17958016e9..f281cfb769 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -82,6 +82,8 @@ declare const ASC_FEATURE_REFERENCE_TYPES: bool; declare const ASC_FEATURE_MULTI_VALUE: bool; /** Whether the garbage collection feature is enabled. */ declare const ASC_FEATURE_GC: bool; +/** Whether the memory64 feature is enabled. */ +declare const ASC_FEATURE_MEMORY64: bool; // Builtins diff --git a/std/assembly/shared/feature.ts b/std/assembly/shared/feature.ts index df69f166d7..0b36c644eb 100644 --- a/std/assembly/shared/feature.ts +++ b/std/assembly/shared/feature.ts @@ -25,7 +25,9 @@ export const enum Feature { /** Multi value types. */ MULTI_VALUE = 1 << 9, // see: https://github.com/WebAssembly/multi-value /** Garbage collection. */ - GC = 1 << 10 // see: https://github.com/WebAssembly/gc + GC = 1 << 10, // see: https://github.com/WebAssembly/gc + /** Memory64. */ + MEMORY64 = 1 << 11 // see: https://github.com/WebAssembly/memory64 } /** Gets the name of the specified feature one would specify on the command line. */ @@ -42,6 +44,7 @@ export function featureToString(feature: Feature): string { case Feature.REFERENCE_TYPES: return "reference-types"; case Feature.MULTI_VALUE: return "multi-value"; case Feature.GC: return "gc"; + case Feature.MEMORY64: return "memory64"; } assert(false); return ""; diff --git a/tests/compiler/abi.untouched.wat b/tests/compiler/abi.untouched.wat index b09618cc81..f540d255b1 100644 --- a/tests/compiler/abi.untouched.wat +++ b/tests/compiler/abi.untouched.wat @@ -27,7 +27,10 @@ i32.const 256 local.set $0 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eqz i32.eqz if @@ -43,19 +46,28 @@ global.get $abi/condition if local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 2 i32.div_s local.set $0 else local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 2 i32.div_s local.set $0 end local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eqz i32.eqz if @@ -71,7 +83,10 @@ global.get $abi/condition if local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 24 i32.shr_s local.set $0 @@ -93,7 +108,10 @@ unreachable end i32.const 256 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s global.set $abi/y global.get $abi/y i32.eqz @@ -165,16 +183,20 @@ ) (func $abi/exported (result i32) i32.const 128 - i32.extend8_s - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s ) (func $abi/exportedExported (result i32) call $abi/exported - i32.extend8_s ) (func $abi/exportedInternal (result i32) call $abi/internal - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s ) (func $~start call $start:abi diff --git a/tests/compiler/asc-constants.ts b/tests/compiler/asc-constants.ts index a355b602bc..3b007986a3 100644 --- a/tests/compiler/asc-constants.ts +++ b/tests/compiler/asc-constants.ts @@ -15,3 +15,4 @@ ASC_FEATURE_TAIL_CALLS; ASC_FEATURE_REFERENCE_TYPES; ASC_FEATURE_MULTI_VALUE; ASC_FEATURE_GC; +ASC_FEATURE_MEMORY64; diff --git a/tests/compiler/asc-constants.untouched.wat b/tests/compiler/asc-constants.untouched.wat index e548fa7c07..e32d4d899e 100644 --- a/tests/compiler/asc-constants.untouched.wat +++ b/tests/compiler/asc-constants.untouched.wat @@ -7,7 +7,7 @@ (global $~lib/ASC_MEMORY_BASE i32 (i32.const 0)) (global $~lib/ASC_OPTIMIZE_LEVEL i32 (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/ASC_FEATURE_SIGN_EXTENSION i32 (i32.const 1)) + (global $~lib/ASC_FEATURE_SIGN_EXTENSION i32 (i32.const 0)) (global $~lib/ASC_FEATURE_MUTABLE_GLOBALS i32 (i32.const 1)) (global $~lib/ASC_FEATURE_NONTRAPPING_F2I i32 (i32.const 0)) (global $~lib/ASC_FEATURE_BULK_MEMORY i32 (i32.const 0)) @@ -18,6 +18,7 @@ (global $~lib/ASC_FEATURE_REFERENCE_TYPES i32 (i32.const 0)) (global $~lib/ASC_FEATURE_MULTI_VALUE i32 (i32.const 0)) (global $~lib/ASC_FEATURE_GC i32 (i32.const 0)) + (global $~lib/ASC_FEATURE_MEMORY64 i32 (i32.const 0)) (export "memory" (memory $0)) (start $~start) (func $start:asc-constants @@ -31,7 +32,7 @@ drop i32.const 0 drop - i32.const 1 + i32.const 0 drop i32.const 1 drop @@ -53,6 +54,8 @@ drop i32.const 0 drop + i32.const 0 + drop ) (func $~start call $start:asc-constants diff --git a/tests/compiler/builtins.untouched.wat b/tests/compiler/builtins.untouched.wat index 75ee155610..9573100c47 100644 --- a/tests/compiler/builtins.untouched.wat +++ b/tests/compiler/builtins.untouched.wat @@ -1437,7 +1437,10 @@ drop global.get $~lib/builtins/i8.MIN_VALUE i32.const 128 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq drop global.get $~lib/builtins/i8.MAX_VALUE @@ -1446,7 +1449,10 @@ drop global.get $~lib/builtins/i16.MIN_VALUE i32.const 32768 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eq drop global.get $~lib/builtins/i16.MAX_VALUE diff --git a/tests/compiler/features/simd.untouched.wat b/tests/compiler/features/simd.untouched.wat index fb3322732c..616a7bba44 100644 --- a/tests/compiler/features/simd.untouched.wat +++ b/tests/compiler/features/simd.untouched.wat @@ -412,7 +412,10 @@ end local.get $2 i8x16.extract_lane_s 0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 2 i32.eq i32.eqz @@ -426,7 +429,10 @@ end local.get $2 i8x16.extract_lane_s 15 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const -128 i32.eq i32.eqz @@ -948,7 +954,10 @@ end local.get $2 i16x8.extract_lane_s 0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 2 i32.eq i32.eqz @@ -962,7 +971,10 @@ end local.get $2 i16x8.extract_lane_s 7 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -32768 i32.eq i32.eqz diff --git a/tests/compiler/many-locals.optimized.wat b/tests/compiler/many-locals.optimized.wat index 13729fb302..4c9f7826dd 100644 --- a/tests/compiler/many-locals.optimized.wat +++ b/tests/compiler/many-locals.optimized.wat @@ -1,15 +1,36 @@ (module (type $i32_=>_i32 (func (param i32) (result i32))) + (type $none_=>_none (func)) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 1024) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00m\00a\00n\00y\00-\00l\00o\00c\00a\00l\00s\00.\00t\00s") (export "memory" (memory $0)) (export "testI32" (func $many-locals/testI32)) (export "testI8" (func $many-locals/testI8)) + (start $~start) (func $many-locals/testI32 (param $0 i32) (result i32) local.get $0 ) (func $many-locals/testI8 (param $0 i32) (result i32) local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + ) + (func $~start + i32.const 42 + call $many-locals/testI8 + i32.const 42 + i32.ne + if + i32.const 0 + i32.const 1040 + i32.const 267 + i32.const 1 + call $~lib/builtins/abort + unreachable + end ) ) diff --git a/tests/compiler/many-locals.untouched.wat b/tests/compiler/many-locals.untouched.wat index 7aae338a39..8e2517e717 100644 --- a/tests/compiler/many-locals.untouched.wat +++ b/tests/compiler/many-locals.untouched.wat @@ -783,7 +783,10 @@ local.get $127 local.set $128 local.get $128 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s ) (func $start:many-locals i32.const 42 @@ -801,7 +804,6 @@ end i32.const 42 call $many-locals/testI8 - i32.extend8_s i32.const 42 i32.eq i32.eqz diff --git a/tests/compiler/overflow.untouched.wat b/tests/compiler/overflow.untouched.wat index a77b150069..4b9a74b4cb 100644 --- a/tests/compiler/overflow.untouched.wat +++ b/tests/compiler/overflow.untouched.wat @@ -18,7 +18,10 @@ i32.add local.set $0 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const -128 i32.eq i32.eqz @@ -35,7 +38,10 @@ i32.sub local.set $0 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 127 i32.eq i32.eqz @@ -55,7 +61,10 @@ local.get $2 local.set $1 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const -128 i32.eq i32.eqz @@ -75,7 +84,10 @@ local.get $2 local.set $1 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 127 i32.eq i32.eqz @@ -92,7 +104,10 @@ i32.add local.set $0 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const -128 i32.eq i32.eqz @@ -109,7 +124,10 @@ i32.sub local.set $0 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 127 i32.eq i32.eqz @@ -127,7 +145,10 @@ local.tee $0 local.set $1 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const -128 i32.eq i32.eqz @@ -145,7 +166,10 @@ local.tee $0 local.set $1 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 127 i32.eq i32.eqz @@ -160,7 +184,10 @@ local.get $0 i32.const 1 i32.add - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const -128 i32.eq i32.eqz @@ -179,7 +206,10 @@ i32.add local.set $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -32768 i32.eq i32.eqz @@ -196,7 +226,10 @@ i32.sub local.set $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 32767 i32.eq i32.eqz @@ -216,7 +249,10 @@ local.get $2 local.set $0 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -32768 i32.eq i32.eqz @@ -236,7 +272,10 @@ local.get $2 local.set $0 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 32767 i32.eq i32.eqz @@ -253,7 +292,10 @@ i32.add local.set $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -32768 i32.eq i32.eqz @@ -270,7 +312,10 @@ i32.sub local.set $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 32767 i32.eq i32.eqz @@ -288,7 +333,10 @@ local.tee $1 local.set $0 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -32768 i32.eq i32.eqz @@ -306,7 +354,10 @@ local.tee $1 local.set $0 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 32767 i32.eq i32.eqz @@ -321,7 +372,10 @@ local.get $1 i32.const 1 i32.add - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -32768 i32.eq i32.eqz diff --git a/tests/compiler/portable-conversions.untouched.wat b/tests/compiler/portable-conversions.untouched.wat index 0d7376bca1..6d00acc97a 100644 --- a/tests/compiler/portable-conversions.untouched.wat +++ b/tests/compiler/portable-conversions.untouched.wat @@ -13,7 +13,10 @@ (start $~start) (func $start:portable-conversions global.get $portable-conversions/i - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eqz if i32.const 0 @@ -25,7 +28,10 @@ end global.get $portable-conversions/I i32.wrap_i64 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eqz if i32.const 0 @@ -37,7 +43,10 @@ end global.get $portable-conversions/f i32.trunc_f32_s - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eqz if i32.const 0 @@ -49,7 +58,10 @@ end global.get $portable-conversions/F i32.trunc_f64_s - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eqz if i32.const 0 @@ -60,7 +72,10 @@ unreachable end global.get $portable-conversions/i - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eqz if i32.const 0 @@ -72,7 +87,10 @@ end global.get $portable-conversions/I i32.wrap_i64 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eqz if i32.const 0 @@ -84,7 +102,10 @@ end global.get $portable-conversions/f i32.trunc_f32_s - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eqz if i32.const 0 @@ -96,7 +117,10 @@ end global.get $portable-conversions/F i32.trunc_f64_s - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eqz if i32.const 0 diff --git a/tests/compiler/retain-i32.optimized.wat b/tests/compiler/retain-i32.optimized.wat index 37736ab94d..99faa43113 100644 --- a/tests/compiler/retain-i32.optimized.wat +++ b/tests/compiler/retain-i32.optimized.wat @@ -1,198 +1,11 @@ (module (type $none_=>_none (func)) - (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 1024) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00r\00e\00t\00a\00i\00n\00-\00i\003\002\00.\00t\00s") (export "memory" (memory $0)) (start $~start) - (func $retain-i32/test (param $0 i32) (param $1 i32) - (local $2 i32) - local.get $0 - local.get $1 - i32.add - local.tee $2 - i32.extend8_s - local.get $2 - i32.extend8_s - i32.ne - if - i32.const 0 - i32.const 1040 - i32.const 4 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.sub - local.tee $2 - i32.extend8_s - local.get $2 - i32.extend8_s - i32.ne - if - i32.const 0 - i32.const 1040 - i32.const 5 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.mul - local.tee $2 - i32.extend8_s - local.get $2 - i32.extend8_s - i32.ne - if - i32.const 0 - i32.const 1040 - i32.const 6 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.and - local.tee $2 - i32.extend8_s - local.get $2 - i32.extend8_s - i32.ne - if - i32.const 0 - i32.const 1040 - i32.const 7 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.or - local.tee $2 - i32.extend8_s - local.get $2 - i32.extend8_s - i32.ne - if - i32.const 0 - i32.const 1040 - i32.const 8 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.xor - local.tee $2 - i32.extend8_s - local.get $2 - i32.extend8_s - i32.ne - if - i32.const 0 - i32.const 1040 - i32.const 9 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.shl - local.tee $0 - i32.extend8_s - local.get $0 - i32.extend8_s - i32.ne - if - i32.const 0 - i32.const 1040 - i32.const 10 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - ) - (func $start:retain-i32 + (func $~start (local $0 i32) - i32.const 0 - i32.const 127 - call $retain-i32/test - i32.const 127 - i32.const 0 - call $retain-i32/test - i32.const 1 - i32.const 127 - call $retain-i32/test - i32.const 127 - i32.const 1 - call $retain-i32/test - i32.const -1 - i32.const 127 - call $retain-i32/test - i32.const 127 - i32.const -1 - call $retain-i32/test - i32.const 0 - i32.const -128 - call $retain-i32/test - i32.const -128 - i32.const 0 - call $retain-i32/test - i32.const 1 - i32.const -128 - call $retain-i32/test - i32.const -128 - i32.const 1 - call $retain-i32/test - i32.const -1 - i32.const -128 - call $retain-i32/test - i32.const -128 - i32.const -1 - call $retain-i32/test - i32.const 127 - i32.const 127 - call $retain-i32/test - i32.const -128 - i32.const -128 - call $retain-i32/test - i32.const 127 - i32.const -128 - call $retain-i32/test - i32.const -128 - i32.const 127 - call $retain-i32/test - i32.const 0 - i32.const 255 - call $retain-i32/test - i32.const 255 - i32.const 0 - call $retain-i32/test - i32.const 1 - i32.const 255 - call $retain-i32/test - i32.const 255 - i32.const 1 - call $retain-i32/test - i32.const -1 - i32.const 255 - call $retain-i32/test - i32.const 255 - i32.const -1 - call $retain-i32/test - i32.const 255 - i32.const 255 - call $retain-i32/test i32.const -128 local.set $0 loop $for-loop|0 @@ -200,42 +13,6 @@ i32.const 255 i32.le_s if - i32.const 0 - local.get $0 - call $retain-i32/test - i32.const 1 - local.get $0 - call $retain-i32/test - i32.const -1 - local.get $0 - call $retain-i32/test - i32.const -128 - local.get $0 - call $retain-i32/test - i32.const 127 - local.get $0 - call $retain-i32/test - i32.const 255 - local.get $0 - call $retain-i32/test - i32.const -32768 - local.get $0 - call $retain-i32/test - i32.const 32767 - local.get $0 - call $retain-i32/test - i32.const 65535 - local.get $0 - call $retain-i32/test - i32.const 2147483647 - local.get $0 - call $retain-i32/test - i32.const -2147483648 - local.get $0 - call $retain-i32/test - i32.const -1 - local.get $0 - call $retain-i32/test local.get $0 i32.const 1 i32.add @@ -250,7 +27,4 @@ i32.load8_s drop ) - (func $~start - call $start:retain-i32 - ) ) diff --git a/tests/compiler/retain-i32.untouched.wat b/tests/compiler/retain-i32.untouched.wat index 16cd33c52b..a096fb55d4 100644 --- a/tests/compiler/retain-i32.untouched.wat +++ b/tests/compiler/retain-i32.untouched.wat @@ -24,11 +24,17 @@ local.get $0 local.get $1 i32.add - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s local.get $0 local.get $1 i32.add - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -42,11 +48,17 @@ local.get $0 local.get $1 i32.sub - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s local.get $0 local.get $1 i32.sub - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -60,11 +72,17 @@ local.get $0 local.get $1 i32.mul - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s local.get $0 local.get $1 i32.mul - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -78,11 +96,17 @@ local.get $0 local.get $1 i32.and - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s local.get $0 local.get $1 i32.and - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -96,11 +120,17 @@ local.get $0 local.get $1 i32.or - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s local.get $0 local.get $1 i32.or - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -114,11 +144,17 @@ local.get $0 local.get $1 i32.xor - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s local.get $0 local.get $1 i32.xor - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -132,11 +168,17 @@ local.get $0 local.get $1 i32.shl - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s local.get $0 local.get $1 i32.shl - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -425,7 +467,10 @@ i32.add i32.const 1 i32.add - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s global.set $retain-i32/si global.get $retain-i32/si i32.const -1 @@ -444,7 +489,10 @@ i32.sub i32.const 127 i32.sub - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s global.set $retain-i32/si global.get $retain-i32/si i32.const -1 @@ -461,7 +509,10 @@ i32.const 127 i32.const 2 i32.mul - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s global.set $retain-i32/si global.get $retain-i32/si i32.const -2 @@ -478,7 +529,10 @@ i32.const 0 i32.const -128 i32.sub - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s global.set $retain-i32/si global.get $retain-i32/si i32.const -128 @@ -495,7 +549,10 @@ i32.const -128 i32.const -1 i32.mul - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s global.set $retain-i32/si global.get $retain-i32/si i32.const -128 @@ -512,7 +569,10 @@ i32.const 127 i32.const -1 i32.div_s - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s global.set $retain-i32/si global.get $retain-i32/si i32.const -127 @@ -529,7 +589,10 @@ i32.const -128 i32.const -1 i32.div_s - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s global.set $retain-i32/si global.get $retain-i32/si i32.const -128 diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 3af5f13c15..feee7718d4 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -9198,7 +9198,10 @@ (func $~lib/util/number/itoa_buffered (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 0 i32.lt_s local.tee $2 @@ -9212,7 +9215,10 @@ local.set $1 end local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 10 i32.lt_u if @@ -9222,7 +9228,10 @@ i32.shl i32.add local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 48 i32.or i32.store16 @@ -9231,17 +9240,21 @@ i32.add return end - local.get $0 - local.get $1 - i32.extend8_s + local.get $2 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + local.tee $2 call $~lib/util/number/decimalCount32 - local.get $2 i32.add - local.tee $0 - call $~lib/util/number/utoa_dec_simple + local.set $1 local.get $0 + local.get $2 + local.get $1 + call $~lib/util/number/utoa_dec_simple + local.get $1 ) (func $~lib/util/string/joinIntegerArray (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -15524,10 +15537,7 @@ i32.const 6080 i32.const 0 call $~lib/array/Array#reduce - i32.const 0 - i32.ne - i32.const 1 - i32.ne + i32.eqz if i32.const 0 i32.const 1296 @@ -15676,10 +15686,7 @@ i32.const 6304 i32.const 0 call $~lib/array/Array#reduceRight - i32.const 0 - i32.ne - i32.const 1 - i32.ne + i32.eqz if i32.const 0 i32.const 1296 diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index a5231ab901..347bea9cff 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -16751,7 +16751,10 @@ i32.const 1 drop local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 0 i32.lt_s local.set $2 @@ -16776,7 +16779,10 @@ i32.le_u drop local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 10 i32.lt_u if @@ -16786,7 +16792,10 @@ i32.shl i32.add local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 48 i32.or i32.store16 @@ -16803,14 +16812,20 @@ drop local.get $3 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/number/decimalCount32 i32.add local.set $3 local.get $0 local.set $6 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s local.set $5 local.get $3 local.set $4 diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index e7aa132790..f710a3aca4 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -1401,8 +1401,9 @@ ) (func $~lib/polyfills/bswap (param $0 i32) (result i32) local.get $0 - i32.extend16_s - i32.const 8 + i32.const 16 + i32.shl + i32.const 24 i32.shr_s i32.const 255 i32.and @@ -2148,8 +2149,9 @@ i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s - i32.const -7946 + i32.const 65535 + i32.and + i32.const 57590 i32.ne if i32.const 0 @@ -2163,7 +2165,8 @@ i32.const 1 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 65535 + i32.and i32.const 22752 i32.ne if @@ -2178,8 +2181,9 @@ i32.const 2 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s - i32.const -24744 + i32.const 65535 + i32.and + i32.const 40792 i32.ne if i32.const 0 @@ -2193,8 +2197,9 @@ i32.const 3 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s - i32.const -32097 + i32.const 65535 + i32.and + i32.const 33439 i32.ne if i32.const 0 @@ -2208,7 +2213,8 @@ i32.const 4 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 65535 + i32.and i32.const 25986 i32.ne if @@ -2223,7 +2229,8 @@ i32.const 5 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 65535 + i32.and i32.const 17253 i32.ne if @@ -2238,7 +2245,8 @@ i32.const 6 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 65535 + i32.and i32.const 24387 i32.ne if @@ -2253,8 +2261,9 @@ i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s - i32.const -2336 + i32.const 65535 + i32.and + i32.const 63200 i32.ne if i32.const 0 @@ -2268,8 +2277,9 @@ i32.const 1 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s - i32.const -8104 + i32.const 65535 + i32.and + i32.const 57432 i32.ne if i32.const 0 @@ -2283,7 +2293,8 @@ i32.const 2 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 65535 + i32.and i32.const 22687 i32.ne if @@ -2298,8 +2309,9 @@ i32.const 3 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s - i32.const -24702 + i32.const 65535 + i32.and + i32.const 40834 i32.ne if i32.const 0 @@ -2313,8 +2325,9 @@ i32.const 4 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s - i32.const -32155 + i32.const 65535 + i32.and + i32.const 33381 i32.ne if i32.const 0 @@ -2328,7 +2341,8 @@ i32.const 5 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 65535 + i32.and i32.const 25923 i32.ne if @@ -2343,7 +2357,8 @@ i32.const 6 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 65535 + i32.and i32.const 17247 i32.ne if @@ -3121,8 +3136,9 @@ i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s - i32.const -13360 + i32.const 65535 + i32.and + i32.const 52176 i32.ne if i32.const 0 @@ -3140,7 +3156,8 @@ i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 65535 + i32.and i32.const 14689 i32.ne if diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index 643334b687..d0b78e568f 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -2134,7 +2134,10 @@ i32.const 8 i32.shl local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 8 i32.shr_s i32.const 255 @@ -3147,7 +3150,10 @@ i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -7946 i32.eq i32.eqz @@ -3163,7 +3169,10 @@ i32.const 1 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 22752 i32.eq i32.eqz @@ -3179,7 +3188,10 @@ i32.const 2 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -24744 i32.eq i32.eqz @@ -3195,7 +3207,10 @@ i32.const 3 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -32097 i32.eq i32.eqz @@ -3211,7 +3226,10 @@ i32.const 4 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 25986 i32.eq i32.eqz @@ -3227,7 +3245,10 @@ i32.const 5 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 17253 i32.eq i32.eqz @@ -3243,7 +3264,10 @@ i32.const 6 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 24387 i32.eq i32.eqz @@ -3259,7 +3283,10 @@ i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -2336 i32.eq i32.eqz @@ -3275,7 +3302,10 @@ i32.const 1 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -8104 i32.eq i32.eqz @@ -3291,7 +3321,10 @@ i32.const 2 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 22687 i32.eq i32.eqz @@ -3307,7 +3340,10 @@ i32.const 3 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -24702 i32.eq i32.eqz @@ -3323,7 +3359,10 @@ i32.const 4 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -32155 i32.eq i32.eqz @@ -3339,7 +3378,10 @@ i32.const 5 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 25923 i32.eq i32.eqz @@ -3355,7 +3397,10 @@ i32.const 6 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 17247 i32.eq i32.eqz @@ -4184,7 +4229,10 @@ i32.const 0 i32.const 1 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const -13360 i32.eq i32.eqz @@ -4205,7 +4253,10 @@ i32.const 0 i32.const 0 call $~lib/dataview/DataView#getInt16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 14689 i32.eq i32.eqz diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index 9f2064769b..117298a2c0 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -1333,9 +1333,10 @@ i32.const 0 else local.get $0 - i32.load8_s + i32.load8_u local.get $1 - i32.extend8_s + i32.const 255 + i32.and i32.eq end if @@ -1356,7 +1357,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 call $~lib/map/Map#find i32.const 0 @@ -1502,7 +1506,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 local.tee $5 call $~lib/map/Map#find @@ -1595,7 +1602,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 call $~lib/map/Map#find local.tee $0 @@ -2520,7 +2530,10 @@ (local $5 i32) local.get $1 local.tee $3 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 local.set $4 local.get $0 @@ -2546,9 +2559,10 @@ i32.const 0 else local.get $1 - i32.load8_s + i32.load8_u local.get $3 - i32.extend8_s + i32.const 255 + i32.and i32.eq end br_if $__inlined_func$~lib/map/Map#find @@ -2953,7 +2967,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 call $~lib/map/Map#find local.tee $1 @@ -3076,7 +3093,10 @@ i32.store offset=20 loop $for-loop|1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 100 i32.lt_s if @@ -3094,7 +3114,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 10 i32.add call $~lib/map/Map#set @@ -3115,7 +3138,10 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 10 i32.add i32.ne @@ -3150,7 +3176,10 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 100 i32.lt_s if @@ -3170,7 +3199,10 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 10 i32.add i32.ne @@ -3185,7 +3217,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 20 i32.add call $~lib/map/Map#set @@ -3206,7 +3241,10 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 20 i32.add i32.ne @@ -3371,7 +3409,10 @@ local.set $2 loop $for-loop|6 local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 50 i32.lt_s if @@ -3391,7 +3432,10 @@ local.get $2 call $~lib/map/Map#get local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 20 i32.add i32.ne @@ -3440,7 +3484,10 @@ local.set $2 loop $for-loop|8 local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 50 i32.lt_s if @@ -3458,7 +3505,10 @@ local.get $0 local.get $2 local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 10 i32.add call $~lib/map/Map#set @@ -3531,49 +3581,6 @@ local.get $0 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $0 - i32.load - local.get $2 - local.get $0 - i32.load offset=4 - i32.and - i32.const 2 - i32.shl - i32.add - i32.load - local.set $0 - loop $while-continue|0 - local.get $0 - if - local.get $0 - i32.load offset=8 - i32.const 1 - i32.and - if (result i32) - i32.const 0 - else - local.get $0 - i32.load8_u - local.get $1 - i32.const 255 - i32.and - i32.eq - end - if - local.get $0 - return - end - local.get $0 - i32.load offset=8 - i32.const -2 - i32.and - local.set $0 - br $while-continue|0 - end - end - i32.const 0 - ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 @@ -3581,7 +3588,7 @@ i32.const 255 i32.and call $~lib/util/hash/hash8 - call $~lib/map/Map#find + call $~lib/map/Map#find i32.const 0 i32.ne ) @@ -3729,7 +3736,7 @@ i32.and call $~lib/util/hash/hash8 local.tee $5 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $3 if local.get $3 @@ -3822,7 +3829,7 @@ i32.const 255 i32.and call $~lib/util/hash/hash8 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $0 i32.eqz if @@ -4226,7 +4233,7 @@ i32.const 255 i32.and call $~lib/util/hash/hash8 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $1 i32.eqz if @@ -4818,9 +4825,10 @@ i32.const 0 else local.get $0 - i32.load16_s + i32.load16_u local.get $1 - i32.extend16_s + i32.const 65535 + i32.and i32.eq end if @@ -4841,7 +4849,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 call $~lib/map/Map#find i32.const 0 @@ -4987,7 +4998,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 local.tee $5 call $~lib/map/Map#find @@ -5080,7 +5094,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 call $~lib/map/Map#find local.tee $0 @@ -5402,7 +5419,10 @@ (local $5 i32) local.get $1 local.tee $3 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 local.set $4 local.get $0 @@ -5428,9 +5448,10 @@ i32.const 0 else local.get $1 - i32.load16_s + i32.load16_u local.get $3 - i32.extend16_s + i32.const 65535 + i32.and i32.eq end br_if $__inlined_func$~lib/map/Map#find @@ -5535,7 +5556,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 call $~lib/map/Map#find local.tee $1 @@ -5625,7 +5649,10 @@ i32.store offset=20 loop $for-loop|1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 100 i32.lt_s if @@ -5643,7 +5670,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 10 i32.add call $~lib/map/Map#set @@ -5664,7 +5694,10 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 10 i32.add i32.ne @@ -5699,7 +5732,10 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 100 i32.lt_s if @@ -5719,7 +5755,10 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 10 i32.add i32.ne @@ -5734,7 +5773,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 20 i32.add call $~lib/map/Map#set @@ -5755,7 +5797,10 @@ local.get $1 call $~lib/map/Map#get local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 20 i32.add i32.ne @@ -5922,7 +5967,10 @@ local.set $2 loop $for-loop|6 local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 50 i32.lt_s if @@ -5942,7 +5990,10 @@ local.get $2 call $~lib/map/Map#get local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 20 i32.add i32.ne @@ -5991,7 +6042,10 @@ local.set $2 loop $for-loop|8 local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 50 i32.lt_s if @@ -6009,7 +6063,10 @@ local.get $0 local.get $2 local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 10 i32.add call $~lib/map/Map#set @@ -6082,49 +6139,6 @@ local.get $0 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $0 - i32.load - local.get $2 - local.get $0 - i32.load offset=4 - i32.and - i32.const 2 - i32.shl - i32.add - i32.load - local.set $0 - loop $while-continue|0 - local.get $0 - if - local.get $0 - i32.load offset=8 - i32.const 1 - i32.and - if (result i32) - i32.const 0 - else - local.get $0 - i32.load16_u - local.get $1 - i32.const 65535 - i32.and - i32.eq - end - if - local.get $0 - return - end - local.get $0 - i32.load offset=8 - i32.const -2 - i32.and - local.set $0 - br $while-continue|0 - end - end - i32.const 0 - ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 @@ -6132,7 +6146,7 @@ i32.const 65535 i32.and call $~lib/util/hash/hash16 - call $~lib/map/Map#find + call $~lib/map/Map#find i32.const 0 i32.ne ) @@ -6280,7 +6294,7 @@ i32.and call $~lib/util/hash/hash16 local.tee $5 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $3 if local.get $3 @@ -6373,7 +6387,7 @@ i32.const 65535 i32.and call $~lib/util/hash/hash16 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $0 i32.eqz if @@ -6781,7 +6795,7 @@ i32.const 65535 i32.and call $~lib/util/hash/hash16 - call $~lib/map/Map#find + call $~lib/map/Map#find local.tee $1 i32.eqz if diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index 3cd5a53b19..0d84e733ec 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -1871,7 +1871,10 @@ local.get $3 i32.load8_s local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq else i32.const 0 @@ -1910,7 +1913,10 @@ i32.eq drop local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.0 end @@ -2104,7 +2110,10 @@ i32.eq drop local.get $3 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.1 end @@ -2222,7 +2231,10 @@ i32.eq drop local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.3 end @@ -4344,7 +4356,10 @@ local.get $3 i32.load8_s local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq else i32.const 0 @@ -4551,7 +4566,10 @@ i32.eq drop local.get $3 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.4 end @@ -5069,7 +5087,10 @@ i32.eq drop local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.6 end @@ -5198,7 +5219,10 @@ local.set $1 loop $for-loop|1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 100 i32.lt_s local.set $3 @@ -5221,7 +5245,10 @@ local.get $1 i32.const 10 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release @@ -5242,7 +5269,10 @@ call $~lib/map/Map#get i32.const 10 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.add i32.eq i32.eqz @@ -5278,7 +5308,10 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 100 i32.lt_s local.set $4 @@ -5301,7 +5334,10 @@ call $~lib/map/Map#get i32.const 10 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.add i32.eq i32.eqz @@ -5317,7 +5353,10 @@ local.get $1 i32.const 20 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release @@ -5338,7 +5377,10 @@ call $~lib/map/Map#get i32.const 20 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.add i32.eq i32.eqz @@ -5477,7 +5519,10 @@ local.set $7 loop $for-loop|6 local.get $7 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 50 i32.lt_s local.set $10 @@ -5500,7 +5545,10 @@ call $~lib/map/Map#get i32.const 20 local.get $7 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.add i32.eq i32.eqz @@ -5553,7 +5601,10 @@ local.set $7 loop $for-loop|8 local.get $7 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 50 i32.lt_s local.set $9 @@ -5576,7 +5627,10 @@ local.get $7 i32.const 10 local.get $7 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release @@ -7496,7 +7550,10 @@ local.get $3 i32.load16_s local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eq else i32.const 0 @@ -7539,7 +7596,10 @@ i32.eq drop local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.0 end @@ -7741,7 +7801,10 @@ i32.eq drop local.get $3 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.1 end @@ -7863,7 +7926,10 @@ i32.eq drop local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.3 end @@ -8260,7 +8326,10 @@ local.get $3 i32.load16_s local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eq else i32.const 0 @@ -8475,7 +8544,10 @@ i32.eq drop local.get $3 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.4 end @@ -8603,7 +8675,10 @@ i32.eq drop local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.6 end @@ -8732,7 +8807,10 @@ local.set $1 loop $for-loop|1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 100 i32.lt_s local.set $3 @@ -8755,7 +8833,10 @@ local.get $1 i32.const 10 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release @@ -8776,7 +8857,10 @@ call $~lib/map/Map#get i32.const 10 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.add i32.eq i32.eqz @@ -8812,7 +8896,10 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 100 i32.lt_s local.set $4 @@ -8835,7 +8922,10 @@ call $~lib/map/Map#get i32.const 10 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.add i32.eq i32.eqz @@ -8851,7 +8941,10 @@ local.get $1 i32.const 20 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release @@ -8872,7 +8965,10 @@ call $~lib/map/Map#get i32.const 20 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.add i32.eq i32.eqz @@ -9011,7 +9107,10 @@ local.set $7 loop $for-loop|6 local.get $7 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 50 i32.lt_s local.set $10 @@ -9034,7 +9133,10 @@ call $~lib/map/Map#get i32.const 20 local.get $7 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.add i32.eq i32.eqz @@ -9087,7 +9189,10 @@ local.set $7 loop $for-loop|8 local.get $7 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 50 i32.lt_s local.set $9 @@ -9110,7 +9215,10 @@ local.get $7 i32.const 10 local.get $7 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.add call $~lib/map/Map#set call $~lib/rt/pure/__release diff --git a/tests/compiler/std/math.optimized.wat b/tests/compiler/std/math.optimized.wat index 67ca910887..e482acfa7c 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -48397,7 +48397,8 @@ i32.const 1 i32.const 3 call $~lib/math/ipow32 - i32.extend8_s + i32.const 255 + i32.and i32.const 1 i32.ne if @@ -48411,8 +48412,9 @@ i32.const -2 i32.const 3 call $~lib/math/ipow32 - i32.extend8_s - i32.const -8 + i32.const 255 + i32.and + i32.const 248 i32.ne if i32.const 0 diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index c953dd3369..7becd266bf 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -59088,7 +59088,10 @@ i32.const 1 i32.const 3 call $~lib/math/ipow32 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 1 i32.eq i32.eqz @@ -59103,7 +59106,10 @@ i32.const -2 i32.const 3 call $~lib/math/ipow32 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const -8 i32.eq i32.eqz diff --git a/tests/compiler/std/polyfills.untouched.wat b/tests/compiler/std/polyfills.untouched.wat index ddedc3d41c..966b7ef0aa 100644 --- a/tests/compiler/std/polyfills.untouched.wat +++ b/tests/compiler/std/polyfills.untouched.wat @@ -76,7 +76,10 @@ i32.const 8 i32.shl local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 8 i32.shr_s i32.const 255 @@ -373,7 +376,10 @@ i32.const 8 i32.shl local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 8 i32.shr_s i32.const 255 @@ -469,9 +475,15 @@ end i32.const 170 call $~lib/polyfills/bswap - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 170 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -499,9 +511,15 @@ end i32.const 43707 call $~lib/polyfills/bswap - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 48042 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eq i32.eqz if @@ -607,9 +625,15 @@ end i32.const 170 call $~lib/polyfills/bswap16 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 170 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -637,9 +661,15 @@ end i32.const 43707 call $~lib/polyfills/bswap16 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 48042 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eq i32.eqz if diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index e85922beca..efcadc7858 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -1358,9 +1358,10 @@ i32.const 0 else local.get $0 - i32.load8_s + i32.load8_u local.get $1 - i32.extend8_s + i32.const 255 + i32.and i32.eq end if @@ -1381,7 +1382,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 call $~lib/set/Set#find i32.const 0 @@ -1522,7 +1526,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 local.tee $3 call $~lib/set/Set#find @@ -2172,7 +2179,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 call $~lib/set/Set#find local.tee $1 @@ -2269,7 +2279,10 @@ local.set $0 loop $for-loop|1 local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 100 i32.lt_s if @@ -2323,7 +2336,10 @@ local.set $2 loop $for-loop|3 local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 100 i32.lt_s if @@ -2429,7 +2445,10 @@ local.set $1 loop $for-loop|6 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 50 i32.lt_s if @@ -2482,7 +2501,10 @@ local.set $1 loop $for-loop|8 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 50 i32.lt_s if @@ -2593,49 +2615,6 @@ i32.store offset=20 local.get $0 ) - (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $0 - i32.load - local.get $2 - local.get $0 - i32.load offset=4 - i32.and - i32.const 2 - i32.shl - i32.add - i32.load - local.set $0 - loop $while-continue|0 - local.get $0 - if - local.get $0 - i32.load offset=4 - i32.const 1 - i32.and - if (result i32) - i32.const 0 - else - local.get $0 - i32.load8_u - local.get $1 - i32.const 255 - i32.and - i32.eq - end - if - local.get $0 - return - end - local.get $0 - i32.load offset=4 - i32.const -2 - i32.and - local.set $0 - br $while-continue|0 - end - end - i32.const 0 - ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 @@ -2643,7 +2622,7 @@ i32.const 255 i32.and call $~lib/util/hash/hash8 - call $~lib/set/Set#find + call $~lib/set/Set#find i32.const 0 i32.ne ) @@ -2786,7 +2765,7 @@ i32.and call $~lib/util/hash/hash8 local.tee $3 - call $~lib/set/Set#find + call $~lib/set/Set#find i32.eqz if local.get $0 @@ -3000,7 +2979,7 @@ i32.const 255 i32.and call $~lib/util/hash/hash8 - call $~lib/set/Set#find + call $~lib/set/Set#find local.tee $1 i32.eqz if @@ -3428,9 +3407,10 @@ i32.const 0 else local.get $0 - i32.load16_s + i32.load16_u local.get $1 - i32.extend16_s + i32.const 65535 + i32.and i32.eq end if @@ -3451,7 +3431,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 call $~lib/set/Set#find i32.const 0 @@ -3592,7 +3575,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 local.tee $3 call $~lib/set/Set#find @@ -3862,7 +3848,10 @@ local.get $0 local.get $1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 call $~lib/set/Set#find local.tee $1 @@ -3926,7 +3915,10 @@ local.set $0 loop $for-loop|1 local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 100 i32.lt_s if @@ -3980,7 +3972,10 @@ local.set $2 loop $for-loop|3 local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 100 i32.lt_s if @@ -4086,7 +4081,10 @@ local.set $1 loop $for-loop|6 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 50 i32.lt_s if @@ -4139,7 +4137,10 @@ local.set $1 loop $for-loop|8 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 50 i32.lt_s if @@ -4250,49 +4251,6 @@ i32.store offset=20 local.get $0 ) - (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $0 - i32.load - local.get $2 - local.get $0 - i32.load offset=4 - i32.and - i32.const 2 - i32.shl - i32.add - i32.load - local.set $0 - loop $while-continue|0 - local.get $0 - if - local.get $0 - i32.load offset=4 - i32.const 1 - i32.and - if (result i32) - i32.const 0 - else - local.get $0 - i32.load16_u - local.get $1 - i32.const 65535 - i32.and - i32.eq - end - if - local.get $0 - return - end - local.get $0 - i32.load offset=4 - i32.const -2 - i32.and - local.set $0 - br $while-continue|0 - end - end - i32.const 0 - ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 @@ -4300,7 +4258,7 @@ i32.const 65535 i32.and call $~lib/util/hash/hash16 - call $~lib/set/Set#find + call $~lib/set/Set#find i32.const 0 i32.ne ) @@ -4443,7 +4401,7 @@ i32.and call $~lib/util/hash/hash16 local.tee $3 - call $~lib/set/Set#find + call $~lib/set/Set#find i32.eqz if local.get $0 @@ -4663,7 +4621,7 @@ i32.const 65535 i32.and call $~lib/util/hash/hash16 - call $~lib/set/Set#find + call $~lib/set/Set#find local.tee $1 i32.eqz if diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index e9bbc582fa..b867f31859 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -1866,7 +1866,10 @@ local.get $3 i32.load8_s local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq else i32.const 0 @@ -1905,7 +1908,10 @@ i32.eq drop local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.0 end @@ -2094,7 +2100,10 @@ i32.eq drop local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.1 end @@ -3959,7 +3968,10 @@ i32.eq drop local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/hash/hash8 br $~lib/util/hash/HASH|inlined.3 end @@ -4084,7 +4096,10 @@ local.set $1 loop $for-loop|1 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 100 i32.lt_s local.set $3 @@ -4143,7 +4158,10 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 100 i32.lt_s local.set $4 @@ -4258,7 +4276,10 @@ local.set $5 loop $for-loop|6 local.get $5 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 50 i32.lt_s local.set $7 @@ -4317,7 +4338,10 @@ local.set $5 loop $for-loop|8 local.get $5 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 50 i32.lt_s local.set $8 @@ -5609,7 +5633,10 @@ local.get $3 i32.load16_s local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eq else i32.const 0 @@ -5652,7 +5679,10 @@ i32.eq drop local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.0 end @@ -5849,7 +5879,10 @@ i32.eq drop local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.1 end @@ -6205,7 +6238,10 @@ i32.eq drop local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/hash/hash16 br $~lib/util/hash/HASH|inlined.3 end @@ -6330,7 +6366,10 @@ local.set $1 loop $for-loop|1 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 100 i32.lt_s local.set $3 @@ -6389,7 +6428,10 @@ local.set $1 loop $for-loop|3 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 100 i32.lt_s local.set $4 @@ -6504,7 +6546,10 @@ local.set $5 loop $for-loop|6 local.get $5 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 50 i32.lt_s local.set $7 @@ -6563,7 +6608,10 @@ local.set $5 loop $for-loop|8 local.get $5 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 50 i32.lt_s local.set $8 diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index 74e388f9bd..ffe86dbbc4 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -7963,9 +7963,6 @@ end i32.const 1296 call $~lib/string/String.__not - i32.eqz - i32.const 1 - i32.ne if i32.const 0 i32.const 1088 @@ -7976,9 +7973,6 @@ end i32.const 1328 call $~lib/string/String.__not - i32.eqz - i32.const 1 - i32.ne if i32.const 0 i32.const 1088 diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 98bc9ff4e6..577660b0fb 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -314,7 +314,7 @@ (data (i32.const 12464) "\n\00\00\00\01\00\00\00\00\00\00\00\n\00\00\00\00\ff\00\00\00d\n\ff\ff") (data (i32.const 12496) "\n\00\00\00\01\00\00\00\00\00\00\00\n\00\00\00\01\ffd\ff\00\00d\n\ff") (table $0 123 funcref) - (elem (i32.const 1) $~lib/util/sort/COMPARATOR~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint16Array,u16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float64Array,f64>~anonymous|0) + (elem (i32.const 1) $~lib/util/sort/COMPARATOR~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayFilter<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float64Array,f64>~anonymous|0) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) (global $~argumentsLength (mut i32) (i32.const 0)) @@ -5525,7 +5525,10 @@ ) (func $std/typedarray/testArrayFilter<~lib/typedarray/Int8Array,i8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 2 i32.gt_s ) @@ -6205,7 +6208,10 @@ ) (func $std/typedarray/testArrayFilter<~lib/typedarray/Int16Array,i16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 2 i32.gt_s ) @@ -7832,7 +7838,8 @@ ) (func $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.extend8_s + i32.const 255 + i32.and i32.const 2 i32.eq ) @@ -7899,16 +7906,10 @@ call $~lib/rt/pure/__release ) (func $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $0 - i32.extend8_s - i32.eqz - ) - (func $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 i32.const 255 i32.and - i32.const 2 - i32.eq + i32.eqz ) (func $~lib/typedarray/Uint8Array#some (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -7972,15 +7973,10 @@ local.get $3 call $~lib/rt/pure/__release ) - (func $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $0 - i32.const 255 - i32.and - i32.eqz - ) (func $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.extend16_s + i32.const 65535 + i32.and i32.const 2 i32.eq ) @@ -8051,16 +8047,10 @@ call $~lib/rt/pure/__release ) (func $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $0 - i32.extend16_s - i32.eqz - ) - (func $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 i32.const 65535 i32.and - i32.const 2 - i32.eq + i32.eqz ) (func $~lib/typedarray/Uint16Array#some (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -8128,12 +8118,6 @@ local.get $3 call $~lib/rt/pure/__release ) - (func $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $0 - i32.const 65535 - i32.and - i32.eqz - ) (func $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 i32.const 2 @@ -8501,7 +8485,8 @@ ) (func $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.extend8_s + i32.const 255 + i32.and i32.const 4 i32.eq ) @@ -8568,13 +8553,6 @@ call $~lib/rt/pure/__release local.get $2 ) - (func $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint8Array,u8>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $0 - i32.const 255 - i32.and - i32.const 4 - i32.eq - ) (func $~lib/typedarray/Int16Array#findIndex (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) @@ -8644,7 +8622,8 @@ ) (func $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 - i32.extend16_s + i32.const 65535 + i32.and i32.const 4 i32.eq ) @@ -8715,13 +8694,6 @@ call $~lib/rt/pure/__release local.get $2 ) - (func $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint16Array,u16>~anonymous|1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - local.get $0 - i32.const 65535 - i32.and - i32.const 4 - i32.eq - ) (func $~lib/typedarray/Int32Array#findIndex (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) @@ -9014,10 +8986,12 @@ local.get $2 call $~lib/rt/pure/__retain local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 2 i32.rem_s - i32.extend8_s i32.eqz local.set $0 call $~lib/rt/pure/__release @@ -9159,10 +9133,12 @@ local.get $2 call $~lib/rt/pure/__retain local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 2 i32.rem_s - i32.extend16_s i32.eqz local.set $0 call $~lib/rt/pure/__release @@ -9916,54 +9892,6 @@ call $~lib/rt/pure/__release ) (func $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) - local.get $2 - call $~lib/rt/pure/__retain - local.set $2 - local.get $0 - i32.extend8_s - i32.const 6256 - local.get $1 - call $~lib/array/Array#__get - i32.extend8_s - i32.ne - if - i32.const 0 - i32.const 1312 - i32.const 490 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - local.get $1 - global.get $std/typedarray/forEachCallCount - i32.ne - if - i32.const 0 - i32.const 1312 - i32.const 491 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - local.get $2 - global.get $std/typedarray/forEachSelf - i32.ne - if - i32.const 0 - i32.const 1312 - i32.const 492 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - global.get $std/typedarray/forEachCallCount - i32.const 1 - i32.add - global.set $std/typedarray/forEachCallCount - local.get $2 - call $~lib/rt/pure/__release - ) - (func $std/typedarray/testArrayForEach<~lib/typedarray/Uint8Array,u8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) local.get $2 call $~lib/rt/pure/__retain local.set $2 @@ -10065,54 +9993,6 @@ call $~lib/rt/pure/__release ) (func $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) - local.get $2 - call $~lib/rt/pure/__retain - local.set $2 - local.get $0 - i32.extend16_s - i32.const 6256 - local.get $1 - call $~lib/array/Array#__get - i32.extend16_s - i32.ne - if - i32.const 0 - i32.const 1312 - i32.const 490 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - local.get $1 - global.get $std/typedarray/forEachCallCount - i32.ne - if - i32.const 0 - i32.const 1312 - i32.const 491 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - local.get $2 - global.get $std/typedarray/forEachSelf - i32.ne - if - i32.const 0 - i32.const 1312 - i32.const 492 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - global.get $std/typedarray/forEachCallCount - i32.const 1 - i32.add - global.set $std/typedarray/forEachCallCount - local.get $2 - call $~lib/rt/pure/__release - ) - (func $std/typedarray/testArrayForEach<~lib/typedarray/Uint16Array,u16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) local.get $2 call $~lib/rt/pure/__retain local.set $2 @@ -10538,14 +10418,20 @@ i32.const 6704 local.get $0 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $3 local.get $0 i32.const 6704 local.get $0 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $0 i32.const 1 @@ -10574,7 +10460,10 @@ local.get $0 i32.sub call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.ne if i32.const 0 @@ -11314,14 +11203,20 @@ i32.const 6704 local.get $0 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $3 local.get $0 i32.const 6704 local.get $0 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $0 i32.const 1 @@ -11350,7 +11245,10 @@ local.get $0 i32.sub call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.ne if i32.const 0 @@ -13198,9 +13096,10 @@ local.get $2 local.get $4 i32.add - i32.load8_s + i32.load8_u local.get $1 - i32.extend8_s + i32.const 255 + i32.and i32.eq if local.get $0 @@ -13264,9 +13163,10 @@ local.get $2 local.get $3 i32.add - i32.load8_s + i32.load8_u local.get $1 - i32.extend8_s + i32.const 255 + i32.and i32.eq if local.get $0 @@ -13332,7 +13232,10 @@ i32.const 6800 local.get $1 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $1 i32.const 1 @@ -13730,165 +13633,6 @@ local.get $1 call $~lib/rt/pure/__release ) - (func $~lib/typedarray/Uint8Array#indexOf (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - block $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 - local.get $2 - local.get $0 - call $~lib/rt/pure/__retain - local.tee $0 - i32.load offset=8 - local.tee $3 - i32.ge_s - i32.const 1 - local.get $3 - select - if - local.get $0 - call $~lib/rt/pure/__release - i32.const -1 - local.set $2 - br $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 - end - local.get $2 - i32.const 0 - i32.lt_s - if - local.get $2 - local.get $3 - i32.add - local.tee $2 - i32.const 0 - local.get $2 - i32.const 0 - i32.gt_s - select - local.set $2 - end - local.get $0 - i32.load offset=4 - local.set $4 - loop $while-continue|0 - local.get $2 - local.get $3 - i32.lt_s - if - local.get $2 - local.get $4 - i32.add - i32.load8_u - local.get $1 - i32.const 255 - i32.and - i32.eq - if - local.get $0 - call $~lib/rt/pure/__release - br $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 - end - local.get $2 - i32.const 1 - i32.add - local.set $2 - br $while-continue|0 - end - end - local.get $0 - call $~lib/rt/pure/__release - i32.const -1 - local.set $2 - end - local.get $2 - ) - (func $~lib/typedarray/Uint8Array#lastIndexOf (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - block $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 - local.get $0 - call $~lib/rt/pure/__retain - local.tee $0 - i32.load offset=8 - local.tee $3 - i32.eqz - if - local.get $0 - call $~lib/rt/pure/__release - i32.const -1 - local.set $2 - br $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 - end - local.get $2 - local.get $3 - i32.add - local.get $3 - i32.const 1 - i32.sub - local.get $2 - local.get $2 - local.get $3 - i32.ge_s - select - local.get $2 - i32.const 0 - i32.lt_s - select - local.set $2 - local.get $0 - i32.load offset=4 - local.set $3 - loop $while-continue|0 - local.get $2 - i32.const 0 - i32.ge_s - if - local.get $2 - local.get $3 - i32.add - i32.load8_u - local.get $1 - i32.const 255 - i32.and - i32.eq - if - local.get $0 - call $~lib/rt/pure/__release - br $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint8Array,u8>|inlined.0 - end - local.get $2 - i32.const 1 - i32.sub - local.set $2 - br $while-continue|0 - end - end - local.get $0 - call $~lib/rt/pure/__release - i32.const -1 - local.set $2 - end - local.get $2 - ) - (func $~lib/typedarray/Uint8Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - block $1of1 - block $0of1 - block $outOfRange - global.get $~argumentsLength - i32.const 1 - i32.sub - br_table $0of1 $1of1 $outOfRange - end - unreachable - end - local.get $0 - i32.load offset=8 - local.set $2 - end - local.get $0 - local.get $1 - local.get $2 - call $~lib/typedarray/Uint8Array#lastIndexOf - ) (func $std/typedarray/testArrayIndexOfAndLastIndexOf<~lib/typedarray/Uint8Array,u8> (local $0 i32) (local $1 i32) @@ -13926,7 +13670,7 @@ local.get $0 i32.const 0 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf if i32.const 0 i32.const 1312 @@ -13938,7 +13682,7 @@ local.get $0 i32.const 11 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -13952,7 +13696,7 @@ local.get $0 i32.const -1 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -13966,7 +13710,7 @@ local.get $0 i32.const 3 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 3 i32.ne if @@ -13980,7 +13724,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 3 i32.ne if @@ -13994,7 +13738,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 3 i32.ne if @@ -14008,7 +13752,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14022,7 +13766,7 @@ local.get $0 i32.const 1 i32.const 10 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14036,7 +13780,7 @@ local.get $0 i32.const 1 i32.const -100 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 1 i32.ne if @@ -14051,7 +13795,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Uint8Array#lastIndexOf@varargs + call $~lib/typedarray/Int8Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -14064,7 +13808,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Uint8Array#lastIndexOf@varargs + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -14079,7 +13823,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Uint8Array#lastIndexOf@varargs + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -14094,7 +13838,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Uint8Array#lastIndexOf@varargs + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -14108,7 +13852,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const 3 i32.ne if @@ -14122,7 +13866,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const 3 i32.ne if @@ -14136,7 +13880,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const -1 i32.ne if @@ -14150,7 +13894,7 @@ local.get $0 i32.const 1 i32.const 100 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const 1 i32.ne if @@ -14164,7 +13908,7 @@ local.get $0 i32.const 1 i32.const -10 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const 1 i32.ne if @@ -14178,7 +13922,7 @@ local.get $0 i32.const 1 i32.const -11 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const -1 i32.ne if @@ -14195,7 +13939,7 @@ local.tee $1 i32.const 3 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14209,7 +13953,7 @@ local.get $1 i32.const 4 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf if i32.const 0 i32.const 1312 @@ -14221,7 +13965,7 @@ local.get $1 i32.const 5 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 1 i32.ne if @@ -14235,7 +13979,7 @@ local.get $1 i32.const 9 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14249,7 +13993,7 @@ local.get $1 i32.const 10 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14263,7 +14007,7 @@ local.get $1 i32.const 11 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14277,7 +14021,7 @@ local.get $1 i32.const 5 i32.const 1 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 1 i32.ne if @@ -14291,7 +14035,7 @@ local.get $1 i32.const 5 i32.const 2 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14348,7 +14092,7 @@ local.get $0 i32.const 0 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf if i32.const 0 i32.const 1312 @@ -14360,7 +14104,7 @@ local.get $0 i32.const 11 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14374,7 +14118,7 @@ local.get $0 i32.const -1 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14388,7 +14132,7 @@ local.get $0 i32.const 3 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 3 i32.ne if @@ -14402,7 +14146,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 3 i32.ne if @@ -14416,7 +14160,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 3 i32.ne if @@ -14430,7 +14174,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14444,7 +14188,7 @@ local.get $0 i32.const 1 i32.const 10 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14458,7 +14202,7 @@ local.get $0 i32.const 1 i32.const -100 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 1 i32.ne if @@ -14473,7 +14217,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Uint8Array#lastIndexOf@varargs + call $~lib/typedarray/Int8Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -14486,7 +14230,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Uint8Array#lastIndexOf@varargs + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -14501,7 +14245,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Uint8Array#lastIndexOf@varargs + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -14516,7 +14260,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Uint8Array#lastIndexOf@varargs + call $~lib/typedarray/Int8Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -14530,7 +14274,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const 3 i32.ne if @@ -14544,7 +14288,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const 3 i32.ne if @@ -14558,7 +14302,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const -1 i32.ne if @@ -14572,7 +14316,7 @@ local.get $0 i32.const 1 i32.const 100 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const 1 i32.ne if @@ -14586,7 +14330,7 @@ local.get $0 i32.const 1 i32.const -10 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const 1 i32.ne if @@ -14600,7 +14344,7 @@ local.get $0 i32.const 1 i32.const -11 - call $~lib/typedarray/Uint8Array#lastIndexOf + call $~lib/typedarray/Int8Array#lastIndexOf i32.const -1 i32.ne if @@ -14617,7 +14361,7 @@ local.tee $1 i32.const 3 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14631,7 +14375,7 @@ local.get $1 i32.const 4 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf if i32.const 0 i32.const 1312 @@ -14643,7 +14387,7 @@ local.get $1 i32.const 5 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 1 i32.ne if @@ -14657,7 +14401,7 @@ local.get $1 i32.const 9 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14671,7 +14415,7 @@ local.get $1 i32.const 10 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14685,7 +14429,7 @@ local.get $1 i32.const 11 i32.const 0 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14699,7 +14443,7 @@ local.get $1 i32.const 5 i32.const 1 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const 1 i32.ne if @@ -14713,7 +14457,7 @@ local.get $1 i32.const 5 i32.const 2 - call $~lib/typedarray/Uint8Array#indexOf + call $~lib/typedarray/Int8Array#indexOf i32.const -1 i32.ne if @@ -14784,9 +14528,10 @@ i32.const 1 i32.shl i32.add - i32.load16_s + i32.load16_u local.get $1 - i32.extend16_s + i32.const 65535 + i32.and i32.eq if local.get $0 @@ -14854,9 +14599,10 @@ i32.const 1 i32.shl i32.add - i32.load16_s + i32.load16_u local.get $1 - i32.extend16_s + i32.const 65535 + i32.and i32.eq if local.get $0 @@ -14924,7 +14670,10 @@ i32.const 6800 local.get $1 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $1 i32.const 1 @@ -15321,175 +15070,6 @@ local.get $1 call $~lib/rt/pure/__release ) - (func $~lib/typedarray/Uint16Array#indexOf (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - block $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 - local.get $2 - local.get $0 - call $~lib/rt/pure/__retain - local.tee $0 - i32.load offset=8 - i32.const 1 - i32.shr_u - local.tee $3 - i32.ge_s - i32.const 1 - local.get $3 - select - if - local.get $0 - call $~lib/rt/pure/__release - i32.const -1 - local.set $2 - br $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 - end - local.get $2 - i32.const 0 - i32.lt_s - if - local.get $2 - local.get $3 - i32.add - local.tee $2 - i32.const 0 - local.get $2 - i32.const 0 - i32.gt_s - select - local.set $2 - end - local.get $0 - i32.load offset=4 - local.set $4 - loop $while-continue|0 - local.get $2 - local.get $3 - i32.lt_s - if - local.get $4 - local.get $2 - i32.const 1 - i32.shl - i32.add - i32.load16_u - local.get $1 - i32.const 65535 - i32.and - i32.eq - if - local.get $0 - call $~lib/rt/pure/__release - br $~lib/typedarray/INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 - end - local.get $2 - i32.const 1 - i32.add - local.set $2 - br $while-continue|0 - end - end - local.get $0 - call $~lib/rt/pure/__release - i32.const -1 - local.set $2 - end - local.get $2 - ) - (func $~lib/typedarray/Uint16Array#lastIndexOf (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - block $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 - local.get $0 - call $~lib/rt/pure/__retain - local.tee $0 - i32.load offset=8 - i32.const 1 - i32.shr_u - local.tee $3 - i32.eqz - if - local.get $0 - call $~lib/rt/pure/__release - i32.const -1 - local.set $2 - br $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 - end - local.get $2 - local.get $3 - i32.add - local.get $3 - i32.const 1 - i32.sub - local.get $2 - local.get $2 - local.get $3 - i32.ge_s - select - local.get $2 - i32.const 0 - i32.lt_s - select - local.set $2 - local.get $0 - i32.load offset=4 - local.set $3 - loop $while-continue|0 - local.get $2 - i32.const 0 - i32.ge_s - if - local.get $3 - local.get $2 - i32.const 1 - i32.shl - i32.add - i32.load16_u - local.get $1 - i32.const 65535 - i32.and - i32.eq - if - local.get $0 - call $~lib/rt/pure/__release - br $~lib/typedarray/LAST_INDEX_OF<~lib/typedarray/Uint16Array,u16>|inlined.0 - end - local.get $2 - i32.const 1 - i32.sub - local.set $2 - br $while-continue|0 - end - end - local.get $0 - call $~lib/rt/pure/__release - i32.const -1 - local.set $2 - end - local.get $2 - ) - (func $~lib/typedarray/Uint16Array#lastIndexOf@varargs (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - block $1of1 - block $0of1 - block $outOfRange - global.get $~argumentsLength - i32.const 1 - i32.sub - br_table $0of1 $1of1 $outOfRange - end - unreachable - end - local.get $0 - i32.load offset=8 - i32.const 1 - i32.shr_u - local.set $2 - end - local.get $0 - local.get $1 - local.get $2 - call $~lib/typedarray/Uint16Array#lastIndexOf - ) (func $std/typedarray/testArrayIndexOfAndLastIndexOf<~lib/typedarray/Uint16Array,u16> (local $0 i32) (local $1 i32) @@ -15527,7 +15107,7 @@ local.get $0 i32.const 0 i32.const 0 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf if i32.const 0 i32.const 1312 @@ -15539,7 +15119,7 @@ local.get $0 i32.const 11 i32.const 0 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const -1 i32.ne if @@ -15553,7 +15133,7 @@ local.get $0 i32.const -1 i32.const 0 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const -1 i32.ne if @@ -15567,7 +15147,7 @@ local.get $0 i32.const 3 i32.const 0 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const 3 i32.ne if @@ -15581,7 +15161,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const 3 i32.ne if @@ -15595,7 +15175,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const 3 i32.ne if @@ -15609,7 +15189,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const -1 i32.ne if @@ -15623,7 +15203,7 @@ local.get $0 i32.const 1 i32.const 10 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const -1 i32.ne if @@ -15637,7 +15217,7 @@ local.get $0 i32.const 1 i32.const -100 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const 1 i32.ne if @@ -15652,7 +15232,7 @@ global.set $~argumentsLength local.get $0 i32.const 0 - call $~lib/typedarray/Uint16Array#lastIndexOf@varargs + call $~lib/typedarray/Int16Array#lastIndexOf@varargs if i32.const 0 i32.const 1312 @@ -15665,7 +15245,7 @@ global.set $~argumentsLength local.get $0 i32.const 11 - call $~lib/typedarray/Uint16Array#lastIndexOf@varargs + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -15680,7 +15260,7 @@ global.set $~argumentsLength local.get $0 i32.const -1 - call $~lib/typedarray/Uint16Array#lastIndexOf@varargs + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const -1 i32.ne if @@ -15695,7 +15275,7 @@ global.set $~argumentsLength local.get $0 i32.const 3 - call $~lib/typedarray/Uint16Array#lastIndexOf@varargs + call $~lib/typedarray/Int16Array#lastIndexOf@varargs i32.const 3 i32.ne if @@ -15709,7 +15289,7 @@ local.get $0 i32.const 3 i32.const 4 - call $~lib/typedarray/Uint16Array#lastIndexOf + call $~lib/typedarray/Int16Array#lastIndexOf i32.const 3 i32.ne if @@ -15723,7 +15303,7 @@ local.get $0 i32.const 3 i32.const 3 - call $~lib/typedarray/Uint16Array#lastIndexOf + call $~lib/typedarray/Int16Array#lastIndexOf i32.const 3 i32.ne if @@ -15737,7 +15317,7 @@ local.get $0 i32.const 3 i32.const 2 - call $~lib/typedarray/Uint16Array#lastIndexOf + call $~lib/typedarray/Int16Array#lastIndexOf i32.const -1 i32.ne if @@ -15751,7 +15331,7 @@ local.get $0 i32.const 1 i32.const 100 - call $~lib/typedarray/Uint16Array#lastIndexOf + call $~lib/typedarray/Int16Array#lastIndexOf i32.const 1 i32.ne if @@ -15765,7 +15345,7 @@ local.get $0 i32.const 1 i32.const -10 - call $~lib/typedarray/Uint16Array#lastIndexOf + call $~lib/typedarray/Int16Array#lastIndexOf i32.const 1 i32.ne if @@ -15779,7 +15359,7 @@ local.get $0 i32.const 1 i32.const -11 - call $~lib/typedarray/Uint16Array#lastIndexOf + call $~lib/typedarray/Int16Array#lastIndexOf i32.const -1 i32.ne if @@ -15796,7 +15376,7 @@ local.tee $1 i32.const 3 i32.const 0 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const -1 i32.ne if @@ -15810,7 +15390,7 @@ local.get $1 i32.const 4 i32.const 0 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf if i32.const 0 i32.const 1312 @@ -15822,7 +15402,7 @@ local.get $1 i32.const 5 i32.const 0 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const 1 i32.ne if @@ -15836,7 +15416,7 @@ local.get $1 i32.const 9 i32.const 0 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const -1 i32.ne if @@ -15850,7 +15430,7 @@ local.get $1 i32.const 10 i32.const 0 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const -1 i32.ne if @@ -15864,7 +15444,7 @@ local.get $1 i32.const 11 i32.const 0 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const -1 i32.ne if @@ -15878,7 +15458,7 @@ local.get $1 i32.const 5 i32.const 1 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const 1 i32.ne if @@ -15892,7 +15472,7 @@ local.get $1 i32.const 5 i32.const 2 - call $~lib/typedarray/Uint16Array#indexOf + call $~lib/typedarray/Int16Array#indexOf i32.const -1 i32.ne if @@ -19220,7 +18800,10 @@ (func $~lib/util/number/itoa_buffered (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 0 i32.lt_s local.tee $2 @@ -19234,7 +18817,10 @@ local.set $1 end local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 10 i32.lt_u if @@ -19244,7 +18830,10 @@ i32.shl i32.add local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 48 i32.or i32.store16 @@ -19253,17 +18842,21 @@ i32.add return end - local.get $0 - local.get $1 - i32.extend8_s + local.get $2 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + local.tee $2 call $~lib/util/number/decimalCount32 - local.get $2 i32.add - local.tee $0 - call $~lib/util/number/utoa_dec_simple + local.set $1 local.get $0 + local.get $2 + local.get $1 + call $~lib/util/number/utoa_dec_simple + local.get $1 ) (func $~lib/string/String#substring (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -19791,7 +19384,10 @@ (func $~lib/util/number/itoa_buffered (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 0 i32.lt_s local.tee $2 @@ -19805,7 +19401,10 @@ local.set $1 end local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 10 i32.lt_u if @@ -19815,7 +19414,10 @@ i32.shl i32.add local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 48 i32.or i32.store16 @@ -19824,17 +19426,21 @@ i32.add return end - local.get $0 - local.get $1 - i32.extend16_s + local.get $2 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s + local.tee $2 call $~lib/util/number/decimalCount32 - local.get $2 i32.add - local.tee $0 - call $~lib/util/number/utoa_dec_simple + local.set $1 local.get $0 + local.get $2 + local.get $1 + call $~lib/util/number/utoa_dec_simple + local.get $1 ) (func $~lib/util/string/joinIntegerArray (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -22537,7 +22143,10 @@ i32.const 8432 local.get $0 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $0 i32.const 1 @@ -22887,7 +22496,10 @@ i32.const 8432 local.get $0 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $0 i32.const 1 @@ -32257,7 +31869,8 @@ block $folding-inner3 block $folding-inner2 local.get $3 - i32.extend8_s + i32.const 255 + i32.and i32.const 6 i32.ne br_if $folding-inner2 @@ -32391,7 +32004,8 @@ i32.const 2800 call $~lib/rt/pure/__release local.get $3 - i32.extend16_s + i32.const 65535 + i32.and i32.const 6 i32.ne br_if $folding-inner2 @@ -32798,7 +32412,8 @@ i32.const 3056 call $~lib/rt/pure/__release local.get $3 - i32.extend8_s + i32.const 255 + i32.and i32.const 6 i32.ne br_if $folding-inner3 @@ -32932,7 +32547,8 @@ i32.const 3152 call $~lib/rt/pure/__release local.get $3 - i32.extend16_s + i32.const 65535 + i32.and i32.const 6 i32.ne br_if $folding-inner3 @@ -34754,21 +34370,30 @@ i32.const 6256 i32.const 0 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $0 i32.const 1 i32.const 6256 i32.const 1 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $0 i32.const 2 i32.const 6256 i32.const 2 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set i32.const 0 local.set $1 @@ -34920,21 +34545,30 @@ i32.const 6256 i32.const 0 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $0 i32.const 1 i32.const 6256 i32.const 1 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $0 i32.const 2 i32.const 6256 i32.const 2 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set i32.const 0 local.set $1 @@ -35502,10 +35136,7 @@ call $~lib/rt/pure/__release i32.const 0 end - i32.const 0 - i32.ne - i32.const 1 - i32.ne + i32.eqz if i32.const 0 i32.const 1312 @@ -35594,10 +35225,7 @@ call $~lib/rt/pure/__release i32.const 0 end - i32.const 0 - i32.ne - i32.const 1 - i32.ne + i32.eqz if i32.const 0 i32.const 1312 diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 183f5399f9..09e9e6da94 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -6126,7 +6126,10 @@ call $~lib/typedarray/Int8Array#reduce local.set $2 local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 6 i32.eq i32.eqz @@ -6550,7 +6553,10 @@ call $~lib/typedarray/Int16Array#reduce local.set $2 local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 6 i32.eq i32.eqz @@ -7676,7 +7682,10 @@ call $~lib/typedarray/Int8Array#reduceRight local.set $2 local.get $2 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 6 i32.eq i32.eqz @@ -8053,7 +8062,10 @@ call $~lib/typedarray/Int16Array#reduceRight local.set $2 local.get $2 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 6 i32.eq i32.eqz @@ -11120,7 +11132,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 2 i32.gt_s local.set $3 @@ -11968,7 +11983,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 2 i32.gt_s local.set $3 @@ -13867,7 +13885,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 2 i32.eq local.set $3 @@ -13957,7 +13978,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 0 i32.eq local.set $3 @@ -14360,7 +14384,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 2 i32.eq local.set $3 @@ -14450,7 +14477,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 0 i32.eq local.set $3 @@ -15654,7 +15684,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 2 i32.eq local.set $3 @@ -15744,7 +15777,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 4 i32.eq local.set $3 @@ -16150,7 +16186,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 2 i32.eq local.set $3 @@ -16240,7 +16279,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 4 i32.eq local.set $3 @@ -17452,10 +17494,12 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 2 i32.rem_s - i32.extend8_s i32.const 0 i32.eq local.set $3 @@ -17548,7 +17592,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 2 i32.eq local.set $3 @@ -17961,10 +18008,12 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 2 i32.rem_s - i32.extend16_s i32.const 0 i32.eq local.set $3 @@ -18057,7 +18106,10 @@ call $~lib/rt/pure/__retain local.set $2 local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 2 i32.eq local.set $3 @@ -19828,9 +19880,15 @@ call $~lib/array/Array#__get local.set $3 local.get $0 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s local.get $3 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -19948,21 +20006,30 @@ global.get $std/typedarray/forEachValues i32.const 0 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $1 i32.const 1 global.get $std/typedarray/forEachValues i32.const 1 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $1 i32.const 2 global.get $std/typedarray/forEachValues i32.const 2 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $1 i32.const 5280 @@ -20336,9 +20403,15 @@ call $~lib/array/Array#__get local.set $3 local.get $0 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s local.get $3 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eq i32.eqz if @@ -20456,21 +20529,30 @@ global.get $std/typedarray/forEachValues i32.const 0 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $1 i32.const 1 global.get $std/typedarray/forEachValues i32.const 1 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $1 i32.const 2 global.get $std/typedarray/forEachValues i32.const 2 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $1 i32.const 5376 @@ -21751,14 +21833,20 @@ local.get $0 local.get $6 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $5 local.get $6 local.get $0 local.get $6 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $6 i32.const 1 @@ -21789,7 +21877,10 @@ local.get $6 i32.sub call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq i32.eqz if @@ -22798,14 +22889,20 @@ local.get $0 local.get $6 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $5 local.get $6 local.get $0 local.get $6 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $6 i32.const 1 @@ -22836,7 +22933,10 @@ local.get $6 i32.sub call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eq i32.eqz if @@ -25217,7 +25317,10 @@ i32.add i32.load8_s local.get $4 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq if local.get $6 @@ -25310,7 +25413,10 @@ i32.add i32.load8_s local.get $4 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.eq if local.get $6 @@ -25388,7 +25494,10 @@ local.get $0 local.get $4 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $4 i32.const 1 @@ -27281,7 +27390,10 @@ i32.add i32.load16_s local.get $4 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eq if local.get $6 @@ -27374,7 +27486,10 @@ i32.add i32.load16_s local.get $4 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.eq if local.get $6 @@ -27452,7 +27567,10 @@ local.get $0 local.get $4 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $4 i32.const 1 @@ -33490,7 +33608,10 @@ i32.const 1 drop local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 0 i32.lt_s local.set $2 @@ -33515,7 +33636,10 @@ i32.le_u drop local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 10 i32.lt_u if @@ -33525,7 +33649,10 @@ i32.shl i32.add local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s i32.const 48 i32.or i32.store16 @@ -33542,14 +33669,20 @@ drop local.get $3 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/util/number/decimalCount32 i32.add local.set $3 local.get $0 local.set $6 local.get $1 - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s local.set $5 local.get $3 local.set $4 @@ -34654,7 +34787,10 @@ i32.const 1 drop local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 0 i32.lt_s local.set $2 @@ -34679,7 +34815,10 @@ i32.le_u drop local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 10 i32.lt_u if @@ -34689,7 +34828,10 @@ i32.shl i32.add local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s i32.const 48 i32.or i32.store16 @@ -34706,14 +34848,20 @@ drop local.get $3 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/util/number/decimalCount32 i32.add local.set $3 local.get $0 local.set $6 local.get $1 - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s local.set $5 local.get $3 local.set $4 @@ -39435,7 +39583,10 @@ local.get $0 local.get $4 call $~lib/array/Array#__get - i32.extend8_s + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s call $~lib/typedarray/Int8Array#__set local.get $4 i32.const 1 @@ -40054,7 +40205,10 @@ local.get $0 local.get $4 call $~lib/array/Array#__get - i32.extend16_s + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s call $~lib/typedarray/Int16Array#__set local.get $4 i32.const 1 From e29a8eacbf0e2dcdac2c303238799f8f6c3d9c9a Mon Sep 17 00:00:00 2001 From: dcode Date: Sat, 19 Sep 2020 14:54:06 +0200 Subject: [PATCH 7/7] fix --- src/program.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/program.ts b/src/program.ts index 41e36e7f1b..c497a82243 100644 --- a/src/program.ts +++ b/src/program.ts @@ -945,8 +945,8 @@ export class Program extends DiagnosticEmitter { i64_new(options.hasFeature(Feature.MULTI_VALUE) ? 1 : 0, 0)); this.registerConstantInteger(CommonNames.ASC_FEATURE_GC, Type.bool, i64_new(options.hasFeature(Feature.GC) ? 1 : 0, 0)); - this.registerConstantInteger(CommonNames.ASC_FEATURE_MEMORY64, Type.bool, - i64_new(options.hasFeature(Feature.MEMORY64) ? 1 : 0, 0)); + this.registerConstantInteger(CommonNames.ASC_FEATURE_MEMORY64, Type.bool, + i64_new(options.hasFeature(Feature.MEMORY64) ? 1 : 0, 0)); // remember deferred elements var queuedImports = new Array();