diff --git a/NOTICE b/NOTICE index a884c7b6..cf9d1014 100644 --- a/NOTICE +++ b/NOTICE @@ -10,6 +10,7 @@ under the licensing terms detailed in LICENSE: * Alan Pierce * Palmer * Linus Unnebäck +* Joshua Tenner Portions of this software are derived from third-party works licensed under the following terms: diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 058231ae..dbba2482 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -520,6 +520,16 @@ declare abstract class TypedArray implements ArrayBufferView { readonly length: i32; /** Returns a new TypedArray of this type on the same ArrayBuffer from begin inclusive to end exclusive. */ subarray(begin?: i32, end?: i32): this; + /** The reduce() method applies a function against an accumulator and each value of the typed array (from left-to-right) has to reduce it to a single value. This method has the same algorithm as Array.prototype.reduce(). */ + reduce( + callbackfn: (accumulator: W, value: T, index: i32, self: this) => W, + initialValue: W, + ): W; + /** The reduceRight() method applies a function against an accumulator and each value of the typed array (from left-to-right) has to reduce it to a single value, starting from the end of the array. This method has the same algorithm as Array.prototype.reduceRight(). */ + reduceRight( + callbackfn: (accumulator: W, value: T, index: i32, self: this) => W, + initialValue: W, + ): W; } /** An array of twos-complement 8-bit signed integers. */ diff --git a/std/assembly/internal/typedarray.ts b/std/assembly/internal/typedarray.ts index 61ab7203..c90eb654 100644 --- a/std/assembly/internal/typedarray.ts +++ b/std/assembly/internal/typedarray.ts @@ -126,4 +126,31 @@ export abstract class TypedArray { return this; } } + + /** + * TypedArray reduce implementation. This is a method that will be called from the parent, + * passing types down from the child class using the typed parameters TypedArrayType and + * ReturnType respectively. This implementation requires an initial value, and the direction. + * When direction is true, reduce will reduce from the right side. + */ + @inline + protected reduce_internal( + callbackfn: (accumulator: ReturnType, value: T, index: i32, array: TypedArrayType) => ReturnType, + array: TypedArrayType, + initialValue: ReturnType, + direction: bool = false, + ): ReturnType { + var index: i32 = direction ? this.length - 1 : 0; + var length: i32 = direction ? -1 : this.length; + while (index != length) { + initialValue = callbackfn( + initialValue, + this.__unchecked_get(index), + index, + array, + ); + index = direction ? index - 1 : index + 1; + } + return initialValue; + } } diff --git a/std/assembly/typedarray.ts b/std/assembly/typedarray.ts index d5bb3a7d..84a1ccb2 100644 --- a/std/assembly/typedarray.ts +++ b/std/assembly/typedarray.ts @@ -8,6 +8,20 @@ export class Int8Array extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Int8Array { return changetype(super.subarray(begin, end)); } + + reduce( + callbackfn: (accumulator: ReturnType, value: i8, index: i32, array: Int8Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: i8, index: i32, array: Int8Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } export class Uint8Array extends TypedArray { @@ -16,6 +30,20 @@ export class Uint8Array extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Uint8Array { return changetype(super.subarray(begin, end)); } + + reduce( + callbackfn: (accumulator: ReturnType, value: u8, index: i32, array: Uint8Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: u8, index: i32, array: Uint8Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } export class Uint8ClampedArray extends TypedArray { @@ -34,6 +62,20 @@ export class Uint8ClampedArray extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Uint8ClampedArray { return changetype(super.subarray(begin, end)); } + + reduce( + callbackfn: (accumulator: ReturnType, value: u8, index: i32, array: Uint8ClampedArray) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: u8, index: i32, array: Uint8ClampedArray) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } export class Int16Array extends TypedArray { @@ -42,6 +84,20 @@ export class Int16Array extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Int16Array { return changetype(super.subarray(begin, end)); } + + reduce( + callbackfn: (accumulator: ReturnType, value: i16, index: i32, array: Int16Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: i16, index: i32, array: Int16Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } export class Uint16Array extends TypedArray { @@ -50,6 +106,20 @@ export class Uint16Array extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Uint16Array { return changetype(super.subarray(begin, end)); } + + reduce( + callbackfn: (accumulator: ReturnType, value: u16, index: i32, array: Uint16Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: u16, index: i32, array: Uint16Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } export class Int32Array extends TypedArray { @@ -58,6 +128,24 @@ export class Int32Array extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Int32Array { return changetype(super.subarray(begin, end)); } + + /** + * @param callbackfn {function} - a function that reduces each value to a ReturnType + * @param initialValue {ReturnType} - the initial ReturnType value to be passed to the callbackfn + */ + reduce( + callbackfn: (accumulator: ReturnType, value: i32, index: i32, array: Int32Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: i32, index: i32, array: Int32Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } export class Uint32Array extends TypedArray { @@ -66,6 +154,20 @@ export class Uint32Array extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Uint32Array { return changetype(super.subarray(begin, end)); } + + reduce( + callbackfn: (accumulator: ReturnType, value: u32, index: i32, array: Uint32Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: u32, index: i32, array: Uint32Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } export class Int64Array extends TypedArray { @@ -74,6 +176,20 @@ export class Int64Array extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Int64Array { return changetype(super.subarray(begin, end)); } + + reduce( + callbackfn: (accumulator: ReturnType, value: i64, index: i32, array: Int64Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: i64, index: i32, array: Int64Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } export class Uint64Array extends TypedArray { @@ -82,6 +198,20 @@ export class Uint64Array extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Uint64Array { return changetype(super.subarray(begin, end)); } + + reduce( + callbackfn: (accumulator: ReturnType, value: u64, index: i32, array: Uint64Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: u64, index: i32, array: Uint64Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } export class Float32Array extends TypedArray { @@ -90,6 +220,20 @@ export class Float32Array extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Float32Array { return changetype(super.subarray(begin, end)); } + + reduce( + callbackfn: (accumulator: ReturnType, value: f32, index: i32, array: Float32Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: f32, index: i32, array: Float32Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } export class Float64Array extends TypedArray { @@ -98,4 +242,18 @@ export class Float64Array extends TypedArray { subarray(begin: i32 = 0, end: i32 = 0x7fffffff): Float64Array { return changetype(super.subarray(begin, end)); } + + reduce( + callbackfn: (accumulator: ReturnType, value: f64, index: i32, array: Float64Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue); + } + + reduceRight( + callbackfn: (accumulator: ReturnType, value: f64, index: i32, array: Float64Array) => ReturnType, + initialValue: ReturnType, + ): ReturnType { + return super.reduce_internal(callbackfn, this, initialValue, true); + } } diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 84b4a823..1d78ea15 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -9,9 +9,17 @@ (type $iiF (func (param i32 i32) (result f64))) (type $iiiii (func (param i32 i32 i32 i32) (result i32))) (type $v (func)) + (type $iiIv (func (param i32 i32 i64))) + (type $IIiiI (func (param i64 i64 i32 i32) (result i64))) + (type $iifv (func (param i32 i32 f32))) + (type $ffiif (func (param f32 f32 i32 i32) (result f32))) + (type $FFiiF (func (param f64 f64 i32 i32) (result f64))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) + (type $FUNCSIG$jii (func (param i32 i32) (result i64))) + (type $FUNCSIG$fi (func (param i32) (result f32))) + (type $FUNCSIG$di (func (param i32) (result f64))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) "\11\00\00\00s\00t\00d\00/\00t\00y\00p\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s") @@ -46,8 +54,8 @@ (data (i32.const 584) "\14\00\00\00\00\00\00\00\01") (data (i32.const 608) "\02") (data (i32.const 616) "H\02\00\00\05") - (table $0 2 anyfunc) - (elem (i32.const 0) $null $~lib/internal/typedarray/TypedArray#sort|trampoline~anonymous|1) + (table $0 24 anyfunc) + (elem (i32.const 0) $null $~lib/internal/typedarray/TypedArray#sort|trampoline~anonymous|1 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt64ArrayTest~anonymous|9 $std/typedarray/reduceInt64ArrayTest~anonymous|9 $std/typedarray/reduceFloat32ArrayTest~anonymous|11 $std/typedarray/reduceFloat64ArrayTest~anonymous|12 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceInt64ArrayTest~anonymous|9 $std/typedarray/reduceInt64ArrayTest~anonymous|9 $std/typedarray/reduceFloat32ArrayTest~anonymous|11 $std/typedarray/reduceFloat64ArrayTest~anonymous|12) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $std/typedarray/arr (mut i32) (i32.const 0)) @@ -2187,7 +2195,1426 @@ get_local $3 call $~lib/internal/typedarray/TypedArray#fill ) - (func $start (; 30 ;) (type $v) + (func $std/typedarray/reduceInt8ArrayTest~anonymous|2 (; 30 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Int8Array#reduce (; 31 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + get_local $0 + i32.load offset=8 + set_local $3 + loop $continue|0 + get_local $1 + get_local $3 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $2 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.add + i32.load8_s offset=8 + get_local $1 + get_local $0 + i32.const 2 + call_indirect (type $iiiii) + set_local $2 + get_local $1 + i32.const 1 + i32.add + set_local $1 + br $continue|0 + end + end + get_local $2 + ) + (func $std/typedarray/reduceInt8ArrayTest (; 32 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + call $~lib/typedarray/Int8Array#reduce + i32.const 255 + i32.and + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 252 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Uint8Array#reduce (; 33 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + get_local $0 + i32.load offset=8 + set_local $4 + loop $continue|0 + get_local $2 + get_local $4 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $3 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $2 + i32.add + i32.load8_u offset=8 + get_local $2 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + set_local $3 + get_local $2 + i32.const 1 + i32.add + set_local $2 + br $continue|0 + end + end + get_local $3 + ) + (func $std/typedarray/reduceUint8ArrayTest (; 34 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 3 + call $~lib/typedarray/Uint8Array#reduce + i32.const 255 + i32.and + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 267 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceUint8ClampedArrayTest (; 35 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 4 + call $~lib/typedarray/Uint8Array#reduce + i32.const 255 + i32.and + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 282 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/internal/typedarray/TypedArray#__set (; 36 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + get_local $1 + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + i32.ge_u + if + i32.const 0 + i32.const 48 + i32.const 54 + i32.const 63 + call $~lib/env/abort + unreachable + end + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 1 + i32.shl + i32.add + get_local $2 + i32.store16 offset=8 + ) + (func $~lib/typedarray/Int16Array#reduce (; 37 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + set_local $3 + loop $continue|0 + get_local $1 + get_local $3 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $2 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 1 + i32.shl + i32.add + i32.load16_s offset=8 + get_local $1 + get_local $0 + i32.const 5 + call_indirect (type $iiiii) + set_local $2 + get_local $1 + i32.const 1 + i32.add + set_local $1 + br $continue|0 + end + end + get_local $2 + ) + (func $std/typedarray/reduceInt16ArrayTest (; 38 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + call $~lib/typedarray/Int16Array#reduce + i32.const 65535 + i32.and + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 297 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Uint16Array#reduce (; 39 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + set_local $3 + loop $continue|0 + get_local $1 + get_local $3 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $2 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 1 + i32.shl + i32.add + i32.load16_u offset=8 + get_local $1 + get_local $0 + i32.const 6 + call_indirect (type $iiiii) + set_local $2 + get_local $1 + i32.const 1 + i32.add + set_local $1 + br $continue|0 + end + end + get_local $2 + ) + (func $std/typedarray/reduceUint16ArrayTest (; 40 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + call $~lib/typedarray/Uint16Array#reduce + i32.const 65535 + i32.and + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 312 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Int32Array#reduce (; 41 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + set_local $4 + loop $continue|0 + get_local $2 + get_local $4 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $3 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $2 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + get_local $2 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + set_local $3 + get_local $2 + i32.const 1 + i32.add + set_local $2 + br $continue|0 + end + end + get_local $3 + ) + (func $std/typedarray/reduceInt32ArrayTest (; 42 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 7 + call $~lib/typedarray/Int32Array#reduce + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 327 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceUint32ArrayTest (; 43 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 8 + call $~lib/typedarray/Int32Array#reduce + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 342 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/internal/typedarray/TypedArray#__set (; 44 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) + get_local $1 + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + i32.ge_u + if + i32.const 0 + i32.const 48 + i32.const 54 + i32.const 63 + call $~lib/env/abort + unreachable + end + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 3 + i32.shl + i32.add + get_local $2 + i64.store offset=8 + ) + (func $std/typedarray/reduceInt64ArrayTest~anonymous|9 (; 45 ;) (type $IIiiI) (param $0 i64) (param $1 i64) (param $2 i32) (param $3 i32) (result i64) + get_local $0 + get_local $1 + i64.add + ) + (func $~lib/typedarray/Int64Array#reduce (; 46 ;) (type $FUNCSIG$jii) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (local $3 i64) + (local $4 i32) + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + set_local $4 + loop $continue|0 + get_local $2 + get_local $4 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $3 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $2 + i32.const 3 + i32.shl + i32.add + i64.load offset=8 + get_local $2 + get_local $0 + get_local $1 + call_indirect (type $IIiiI) + set_local $3 + get_local $2 + i32.const 1 + i32.add + set_local $2 + br $continue|0 + end + end + get_local $3 + ) + (func $std/typedarray/reduceInt64ArrayTest (; 47 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 9 + call $~lib/typedarray/Int64Array#reduce + i64.const 6 + i64.ne + if + i32.const 0 + i32.const 8 + i32.const 357 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceUint64ArrayTest (; 48 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 10 + call $~lib/typedarray/Int64Array#reduce + i64.const 6 + i64.ne + if + i32.const 0 + i32.const 8 + i32.const 372 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/internal/typedarray/TypedArray#__set (; 49 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) + get_local $1 + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + i32.ge_u + if + i32.const 0 + i32.const 48 + i32.const 54 + i32.const 63 + call $~lib/env/abort + unreachable + end + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + f32.store offset=8 + ) + (func $std/typedarray/reduceFloat32ArrayTest~anonymous|11 (; 50 ;) (type $ffiif) (param $0 f32) (param $1 f32) (param $2 i32) (param $3 i32) (result f32) + get_local $0 + get_local $1 + f32.add + ) + (func $~lib/typedarray/Float32Array#reduce (; 51 ;) (type $FUNCSIG$fi) (param $0 i32) (result f32) + (local $1 i32) + (local $2 f32) + (local $3 i32) + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + set_local $3 + loop $continue|0 + get_local $1 + get_local $3 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $2 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 2 + i32.shl + i32.add + f32.load offset=8 + get_local $1 + get_local $0 + i32.const 11 + call_indirect (type $ffiif) + set_local $2 + get_local $1 + i32.const 1 + i32.add + set_local $1 + br $continue|0 + end + end + get_local $2 + ) + (func $std/typedarray/reduceFloat32ArrayTest (; 52 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + f32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + f32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + f32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + call $~lib/typedarray/Float32Array#reduce + f32.const 6 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 387 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceFloat64ArrayTest~anonymous|12 (; 53 ;) (type $FFiiF) (param $0 f64) (param $1 f64) (param $2 i32) (param $3 i32) (result f64) + get_local $0 + get_local $1 + f64.add + ) + (func $~lib/typedarray/Float64Array#reduce (; 54 ;) (type $FUNCSIG$di) (param $0 i32) (result f64) + (local $1 i32) + (local $2 f64) + (local $3 i32) + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + set_local $3 + loop $continue|0 + get_local $1 + get_local $3 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $2 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 3 + i32.shl + i32.add + f64.load offset=8 + get_local $1 + get_local $0 + i32.const 12 + call_indirect (type $FFiiF) + set_local $2 + get_local $1 + i32.const 1 + i32.add + set_local $1 + br $continue|0 + end + end + get_local $2 + ) + (func $std/typedarray/reduceFloat64ArrayTest (; 55 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + f64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + f64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + f64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + call $~lib/typedarray/Float64Array#reduce + f64.const 6 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 402 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Int8Array#reduceRight (; 56 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + get_local $0 + i32.load offset=8 + i32.const 1 + i32.sub + set_local $1 + loop $continue|0 + get_local $1 + i32.const -1 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $2 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.add + i32.load8_s offset=8 + get_local $1 + get_local $0 + i32.const 13 + call_indirect (type $iiiii) + set_local $2 + get_local $1 + i32.const 1 + i32.sub + set_local $1 + br $continue|0 + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightInt8ArrayTest (; 57 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + call $~lib/typedarray/Int8Array#reduceRight + i32.const 255 + i32.and + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 440 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Uint8Array#reduceRight (; 58 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + get_local $0 + i32.load offset=8 + i32.const 1 + i32.sub + set_local $2 + loop $continue|0 + get_local $2 + i32.const -1 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $3 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $2 + i32.add + i32.load8_u offset=8 + get_local $2 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + set_local $3 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + br $continue|0 + end + end + get_local $3 + ) + (func $std/typedarray/reduceRightUint8ArrayTest (; 59 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 14 + call $~lib/typedarray/Uint8Array#reduceRight + i32.const 255 + i32.and + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 455 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightUint8ClampedArrayTest (; 60 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 15 + call $~lib/typedarray/Uint8Array#reduceRight + i32.const 255 + i32.and + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 470 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Int16Array#reduceRight (; 61 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + i32.const 1 + i32.sub + set_local $1 + loop $continue|0 + get_local $1 + i32.const -1 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $2 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 1 + i32.shl + i32.add + i32.load16_s offset=8 + get_local $1 + get_local $0 + i32.const 16 + call_indirect (type $iiiii) + set_local $2 + get_local $1 + i32.const 1 + i32.sub + set_local $1 + br $continue|0 + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightInt16ArrayTest (; 62 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + call $~lib/typedarray/Int16Array#reduceRight + i32.const 65535 + i32.and + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 485 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Uint16Array#reduceRight (; 63 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + i32.const 1 + i32.sub + set_local $1 + loop $continue|0 + get_local $1 + i32.const -1 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $2 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 1 + i32.shl + i32.add + i32.load16_u offset=8 + get_local $1 + get_local $0 + i32.const 17 + call_indirect (type $iiiii) + set_local $2 + get_local $1 + i32.const 1 + i32.sub + set_local $1 + br $continue|0 + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightUint16ArrayTest (; 64 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + call $~lib/typedarray/Uint16Array#reduceRight + i32.const 65535 + i32.and + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 500 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Int32Array#reduceRight (; 65 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + i32.const 1 + i32.sub + set_local $2 + loop $continue|0 + get_local $2 + i32.const -1 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $3 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $2 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + get_local $2 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + set_local $3 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + br $continue|0 + end + end + get_local $3 + ) + (func $std/typedarray/reduceRightInt32ArrayTest (; 66 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 18 + call $~lib/typedarray/Int32Array#reduceRight + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 515 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightUint32ArrayTest (; 67 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 19 + call $~lib/typedarray/Int32Array#reduceRight + i32.const 6 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 530 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Int64Array#reduceRight (; 68 ;) (type $FUNCSIG$jii) (param $0 i32) (param $1 i32) (result i64) + (local $2 i32) + (local $3 i64) + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + i32.const 1 + i32.sub + set_local $2 + loop $continue|0 + get_local $2 + i32.const -1 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $3 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $2 + i32.const 3 + i32.shl + i32.add + i64.load offset=8 + get_local $2 + get_local $0 + get_local $1 + call_indirect (type $IIiiI) + set_local $3 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + br $continue|0 + end + end + get_local $3 + ) + (func $std/typedarray/reduceRightInt64ArrayTest (; 69 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 20 + call $~lib/typedarray/Int64Array#reduceRight + i64.const 6 + i64.ne + if + i32.const 0 + i32.const 8 + i32.const 545 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightUint64ArrayTest (; 70 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + i64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 21 + call $~lib/typedarray/Int64Array#reduceRight + i64.const 6 + i64.ne + if + i32.const 0 + i32.const 8 + i32.const 560 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Float32Array#reduceRight (; 71 ;) (type $FUNCSIG$fi) (param $0 i32) (result f32) + (local $1 i32) + (local $2 f32) + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + i32.const 1 + i32.sub + set_local $1 + loop $continue|0 + get_local $1 + i32.const -1 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $2 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 2 + i32.shl + i32.add + f32.load offset=8 + get_local $1 + get_local $0 + i32.const 22 + call_indirect (type $ffiif) + set_local $2 + get_local $1 + i32.const 1 + i32.sub + set_local $1 + br $continue|0 + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightFloat32ArrayTest (; 72 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + f32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + f32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + f32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + call $~lib/typedarray/Float32Array#reduceRight + f32.const 6 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 575 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/typedarray/Float64Array#reduceRight (; 73 ;) (type $FUNCSIG$di) (param $0 i32) (result f64) + (local $1 i32) + (local $2 f64) + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + i32.const 1 + i32.sub + set_local $1 + loop $continue|0 + get_local $1 + i32.const -1 + i32.ne + if + i32.const 4 + set_global $~argc + get_local $2 + get_local $0 + i32.load + get_local $0 + i32.load offset=4 + i32.add + get_local $1 + i32.const 3 + i32.shl + i32.add + f64.load offset=8 + get_local $1 + get_local $0 + i32.const 23 + call_indirect (type $FFiiF) + set_local $2 + get_local $1 + i32.const 1 + i32.sub + set_local $1 + br $continue|0 + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightFloat64ArrayTest (; 74 ;) (type $v) + (local $0 i32) + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + tee_local $0 + i32.const 0 + f64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + f64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + f64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + call $~lib/typedarray/Float64Array#reduceRight + f64.const 6 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 590 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $start (; 75 ;) (type $v) (local $0 i32) (local $1 i32) i32.const 624 @@ -3107,8 +4534,30 @@ call $~lib/env/abort unreachable end + call $std/typedarray/reduceInt8ArrayTest + call $std/typedarray/reduceUint8ArrayTest + call $std/typedarray/reduceUint8ClampedArrayTest + call $std/typedarray/reduceInt16ArrayTest + call $std/typedarray/reduceUint16ArrayTest + call $std/typedarray/reduceInt32ArrayTest + call $std/typedarray/reduceUint32ArrayTest + call $std/typedarray/reduceInt64ArrayTest + call $std/typedarray/reduceUint64ArrayTest + call $std/typedarray/reduceFloat32ArrayTest + call $std/typedarray/reduceFloat64ArrayTest + call $std/typedarray/reduceRightInt8ArrayTest + call $std/typedarray/reduceRightUint8ArrayTest + call $std/typedarray/reduceRightUint8ClampedArrayTest + call $std/typedarray/reduceRightInt16ArrayTest + call $std/typedarray/reduceRightUint16ArrayTest + call $std/typedarray/reduceRightInt32ArrayTest + call $std/typedarray/reduceRightUint32ArrayTest + call $std/typedarray/reduceRightInt64ArrayTest + call $std/typedarray/reduceRightUint64ArrayTest + call $std/typedarray/reduceRightFloat32ArrayTest + call $std/typedarray/reduceRightFloat64ArrayTest ) - (func $null (; 31 ;) (type $v) + (func $null (; 76 ;) (type $v) nop ) ) diff --git a/tests/compiler/std/typedarray.ts b/tests/compiler/std/typedarray.ts index 6c583867..436da007 100644 --- a/tests/compiler/std/typedarray.ts +++ b/tests/compiler/std/typedarray.ts @@ -225,3 +225,379 @@ assert(multisubarr3[0] === 4); assert(multisubarr3.length === 3); assert(multisubarr3.byteOffset === 3); assert(multisubarr3.byteLength === 3); + +/** + * Reduce test suite: + * Each function is designed to test a simple sum reduction. In each test it initialized the tested + * typedarray, and sets the values manually. Then it calls `TypedArray.prototype.reduce` with a + * single sum arrow function reduction. For each reduction, it verifies the `self` parameter is the + * instantiated array, the index is the correct index, and it increments the testIndex variable. + * Finally, it asserts the value is 6. + * + * TODO: When function closure support is added, remove the function comments to fully verify the + * tests work. + */ +function reduceInt8ArrayTest(): void { + var array: Int8Array = new Int8Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: i8, val: i8, index: i32, self: Int8Array): i8 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceUint8ArrayTest(): void { + var array: Uint8Array = new Uint8Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: u8, val: u8, index: i32, self: Uint8Array): u8 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceUint8ClampedArrayTest(): void { + var array: Uint8ClampedArray = new Uint8ClampedArray(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: u8, val: u8, index: i32, self: Uint8ClampedArray): u8 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceInt16ArrayTest(): void { + var array: Int16Array = new Int16Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: i16, val: i16, index: i32, self: Int16Array): i16 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceUint16ArrayTest(): void { + var array: Uint16Array = new Uint16Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: u16, val: u16, index: i32, self: Uint16Array): u16 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceInt32ArrayTest(): void { + var array: Int32Array = new Int32Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: i32, val: i32, index: i32, self: Int32Array): i32 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceUint32ArrayTest(): void { + var array: Uint32Array = new Uint32Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: u32, val: u32, index: i32, self: Uint32Array): u32 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceInt64ArrayTest(): void { + var array: Int64Array = new Int64Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: i64, val: i64, index: i32, self: Int64Array): i64 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceUint64ArrayTest(): void { + var array: Uint64Array = new Uint64Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: u64, val: u64, index: i32, self: Uint64Array): u64 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceFloat32ArrayTest(): void { + var array: Float32Array = new Float32Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: f32, val: f32, index: i32, self: Float32Array): f32 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceFloat64ArrayTest(): void { + var array: Float64Array = new Float64Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 0; + var result = array.reduce((acc: f64, val: f64, index: i32, self: Float64Array): f64 => { + // assert(testindex == index); + // assert(array == self); + // ++testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +reduceInt8ArrayTest(); +reduceUint8ArrayTest(); +reduceUint8ClampedArrayTest(); +reduceInt16ArrayTest(); +reduceUint16ArrayTest(); +reduceInt32ArrayTest(); +reduceUint32ArrayTest(); +reduceInt64ArrayTest(); +reduceUint64ArrayTest(); +reduceFloat32ArrayTest(); +reduceFloat64ArrayTest(); + +/** + * ReduceRight test suite: + * Each function is designed to test a simple sum reduction. In each test it initialized the tested + * typedarray, and sets the values manually. Then it calls `TypedArray.prototype.reduceRight` with a + * single sum arrow function reduction. For each reduction, it verifies the `self` parameter is the + * instantiated array, the index is the correct index, and it increments the testIndex variable. + * Finally, it asserts the value is 6. + * + * TODO: When function closure support is added, remove the function comments to fully verify the + * tests work. + */ +function reduceRightInt8ArrayTest(): void { + var array: Int8Array = new Int8Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: i8, val: i8, index: i32, self: Int8Array): i8 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceRightUint8ArrayTest(): void { + var array: Uint8Array = new Uint8Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: u8, val: u8, index: i32, self: Uint8Array): u8 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceRightUint8ClampedArrayTest(): void { + var array: Uint8ClampedArray = new Uint8ClampedArray(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: u8, val: u8, index: i32, self: Uint8ClampedArray): u8 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceRightInt16ArrayTest(): void { + var array: Int16Array = new Int16Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: i16, val: i16, index: i32, self: Int16Array): i16 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceRightUint16ArrayTest(): void { + var array: Uint16Array = new Uint16Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: u16, val: u16, index: i32, self: Uint16Array): u16 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceRightInt32ArrayTest(): void { + var array: Int32Array = new Int32Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: i32, val: i32, index: i32, self: Int32Array): i32 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceRightUint32ArrayTest(): void { + var array: Uint32Array = new Uint32Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: u32, val: u32, index: i32, self: Uint32Array): u32 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceRightInt64ArrayTest(): void { + var array: Int64Array = new Int64Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: i64, val: i64, index: i32, self: Int64Array): i64 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceRightUint64ArrayTest(): void { + var array: Uint64Array = new Uint64Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: u64, val: u64, index: i32, self: Uint64Array): u64 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceRightFloat32ArrayTest(): void { + var array: Float32Array = new Float32Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: f32, val: f32, index: i32, self: Float32Array): f32 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +function reduceRightFloat64ArrayTest(): void { + var array: Float64Array = new Float64Array(3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + // var testindex: i32 = 2; + var result = array.reduceRight((acc: f64, val: f64, index: i32, self: Float64Array): f64 => { + // assert(testindex == index); + // assert(array == self); + // --testindex; + return acc + val; + }, 0); + assert(result == 6); +} + +reduceRightInt8ArrayTest(); +reduceRightUint8ArrayTest(); +reduceRightUint8ClampedArrayTest(); +reduceRightInt16ArrayTest(); +reduceRightUint16ArrayTest(); +reduceRightInt32ArrayTest(); +reduceRightUint32ArrayTest(); +reduceRightInt64ArrayTest(); +reduceRightUint64ArrayTest(); +reduceRightFloat32ArrayTest(); +reduceRightFloat64ArrayTest(); diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index abeb77ae..3aa03171 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -10,6 +10,14 @@ (type $iiF (func (param i32 i32) (result f64))) (type $iiiii (func (param i32 i32 i32 i32) (result i32))) (type $v (func)) + (type $iiIv (func (param i32 i32 i64))) + (type $IIiiI (func (param i64 i64 i32 i32) (result i64))) + (type $iiII (func (param i32 i32 i64) (result i64))) + (type $iifv (func (param i32 i32 f32))) + (type $ffiif (func (param f32 f32 i32 i32) (result f32))) + (type $iiff (func (param i32 i32 f32) (result f32))) + (type $FFiiF (func (param f64 f64 i32 i32) (result f64))) + (type $iiFF (func (param i32 i32 f64) (result f64))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) "\11\00\00\00s\00t\00d\00/\00t\00y\00p\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s\00") @@ -43,8 +51,8 @@ (data (i32.const 576) " \02\00\00\03\00\00\00") (data (i32.const 584) "\14\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00") (data (i32.const 616) "H\02\00\00\05\00\00\00") - (table $0 2 anyfunc) - (elem (i32.const 0) $null $~lib/internal/typedarray/TypedArray#sort|trampoline~anonymous|1) + (table $0 24 anyfunc) + (elem (i32.const 0) $null $~lib/internal/typedarray/TypedArray#sort|trampoline~anonymous|1 $std/typedarray/reduceInt8ArrayTest~anonymous|2 $std/typedarray/reduceUint8ArrayTest~anonymous|3 $std/typedarray/reduceUint8ClampedArrayTest~anonymous|4 $std/typedarray/reduceInt16ArrayTest~anonymous|5 $std/typedarray/reduceUint16ArrayTest~anonymous|6 $std/typedarray/reduceInt32ArrayTest~anonymous|7 $std/typedarray/reduceUint32ArrayTest~anonymous|8 $std/typedarray/reduceInt64ArrayTest~anonymous|9 $std/typedarray/reduceUint64ArrayTest~anonymous|10 $std/typedarray/reduceFloat32ArrayTest~anonymous|11 $std/typedarray/reduceFloat64ArrayTest~anonymous|12 $std/typedarray/reduceRightInt8ArrayTest~anonymous|13 $std/typedarray/reduceRightUint8ArrayTest~anonymous|14 $std/typedarray/reduceRightUint8ClampedArrayTest~anonymous|15 $std/typedarray/reduceRightInt16ArrayTest~anonymous|16 $std/typedarray/reduceRightUint16ArrayTest~anonymous|17 $std/typedarray/reduceRightInt32ArrayTest~anonymous|18 $std/typedarray/reduceRightUint32ArrayTest~anonymous|19 $std/typedarray/reduceRightInt64ArrayTest~anonymous|20 $std/typedarray/reduceRightUint64ArrayTest~anonymous|21 $std/typedarray/reduceRightFloat32ArrayTest~anonymous|22 $std/typedarray/reduceRightFloat64ArrayTest~anonymous|23) (global $~lib/typedarray/Int8Array.BYTES_PER_ELEMENT i32 (i32.const 1)) (global $~lib/typedarray/Uint8Array.BYTES_PER_ELEMENT i32 (i32.const 1)) (global $~lib/typedarray/Uint8ClampedArray.BYTES_PER_ELEMENT i32 (i32.const 1)) @@ -3347,7 +3355,3027 @@ get_local $3 call $~lib/internal/typedarray/TypedArray#fill ) - (func $start (; 43 ;) (type $v) + (func $std/typedarray/reduceInt8ArrayTest~anonymous|2 (; 43 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Int8Array#reduce (; 44 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.10 (result i32) + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.0 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.1 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 0 + i32.shl + i32.add + i32.load8_s offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceInt8ArrayTest (; 45 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 0 + call $~lib/typedarray/Int8Array#reduce + set_local $1 + get_local $1 + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 252 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceUint8ArrayTest~anonymous|3 (; 46 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Uint8Array#reduce (; 47 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.2 (result i32) + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.0 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.1 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 0 + i32.shl + i32.add + i32.load8_u offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceUint8ArrayTest (; 48 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 3 + i32.const 0 + call $~lib/typedarray/Uint8Array#reduce + set_local $1 + get_local $1 + i32.const 255 + i32.and + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 267 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceUint8ClampedArrayTest~anonymous|4 (; 49 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Uint8ClampedArray#reduce (; 50 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.4 (result i32) + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.1 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.2 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 0 + i32.shl + i32.add + i32.load8_u offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceUint8ClampedArrayTest (; 51 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 4 + i32.const 0 + call $~lib/typedarray/Uint8ClampedArray#reduce + set_local $1 + get_local $1 + i32.const 255 + i32.and + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 282 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/internal/typedarray/TypedArray#__set (; 52 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + get_local $1 + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + i32.ge_u + if + i32.const 0 + i32.const 48 + i32.const 54 + i32.const 63 + call $~lib/env/abort + unreachable + end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 1 + i32.shl + i32.add + get_local $2 + i32.store16 offset=8 + ) + (func $std/typedarray/reduceInt16ArrayTest~anonymous|5 (; 53 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Int16Array#reduce (; 54 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.1 (result i32) + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.0 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.0 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 1 + i32.shl + i32.add + i32.load16_s offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceInt16ArrayTest (; 55 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 5 + i32.const 0 + call $~lib/typedarray/Int16Array#reduce + set_local $1 + get_local $1 + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 297 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/internal/typedarray/TypedArray#__set (; 56 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + get_local $1 + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + i32.ge_u + if + i32.const 0 + i32.const 48 + i32.const 54 + i32.const 63 + call $~lib/env/abort + unreachable + end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 1 + i32.shl + i32.add + get_local $2 + i32.store16 offset=8 + ) + (func $std/typedarray/reduceUint16ArrayTest~anonymous|6 (; 57 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Uint16Array#reduce (; 58 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.1 (result i32) + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.0 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.0 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 1 + i32.shl + i32.add + i32.load16_u offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceUint16ArrayTest (; 59 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 6 + i32.const 0 + call $~lib/typedarray/Uint16Array#reduce + set_local $1 + get_local $1 + i32.const 65535 + i32.and + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 312 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceInt32ArrayTest~anonymous|7 (; 60 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Int32Array#reduce (; 61 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.9 (result i32) + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.0 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.1 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceInt32ArrayTest (; 62 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 7 + i32.const 0 + call $~lib/typedarray/Int32Array#reduce + set_local $1 + get_local $1 + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 327 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/internal/typedarray/TypedArray#__set (; 63 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + get_local $1 + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + i32.ge_u + if + i32.const 0 + i32.const 48 + i32.const 54 + i32.const 63 + call $~lib/env/abort + unreachable + end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 + ) + (func $std/typedarray/reduceUint32ArrayTest~anonymous|8 (; 64 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Uint32Array#reduce (; 65 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.1 (result i32) + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.0 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.0 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceUint32ArrayTest (; 66 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 8 + i32.const 0 + call $~lib/typedarray/Uint32Array#reduce + set_local $1 + get_local $1 + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 342 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/internal/typedarray/TypedArray#__set (; 67 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (local $4 i32) + get_local $1 + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + i32.ge_u + if + i32.const 0 + i32.const 48 + i32.const 54 + i32.const 63 + call $~lib/env/abort + unreachable + end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 3 + i32.shl + i32.add + get_local $2 + i64.store offset=8 + ) + (func $std/typedarray/reduceInt64ArrayTest~anonymous|9 (; 68 ;) (type $IIiiI) (param $0 i64) (param $1 i64) (param $2 i32) (param $3 i32) (result i64) + get_local $0 + get_local $1 + i64.add + ) + (func $~lib/typedarray/Int64Array#reduce (; 69 ;) (type $iiII) (param $0 i32) (param $1 i32) (param $2 i64) (result i64) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.1 (result i32) + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i64) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.0 (result i64) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.0 (result i64) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 3 + i32.shl + i32.add + i64.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $IIiiI) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceInt64ArrayTest (; 70 ;) (type $v) + (local $0 i32) + (local $1 i64) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 9 + i64.const 0 + call $~lib/typedarray/Int64Array#reduce + set_local $1 + get_local $1 + i64.const 6 + i64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 357 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/internal/typedarray/TypedArray#__set (; 71 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (local $4 i32) + get_local $1 + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + i32.ge_u + if + i32.const 0 + i32.const 48 + i32.const 54 + i32.const 63 + call $~lib/env/abort + unreachable + end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 3 + i32.shl + i32.add + get_local $2 + i64.store offset=8 + ) + (func $std/typedarray/reduceUint64ArrayTest~anonymous|10 (; 72 ;) (type $IIiiI) (param $0 i64) (param $1 i64) (param $2 i32) (param $3 i32) (result i64) + get_local $0 + get_local $1 + i64.add + ) + (func $~lib/typedarray/Uint64Array#reduce (; 73 ;) (type $iiII) (param $0 i32) (param $1 i32) (param $2 i64) (result i64) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.1 (result i32) + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i64) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.0 (result i64) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.0 (result i64) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 3 + i32.shl + i32.add + i64.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $IIiiI) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceUint64ArrayTest (; 74 ;) (type $v) + (local $0 i32) + (local $1 i64) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 10 + i64.const 0 + call $~lib/typedarray/Uint64Array#reduce + set_local $1 + get_local $1 + i64.const 6 + i64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 372 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/internal/typedarray/TypedArray#__set (; 75 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) + (local $3 i32) + (local $4 i32) + get_local $1 + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + i32.ge_u + if + i32.const 0 + i32.const 48 + i32.const 54 + i32.const 63 + call $~lib/env/abort + unreachable + end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + f32.store offset=8 + ) + (func $std/typedarray/reduceFloat32ArrayTest~anonymous|11 (; 76 ;) (type $ffiif) (param $0 f32) (param $1 f32) (param $2 i32) (param $3 i32) (result f32) + get_local $0 + get_local $1 + f32.add + ) + (func $~lib/typedarray/Float32Array#reduce (; 77 ;) (type $iiff) (param $0 i32) (param $1 i32) (param $2 f32) (result f32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.1 (result i32) + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result f32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.0 (result f32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.0 (result f32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 2 + i32.shl + i32.add + f32.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $ffiif) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceFloat32ArrayTest (; 78 ;) (type $v) + (local $0 i32) + (local $1 f32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + f32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + f32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + f32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 11 + f32.const 0 + call $~lib/typedarray/Float32Array#reduce + set_local $1 + get_local $1 + f32.const 6 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 387 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceFloat64ArrayTest~anonymous|12 (; 79 ;) (type $FFiiF) (param $0 f64) (param $1 f64) (param $2 i32) (param $3 i32) (result f64) + get_local $0 + get_local $1 + f64.add + ) + (func $~lib/typedarray/Float64Array#reduce (; 80 ;) (type $iiFF) (param $0 i32) (param $1 i32) (param $2 f64) (result f64) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.4 (result i32) + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result f64) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.0 (result f64) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.13 (result f64) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 3 + i32.shl + i32.add + f64.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $FFiiF) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceFloat64ArrayTest (; 81 ;) (type $v) + (local $0 i32) + (local $1 f64) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + f64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + f64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + f64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 12 + f64.const 0 + call $~lib/typedarray/Float64Array#reduce + set_local $1 + get_local $1 + f64.const 6 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 402 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightInt8ArrayTest~anonymous|13 (; 82 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Int8Array#reduceRight (; 83 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.12 (result i32) + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.1 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.2 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 0 + i32.shl + i32.add + i32.load8_s offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightInt8ArrayTest (; 84 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 13 + i32.const 0 + call $~lib/typedarray/Int8Array#reduceRight + set_local $1 + get_local $1 + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 440 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightUint8ArrayTest~anonymous|14 (; 85 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Uint8Array#reduceRight (; 86 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.6 (result i32) + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.2 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.3 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 0 + i32.shl + i32.add + i32.load8_u offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightUint8ArrayTest (; 87 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 14 + i32.const 0 + call $~lib/typedarray/Uint8Array#reduceRight + set_local $1 + get_local $1 + i32.const 255 + i32.and + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 455 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightUint8ClampedArrayTest~anonymous|15 (; 88 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Uint8ClampedArray#reduceRight (; 89 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.8 (result i32) + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 0 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.3 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.4 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 0 + i32.shl + i32.add + i32.load8_u offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightUint8ClampedArrayTest (; 90 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/typedarray/Uint8ClampedArray#__set + get_local $0 + i32.const 15 + i32.const 0 + call $~lib/typedarray/Uint8ClampedArray#reduceRight + set_local $1 + get_local $1 + i32.const 255 + i32.and + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 470 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightInt16ArrayTest~anonymous|16 (; 91 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Int16Array#reduceRight (; 92 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.3 (result i32) + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.1 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.1 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 1 + i32.shl + i32.add + i32.load16_s offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightInt16ArrayTest (; 93 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 16 + i32.const 0 + call $~lib/typedarray/Int16Array#reduceRight + set_local $1 + get_local $1 + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 485 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightUint16ArrayTest~anonymous|17 (; 94 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Uint16Array#reduceRight (; 95 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.3 (result i32) + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 1 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.1 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.1 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 1 + i32.shl + i32.add + i32.load16_u offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightUint16ArrayTest (; 96 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 17 + i32.const 0 + call $~lib/typedarray/Uint16Array#reduceRight + set_local $1 + get_local $1 + i32.const 65535 + i32.and + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 500 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightInt32ArrayTest~anonymous|18 (; 97 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Int32Array#reduceRight (; 98 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.11 (result i32) + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.1 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.2 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightInt32ArrayTest (; 99 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 18 + i32.const 0 + call $~lib/typedarray/Int32Array#reduceRight + set_local $1 + get_local $1 + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 515 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightUint32ArrayTest~anonymous|19 (; 100 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + get_local $0 + get_local $1 + i32.add + ) + (func $~lib/typedarray/Uint32Array#reduceRight (; 101 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.3 (result i32) + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.1 (result i32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.1 (result i32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $iiiii) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightUint32ArrayTest (; 102 ;) (type $v) + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 19 + i32.const 0 + call $~lib/typedarray/Uint32Array#reduceRight + set_local $1 + get_local $1 + i32.const 6 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 530 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightInt64ArrayTest~anonymous|20 (; 103 ;) (type $IIiiI) (param $0 i64) (param $1 i64) (param $2 i32) (param $3 i32) (result i64) + get_local $0 + get_local $1 + i64.add + ) + (func $~lib/typedarray/Int64Array#reduceRight (; 104 ;) (type $iiII) (param $0 i32) (param $1 i32) (param $2 i64) (result i64) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.3 (result i32) + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i64) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.1 (result i64) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.1 (result i64) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 3 + i32.shl + i32.add + i64.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $IIiiI) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightInt64ArrayTest (; 105 ;) (type $v) + (local $0 i32) + (local $1 i64) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 20 + i64.const 0 + call $~lib/typedarray/Int64Array#reduceRight + set_local $1 + get_local $1 + i64.const 6 + i64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 545 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightUint64ArrayTest~anonymous|21 (; 106 ;) (type $IIiiI) (param $0 i64) (param $1 i64) (param $2 i32) (param $3 i32) (result i64) + get_local $0 + get_local $1 + i64.add + ) + (func $~lib/typedarray/Uint64Array#reduceRight (; 107 ;) (type $iiII) (param $0 i32) (param $1 i32) (param $2 i64) (result i64) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.3 (result i32) + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result i64) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.1 (result i64) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.1 (result i64) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 3 + i32.shl + i32.add + i64.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $IIiiI) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightUint64ArrayTest (; 108 ;) (type $v) + (local $0 i32) + (local $1 i64) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + i64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + i64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + i64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 21 + i64.const 0 + call $~lib/typedarray/Uint64Array#reduceRight + set_local $1 + get_local $1 + i64.const 6 + i64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 560 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightFloat32ArrayTest~anonymous|22 (; 109 ;) (type $ffiif) (param $0 f32) (param $1 f32) (param $2 i32) (param $3 i32) (result f32) + get_local $0 + get_local $1 + f32.add + ) + (func $~lib/typedarray/Float32Array#reduceRight (; 110 ;) (type $iiff) (param $0 i32) (param $1 i32) (param $2 f32) (result f32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.3 (result i32) + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result f32) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.1 (result f32) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.1 (result f32) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 2 + i32.shl + i32.add + f32.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $ffiif) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightFloat32ArrayTest (; 111 ;) (type $v) + (local $0 i32) + (local $1 f32) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + f32.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + f32.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + f32.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 22 + f32.const 0 + call $~lib/typedarray/Float32Array#reduceRight + set_local $1 + get_local $1 + f32.const 6 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 575 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $std/typedarray/reduceRightFloat64ArrayTest~anonymous|23 (; 112 ;) (type $FFiiF) (param $0 f64) (param $1 f64) (param $2 i32) (param $3 i32) (result f64) + get_local $0 + get_local $1 + f64.add + ) + (func $~lib/typedarray/Float64Array#reduceRight (; 113 ;) (type $iiFF) (param $0 i32) (param $1 i32) (param $2 f64) (result f64) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 1 + set_local $3 + get_local $3 + if (result i32) + block $~lib/internal/typedarray/TypedArray#get:length|inlined.6 (result i32) + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + i32.const 1 + i32.sub + else + i32.const 0 + end + set_local $4 + get_local $3 + if (result i32) + i32.const -1 + else + get_local $0 + i32.load offset=8 + i32.const 3 + i32.shr_u + end + set_local $5 + block $break|0 + loop $continue|0 + get_local $4 + get_local $5 + i32.ne + if + block + block (result f64) + i32.const 4 + set_global $~argc + get_local $2 + block $~lib/internal/typedarray/TypedArray#__unchecked_get|inlined.1 (result f64) + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.14 (result f64) + get_local $0 + i32.load + set_local $6 + get_local $0 + i32.load offset=4 + set_local $7 + get_local $6 + get_local $7 + i32.add + get_local $4 + i32.const 3 + i32.shl + i32.add + f64.load offset=8 + end + end + get_local $4 + get_local $0 + get_local $1 + call_indirect (type $FFiiF) + end + set_local $2 + get_local $3 + if (result i32) + get_local $4 + i32.const 1 + i32.sub + else + get_local $4 + i32.const 1 + i32.add + end + set_local $4 + end + br $continue|0 + end + end + end + get_local $2 + ) + (func $std/typedarray/reduceRightFloat64ArrayTest (; 114 ;) (type $v) + (local $0 i32) + (local $1 f64) + i32.const 0 + i32.const 3 + call $~lib/internal/typedarray/TypedArray#constructor + set_local $0 + get_local $0 + i32.const 0 + f64.const 1 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 1 + f64.const 2 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 2 + f64.const 3 + call $~lib/internal/typedarray/TypedArray#__set + get_local $0 + i32.const 23 + f64.const 0 + call $~lib/typedarray/Float64Array#reduceRight + set_local $1 + get_local $1 + f64.const 6 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 590 + i32.const 2 + call $~lib/env/abort + unreachable + end + ) + (func $start (; 115 ;) (type $v) (local $0 i32) get_global $~lib/typedarray/Int8Array.BYTES_PER_ELEMENT i32.const 1 @@ -4526,7 +7554,29 @@ call $~lib/env/abort unreachable end + call $std/typedarray/reduceInt8ArrayTest + call $std/typedarray/reduceUint8ArrayTest + call $std/typedarray/reduceUint8ClampedArrayTest + call $std/typedarray/reduceInt16ArrayTest + call $std/typedarray/reduceUint16ArrayTest + call $std/typedarray/reduceInt32ArrayTest + call $std/typedarray/reduceUint32ArrayTest + call $std/typedarray/reduceInt64ArrayTest + call $std/typedarray/reduceUint64ArrayTest + call $std/typedarray/reduceFloat32ArrayTest + call $std/typedarray/reduceFloat64ArrayTest + call $std/typedarray/reduceRightInt8ArrayTest + call $std/typedarray/reduceRightUint8ArrayTest + call $std/typedarray/reduceRightUint8ClampedArrayTest + call $std/typedarray/reduceRightInt16ArrayTest + call $std/typedarray/reduceRightUint16ArrayTest + call $std/typedarray/reduceRightInt32ArrayTest + call $std/typedarray/reduceRightUint32ArrayTest + call $std/typedarray/reduceRightInt64ArrayTest + call $std/typedarray/reduceRightUint64ArrayTest + call $std/typedarray/reduceRightFloat32ArrayTest + call $std/typedarray/reduceRightFloat64ArrayTest ) - (func $null (; 44 ;) (type $v) + (func $null (; 116 ;) (type $v) ) )