From ec9187fa986f2c4f99480ad7ea173451c7c0eb12 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Thu, 4 Aug 2022 22:48:04 +0300 Subject: [PATCH 1/6] init --- std/assembly/array.ts | 53 +- std/assembly/staticarray.ts | 53 +- std/assembly/typedarray.ts | 98 ++-- std/assembly/util/bytes.ts | 60 +++ tests/compiler/std/array.debug.wat | 546 +++++++++++---------- tests/compiler/std/array.release.wat | 299 +++++------ tests/compiler/std/staticarray.debug.wat | 223 +++++---- tests/compiler/std/staticarray.release.wat | 2 +- tests/compiler/std/typedarray.debug.wat | 517 +++++++++---------- tests/compiler/std/typedarray.release.wat | 271 +++++----- 10 files changed, 1015 insertions(+), 1107 deletions(-) diff --git a/std/assembly/array.ts b/std/assembly/array.ts index 27ff361e30..e296cf0d21 100644 --- a/std/assembly/array.ts +++ b/std/assembly/array.ts @@ -3,7 +3,7 @@ import { BLOCK_MAXSIZE } from "./rt/common"; import { Runtime } from "shared/runtime"; import { COMPARATOR, SORT } from "./util/sort"; -import { REVERSE } from "./util/bytes"; +import { REVERSE, FILL } from "./util/bytes"; import { joinBooleanArray, joinIntegerArray, joinFloatArray, joinStringArray, joinReferenceArray } from "./util/string"; import { idof, isArray as builtin_isArray } from "./builtins"; import { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_ILLEGALGENTYPE, E_EMPTYARRAY, E_HOLEYARRAY } from "./util/error"; @@ -155,56 +155,7 @@ export class Array { } fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { - var ptr = this.dataStart; - var len = this.length_; - start = start < 0 ? max(len + start, 0) : min(start, len); - end = end < 0 ? max(len + end, 0) : min(end, len); - if (isManaged()) { - for (; start < end; ++start) { - store(ptr + (start << alignof()), changetype(value)); - __link(changetype(this), changetype(value), true); - } - } else if (sizeof() == 1) { - if (start < end) { - memory.fill( - ptr + start, - u8(value), - (end - start) - ); - } - } else { - if (ASC_SHRINK_LEVEL <= 1) { - if (isInteger()) { - // @ts-ignore - if (value == 0 | value == -1) { - if (start < end) { - memory.fill( - ptr + (start << alignof()), - u8(value), - (end - start) << alignof() - ); - } - return this; - } - } else if (isFloat()) { - // for floating non-negative zeros we can use fast memory.fill - if ((sizeof() == 4 && reinterpret(f32(value)) == 0) || - (sizeof() == 8 && reinterpret(f64(value)) == 0)) { - if (start < end) { - memory.fill( - ptr + (start << alignof()), - 0, - (end - start) << alignof() - ); - } - return this; - } - } - } - for (; start < end; ++start) { - store(ptr + (start << alignof()), value); - } - } + FILL(this.dataStart, this.length_, value, start, end, changetype(this)); return this; } diff --git a/std/assembly/staticarray.ts b/std/assembly/staticarray.ts index b8029ea923..15fa5a0eb5 100644 --- a/std/assembly/staticarray.ts +++ b/std/assembly/staticarray.ts @@ -3,7 +3,7 @@ import { OBJECT, BLOCK_MAXSIZE, TOTAL_OVERHEAD } from "./rt/common"; import { Runtime } from "shared/runtime"; import { COMPARATOR, SORT } from "./util/sort"; -import { REVERSE } from "./util/bytes"; +import { REVERSE, FILL } from "./util/bytes"; import { idof } from "./builtins"; import { Array } from "./array"; import { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_HOLEYARRAY } from "./util/error"; @@ -142,56 +142,7 @@ export class StaticArray { } fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { - var ptr = changetype(this); - var len = this.length; - start = start < 0 ? max(len + start, 0) : min(start, len); - end = end < 0 ? max(len + end, 0) : min(end, len); - if (isManaged()) { - for (; start < end; ++start) { - store(ptr + (start << alignof()), changetype(value)); - __link(changetype(this), changetype(value), true); - } - } else if (sizeof() == 1) { - if (start < end) { - memory.fill( - ptr + start, - u8(value), - (end - start) - ); - } - } else { - if (ASC_SHRINK_LEVEL <= 1) { - if (isInteger()) { - // @ts-ignore - if (value == 0 | value == -1) { - if (start < end) { - memory.fill( - ptr + (start << alignof()), - u8(value), - (end - start) << alignof() - ); - } - return this; - } - } else if (isFloat()) { - // for floating non-negative zeros we can use fast memory.fill - if ((sizeof() == 4 && reinterpret(f32(value)) == 0) || - (sizeof() == 8 && reinterpret(f64(value)) == 0)) { - if (start < end) { - memory.fill( - ptr + (start << alignof()), - 0, - (end - start) << alignof() - ); - } - return this; - } - } - } - for (; start < end; ++start) { - store(ptr + (start << alignof()), value); - } - } + FILL(changetype(this), this.length, value, start, end); return this; } diff --git a/std/assembly/typedarray.ts b/std/assembly/typedarray.ts index eae32f5db3..c1eea946d7 100644 --- a/std/assembly/typedarray.ts +++ b/std/assembly/typedarray.ts @@ -1,7 +1,7 @@ import { COMPARATOR, SORT } from "./util/sort"; import { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_NOTIMPLEMENTED } from "./util/error"; import { joinIntegerArray, joinFloatArray } from "./util/string"; -import { REVERSE } from "./util/bytes"; +import { REVERSE, FILL } from "./util/bytes"; import { idof } from "./builtins"; import { ArrayBufferView } from "./arraybuffer"; @@ -61,11 +61,12 @@ export class Int8Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int8Array { - return FILL(this, value, start, end); + fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + FILL(this.dataStart, this.length, u8(value), start, end); + return this; } - sort(comparator: (a: i8, b: i8) => i32 = COMPARATOR()): Int8Array { + sort(comparator: (a: i8, b: i8) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } @@ -202,11 +203,12 @@ export class Uint8Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8Array { - return FILL(this, value, start, end); + fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + FILL(this.dataStart, this.length, value, start, end); + return this; } - sort(comparator: (a: u8, b: u8) => i32 = COMPARATOR()): Uint8Array { + sort(comparator: (a: u8, b: u8) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } @@ -343,11 +345,13 @@ export class Uint8ClampedArray extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8ClampedArray { - return FILL(this, value, start, end); + fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + value = ~(value >> 31) & (((255 - value) >> 31) | value); + FILL(this.dataStart, this.length, u8(value), start, end); + return this; } - sort(comparator: (a: u8, b: u8) => i32 = COMPARATOR()): Uint8ClampedArray { + sort(comparator: (a: u8, b: u8) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } @@ -485,7 +489,8 @@ export class Int16Array extends ArrayBufferView { } fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array { - return FILL(this, value, start, end); + FILL(this.dataStart, this.length, i16(value), start, end); + return this; } sort(comparator: (a: i16, b: i16) => i32 = COMPARATOR()): Int16Array { @@ -626,7 +631,8 @@ export class Uint16Array extends ArrayBufferView { } fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array { - return FILL(this, value, start, end); + FILL(this.dataStart, this.length, u16(value), start, end); + return this; } sort(comparator: (a: u16, b: u16) => i32 = COMPARATOR()): Uint16Array { @@ -767,7 +773,8 @@ export class Int32Array extends ArrayBufferView { } fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array { - return FILL(this, value, start, end); + FILL(this.dataStart, this.length, value, start, end); + return this; } sort(comparator: (a: i32, b: i32) => i32 = COMPARATOR()): Int32Array { @@ -908,7 +915,8 @@ export class Uint32Array extends ArrayBufferView { } fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array { - return FILL(this, value, start, end); + FILL(this.dataStart, this.length, value, start, end); + return this; } sort(comparator: (a: u32, b: u32) => i32 = COMPARATOR()): Uint32Array { @@ -1049,7 +1057,8 @@ export class Int64Array extends ArrayBufferView { } fill(value: i64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array { - return FILL(this, value, start, end); + FILL(this.dataStart, this.length, value, start, end); + return this; } sort(comparator: (a: i64, b: i64) => i32 = COMPARATOR()): Int64Array { @@ -1190,7 +1199,8 @@ export class Uint64Array extends ArrayBufferView { } fill(value: u64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array { - return FILL(this, value, start, end); + FILL(this.dataStart, this.length, value, start, end); + return this; } sort(comparator: (a: u64, b: u64) => i32 = COMPARATOR()): Uint64Array { @@ -1331,7 +1341,8 @@ export class Float32Array extends ArrayBufferView { } fill(value: f32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array { - return FILL(this, value, start, end); + FILL(this.dataStart, this.length, value, start, end); + return this; } sort(comparator: (a: f32, b: f32) => i32 = COMPARATOR()): Float32Array { @@ -1472,7 +1483,8 @@ export class Float64Array extends ArrayBufferView { } fill(value: f64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array { - return FILL(this, value, start, end); + FILL(this.dataStart, this.length, value, start, end); + return this; } sort(comparator: (a: f64, b: f64) => i32 = COMPARATOR()): Float64Array { @@ -1556,56 +1568,6 @@ export class Float64Array extends ArrayBufferView { } } -// @ts-ignore: decorator -@inline -function FILL( - array: TArray, - value: native, - start: i32, - end: i32 -): TArray { - var ptr = array.dataStart; - var len = array.length; - start = start < 0 ? max(len + start, 0) : min(start, len); - end = end < 0 ? max(len + end, 0) : min(end, len); - if (sizeof() == 1) { - if (start < end) memory.fill(ptr + start, value, (end - start)); - } else { - if (ASC_SHRINK_LEVEL <= 1) { - if (isInteger()) { - // @ts-ignore - if (value == 0 | value == -1) { - if (start < end) { - memory.fill( - ptr + (start << alignof()), - u8(value), - (end - start) << alignof() - ); - } - return array; - } - } else if (isFloat()) { - // for floating non-negative zeros we can use fast memory.fill - if ((sizeof() == 4 && reinterpret(f32(value)) == 0) || - (sizeof() == 8 && reinterpret(f64(value)) == 0)) { - if (start < end) { - memory.fill( - ptr + (start << alignof()), - 0, - (end - start) << alignof() - ); - } - return array; - } - } - } - for (; start < end; ++start) { - store(ptr + (start << alignof()), value); - } - } - return array; -} - // @ts-ignore: decorator @inline function SLICE( diff --git a/std/assembly/util/bytes.ts b/std/assembly/util/bytes.ts index 1d4752786f..1ee375d6d5 100644 --- a/std/assembly/util/bytes.ts +++ b/std/assembly/util/bytes.ts @@ -52,3 +52,63 @@ export function REVERSE(ptr: usize, len: usize): void { } } } + +// @ts-ignore +@inline export function FILL( + ptr: usize, + len: usize, + value: T, + start: isize, + end: isize, + self: usize = ptr +): void { + start = start < 0 ? max(len + start, 0) : min(start, len); + end = end < 0 ? max(len + end, 0) : min(end, len); + + if (isManaged()) { + for (; start < end; ++start) { + store(ptr + (start << alignof()), changetype(value)); + __link(self, changetype(value), true); + } + } else if (sizeof() == 1) { + if (start < end) { + memory.fill( + ptr + start, + u8(value), + (end - start) + ); + } + } else { + if (ASC_SHRINK_LEVEL <= 1) { + if (isInteger()) { + // @ts-ignore + if (value == 0 | value == -1) { + if (start < end) { + memory.fill( + ptr + (start << alignof()), + u8(value), + (end - start) << alignof() + ); + } + return; + } + } else if (isFloat()) { + // for floating non-negative zeros we can use fast memory.fill + if ((sizeof() == 4 && reinterpret(f32(value)) == 0) || + (sizeof() == 8 && reinterpret(f64(value)) == 0)) { + if (start < end) { + memory.fill( + ptr + (start << alignof()), + 0, + (end - start) << alignof() + ); + } + return; + } + } + } + for (; start < end; ++start) { + store(ptr + (start << alignof()), value); + } + } +} diff --git a/tests/compiler/std/array.debug.wat b/tests/compiler/std/array.debug.wat index a925fa103f..b1221c186f 100644 --- a/tests/compiler/std/array.debug.wat +++ b/tests/compiler/std/array.debug.wat @@ -2644,78 +2644,90 @@ (local $5 i32) (local $6 i32) (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) local.get $0 i32.load offset=4 - local.set $4 + local.set $9 local.get $0 i32.load offset=12 - local.set $5 + local.set $8 + local.get $1 + local.set $7 local.get $2 + local.set $6 + local.get $3 + local.set $5 + local.get $0 + local.set $4 + local.get $6 i32.const 0 i32.lt_s if (result i32) - local.get $5 - local.get $2 + local.get $8 + local.get $6 i32.add - local.tee $6 + local.tee $10 i32.const 0 - local.tee $7 - local.get $6 - local.get $7 - i32.gt_s + local.tee $11 + local.get $10 + local.get $11 + i32.gt_u select else - local.get $2 - local.tee $7 - local.get $5 - local.tee $6 - local.get $7 local.get $6 + local.tee $11 + local.get $8 + local.tee $10 + local.get $11 + local.get $10 i32.lt_s select end - local.set $2 - local.get $3 + local.set $6 + local.get $5 i32.const 0 i32.lt_s if (result i32) + local.get $8 local.get $5 - local.get $3 i32.add - local.tee $6 + local.tee $10 i32.const 0 - local.tee $7 - local.get $6 - local.get $7 - i32.gt_s + local.tee $11 + local.get $10 + local.get $11 + i32.gt_u select else - local.get $3 - local.tee $7 local.get $5 - local.tee $6 - local.get $7 - local.get $6 + local.tee $11 + local.get $8 + local.tee $10 + local.get $11 + local.get $10 i32.lt_s select end - local.set $3 + local.set $5 i32.const 0 drop i32.const 1 i32.const 1 i32.eq drop - local.get $2 - local.get $3 + local.get $6 + local.get $5 i32.lt_s if - local.get $4 - local.get $2 + local.get $9 + local.get $6 i32.add - local.get $1 - local.get $3 - local.get $2 + local.get $7 + local.get $5 + local.get $6 i32.sub memory.fill end @@ -2812,121 +2824,134 @@ (local $5 i32) (local $6 i32) (local $7 i32) - local.get $0 - i32.load offset=4 - local.set $4 - local.get $0 - i32.load offset=12 - local.set $5 - local.get $2 - i32.const 0 - i32.lt_s - if (result i32) - local.get $5 - local.get $2 - i32.add - local.tee $6 - i32.const 0 - local.tee $7 - local.get $6 - local.get $7 - i32.gt_s - select - else + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + block $~lib/util/bytes/FILL|inlined.0 + local.get $0 + i32.load offset=4 + local.set $9 + local.get $0 + i32.load offset=12 + local.set $8 + local.get $1 + local.set $7 local.get $2 - local.tee $7 - local.get $5 - local.tee $6 - local.get $7 + local.set $6 + local.get $3 + local.set $5 + local.get $0 + local.set $4 local.get $6 + i32.const 0 i32.lt_s - select - end - local.set $2 - local.get $3 - i32.const 0 - i32.lt_s - if (result i32) + if (result i32) + local.get $8 + local.get $6 + i32.add + local.tee $10 + i32.const 0 + local.tee $11 + local.get $10 + local.get $11 + i32.gt_u + select + else + local.get $6 + local.tee $11 + local.get $8 + local.tee $10 + local.get $11 + local.get $10 + i32.lt_s + select + end + local.set $6 local.get $5 - local.get $3 - i32.add - local.tee $6 i32.const 0 - local.tee $7 - local.get $6 - local.get $7 - i32.gt_s - select - else - local.get $3 - local.tee $7 - local.get $5 - local.tee $6 - local.get $7 - local.get $6 - i32.lt_s - select - end - local.set $3 - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 0 - i32.const 1 - i32.le_s - drop - i32.const 1 - drop - local.get $1 - i32.const 0 - i32.eq - local.get $1 - i32.const -1 - i32.eq - i32.or - if - local.get $2 - local.get $3 i32.lt_s - if - local.get $4 - local.get $2 - i32.const 2 - i32.shl + if (result i32) + local.get $8 + local.get $5 i32.add - local.get $1 - local.get $3 - local.get $2 - i32.sub - i32.const 2 - i32.shl - memory.fill + local.tee $10 + i32.const 0 + local.tee $11 + local.get $10 + local.get $11 + i32.gt_u + select + else + local.get $5 + local.tee $11 + local.get $8 + local.tee $10 + local.get $11 + local.get $10 + i32.lt_s + select end - local.get $0 - return - end - loop $for-loop|0 - local.get $2 - local.get $3 - i32.lt_s - local.set $7 + local.set $5 + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 0 + i32.const 1 + i32.le_s + drop + i32.const 1 + drop + local.get $7 + i32.const 0 + i32.eq local.get $7 + i32.const -1 + i32.eq + i32.or if - local.get $4 - local.get $2 - i32.const 2 - i32.shl - i32.add - local.get $1 - i32.store - local.get $2 - i32.const 1 - i32.add - local.set $2 - br $for-loop|0 + local.get $6 + local.get $5 + i32.lt_s + if + local.get $9 + local.get $6 + i32.const 2 + i32.shl + i32.add + local.get $7 + local.get $5 + local.get $6 + i32.sub + i32.const 2 + i32.shl + memory.fill + end + br $~lib/util/bytes/FILL|inlined.0 + end + loop $for-loop|0 + local.get $6 + local.get $5 + i32.lt_s + local.set $11 + local.get $11 + if + local.get $9 + local.get $6 + i32.const 2 + i32.shl + i32.add + local.get $7 + i32.store + local.get $6 + i32.const 1 + i32.add + local.set $6 + br $for-loop|0 + end end end local.get $0 @@ -3021,128 +3046,141 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - local.get $0 - i32.load offset=4 - local.set $4 - local.get $0 - i32.load offset=12 - local.set $5 - local.get $2 - i32.const 0 - i32.lt_s - if (result i32) - local.get $5 - local.get $2 - i32.add - local.tee $6 - i32.const 0 - local.tee $7 - local.get $6 - local.get $7 - i32.gt_s - select - else + (local $7 f32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + block $~lib/util/bytes/FILL|inlined.0 + local.get $0 + i32.load offset=4 + local.set $9 + local.get $0 + i32.load offset=12 + local.set $8 + local.get $1 + local.set $7 local.get $2 - local.tee $7 - local.get $5 - local.tee $6 - local.get $7 + local.set $6 + local.get $3 + local.set $5 + local.get $0 + local.set $4 local.get $6 + i32.const 0 i32.lt_s - select - end - local.set $2 - local.get $3 - i32.const 0 - i32.lt_s - if (result i32) + if (result i32) + local.get $8 + local.get $6 + i32.add + local.tee $10 + i32.const 0 + local.tee $11 + local.get $10 + local.get $11 + i32.gt_u + select + else + local.get $6 + local.tee $11 + local.get $8 + local.tee $10 + local.get $11 + local.get $10 + i32.lt_s + select + end + local.set $6 local.get $5 - local.get $3 - i32.add - local.tee $6 i32.const 0 - local.tee $7 - local.get $6 - local.get $7 - i32.gt_s - select - else - local.get $3 - local.tee $7 - local.get $5 - local.tee $6 - local.get $7 - local.get $6 - i32.lt_s - select - end - local.set $3 - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 0 - i32.const 1 - i32.le_s - drop - i32.const 0 - drop - i32.const 1 - drop - local.get $1 - i32.reinterpret_f32 - i32.const 0 - i32.eq - if (result i32) - i32.const 1 - else - i32.const 4 - i32.const 8 - i32.eq - end - if - local.get $2 - local.get $3 i32.lt_s - if - local.get $4 - local.get $2 - i32.const 2 - i32.shl + if (result i32) + local.get $8 + local.get $5 i32.add + local.tee $10 i32.const 0 - local.get $3 - local.get $2 - i32.sub - i32.const 2 - i32.shl - memory.fill + local.tee $11 + local.get $10 + local.get $11 + i32.gt_u + select + else + local.get $5 + local.tee $11 + local.get $8 + local.tee $10 + local.get $11 + local.get $10 + i32.lt_s + select end - local.get $0 - return - end - loop $for-loop|0 - local.get $2 - local.get $3 - i32.lt_s - local.set $7 + local.set $5 + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 0 + i32.const 1 + i32.le_s + drop + i32.const 0 + drop + i32.const 1 + drop local.get $7 - if - local.get $4 - local.get $2 - i32.const 2 - i32.shl - i32.add - local.get $1 - f32.store - local.get $2 + i32.reinterpret_f32 + i32.const 0 + i32.eq + if (result i32) i32.const 1 - i32.add - local.set $2 - br $for-loop|0 + else + i32.const 4 + i32.const 8 + i32.eq + end + if + local.get $6 + local.get $5 + i32.lt_s + if + local.get $9 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.const 0 + local.get $5 + local.get $6 + i32.sub + i32.const 2 + i32.shl + memory.fill + end + br $~lib/util/bytes/FILL|inlined.0 + end + loop $for-loop|0 + local.get $6 + local.get $5 + i32.lt_s + local.set $11 + local.get $11 + if + local.get $9 + local.get $6 + i32.const 2 + i32.shl + i32.add + local.get $7 + f32.store + local.get $6 + i32.const 1 + i32.add + local.set $6 + br $for-loop|0 + end end end local.get $0 @@ -3501,7 +3539,7 @@ if i32.const 1616 i32.const 80 - i32.const 319 + i32.const 270 i32.const 18 call $~lib/builtins/abort unreachable @@ -3829,7 +3867,7 @@ if i32.const 1616 i32.const 80 - i32.const 378 + i32.const 329 i32.const 18 call $~lib/builtins/abort unreachable @@ -32246,7 +32284,7 @@ if i32.const 32 i32.const 80 - i32.const 272 + i32.const 223 i32.const 60 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array.release.wat b/tests/compiler/std/array.release.wat index 02a578b075..867ea349b6 100644 --- a/tests/compiler/std/array.release.wat +++ b/tests/compiler/std/array.release.wat @@ -2214,99 +2214,85 @@ ) (func $~lib/array/Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 - local.set $4 + local.set $5 local.get $0 i32.load offset=12 - local.set $0 + local.tee $4 + local.get $2 + i32.add + local.get $2 + local.get $4 + local.get $2 + local.get $4 + i32.lt_s + select local.get $2 i32.const 0 i32.lt_s - if (result i32) - local.get $0 - local.get $2 - i32.add - local.tee $2 - i32.const 0 - local.get $2 - i32.const 0 - i32.gt_s - select - else - local.get $2 - local.get $0 - local.get $0 - local.get $2 - i32.gt_s - select - end - local.set $2 + select + local.set $0 + local.get $3 + local.get $4 + i32.add + local.get $3 + local.get $4 + local.get $3 + local.get $4 + i32.lt_s + select local.get $3 i32.const 0 i32.lt_s - if (result i32) - local.get $0 - local.get $3 - i32.add - local.tee $0 - i32.const 0 - local.get $0 - i32.const 0 - i32.gt_s - select - else - local.get $3 - local.get $0 - local.get $0 - local.get $3 - i32.gt_s - select - end - local.set $0 - local.get $1 - i32.eqz - local.get $1 - i32.const -1 - i32.eq - i32.or - if - local.get $0 - local.get $2 - i32.gt_s + select + local.set $2 + block $~lib/util/bytes/FILL|inlined.0 + local.get $1 + i32.eqz + local.get $1 + i32.const -1 + i32.eq + i32.or if - local.get $4 - local.get $2 - i32.const 2 - i32.shl - i32.add - local.get $1 local.get $0 local.get $2 - i32.sub - i32.const 2 - i32.shl - memory.fill + i32.lt_s + if + local.get $5 + local.get $0 + i32.const 2 + i32.shl + i32.add + local.get $1 + local.get $2 + local.get $0 + i32.sub + i32.const 2 + i32.shl + memory.fill + end + br $~lib/util/bytes/FILL|inlined.0 end - return - end - loop $for-loop|0 - local.get $0 - local.get $2 - i32.gt_s - if - local.get $4 - local.get $2 - i32.const 2 - i32.shl - i32.add - local.get $1 - i32.store + loop $for-loop|0 + local.get $0 local.get $2 - i32.const 1 - i32.add - local.set $2 - br $for-loop|0 + i32.lt_s + if + local.get $5 + local.get $0 + i32.const 2 + i32.shl + i32.add + local.get $1 + i32.store + local.get $0 + i32.const 1 + i32.add + local.set $0 + br $for-loop|0 + end end end ) @@ -2378,96 +2364,82 @@ ) (func $~lib/array/Array#fill (param $0 i32) (param $1 f32) (param $2 i32) (param $3 i32) (local $4 i32) + (local $5 i32) local.get $0 i32.load offset=4 - local.set $4 + local.set $5 local.get $0 i32.load offset=12 - local.set $0 + local.tee $4 + local.get $2 + i32.add + local.get $2 + local.get $4 + local.get $2 + local.get $4 + i32.lt_s + select local.get $2 i32.const 0 i32.lt_s - if (result i32) - local.get $0 - local.get $2 - i32.add - local.tee $2 - i32.const 0 - local.get $2 - i32.const 0 - i32.gt_s - select - else - local.get $2 - local.get $0 - local.get $0 - local.get $2 - i32.gt_s - select - end - local.set $2 + select + local.set $0 + local.get $3 + local.get $4 + i32.add + local.get $3 + local.get $4 + local.get $3 + local.get $4 + i32.lt_s + select local.get $3 i32.const 0 i32.lt_s - if (result i32) - local.get $0 - local.get $3 - i32.add - local.tee $0 - i32.const 0 - local.get $0 - i32.const 0 - i32.gt_s - select - else - local.get $3 - local.get $0 - local.get $0 - local.get $3 - i32.gt_s - select - end - local.set $0 - local.get $1 - i32.reinterpret_f32 - i32.eqz - if - local.get $0 - local.get $2 - i32.gt_s + select + local.set $2 + block $~lib/util/bytes/FILL|inlined.0 + local.get $1 + i32.reinterpret_f32 + i32.eqz if - local.get $4 - local.get $2 - i32.const 2 - i32.shl - i32.add - i32.const 0 local.get $0 local.get $2 - i32.sub - i32.const 2 - i32.shl - memory.fill + i32.lt_s + if + local.get $5 + local.get $0 + i32.const 2 + i32.shl + i32.add + i32.const 0 + local.get $2 + local.get $0 + i32.sub + i32.const 2 + i32.shl + memory.fill + end + br $~lib/util/bytes/FILL|inlined.0 end - return - end - loop $for-loop|0 - local.get $0 - local.get $2 - i32.gt_s - if - local.get $4 - local.get $2 - i32.const 2 - i32.shl - i32.add - local.get $1 - f32.store + loop $for-loop|0 + local.get $0 local.get $2 - i32.const 1 - i32.add - local.set $2 - br $for-loop|0 + i32.lt_s + if + local.get $5 + local.get $0 + i32.const 2 + i32.shl + i32.add + local.get $1 + f32.store + local.get $0 + i32.const 1 + i32.add + local.set $0 + br $for-loop|0 + end end end ) @@ -2746,7 +2718,7 @@ if i32.const 2640 i32.const 1104 - i32.const 319 + i32.const 270 i32.const 18 call $~lib/builtins/abort unreachable @@ -13377,12 +13349,6 @@ i32.const 3 i32.sub local.tee $9 - i32.const 0 - local.get $9 - i32.const 0 - i32.gt_s - select - local.tee $9 i32.lt_s if local.get $8 @@ -13423,15 +13389,10 @@ local.tee $9 i32.const 2 i32.sub - local.tee $10 - i32.const 0 + local.set $10 + local.get $9 local.get $10 - i32.const 0 i32.gt_s - select - local.tee $10 - local.get $9 - i32.lt_s if local.get $8 local.get $10 @@ -15393,7 +15354,7 @@ if i32.const 2640 i32.const 1104 - i32.const 378 + i32.const 329 i32.const 18 call $~lib/builtins/abort unreachable @@ -27271,7 +27232,7 @@ if i32.const 1056 i32.const 1104 - i32.const 272 + i32.const 223 i32.const 60 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/staticarray.debug.wat b/tests/compiler/std/staticarray.debug.wat index 78be5d76e9..fb050b4154 100644 --- a/tests/compiler/std/staticarray.debug.wat +++ b/tests/compiler/std/staticarray.debug.wat @@ -2913,120 +2913,133 @@ (local $5 i32) (local $6 i32) (local $7 i32) - local.get $0 - local.set $4 - local.get $0 - call $~lib/staticarray/StaticArray#get:length - local.set $5 - local.get $2 - i32.const 0 - i32.lt_s - if (result i32) - local.get $5 - local.get $2 - i32.add - local.tee $6 - i32.const 0 - local.tee $7 - local.get $6 - local.get $7 - i32.gt_s - select - else + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + block $~lib/util/bytes/FILL|inlined.0 + local.get $0 + local.set $8 + local.get $0 + call $~lib/staticarray/StaticArray#get:length + local.set $7 + local.get $1 + local.set $6 local.get $2 - local.tee $7 - local.get $5 - local.tee $6 - local.get $7 - local.get $6 - i32.lt_s - select - end - local.set $2 - local.get $3 - i32.const 0 - i32.lt_s - if (result i32) - local.get $5 - local.get $3 - i32.add - local.tee $6 - i32.const 0 - local.tee $7 - local.get $6 - local.get $7 - i32.gt_s - select - else + local.set $5 local.get $3 - local.tee $7 + local.set $4 + local.get $8 + local.set $9 local.get $5 - local.tee $6 - local.get $7 - local.get $6 + i32.const 0 i32.lt_s - select - end - local.set $3 - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 0 - i32.const 1 - i32.le_s - drop - i32.const 1 - drop - local.get $1 - i32.const 0 - i32.eq - local.get $1 - i32.const -1 - i32.eq - i32.or - if - local.get $2 - local.get $3 + if (result i32) + local.get $7 + local.get $5 + i32.add + local.tee $10 + i32.const 0 + local.tee $11 + local.get $10 + local.get $11 + i32.gt_u + select + else + local.get $5 + local.tee $11 + local.get $7 + local.tee $10 + local.get $11 + local.get $10 + i32.lt_s + select + end + local.set $5 + local.get $4 + i32.const 0 i32.lt_s - if + if (result i32) + local.get $7 local.get $4 - local.get $2 - i32.const 2 - i32.shl i32.add - local.get $1 - local.get $3 - local.get $2 - i32.sub - i32.const 2 - i32.shl - memory.fill + local.tee $10 + i32.const 0 + local.tee $11 + local.get $10 + local.get $11 + i32.gt_u + select + else + local.get $4 + local.tee $11 + local.get $7 + local.tee $10 + local.get $11 + local.get $10 + i32.lt_s + select end - local.get $0 - return - end - loop $for-loop|0 - local.get $2 - local.get $3 - i32.lt_s - local.set $7 - local.get $7 + local.set $4 + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 0 + i32.const 1 + i32.le_s + drop + i32.const 1 + drop + local.get $6 + i32.const 0 + i32.eq + local.get $6 + i32.const -1 + i32.eq + i32.or if + local.get $5 local.get $4 - local.get $2 - i32.const 2 - i32.shl - i32.add - local.get $1 - i32.store - local.get $2 - i32.const 1 - i32.add - local.set $2 - br $for-loop|0 + i32.lt_s + if + local.get $8 + local.get $5 + i32.const 2 + i32.shl + i32.add + local.get $6 + local.get $4 + local.get $5 + i32.sub + i32.const 2 + i32.shl + memory.fill + end + br $~lib/util/bytes/FILL|inlined.0 + end + loop $for-loop|0 + local.get $5 + local.get $4 + i32.lt_s + local.set $11 + local.get $11 + if + local.get $8 + local.get $5 + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $for-loop|0 + end end end local.get $0 @@ -7722,7 +7735,7 @@ if i32.const 656 i32.const 128 - i32.const 261 + i32.const 212 i32.const 60 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/staticarray.release.wat b/tests/compiler/std/staticarray.release.wat index 4923e6b180..ba4d761237 100644 --- a/tests/compiler/std/staticarray.release.wat +++ b/tests/compiler/std/staticarray.release.wat @@ -6749,7 +6749,7 @@ if i32.const 1680 i32.const 1152 - i32.const 261 + i32.const 212 i32.const 60 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/typedarray.debug.wat b/tests/compiler/std/typedarray.debug.wat index 103567e5ee..839038fc80 100644 --- a/tests/compiler/std/typedarray.debug.wat +++ b/tests/compiler/std/typedarray.debug.wat @@ -3192,7 +3192,7 @@ if i32.const 336 i32.const 608 - i32.const 741 + i32.const 747 i32.const 64 call $~lib/builtins/abort unreachable @@ -3216,7 +3216,7 @@ if i32.const 336 i32.const 608 - i32.const 730 + i32.const 736 i32.const 64 call $~lib/builtins/abort unreachable @@ -3239,7 +3239,7 @@ if i32.const 336 i32.const 608 - i32.const 1446 + i32.const 1457 i32.const 64 call $~lib/builtins/abort unreachable @@ -4258,7 +4258,7 @@ if i32.const 336 i32.const 608 - i32.const 1435 + i32.const 1446 i32.const 64 call $~lib/builtins/abort unreachable @@ -4279,7 +4279,7 @@ if i32.const 336 i32.const 608 - i32.const 318 + i32.const 320 i32.const 45 call $~lib/builtins/abort unreachable @@ -4311,7 +4311,7 @@ if i32.const 336 i32.const 608 - i32.const 307 + i32.const 309 i32.const 45 call $~lib/builtins/abort unreachable @@ -4352,6 +4352,10 @@ (local $10 i32) (local $11 i32) local.get $0 + i32.load offset=4 + local.set $8 + local.get $0 + call $~lib/typedarray/Int8Array#get:length local.set $7 local.get $1 local.set $6 @@ -4359,17 +4363,13 @@ local.set $5 local.get $3 local.set $4 - local.get $7 - i32.load offset=4 - local.set $8 - local.get $7 - call $~lib/typedarray/Int8Array#get:length + local.get $8 local.set $9 local.get $5 i32.const 0 i32.lt_s if (result i32) - local.get $9 + local.get $7 local.get $5 i32.add local.tee $10 @@ -4377,12 +4377,12 @@ local.tee $11 local.get $10 local.get $11 - i32.gt_s + i32.gt_u select else local.get $5 local.tee $11 - local.get $9 + local.get $7 local.tee $10 local.get $11 local.get $10 @@ -4394,7 +4394,7 @@ i32.const 0 i32.lt_s if (result i32) - local.get $9 + local.get $7 local.get $4 i32.add local.tee $10 @@ -4402,12 +4402,12 @@ local.tee $11 local.get $10 local.get $11 - i32.gt_s + i32.gt_u select else local.get $4 local.tee $11 - local.get $9 + local.get $7 local.tee $10 local.get $11 local.get $10 @@ -4415,6 +4415,8 @@ select end local.set $4 + i32.const 0 + drop i32.const 1 i32.const 1 i32.eq @@ -4432,7 +4434,7 @@ i32.sub memory.fill end - local.get $7 + local.get $0 ) (func $~lib/rt/__newBuffer (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -4552,8 +4554,12 @@ (local $9 i32) (local $10 i32) (local $11 i32) - block $~lib/typedarray/FILL<~lib/typedarray/Int32Array,i32>|inlined.0 (result i32) + block $~lib/util/bytes/FILL|inlined.0 local.get $0 + i32.load offset=4 + local.set $8 + local.get $0 + call $~lib/typedarray/Int32Array#get:length local.set $7 local.get $1 local.set $6 @@ -4561,17 +4567,13 @@ local.set $5 local.get $3 local.set $4 - local.get $7 - i32.load offset=4 - local.set $8 - local.get $7 - call $~lib/typedarray/Int32Array#get:length + local.get $8 local.set $9 local.get $5 i32.const 0 i32.lt_s if (result i32) - local.get $9 + local.get $7 local.get $5 i32.add local.tee $10 @@ -4579,12 +4581,12 @@ local.tee $11 local.get $10 local.get $11 - i32.gt_s + i32.gt_u select else local.get $5 local.tee $11 - local.get $9 + local.get $7 local.tee $10 local.get $11 local.get $10 @@ -4596,7 +4598,7 @@ i32.const 0 i32.lt_s if (result i32) - local.get $9 + local.get $7 local.get $4 i32.add local.tee $10 @@ -4604,12 +4606,12 @@ local.tee $11 local.get $10 local.get $11 - i32.gt_s + i32.gt_u select else local.get $4 local.tee $11 - local.get $9 + local.get $7 local.tee $10 local.get $11 local.get $10 @@ -4617,6 +4619,8 @@ select end local.set $4 + i32.const 0 + drop i32.const 4 i32.const 1 i32.eq @@ -4652,8 +4656,7 @@ i32.shl memory.fill end - local.get $7 - br $~lib/typedarray/FILL<~lib/typedarray/Int32Array,i32>|inlined.0 + br $~lib/util/bytes/FILL|inlined.0 end loop $for-loop|0 local.get $5 @@ -4676,8 +4679,8 @@ br $for-loop|0 end end - local.get $7 end + local.get $0 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) local.get $0 @@ -4959,7 +4962,7 @@ if i32.const 336 i32.const 608 - i32.const 177 + i32.const 178 i32.const 45 call $~lib/builtins/abort unreachable @@ -5097,7 +5100,7 @@ if i32.const 336 i32.const 608 - i32.const 459 + i32.const 463 i32.const 64 call $~lib/builtins/abort unreachable @@ -5179,7 +5182,7 @@ if i32.const 336 i32.const 608 - i32.const 600 + i32.const 605 i32.const 64 call $~lib/builtins/abort unreachable @@ -5319,7 +5322,7 @@ if i32.const 336 i32.const 608 - i32.const 882 + i32.const 889 i32.const 64 call $~lib/builtins/abort unreachable @@ -5401,7 +5404,7 @@ if i32.const 336 i32.const 608 - i32.const 1023 + i32.const 1031 i32.const 64 call $~lib/builtins/abort unreachable @@ -5483,7 +5486,7 @@ if i32.const 336 i32.const 608 - i32.const 1164 + i32.const 1173 i32.const 64 call $~lib/builtins/abort unreachable @@ -5565,7 +5568,7 @@ if i32.const 336 i32.const 608 - i32.const 1305 + i32.const 1315 i32.const 64 call $~lib/builtins/abort unreachable @@ -5821,7 +5824,7 @@ if i32.const 336 i32.const 608 - i32.const 189 + i32.const 190 i32.const 33 call $~lib/builtins/abort unreachable @@ -5927,7 +5930,7 @@ if i32.const 336 i32.const 608 - i32.const 330 + i32.const 332 i32.const 33 call $~lib/builtins/abort unreachable @@ -6035,7 +6038,7 @@ if i32.const 336 i32.const 608 - i32.const 471 + i32.const 475 i32.const 33 call $~lib/builtins/abort unreachable @@ -6145,7 +6148,7 @@ if i32.const 336 i32.const 608 - i32.const 612 + i32.const 617 i32.const 33 call $~lib/builtins/abort unreachable @@ -6255,7 +6258,7 @@ if i32.const 336 i32.const 608 - i32.const 753 + i32.const 759 i32.const 33 call $~lib/builtins/abort unreachable @@ -6365,7 +6368,7 @@ if i32.const 336 i32.const 608 - i32.const 894 + i32.const 901 i32.const 33 call $~lib/builtins/abort unreachable @@ -6475,7 +6478,7 @@ if i32.const 336 i32.const 608 - i32.const 1035 + i32.const 1043 i32.const 33 call $~lib/builtins/abort unreachable @@ -6585,7 +6588,7 @@ if i32.const 336 i32.const 608 - i32.const 1176 + i32.const 1185 i32.const 33 call $~lib/builtins/abort unreachable @@ -6695,7 +6698,7 @@ if i32.const 336 i32.const 608 - i32.const 1317 + i32.const 1327 i32.const 33 call $~lib/builtins/abort unreachable @@ -6805,7 +6808,7 @@ if i32.const 336 i32.const 608 - i32.const 1458 + i32.const 1469 i32.const 33 call $~lib/builtins/abort unreachable @@ -7538,7 +7541,7 @@ if i32.const 336 i32.const 608 - i32.const 166 + i32.const 167 i32.const 45 call $~lib/builtins/abort unreachable @@ -7569,7 +7572,7 @@ if i32.const 336 i32.const 608 - i32.const 448 + i32.const 452 i32.const 64 call $~lib/builtins/abort unreachable @@ -7597,7 +7600,7 @@ if i32.const 336 i32.const 608 - i32.const 589 + i32.const 594 i32.const 64 call $~lib/builtins/abort unreachable @@ -7630,7 +7633,7 @@ if i32.const 336 i32.const 608 - i32.const 871 + i32.const 878 i32.const 64 call $~lib/builtins/abort unreachable @@ -7658,7 +7661,7 @@ if i32.const 336 i32.const 608 - i32.const 1012 + i32.const 1020 i32.const 64 call $~lib/builtins/abort unreachable @@ -7686,7 +7689,7 @@ if i32.const 336 i32.const 608 - i32.const 1153 + i32.const 1162 i32.const 64 call $~lib/builtins/abort unreachable @@ -7714,7 +7717,7 @@ if i32.const 336 i32.const 608 - i32.const 1294 + i32.const 1304 i32.const 64 call $~lib/builtins/abort unreachable @@ -23239,7 +23242,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -23254,7 +23257,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -23355,7 +23358,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -23370,7 +23373,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -23461,7 +23464,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -23476,7 +23479,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -23561,7 +23564,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -23576,7 +23579,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -23662,7 +23665,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -23677,7 +23680,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -23720,7 +23723,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -23735,7 +23738,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -23810,7 +23813,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -23825,7 +23828,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -23868,7 +23871,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -23883,7 +23886,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -23984,7 +23987,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -23999,7 +24002,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -24090,7 +24093,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -24105,7 +24108,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -24186,7 +24189,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -24201,7 +24204,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -24287,7 +24290,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -24302,7 +24305,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -24345,7 +24348,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -24360,7 +24363,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -24435,7 +24438,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -24450,7 +24453,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -24494,7 +24497,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -24509,7 +24512,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -24616,7 +24619,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -24631,7 +24634,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -24726,7 +24729,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -24741,7 +24744,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -24845,7 +24848,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -24860,7 +24863,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -24949,7 +24952,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -24964,7 +24967,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -25008,7 +25011,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -25023,7 +25026,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -25123,7 +25126,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -25138,7 +25141,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -25236,7 +25239,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -25251,7 +25254,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -25354,7 +25357,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -25369,7 +25372,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -25460,7 +25463,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -25475,7 +25478,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -25556,7 +25559,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -25571,7 +25574,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -25662,7 +25665,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -25677,7 +25680,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -25752,7 +25755,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -25767,7 +25770,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -25810,7 +25813,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -25825,7 +25828,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -25905,7 +25908,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -25920,7 +25923,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26023,7 +26026,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26038,7 +26041,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26129,7 +26132,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26144,7 +26147,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26225,7 +26228,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26240,7 +26243,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26331,7 +26334,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26346,7 +26349,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26421,7 +26424,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26436,7 +26439,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26479,7 +26482,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26494,7 +26497,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26569,7 +26572,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26584,7 +26587,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26646,7 +26649,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26661,7 +26664,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26752,7 +26755,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26767,7 +26770,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26848,7 +26851,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26863,7 +26866,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26954,7 +26957,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26969,7 +26972,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27049,7 +27052,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27064,7 +27067,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27144,7 +27147,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27159,7 +27162,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27234,7 +27237,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27249,7 +27252,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27315,7 +27318,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27330,7 +27333,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27421,7 +27424,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27436,7 +27439,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27517,7 +27520,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27532,7 +27535,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27623,7 +27626,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27638,7 +27641,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27718,7 +27721,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27733,7 +27736,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27813,7 +27816,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27828,7 +27831,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27908,7 +27911,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27923,7 +27926,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28026,7 +28029,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28041,7 +28044,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28127,7 +28130,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28142,7 +28145,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28186,7 +28189,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28201,7 +28204,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28292,7 +28295,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28307,7 +28310,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28387,7 +28390,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28402,7 +28405,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28482,7 +28485,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28497,7 +28500,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28577,7 +28580,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28592,7 +28595,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28695,7 +28698,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28710,7 +28713,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28796,7 +28799,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28811,7 +28814,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28855,7 +28858,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28870,7 +28873,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -28961,7 +28964,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -28976,7 +28979,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -29056,7 +29059,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -29071,7 +29074,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -29151,7 +29154,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -29166,7 +29169,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -29246,7 +29249,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -29261,7 +29264,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -29356,7 +29359,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -29371,7 +29374,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -29414,7 +29417,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -29429,7 +29432,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -29511,7 +29514,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -29526,7 +29529,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -29608,7 +29611,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -29623,7 +29626,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -29705,7 +29708,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -29720,7 +29723,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -29802,7 +29805,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -29817,7 +29820,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -29917,7 +29920,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -29932,7 +29935,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -30015,7 +30018,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -30030,7 +30033,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -30112,7 +30115,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -30127,7 +30130,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -30209,7 +30212,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -30224,7 +30227,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -30306,7 +30309,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -30321,7 +30324,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -30404,7 +30407,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -30419,7 +30422,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -30514,7 +30517,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -30529,7 +30532,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -30631,7 +30634,7 @@ if i32.const 336 i32.const 608 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -30646,7 +30649,7 @@ if i32.const 336 i32.const 608 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -68291,7 +68294,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -68310,7 +68313,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -68322,7 +68325,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -68340,7 +68343,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -68509,7 +68512,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -68528,7 +68531,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -68540,7 +68543,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -68558,7 +68561,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -68628,7 +68631,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -68647,7 +68650,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -68659,7 +68662,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -68677,7 +68680,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -68747,7 +68750,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -68766,7 +68769,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -68778,7 +68781,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -68796,7 +68799,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -68866,7 +68869,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -68885,7 +68888,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -68897,7 +68900,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -68915,7 +68918,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -68985,7 +68988,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -69004,7 +69007,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -69016,7 +69019,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -69034,7 +69037,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -69104,7 +69107,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -69123,7 +69126,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -69135,7 +69138,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -69153,7 +69156,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -69223,7 +69226,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -69242,7 +69245,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -69254,7 +69257,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -69272,7 +69275,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -69342,7 +69345,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -69361,7 +69364,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -69373,7 +69376,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -69391,7 +69394,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -69461,7 +69464,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -69480,7 +69483,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -69492,7 +69495,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -69510,7 +69513,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -69580,7 +69583,7 @@ if i32.const 336 i32.const 608 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -69599,7 +69602,7 @@ if i32.const 32 i32.const 608 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable @@ -69611,7 +69614,7 @@ else i32.const 32 i32.const 608 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -69629,7 +69632,7 @@ if i32.const 32 i32.const 608 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/typedarray.release.wat b/tests/compiler/std/typedarray.release.wat index 8dfa871504..a60389e0f2 100644 --- a/tests/compiler/std/typedarray.release.wat +++ b/tests/compiler/std/typedarray.release.wat @@ -2701,7 +2701,7 @@ if i32.const 1360 i32.const 1632 - i32.const 741 + i32.const 747 i32.const 64 call $~lib/builtins/abort unreachable @@ -2725,7 +2725,7 @@ if i32.const 1360 i32.const 1632 - i32.const 730 + i32.const 736 i32.const 64 call $~lib/builtins/abort unreachable @@ -2748,7 +2748,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1446 + i32.const 1457 i32.const 64 call $~lib/builtins/abort unreachable @@ -3610,7 +3610,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1435 + i32.const 1446 i32.const 64 call $~lib/builtins/abort unreachable @@ -3631,7 +3631,7 @@ if i32.const 1360 i32.const 1632 - i32.const 318 + i32.const 320 i32.const 45 call $~lib/builtins/abort unreachable @@ -3663,7 +3663,7 @@ if i32.const 1360 i32.const 1632 - i32.const 307 + i32.const 309 i32.const 45 call $~lib/builtins/abort unreachable @@ -3771,103 +3771,84 @@ (func $~lib/typedarray/Int32Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) - block $~lib/typedarray/FILL<~lib/typedarray/Int32Array,i32>|inlined.0 + local.get $0 + i32.load offset=4 + local.set $5 + local.get $0 + i32.load offset=8 + i32.const 2 + i32.shr_u + local.tee $4 + local.get $2 + i32.add + local.get $2 + local.get $4 + local.get $2 + local.get $4 + i32.lt_s + select + local.get $2 + i32.const 0 + i32.lt_s + select + local.set $0 + local.get $3 + local.get $4 + i32.add + local.get $3 + local.get $4 + local.get $3 + local.get $4 + i32.lt_s + select + local.get $3 + i32.const 0 + i32.lt_s + select + local.set $2 + block $~lib/util/bytes/FILL|inlined.0 local.get $1 - local.set $4 - local.get $0 - i32.load offset=4 - local.set $5 - local.get $0 - i32.load offset=8 - i32.const 2 - i32.shr_u - local.set $0 - local.get $2 - i32.const 0 - i32.lt_s - if (result i32) - local.get $0 - local.get $2 - i32.add - local.tee $1 - i32.const 0 - local.get $1 - i32.const 0 - i32.gt_s - select - else - local.get $2 - local.get $0 - local.get $0 - local.get $2 - i32.gt_s - select - end - local.set $1 - local.get $3 - i32.const 0 - i32.lt_s - if (result i32) - local.get $0 - local.get $3 - i32.add - local.tee $0 - i32.const 0 - local.get $0 - i32.const 0 - i32.gt_s - select - else - local.get $3 - local.get $0 - local.get $0 - local.get $3 - i32.gt_s - select - end - local.set $0 - local.get $4 i32.eqz - local.get $4 + local.get $1 i32.const -1 i32.eq i32.or if local.get $0 - local.get $1 - i32.gt_s + local.get $2 + i32.lt_s if local.get $5 - local.get $1 + local.get $0 i32.const 2 i32.shl i32.add - local.get $4 - local.get $0 local.get $1 + local.get $2 + local.get $0 i32.sub i32.const 2 i32.shl memory.fill end - br $~lib/typedarray/FILL<~lib/typedarray/Int32Array,i32>|inlined.0 + br $~lib/util/bytes/FILL|inlined.0 end loop $for-loop|0 local.get $0 - local.get $1 - i32.gt_s + local.get $2 + i32.lt_s if local.get $5 - local.get $1 + local.get $0 i32.const 2 i32.shl i32.add - local.get $4 - i32.store local.get $1 + i32.store + local.get $0 i32.const 1 i32.add - local.set $1 + local.set $0 br $for-loop|0 end end @@ -4056,7 +4037,7 @@ if i32.const 1360 i32.const 1632 - i32.const 177 + i32.const 178 i32.const 45 call $~lib/builtins/abort unreachable @@ -4078,7 +4059,7 @@ if i32.const 1360 i32.const 1632 - i32.const 459 + i32.const 463 i32.const 64 call $~lib/builtins/abort unreachable @@ -4102,7 +4083,7 @@ if i32.const 1360 i32.const 1632 - i32.const 600 + i32.const 605 i32.const 64 call $~lib/builtins/abort unreachable @@ -4126,7 +4107,7 @@ if i32.const 1360 i32.const 1632 - i32.const 882 + i32.const 889 i32.const 64 call $~lib/builtins/abort unreachable @@ -4150,7 +4131,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1023 + i32.const 1031 i32.const 64 call $~lib/builtins/abort unreachable @@ -4179,7 +4160,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1164 + i32.const 1173 i32.const 64 call $~lib/builtins/abort unreachable @@ -4203,7 +4184,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1305 + i32.const 1315 i32.const 64 call $~lib/builtins/abort unreachable @@ -4274,7 +4255,7 @@ if i32.const 1360 i32.const 1632 - i32.const 189 + i32.const 190 i32.const 33 call $~lib/builtins/abort unreachable @@ -4303,7 +4284,7 @@ if i32.const 1360 i32.const 1632 - i32.const 330 + i32.const 332 i32.const 33 call $~lib/builtins/abort unreachable @@ -4334,7 +4315,7 @@ if i32.const 1360 i32.const 1632 - i32.const 471 + i32.const 475 i32.const 33 call $~lib/builtins/abort unreachable @@ -4367,7 +4348,7 @@ if i32.const 1360 i32.const 1632 - i32.const 612 + i32.const 617 i32.const 33 call $~lib/builtins/abort unreachable @@ -4400,7 +4381,7 @@ if i32.const 1360 i32.const 1632 - i32.const 753 + i32.const 759 i32.const 33 call $~lib/builtins/abort unreachable @@ -4433,7 +4414,7 @@ if i32.const 1360 i32.const 1632 - i32.const 894 + i32.const 901 i32.const 33 call $~lib/builtins/abort unreachable @@ -4466,7 +4447,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1035 + i32.const 1043 i32.const 33 call $~lib/builtins/abort unreachable @@ -4499,7 +4480,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1176 + i32.const 1185 i32.const 33 call $~lib/builtins/abort unreachable @@ -4532,7 +4513,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1317 + i32.const 1327 i32.const 33 call $~lib/builtins/abort unreachable @@ -4565,7 +4546,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1458 + i32.const 1469 i32.const 33 call $~lib/builtins/abort unreachable @@ -4591,7 +4572,7 @@ if i32.const 1360 i32.const 1632 - i32.const 166 + i32.const 167 i32.const 45 call $~lib/builtins/abort unreachable @@ -4612,7 +4593,7 @@ if i32.const 1360 i32.const 1632 - i32.const 448 + i32.const 452 i32.const 64 call $~lib/builtins/abort unreachable @@ -4635,7 +4616,7 @@ if i32.const 1360 i32.const 1632 - i32.const 589 + i32.const 594 i32.const 64 call $~lib/builtins/abort unreachable @@ -4658,7 +4639,7 @@ if i32.const 1360 i32.const 1632 - i32.const 871 + i32.const 878 i32.const 64 call $~lib/builtins/abort unreachable @@ -4686,7 +4667,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1012 + i32.const 1020 i32.const 64 call $~lib/builtins/abort unreachable @@ -4709,7 +4690,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1153 + i32.const 1162 i32.const 64 call $~lib/builtins/abort unreachable @@ -4737,7 +4718,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1294 + i32.const 1304 i32.const 64 call $~lib/builtins/abort unreachable @@ -26389,7 +26370,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/builtins/abort unreachable @@ -26408,7 +26389,7 @@ else i32.const 1056 i32.const 1632 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/builtins/abort unreachable @@ -26423,7 +26404,7 @@ if i32.const 1056 i32.const 1632 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/builtins/abort unreachable @@ -26470,7 +26451,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26522,7 +26503,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26572,7 +26553,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26600,7 +26581,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26652,7 +26633,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26677,7 +26658,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26694,7 +26675,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26761,7 +26742,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -26778,7 +26759,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26846,7 +26827,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26902,7 +26883,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -26958,7 +26939,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27010,7 +26991,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27041,7 +27022,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27087,7 +27068,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1936 + i32.const 1898 i32.const 19 call $~lib/builtins/abort unreachable @@ -27104,7 +27085,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27138,7 +27119,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27194,7 +27175,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27248,7 +27229,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27307,7 +27288,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27360,7 +27341,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27414,7 +27395,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27442,7 +27423,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27496,7 +27477,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -27555,7 +27536,7 @@ if i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -38376,7 +38357,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -38757,7 +38738,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -39251,7 +39232,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -39645,7 +39626,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -40039,7 +40020,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -40436,7 +40417,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -40833,7 +40814,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -41228,7 +41209,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -41623,7 +41604,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -42114,7 +42095,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -42648,7 +42629,7 @@ end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable @@ -43233,12 +43214,6 @@ i32.const 3 i32.sub local.tee $2 - i32.const 0 - local.get $2 - i32.const 0 - i32.gt_s - select - local.tee $2 i32.lt_s if local.get $3 @@ -43280,12 +43255,6 @@ i32.const 2 i32.sub local.tee $2 - i32.const 0 - local.get $2 - i32.const 0 - i32.gt_s - select - local.tee $2 local.get $3 i32.lt_s if @@ -61851,14 +61820,14 @@ end i32.const 1056 i32.const 1632 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/builtins/abort unreachable end i32.const 1360 i32.const 1632 - i32.const 1937 + i32.const 1899 i32.const 47 call $~lib/builtins/abort unreachable From b09ed2f32867efe6086434a67ffd036193f5bb60 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Thu, 4 Aug 2022 22:50:45 +0300 Subject: [PATCH 2/6] upd rest fixtures --- tests/compiler/bindings/esm.debug.wat | 6 +++--- tests/compiler/bindings/esm.release.wat | 6 +++--- tests/compiler/bindings/raw.debug.wat | 6 +++--- tests/compiler/bindings/raw.release.wat | 6 +++--- tests/compiler/resolve-elementaccess.debug.wat | 8 ++++---- tests/compiler/resolve-elementaccess.release.wat | 8 ++++---- tests/compiler/std-wasi/crypto.debug.wat | 10 +++++----- tests/compiler/std-wasi/crypto.release.wat | 8 ++++---- tests/compiler/std/dataview.debug.wat | 2 +- tests/compiler/std/dataview.release.wat | 2 +- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/compiler/bindings/esm.debug.wat b/tests/compiler/bindings/esm.debug.wat index 6452a6ab74..56988bda2a 100644 --- a/tests/compiler/bindings/esm.debug.wat +++ b/tests/compiler/bindings/esm.debug.wat @@ -2348,7 +2348,7 @@ if i32.const 528 i32.const 768 - i32.const 448 + i32.const 452 i32.const 64 call $~lib/builtins/abort unreachable @@ -2371,7 +2371,7 @@ if i32.const 528 i32.const 768 - i32.const 1164 + i32.const 1173 i32.const 64 call $~lib/builtins/abort unreachable @@ -2395,7 +2395,7 @@ if i32.const 528 i32.const 768 - i32.const 1294 + i32.const 1304 i32.const 64 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/bindings/esm.release.wat b/tests/compiler/bindings/esm.release.wat index d46f201b4b..26b9adac80 100644 --- a/tests/compiler/bindings/esm.release.wat +++ b/tests/compiler/bindings/esm.release.wat @@ -1701,7 +1701,7 @@ if i32.const 1552 i32.const 1792 - i32.const 1164 + i32.const 1173 i32.const 64 call $~lib/builtins/abort unreachable @@ -2678,7 +2678,7 @@ if i32.const 1552 i32.const 1792 - i32.const 448 + i32.const 452 i32.const 64 call $~lib/builtins/abort unreachable @@ -2726,7 +2726,7 @@ if i32.const 1552 i32.const 1792 - i32.const 1294 + i32.const 1304 i32.const 64 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/bindings/raw.debug.wat b/tests/compiler/bindings/raw.debug.wat index e846c0e2db..7c23f4afbb 100644 --- a/tests/compiler/bindings/raw.debug.wat +++ b/tests/compiler/bindings/raw.debug.wat @@ -2351,7 +2351,7 @@ if i32.const 528 i32.const 768 - i32.const 448 + i32.const 452 i32.const 64 call $~lib/builtins/abort unreachable @@ -2374,7 +2374,7 @@ if i32.const 528 i32.const 768 - i32.const 1164 + i32.const 1173 i32.const 64 call $~lib/builtins/abort unreachable @@ -2398,7 +2398,7 @@ if i32.const 528 i32.const 768 - i32.const 1294 + i32.const 1304 i32.const 64 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/bindings/raw.release.wat b/tests/compiler/bindings/raw.release.wat index 92ff37695f..4dbc23bff9 100644 --- a/tests/compiler/bindings/raw.release.wat +++ b/tests/compiler/bindings/raw.release.wat @@ -1701,7 +1701,7 @@ if i32.const 1552 i32.const 1792 - i32.const 1164 + i32.const 1173 i32.const 64 call $~lib/builtins/abort unreachable @@ -2678,7 +2678,7 @@ if i32.const 1552 i32.const 1792 - i32.const 448 + i32.const 452 i32.const 64 call $~lib/builtins/abort unreachable @@ -2726,7 +2726,7 @@ if i32.const 1552 i32.const 1792 - i32.const 1294 + i32.const 1304 i32.const 64 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-elementaccess.debug.wat b/tests/compiler/resolve-elementaccess.debug.wat index 7f06fe5d04..3648f91ad1 100644 --- a/tests/compiler/resolve-elementaccess.debug.wat +++ b/tests/compiler/resolve-elementaccess.debug.wat @@ -2254,7 +2254,7 @@ if i32.const 336 i32.const 544 - i32.const 1305 + i32.const 1315 i32.const 64 call $~lib/builtins/abort unreachable @@ -2278,7 +2278,7 @@ if i32.const 336 i32.const 544 - i32.const 1294 + i32.const 1304 i32.const 64 call $~lib/builtins/abort unreachable @@ -3905,7 +3905,7 @@ if i32.const 336 i32.const 544 - i32.const 177 + i32.const 178 i32.const 45 call $~lib/builtins/abort unreachable @@ -3925,7 +3925,7 @@ if i32.const 336 i32.const 544 - i32.const 166 + i32.const 167 i32.const 45 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/resolve-elementaccess.release.wat b/tests/compiler/resolve-elementaccess.release.wat index 42b1535f70..0cb924d1b7 100644 --- a/tests/compiler/resolve-elementaccess.release.wat +++ b/tests/compiler/resolve-elementaccess.release.wat @@ -1582,7 +1582,7 @@ if i32.const 1360 i32.const 1568 - i32.const 1305 + i32.const 1315 i32.const 64 call $~lib/builtins/abort unreachable @@ -1606,7 +1606,7 @@ if i32.const 1360 i32.const 1568 - i32.const 1294 + i32.const 1304 i32.const 64 call $~lib/builtins/abort unreachable @@ -2970,7 +2970,7 @@ if i32.const 1360 i32.const 1568 - i32.const 177 + i32.const 178 i32.const 45 call $~lib/builtins/abort unreachable @@ -2990,7 +2990,7 @@ if i32.const 1360 i32.const 1568 - i32.const 166 + i32.const 167 i32.const 45 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std-wasi/crypto.debug.wat b/tests/compiler/std-wasi/crypto.debug.wat index d19ce0b32a..5d310e4418 100644 --- a/tests/compiler/std-wasi/crypto.debug.wat +++ b/tests/compiler/std-wasi/crypto.debug.wat @@ -4420,7 +4420,7 @@ if i32.const 448 i32.const 656 - i32.const 166 + i32.const 167 i32.const 45 call $~lib/wasi/index/abort unreachable @@ -4920,7 +4920,7 @@ if i32.const 448 i32.const 656 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/wasi/index/abort unreachable @@ -4939,7 +4939,7 @@ if i32.const 144 i32.const 656 - i32.const 1903 + i32.const 1865 i32.const 9 call $~lib/wasi/index/abort unreachable @@ -4951,7 +4951,7 @@ else i32.const 144 i32.const 656 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/wasi/index/abort unreachable @@ -4969,7 +4969,7 @@ if i32.const 144 i32.const 656 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/std-wasi/crypto.release.wat b/tests/compiler/std-wasi/crypto.release.wat index 752aa3c76f..65bd1f9059 100644 --- a/tests/compiler/std-wasi/crypto.release.wat +++ b/tests/compiler/std-wasi/crypto.release.wat @@ -3303,7 +3303,7 @@ if i32.const 1472 i32.const 1680 - i32.const 166 + i32.const 167 i32.const 45 call $~lib/wasi/index/abort unreachable @@ -3704,7 +3704,7 @@ if i32.const 1472 i32.const 1680 - i32.const 1898 + i32.const 1860 i32.const 5 call $~lib/wasi/index/abort unreachable @@ -3723,7 +3723,7 @@ else i32.const 1168 i32.const 1680 - i32.const 1907 + i32.const 1869 i32.const 7 call $~lib/wasi/index/abort unreachable @@ -3738,7 +3738,7 @@ if i32.const 1168 i32.const 1680 - i32.const 1912 + i32.const 1874 i32.const 7 call $~lib/wasi/index/abort unreachable diff --git a/tests/compiler/std/dataview.debug.wat b/tests/compiler/std/dataview.debug.wat index 2117355056..28ef36db72 100644 --- a/tests/compiler/std/dataview.debug.wat +++ b/tests/compiler/std/dataview.debug.wat @@ -2223,7 +2223,7 @@ if i32.const 336 i32.const 544 - i32.const 177 + i32.const 178 i32.const 45 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/dataview.release.wat b/tests/compiler/std/dataview.release.wat index 44177e1cae..98f533fd5b 100644 --- a/tests/compiler/std/dataview.release.wat +++ b/tests/compiler/std/dataview.release.wat @@ -1524,7 +1524,7 @@ if i32.const 1360 i32.const 1568 - i32.const 177 + i32.const 178 i32.const 45 call $~lib/builtins/abort unreachable From 121b784e2aa5216581a94c32a5830dcfb147324c Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Thu, 4 Aug 2022 23:08:03 +0300 Subject: [PATCH 3/6] force always using unsigned for value --- std/assembly/typedarray.ts | 8 ++++---- tests/compiler/std/typedarray.debug.wat | 4 ++-- tests/compiler/std/typedarray.release.wat | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/std/assembly/typedarray.ts b/std/assembly/typedarray.ts index c1eea946d7..d4670e4de7 100644 --- a/std/assembly/typedarray.ts +++ b/std/assembly/typedarray.ts @@ -204,7 +204,7 @@ export class Uint8Array extends ArrayBufferView { } fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { - FILL(this.dataStart, this.length, value, start, end); + FILL(this.dataStart, this.length, u8(value), start, end); return this; } @@ -489,7 +489,7 @@ export class Int16Array extends ArrayBufferView { } fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array { - FILL(this.dataStart, this.length, i16(value), start, end); + FILL(this.dataStart, this.length, u16(value), start, end); return this; } @@ -773,7 +773,7 @@ export class Int32Array extends ArrayBufferView { } fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array { - FILL(this.dataStart, this.length, value, start, end); + FILL(this.dataStart, this.length, u32(value), start, end); return this; } @@ -1057,7 +1057,7 @@ export class Int64Array extends ArrayBufferView { } fill(value: i64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array { - FILL(this.dataStart, this.length, value, start, end); + FILL(this.dataStart, this.length, u64(value), start, end); return this; } diff --git a/tests/compiler/std/typedarray.debug.wat b/tests/compiler/std/typedarray.debug.wat index 839038fc80..d23555bd29 100644 --- a/tests/compiler/std/typedarray.debug.wat +++ b/tests/compiler/std/typedarray.debug.wat @@ -4554,7 +4554,7 @@ (local $9 i32) (local $10 i32) (local $11 i32) - block $~lib/util/bytes/FILL|inlined.0 + block $~lib/util/bytes/FILL|inlined.0 local.get $0 i32.load offset=4 local.set $8 @@ -4656,7 +4656,7 @@ i32.shl memory.fill end - br $~lib/util/bytes/FILL|inlined.0 + br $~lib/util/bytes/FILL|inlined.0 end loop $for-loop|0 local.get $5 diff --git a/tests/compiler/std/typedarray.release.wat b/tests/compiler/std/typedarray.release.wat index a60389e0f2..fe7c8a0617 100644 --- a/tests/compiler/std/typedarray.release.wat +++ b/tests/compiler/std/typedarray.release.wat @@ -3806,7 +3806,7 @@ i32.lt_s select local.set $2 - block $~lib/util/bytes/FILL|inlined.0 + block $~lib/util/bytes/FILL|inlined.0 local.get $1 i32.eqz local.get $1 @@ -3831,7 +3831,7 @@ i32.shl memory.fill end - br $~lib/util/bytes/FILL|inlined.0 + br $~lib/util/bytes/FILL|inlined.0 end loop $for-loop|0 local.get $0 From ff7a83ed2dc188aefd3f6f3abd71ac72e083676d Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Thu, 4 Aug 2022 23:28:48 +0300 Subject: [PATCH 4/6] refactor. Don't inline FILL --- std/assembly/staticarray.ts | 2 +- std/assembly/typedarray.ts | 22 +- std/assembly/util/bytes.ts | 5 +- tests/compiler/std/array.debug.wat | 576 ++++++++++----------- tests/compiler/std/array.release.wat | 8 +- tests/compiler/std/staticarray.debug.wat | 229 ++++---- tests/compiler/std/staticarray.release.wat | 2 +- tests/compiler/std/typedarray.debug.wat | 316 ++++++----- tests/compiler/std/typedarray.release.wat | 4 +- 9 files changed, 551 insertions(+), 613 deletions(-) diff --git a/std/assembly/staticarray.ts b/std/assembly/staticarray.ts index 15fa5a0eb5..8faf3ec906 100644 --- a/std/assembly/staticarray.ts +++ b/std/assembly/staticarray.ts @@ -142,7 +142,7 @@ export class StaticArray { } fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { - FILL(changetype(this), this.length, value, start, end); + FILL(changetype(this), this.length, value, start, end, changetype(this)); return this; } diff --git a/std/assembly/typedarray.ts b/std/assembly/typedarray.ts index d4670e4de7..d17bb7566f 100644 --- a/std/assembly/typedarray.ts +++ b/std/assembly/typedarray.ts @@ -62,7 +62,7 @@ export class Int8Array extends ArrayBufferView { } fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { - FILL(this.dataStart, this.length, u8(value), start, end); + FILL(this.dataStart, this.length, u8(value), start, end, 0); return this; } @@ -204,7 +204,7 @@ export class Uint8Array extends ArrayBufferView { } fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { - FILL(this.dataStart, this.length, u8(value), start, end); + FILL(this.dataStart, this.length, u8(value), start, end, 0); return this; } @@ -347,7 +347,7 @@ export class Uint8ClampedArray extends ArrayBufferView { fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { value = ~(value >> 31) & (((255 - value) >> 31) | value); - FILL(this.dataStart, this.length, u8(value), start, end); + FILL(this.dataStart, this.length, u8(value), start, end, 0); return this; } @@ -489,7 +489,7 @@ export class Int16Array extends ArrayBufferView { } fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array { - FILL(this.dataStart, this.length, u16(value), start, end); + FILL(this.dataStart, this.length, u16(value), start, end, 0); return this; } @@ -631,7 +631,7 @@ export class Uint16Array extends ArrayBufferView { } fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array { - FILL(this.dataStart, this.length, u16(value), start, end); + FILL(this.dataStart, this.length, u16(value), start, end, 0); return this; } @@ -773,7 +773,7 @@ export class Int32Array extends ArrayBufferView { } fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array { - FILL(this.dataStart, this.length, u32(value), start, end); + FILL(this.dataStart, this.length, u32(value), start, end, 0); return this; } @@ -915,7 +915,7 @@ export class Uint32Array extends ArrayBufferView { } fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array { - FILL(this.dataStart, this.length, value, start, end); + FILL(this.dataStart, this.length, value, start, end, 0); return this; } @@ -1057,7 +1057,7 @@ export class Int64Array extends ArrayBufferView { } fill(value: i64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array { - FILL(this.dataStart, this.length, u64(value), start, end); + FILL(this.dataStart, this.length, u64(value), start, end, 0); return this; } @@ -1199,7 +1199,7 @@ export class Uint64Array extends ArrayBufferView { } fill(value: u64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array { - FILL(this.dataStart, this.length, value, start, end); + FILL(this.dataStart, this.length, value, start, end, 0); return this; } @@ -1341,7 +1341,7 @@ export class Float32Array extends ArrayBufferView { } fill(value: f32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array { - FILL(this.dataStart, this.length, value, start, end); + FILL(this.dataStart, this.length, value, start, end, 0); return this; } @@ -1483,7 +1483,7 @@ export class Float64Array extends ArrayBufferView { } fill(value: f64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array { - FILL(this.dataStart, this.length, value, start, end); + FILL(this.dataStart, this.length, value, start, end, 0); return this; } diff --git a/std/assembly/util/bytes.ts b/std/assembly/util/bytes.ts index 1ee375d6d5..1a01d54ac7 100644 --- a/std/assembly/util/bytes.ts +++ b/std/assembly/util/bytes.ts @@ -53,14 +53,13 @@ export function REVERSE(ptr: usize, len: usize): void { } } -// @ts-ignore -@inline export function FILL( +export function FILL( ptr: usize, len: usize, value: T, start: isize, end: isize, - self: usize = ptr + self: usize ): void { start = start < 0 ? max(len + start, 0) : min(start, len); end = end < 0 ? max(len + end, 0) : min(end, len); diff --git a/tests/compiler/std/array.debug.wat b/tests/compiler/std/array.debug.wat index b1221c186f..22c59bfa23 100644 --- a/tests/compiler/std/array.debug.wat +++ b/tests/compiler/std/array.debug.wat @@ -5,10 +5,10 @@ (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) + (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) (type $f32_f32_=>_i32 (func (param f32 f32) (result i32))) (type $f64_f64_=>_i32 (func (param f64 f64) (result i32))) (type $i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32))) - (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $none_=>_f64 (func (result f64))) @@ -23,6 +23,7 @@ (type $i32_f64_=>_i32 (func (param i32 f64) (result i32))) (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) (type $none_=>_i32 (func (result i32))) + (type $i32_i32_f32_i32_i32_i32_=>_none (func (param i32 i32 f32 i32 i32 i32))) (type $i32_f32_i32_i32_=>_i32 (func (param i32 f32 i32 i32) (result i32))) (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) (type $i64_=>_none (func (param i64))) @@ -2639,98 +2640,89 @@ end local.get $3 ) - (func $~lib/array/Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) - (local $4 i32) - (local $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (local $6 i32) (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - local.get $0 - i32.load offset=4 - local.set $9 - local.get $0 - i32.load offset=12 - local.set $8 - local.get $1 - local.set $7 - local.get $2 - local.set $6 local.get $3 - local.set $5 - local.get $0 - local.set $4 - local.get $6 i32.const 0 i32.lt_s if (result i32) - local.get $8 - local.get $6 + local.get $1 + local.get $3 i32.add - local.tee $10 + local.tee $6 i32.const 0 - local.tee $11 - local.get $10 - local.get $11 + local.tee $7 + local.get $6 + local.get $7 i32.gt_u select else + local.get $3 + local.tee $7 + local.get $1 + local.tee $6 + local.get $7 local.get $6 - local.tee $11 - local.get $8 - local.tee $10 - local.get $11 - local.get $10 i32.lt_s select end - local.set $6 - local.get $5 + local.set $3 + local.get $4 i32.const 0 i32.lt_s if (result i32) - local.get $8 - local.get $5 + local.get $1 + local.get $4 i32.add - local.tee $10 + local.tee $6 i32.const 0 - local.tee $11 - local.get $10 - local.get $11 + local.tee $7 + local.get $6 + local.get $7 i32.gt_u select else - local.get $5 - local.tee $11 - local.get $8 - local.tee $10 - local.get $11 - local.get $10 + local.get $4 + local.tee $7 + local.get $1 + local.tee $6 + local.get $7 + local.get $6 i32.lt_s select end - local.set $5 + local.set $4 i32.const 0 drop i32.const 1 i32.const 1 i32.eq drop - local.get $6 - local.get $5 + local.get $3 + local.get $4 i32.lt_s if - local.get $9 - local.get $6 + local.get $0 + local.get $3 i32.add - local.get $7 - local.get $5 - local.get $6 + local.get $2 + local.get $4 + local.get $3 i32.sub memory.fill end + ) + (func $~lib/array/Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + local.get $0 + i32.load offset=4 + local.get $0 + i32.load offset=12 + local.get $1 + local.get $2 + local.get $3 + local.get $0 + call $~lib/util/bytes/FILL local.get $0 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) @@ -2819,141 +2811,130 @@ end i32.const 1 ) - (func $~lib/array/Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) - (local $4 i32) - (local $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (local $6 i32) (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - block $~lib/util/bytes/FILL|inlined.0 - local.get $0 - i32.load offset=4 - local.set $9 - local.get $0 - i32.load offset=12 - local.set $8 + local.get $3 + i32.const 0 + i32.lt_s + if (result i32) local.get $1 - local.set $7 - local.get $2 - local.set $6 local.get $3 - local.set $5 - local.get $0 - local.set $4 - local.get $6 + i32.add + local.tee $6 i32.const 0 + local.tee $7 + local.get $6 + local.get $7 + i32.gt_u + select + else + local.get $3 + local.tee $7 + local.get $1 + local.tee $6 + local.get $7 + local.get $6 i32.lt_s - if (result i32) - local.get $8 - local.get $6 - i32.add - local.tee $10 - i32.const 0 - local.tee $11 - local.get $10 - local.get $11 - i32.gt_u - select - else - local.get $6 - local.tee $11 - local.get $8 - local.tee $10 - local.get $11 - local.get $10 - i32.lt_s - select - end - local.set $6 - local.get $5 + select + end + local.set $3 + local.get $4 + i32.const 0 + i32.lt_s + if (result i32) + local.get $1 + local.get $4 + i32.add + local.tee $6 i32.const 0 + local.tee $7 + local.get $6 + local.get $7 + i32.gt_u + select + else + local.get $4 + local.tee $7 + local.get $1 + local.tee $6 + local.get $7 + local.get $6 i32.lt_s - if (result i32) - local.get $8 - local.get $5 + select + end + local.set $4 + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 0 + i32.const 1 + i32.le_s + drop + i32.const 1 + drop + local.get $2 + i32.const 0 + i32.eq + local.get $2 + i32.const -1 + i32.eq + i32.or + if + local.get $3 + local.get $4 + i32.lt_s + if + local.get $0 + local.get $3 + i32.const 2 + i32.shl i32.add - local.tee $10 - i32.const 0 - local.tee $11 - local.get $10 - local.get $11 - i32.gt_u - select - else - local.get $5 - local.tee $11 - local.get $8 - local.tee $10 - local.get $11 - local.get $10 - i32.lt_s - select + local.get $2 + local.get $4 + local.get $3 + i32.sub + i32.const 2 + i32.shl + memory.fill end - local.set $5 - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 0 - i32.const 1 - i32.le_s - drop - i32.const 1 - drop - local.get $7 - i32.const 0 - i32.eq + return + end + loop $for-loop|0 + local.get $3 + local.get $4 + i32.lt_s + local.set $7 local.get $7 - i32.const -1 - i32.eq - i32.or if - local.get $6 - local.get $5 - i32.lt_s - if - local.get $9 - local.get $6 - i32.const 2 - i32.shl - i32.add - local.get $7 - local.get $5 - local.get $6 - i32.sub - i32.const 2 - i32.shl - memory.fill - end - br $~lib/util/bytes/FILL|inlined.0 - end - loop $for-loop|0 - local.get $6 - local.get $5 - i32.lt_s - local.set $11 - local.get $11 - if - local.get $9 - local.get $6 - i32.const 2 - i32.shl - i32.add - local.get $7 - i32.store - local.get $6 - i32.const 1 - i32.add - local.set $6 - br $for-loop|0 - end + local.get $0 + local.get $3 + i32.const 2 + i32.shl + i32.add + local.get $2 + i32.store + local.get $3 + i32.const 1 + i32.add + local.set $3 + br $for-loop|0 end end + ) + (func $~lib/array/Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + local.get $0 + i32.load offset=4 + local.get $0 + i32.load offset=12 + local.get $1 + local.get $2 + local.get $3 + local.get $0 + call $~lib/util/bytes/FILL local.get $0 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) @@ -3042,147 +3023,136 @@ end i32.const 1 ) - (func $~lib/array/Array#fill (param $0 i32) (param $1 f32) (param $2 i32) (param $3 i32) (result i32) - (local $4 i32) - (local $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 f32) (param $3 i32) (param $4 i32) (param $5 i32) (local $6 i32) - (local $7 f32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - block $~lib/util/bytes/FILL|inlined.0 - local.get $0 - i32.load offset=4 - local.set $9 - local.get $0 - i32.load offset=12 - local.set $8 + (local $7 i32) + local.get $3 + i32.const 0 + i32.lt_s + if (result i32) local.get $1 - local.set $7 - local.get $2 - local.set $6 local.get $3 - local.set $5 - local.get $0 - local.set $4 - local.get $6 + i32.add + local.tee $6 i32.const 0 + local.tee $7 + local.get $6 + local.get $7 + i32.gt_u + select + else + local.get $3 + local.tee $7 + local.get $1 + local.tee $6 + local.get $7 + local.get $6 i32.lt_s - if (result i32) - local.get $8 - local.get $6 - i32.add - local.tee $10 - i32.const 0 - local.tee $11 - local.get $10 - local.get $11 - i32.gt_u - select - else - local.get $6 - local.tee $11 - local.get $8 - local.tee $10 - local.get $11 - local.get $10 - i32.lt_s - select - end - local.set $6 - local.get $5 + select + end + local.set $3 + local.get $4 + i32.const 0 + i32.lt_s + if (result i32) + local.get $1 + local.get $4 + i32.add + local.tee $6 i32.const 0 + local.tee $7 + local.get $6 + local.get $7 + i32.gt_u + select + else + local.get $4 + local.tee $7 + local.get $1 + local.tee $6 + local.get $7 + local.get $6 i32.lt_s - if (result i32) - local.get $8 - local.get $5 + select + end + local.set $4 + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 0 + i32.const 1 + i32.le_s + drop + i32.const 0 + drop + i32.const 1 + drop + local.get $2 + i32.reinterpret_f32 + i32.const 0 + i32.eq + if (result i32) + i32.const 1 + else + i32.const 4 + i32.const 8 + i32.eq + end + if + local.get $3 + local.get $4 + i32.lt_s + if + local.get $0 + local.get $3 + i32.const 2 + i32.shl i32.add - local.tee $10 i32.const 0 - local.tee $11 - local.get $10 - local.get $11 - i32.gt_u - select - else - local.get $5 - local.tee $11 - local.get $8 - local.tee $10 - local.get $11 - local.get $10 - i32.lt_s - select + local.get $4 + local.get $3 + i32.sub + i32.const 2 + i32.shl + memory.fill end - local.set $5 - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 0 - i32.const 1 - i32.le_s - drop - i32.const 0 - drop - i32.const 1 - drop + return + end + loop $for-loop|0 + local.get $3 + local.get $4 + i32.lt_s + local.set $7 local.get $7 - i32.reinterpret_f32 - i32.const 0 - i32.eq - if (result i32) - i32.const 1 - else - i32.const 4 - i32.const 8 - i32.eq - end if - local.get $6 - local.get $5 - i32.lt_s - if - local.get $9 - local.get $6 - i32.const 2 - i32.shl - i32.add - i32.const 0 - local.get $5 - local.get $6 - i32.sub - i32.const 2 - i32.shl - memory.fill - end - br $~lib/util/bytes/FILL|inlined.0 - end - loop $for-loop|0 - local.get $6 - local.get $5 - i32.lt_s - local.set $11 - local.get $11 - if - local.get $9 - local.get $6 - i32.const 2 - i32.shl - i32.add - local.get $7 - f32.store - local.get $6 - i32.const 1 - i32.add - local.set $6 - br $for-loop|0 - end + local.get $0 + local.get $3 + i32.const 2 + i32.shl + i32.add + local.get $2 + f32.store + local.get $3 + i32.const 1 + i32.add + local.set $3 + br $for-loop|0 end end + ) + (func $~lib/array/Array#fill (param $0 i32) (param $1 f32) (param $2 i32) (param $3 i32) (result i32) + local.get $0 + i32.load offset=4 + local.get $0 + i32.load offset=12 + local.get $1 + local.get $2 + local.get $3 + local.get $0 + call $~lib/util/bytes/FILL local.get $0 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) diff --git a/tests/compiler/std/array.release.wat b/tests/compiler/std/array.release.wat index 867ea349b6..9353063b9e 100644 --- a/tests/compiler/std/array.release.wat +++ b/tests/compiler/std/array.release.wat @@ -2248,7 +2248,7 @@ i32.lt_s select local.set $2 - block $~lib/util/bytes/FILL|inlined.0 + block $__inlined_func$~lib/util/bytes/FILL local.get $1 i32.eqz local.get $1 @@ -2273,7 +2273,7 @@ i32.shl memory.fill end - br $~lib/util/bytes/FILL|inlined.0 + br $__inlined_func$~lib/util/bytes/FILL end loop $for-loop|0 local.get $0 @@ -2398,7 +2398,7 @@ i32.lt_s select local.set $2 - block $~lib/util/bytes/FILL|inlined.0 + block $__inlined_func$~lib/util/bytes/FILL local.get $1 i32.reinterpret_f32 i32.eqz @@ -2420,7 +2420,7 @@ i32.shl memory.fill end - br $~lib/util/bytes/FILL|inlined.0 + br $__inlined_func$~lib/util/bytes/FILL end loop $for-loop|0 local.get $0 diff --git a/tests/compiler/std/staticarray.debug.wat b/tests/compiler/std/staticarray.debug.wat index fb050b4154..054a0daee7 100644 --- a/tests/compiler/std/staticarray.debug.wat +++ b/tests/compiler/std/staticarray.debug.wat @@ -10,10 +10,10 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (type $i32_i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32 i32) (result i32))) + (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) (type $i32_f32_i32_=>_i32 (func (param i32 f32 i32) (result i32))) (type $i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32))) - (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (global $std/staticarray/arr1 i32 (i32.const 32)) (global $~lib/shared/runtime/Runtime.Stub i32 (i32.const 0)) @@ -2908,140 +2908,129 @@ call $~lib/util/string/joinStringArray return ) - (func $~lib/staticarray/StaticArray#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) - (local $4 i32) - (local $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (local $6 i32) (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - block $~lib/util/bytes/FILL|inlined.0 - local.get $0 - local.set $8 - local.get $0 - call $~lib/staticarray/StaticArray#get:length - local.set $7 + local.get $3 + i32.const 0 + i32.lt_s + if (result i32) local.get $1 - local.set $6 - local.get $2 - local.set $5 local.get $3 - local.set $4 - local.get $8 - local.set $9 - local.get $5 + i32.add + local.tee $6 i32.const 0 + local.tee $7 + local.get $6 + local.get $7 + i32.gt_u + select + else + local.get $3 + local.tee $7 + local.get $1 + local.tee $6 + local.get $7 + local.get $6 i32.lt_s - if (result i32) - local.get $7 - local.get $5 - i32.add - local.tee $10 - i32.const 0 - local.tee $11 - local.get $10 - local.get $11 - i32.gt_u - select - else - local.get $5 - local.tee $11 - local.get $7 - local.tee $10 - local.get $11 - local.get $10 - i32.lt_s - select - end - local.set $5 + select + end + local.set $3 + local.get $4 + i32.const 0 + i32.lt_s + if (result i32) + local.get $1 local.get $4 + i32.add + local.tee $6 i32.const 0 - i32.lt_s - if (result i32) - local.get $7 - local.get $4 - i32.add - local.tee $10 - i32.const 0 - local.tee $11 - local.get $10 - local.get $11 - i32.gt_u - select - else - local.get $4 - local.tee $11 - local.get $7 - local.tee $10 - local.get $11 - local.get $10 - i32.lt_s - select - end - local.set $4 - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 0 - i32.const 1 - i32.le_s - drop - i32.const 1 - drop + local.tee $7 local.get $6 - i32.const 0 - i32.eq + local.get $7 + i32.gt_u + select + else + local.get $4 + local.tee $7 + local.get $1 + local.tee $6 + local.get $7 local.get $6 - i32.const -1 - i32.eq - i32.or + i32.lt_s + select + end + local.set $4 + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 0 + i32.const 1 + i32.le_s + drop + i32.const 1 + drop + local.get $2 + i32.const 0 + i32.eq + local.get $2 + i32.const -1 + i32.eq + i32.or + if + local.get $3 + local.get $4 + i32.lt_s if - local.get $5 + local.get $0 + local.get $3 + i32.const 2 + i32.shl + i32.add + local.get $2 local.get $4 - i32.lt_s - if - local.get $8 - local.get $5 - i32.const 2 - i32.shl - i32.add - local.get $6 - local.get $4 - local.get $5 - i32.sub - i32.const 2 - i32.shl - memory.fill - end - br $~lib/util/bytes/FILL|inlined.0 + local.get $3 + i32.sub + i32.const 2 + i32.shl + memory.fill end - loop $for-loop|0 - local.get $5 - local.get $4 - i32.lt_s - local.set $11 - local.get $11 - if - local.get $8 - local.get $5 - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store - local.get $5 - i32.const 1 - i32.add - local.set $5 - br $for-loop|0 - end + return + end + loop $for-loop|0 + local.get $3 + local.get $4 + i32.lt_s + local.set $7 + local.get $7 + if + local.get $0 + local.get $3 + i32.const 2 + i32.shl + i32.add + local.get $2 + i32.store + local.get $3 + i32.const 1 + i32.add + local.set $3 + br $for-loop|0 end end + ) + (func $~lib/staticarray/StaticArray#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + local.get $0 + local.get $0 + call $~lib/staticarray/StaticArray#get:length + local.get $1 + local.get $2 + local.get $3 + local.get $0 + call $~lib/util/bytes/FILL local.get $0 ) (func $~lib/util/bytes/REVERSE (param $0 i32) (param $1 i32) diff --git a/tests/compiler/std/staticarray.release.wat b/tests/compiler/std/staticarray.release.wat index ba4d761237..db0acf8b53 100644 --- a/tests/compiler/std/staticarray.release.wat +++ b/tests/compiler/std/staticarray.release.wat @@ -5120,7 +5120,7 @@ local.tee $0 local.get $0 i32.const 3 - i32.gt_u + i32.gt_s select local.tee $2 i32.const 2 diff --git a/tests/compiler/std/typedarray.debug.wat b/tests/compiler/std/typedarray.debug.wat index d23555bd29..c0e391c15d 100644 --- a/tests/compiler/std/typedarray.debug.wat +++ b/tests/compiler/std/typedarray.debug.wat @@ -11,9 +11,9 @@ (type $f32_i32_i32_=>_i32 (func (param f32 i32 i32) (result i32))) (type $f64_i32_i32_=>_i32 (func (param f64 i32 i32) (result i32))) (type $f64_f64_=>_i32 (func (param f64 f64) (result i32))) + (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) (type $f32_f32_=>_i32 (func (param f32 f32) (result i32))) (type $i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32))) - (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) (type $i32_=>_none (func (param i32))) (type $i64_i64_i32_i32_=>_i64 (func (param i64 i64 i32 i32) (result i64))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) @@ -4342,75 +4342,55 @@ local.get $2 i32.store8 ) - (func $~lib/typedarray/Int8Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) - (local $4 i32) - (local $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (local $6 i32) (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - local.get $0 - i32.load offset=4 - local.set $8 - local.get $0 - call $~lib/typedarray/Int8Array#get:length - local.set $7 - local.get $1 - local.set $6 - local.get $2 - local.set $5 local.get $3 - local.set $4 - local.get $8 - local.set $9 - local.get $5 i32.const 0 i32.lt_s if (result i32) - local.get $7 - local.get $5 + local.get $1 + local.get $3 i32.add - local.tee $10 + local.tee $6 i32.const 0 - local.tee $11 - local.get $10 - local.get $11 + local.tee $7 + local.get $6 + local.get $7 i32.gt_u select else - local.get $5 - local.tee $11 + local.get $3 + local.tee $7 + local.get $1 + local.tee $6 local.get $7 - local.tee $10 - local.get $11 - local.get $10 + local.get $6 i32.lt_s select end - local.set $5 + local.set $3 local.get $4 i32.const 0 i32.lt_s if (result i32) - local.get $7 + local.get $1 local.get $4 i32.add - local.tee $10 + local.tee $6 i32.const 0 - local.tee $11 - local.get $10 - local.get $11 + local.tee $7 + local.get $6 + local.get $7 i32.gt_u select else local.get $4 - local.tee $11 + local.tee $7 + local.get $1 + local.tee $6 local.get $7 - local.tee $10 - local.get $11 - local.get $10 + local.get $6 i32.lt_s select end @@ -4421,19 +4401,30 @@ i32.const 1 i32.eq drop - local.get $5 + local.get $3 local.get $4 i32.lt_s if - local.get $8 - local.get $5 + local.get $0 + local.get $3 i32.add - local.get $6 + local.get $2 local.get $4 - local.get $5 + local.get $3 i32.sub memory.fill end + ) + (func $~lib/typedarray/Int8Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + local.get $0 + i32.load offset=4 + local.get $0 + call $~lib/typedarray/Int8Array#get:length + local.get $1 + local.get $2 + local.get $3 + i32.const 0 + call $~lib/util/bytes/FILL local.get $0 ) (func $~lib/rt/__newBuffer (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -4545,141 +4536,130 @@ end i32.const 1 ) - (func $~lib/typedarray/Int32Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) - (local $4 i32) - (local $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (local $6 i32) (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - block $~lib/util/bytes/FILL|inlined.0 - local.get $0 - i32.load offset=4 - local.set $8 - local.get $0 - call $~lib/typedarray/Int32Array#get:length - local.set $7 + local.get $3 + i32.const 0 + i32.lt_s + if (result i32) local.get $1 - local.set $6 - local.get $2 - local.set $5 local.get $3 - local.set $4 - local.get $8 - local.set $9 - local.get $5 + i32.add + local.tee $6 i32.const 0 + local.tee $7 + local.get $6 + local.get $7 + i32.gt_u + select + else + local.get $3 + local.tee $7 + local.get $1 + local.tee $6 + local.get $7 + local.get $6 i32.lt_s - if (result i32) - local.get $7 - local.get $5 - i32.add - local.tee $10 - i32.const 0 - local.tee $11 - local.get $10 - local.get $11 - i32.gt_u - select - else - local.get $5 - local.tee $11 - local.get $7 - local.tee $10 - local.get $11 - local.get $10 - i32.lt_s - select - end - local.set $5 + select + end + local.set $3 + local.get $4 + i32.const 0 + i32.lt_s + if (result i32) + local.get $1 local.get $4 + i32.add + local.tee $6 i32.const 0 - i32.lt_s - if (result i32) - local.get $7 - local.get $4 - i32.add - local.tee $10 - i32.const 0 - local.tee $11 - local.get $10 - local.get $11 - i32.gt_u - select - else - local.get $4 - local.tee $11 - local.get $7 - local.tee $10 - local.get $11 - local.get $10 - i32.lt_s - select - end - local.set $4 - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 0 - i32.const 1 - i32.le_s - drop - i32.const 1 - drop + local.tee $7 local.get $6 - i32.const 0 - i32.eq + local.get $7 + i32.gt_u + select + else + local.get $4 + local.tee $7 + local.get $1 + local.tee $6 + local.get $7 local.get $6 - i32.const -1 - i32.eq - i32.or + i32.lt_s + select + end + local.set $4 + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 0 + i32.const 1 + i32.le_s + drop + i32.const 1 + drop + local.get $2 + i32.const 0 + i32.eq + local.get $2 + i32.const -1 + i32.eq + i32.or + if + local.get $3 + local.get $4 + i32.lt_s if - local.get $5 + local.get $0 + local.get $3 + i32.const 2 + i32.shl + i32.add + local.get $2 local.get $4 - i32.lt_s - if - local.get $8 - local.get $5 - i32.const 2 - i32.shl - i32.add - local.get $6 - local.get $4 - local.get $5 - i32.sub - i32.const 2 - i32.shl - memory.fill - end - br $~lib/util/bytes/FILL|inlined.0 + local.get $3 + i32.sub + i32.const 2 + i32.shl + memory.fill end - loop $for-loop|0 - local.get $5 - local.get $4 - i32.lt_s - local.set $11 - local.get $11 - if - local.get $8 - local.get $5 - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store - local.get $5 - i32.const 1 - i32.add - local.set $5 - br $for-loop|0 - end + return + end + loop $for-loop|0 + local.get $3 + local.get $4 + i32.lt_s + local.set $7 + local.get $7 + if + local.get $0 + local.get $3 + i32.const 2 + i32.shl + i32.add + local.get $2 + i32.store + local.get $3 + i32.const 1 + i32.add + local.set $3 + br $for-loop|0 end end + ) + (func $~lib/typedarray/Int32Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + local.get $0 + i32.load offset=4 + local.get $0 + call $~lib/typedarray/Int32Array#get:length + local.get $1 + local.get $2 + local.get $3 + i32.const 0 + call $~lib/util/bytes/FILL local.get $0 ) (func $~lib/array/Array#get:length (param $0 i32) (result i32) diff --git a/tests/compiler/std/typedarray.release.wat b/tests/compiler/std/typedarray.release.wat index fe7c8a0617..62632863f6 100644 --- a/tests/compiler/std/typedarray.release.wat +++ b/tests/compiler/std/typedarray.release.wat @@ -3806,7 +3806,7 @@ i32.lt_s select local.set $2 - block $~lib/util/bytes/FILL|inlined.0 + block $__inlined_func$~lib/util/bytes/FILL local.get $1 i32.eqz local.get $1 @@ -3831,7 +3831,7 @@ i32.shl memory.fill end - br $~lib/util/bytes/FILL|inlined.0 + br $__inlined_func$~lib/util/bytes/FILL end loop $for-loop|0 local.get $0 From 95cfd812978dabb38ab886005031542d1f5ef4c5 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Fri, 5 Aug 2022 00:33:22 +0300 Subject: [PATCH 5/6] move __link out of loop and macro. Refactor --- std/assembly/array.ts | 7 +- std/assembly/staticarray.ts | 7 +- std/assembly/typedarray.ts | 54 +++++----- std/assembly/util/bytes.ts | 10 +- tests/compiler/std/array.debug.wat | 119 ++++++++++----------- tests/compiler/std/array.release.wat | 6 +- tests/compiler/std/staticarray.debug.wat | 43 ++++---- tests/compiler/std/staticarray.release.wat | 2 +- tests/compiler/std/typedarray.debug.wat | 70 ++++++------ 9 files changed, 156 insertions(+), 162 deletions(-) diff --git a/std/assembly/array.ts b/std/assembly/array.ts index e296cf0d21..a3da02fc8a 100644 --- a/std/assembly/array.ts +++ b/std/assembly/array.ts @@ -155,7 +155,12 @@ export class Array { } fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { - FILL(this.dataStart, this.length_, value, start, end, changetype(this)); + if (isManaged()) { + FILL(this.dataStart, this.length_, changetype(value), start, end); + __link(changetype(this), changetype(value), false); + } else { + FILL(this.dataStart, this.length_, value, start, end); + } return this; } diff --git a/std/assembly/staticarray.ts b/std/assembly/staticarray.ts index 8faf3ec906..5d0cfddc86 100644 --- a/std/assembly/staticarray.ts +++ b/std/assembly/staticarray.ts @@ -142,7 +142,12 @@ export class StaticArray { } fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { - FILL(changetype(this), this.length, value, start, end, changetype(this)); + if (isManaged()) { + FILL(changetype(this), this.length, changetype(value), start, end); + __link(changetype(this), changetype(value), false); + } else { + FILL(changetype(this), this.length, value, start, end); + } return this; } diff --git a/std/assembly/typedarray.ts b/std/assembly/typedarray.ts index d17bb7566f..5761a1b94d 100644 --- a/std/assembly/typedarray.ts +++ b/std/assembly/typedarray.ts @@ -62,7 +62,7 @@ export class Int8Array extends ArrayBufferView { } fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { - FILL(this.dataStart, this.length, u8(value), start, end, 0); + FILL(this.dataStart, this.length, u8(value), start, end); return this; } @@ -204,7 +204,7 @@ export class Uint8Array extends ArrayBufferView { } fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { - FILL(this.dataStart, this.length, u8(value), start, end, 0); + FILL(this.dataStart, this.length, u8(value), start, end); return this; } @@ -347,7 +347,7 @@ export class Uint8ClampedArray extends ArrayBufferView { fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { value = ~(value >> 31) & (((255 - value) >> 31) | value); - FILL(this.dataStart, this.length, u8(value), start, end, 0); + FILL(this.dataStart, this.length, u8(value), start, end); return this; } @@ -488,12 +488,12 @@ export class Int16Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array { - FILL(this.dataStart, this.length, u16(value), start, end, 0); + fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + FILL(this.dataStart, this.length, u16(value), start, end); return this; } - sort(comparator: (a: i16, b: i16) => i32 = COMPARATOR()): Int16Array { + sort(comparator: (a: i16, b: i16) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } @@ -630,12 +630,12 @@ export class Uint16Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array { - FILL(this.dataStart, this.length, u16(value), start, end, 0); + fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + FILL(this.dataStart, this.length, u16(value), start, end); return this; } - sort(comparator: (a: u16, b: u16) => i32 = COMPARATOR()): Uint16Array { + sort(comparator: (a: u16, b: u16) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } @@ -772,12 +772,12 @@ export class Int32Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array { - FILL(this.dataStart, this.length, u32(value), start, end, 0); + fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + FILL(this.dataStart, this.length, u32(value), start, end); return this; } - sort(comparator: (a: i32, b: i32) => i32 = COMPARATOR()): Int32Array { + sort(comparator: (a: i32, b: i32) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } @@ -914,12 +914,12 @@ export class Uint32Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array { - FILL(this.dataStart, this.length, value, start, end, 0); + fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + FILL(this.dataStart, this.length, value, start, end); return this; } - sort(comparator: (a: u32, b: u32) => i32 = COMPARATOR()): Uint32Array { + sort(comparator: (a: u32, b: u32) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } @@ -1056,12 +1056,12 @@ export class Int64Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: i64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array { - FILL(this.dataStart, this.length, u64(value), start, end, 0); + fill(value: i64, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + FILL(this.dataStart, this.length, u64(value), start, end); return this; } - sort(comparator: (a: i64, b: i64) => i32 = COMPARATOR()): Int64Array { + sort(comparator: (a: i64, b: i64) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } @@ -1198,12 +1198,12 @@ export class Uint64Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: u64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array { - FILL(this.dataStart, this.length, value, start, end, 0); + fill(value: u64, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + FILL(this.dataStart, this.length, value, start, end); return this; } - sort(comparator: (a: u64, b: u64) => i32 = COMPARATOR()): Uint64Array { + sort(comparator: (a: u64, b: u64) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } @@ -1340,12 +1340,12 @@ export class Float32Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: f32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array { - FILL(this.dataStart, this.length, value, start, end, 0); + fill(value: f32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + FILL(this.dataStart, this.length, value, start, end); return this; } - sort(comparator: (a: f32, b: f32) => i32 = COMPARATOR()): Float32Array { + sort(comparator: (a: f32, b: f32) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } @@ -1482,12 +1482,12 @@ export class Float64Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: f64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array { - FILL(this.dataStart, this.length, value, start, end, 0); + fill(value: f64, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + FILL(this.dataStart, this.length, value, start, end); return this; } - sort(comparator: (a: f64, b: f64) => i32 = COMPARATOR()): Float64Array { + sort(comparator: (a: f64, b: f64) => i32 = COMPARATOR()): this { SORT(this.dataStart, this.length, comparator); return this; } diff --git a/std/assembly/util/bytes.ts b/std/assembly/util/bytes.ts index 1a01d54ac7..016672149a 100644 --- a/std/assembly/util/bytes.ts +++ b/std/assembly/util/bytes.ts @@ -58,18 +58,12 @@ export function FILL( len: usize, value: T, start: isize, - end: isize, - self: usize + end: isize ): void { start = start < 0 ? max(len + start, 0) : min(start, len); end = end < 0 ? max(len + end, 0) : min(end, len); - if (isManaged()) { - for (; start < end; ++start) { - store(ptr + (start << alignof()), changetype(value)); - __link(self, changetype(value), true); - } - } else if (sizeof() == 1) { + if (sizeof() == 1) { if (start < end) { memory.fill( ptr + start, diff --git a/tests/compiler/std/array.debug.wat b/tests/compiler/std/array.debug.wat index 22c59bfa23..7ad6c5c890 100644 --- a/tests/compiler/std/array.debug.wat +++ b/tests/compiler/std/array.debug.wat @@ -5,10 +5,10 @@ (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) - (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) + (type $i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32))) (type $f32_f32_=>_i32 (func (param f32 f32) (result i32))) (type $f64_f64_=>_i32 (func (param f64 f64) (result i32))) - (type $i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32))) + (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) (type $none_=>_f64 (func (result f64))) @@ -23,7 +23,7 @@ (type $i32_f64_=>_i32 (func (param i32 f64) (result i32))) (type $i32_i64_=>_i32 (func (param i32 i64) (result i32))) (type $none_=>_i32 (func (result i32))) - (type $i32_i32_f32_i32_i32_i32_=>_none (func (param i32 i32 f32 i32 i32 i32))) + (type $i32_i32_f32_i32_i32_=>_none (func (param i32 i32 f32 i32 i32))) (type $i32_f32_i32_i32_=>_i32 (func (param i32 f32 i32 i32) (result i32))) (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) (type $i64_=>_none (func (param i64))) @@ -2640,9 +2640,9 @@ end local.get $3 ) - (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (local $5 i32) (local $6 i32) - (local $7 i32) local.get $3 i32.const 0 i32.lt_s @@ -2650,20 +2650,20 @@ local.get $1 local.get $3 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $3 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end @@ -2675,26 +2675,24 @@ local.get $1 local.get $4 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $4 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end local.set $4 - i32.const 0 - drop i32.const 1 i32.const 1 i32.eq @@ -2714,6 +2712,8 @@ end ) (func $~lib/array/Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + i32.const 0 + drop local.get $0 i32.load offset=4 local.get $0 @@ -2721,7 +2721,6 @@ local.get $1 local.get $2 local.get $3 - local.get $0 call $~lib/util/bytes/FILL local.get $0 ) @@ -2811,9 +2810,9 @@ end i32.const 1 ) - (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (local $5 i32) (local $6 i32) - (local $7 i32) local.get $3 i32.const 0 i32.lt_s @@ -2821,20 +2820,20 @@ local.get $1 local.get $3 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $3 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end @@ -2846,26 +2845,24 @@ local.get $1 local.get $4 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $4 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end local.set $4 - i32.const 0 - drop i32.const 4 i32.const 1 i32.eq @@ -2907,8 +2904,8 @@ local.get $3 local.get $4 i32.lt_s - local.set $7 - local.get $7 + local.set $6 + local.get $6 if local.get $0 local.get $3 @@ -2926,6 +2923,8 @@ end ) (func $~lib/array/Array#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + i32.const 0 + drop local.get $0 i32.load offset=4 local.get $0 @@ -2933,7 +2932,6 @@ local.get $1 local.get $2 local.get $3 - local.get $0 call $~lib/util/bytes/FILL local.get $0 ) @@ -3023,9 +3021,9 @@ end i32.const 1 ) - (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 f32) (param $3 i32) (param $4 i32) (param $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 f32) (param $3 i32) (param $4 i32) + (local $5 i32) (local $6 i32) - (local $7 i32) local.get $3 i32.const 0 i32.lt_s @@ -3033,20 +3031,20 @@ local.get $1 local.get $3 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $3 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end @@ -3058,26 +3056,24 @@ local.get $1 local.get $4 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $4 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end local.set $4 - i32.const 0 - drop i32.const 4 i32.const 1 i32.eq @@ -3125,8 +3121,8 @@ local.get $3 local.get $4 i32.lt_s - local.set $7 - local.get $7 + local.set $6 + local.get $6 if local.get $0 local.get $3 @@ -3144,6 +3140,8 @@ end ) (func $~lib/array/Array#fill (param $0 i32) (param $1 f32) (param $2 i32) (param $3 i32) (result i32) + i32.const 0 + drop local.get $0 i32.load offset=4 local.get $0 @@ -3151,7 +3149,6 @@ local.get $1 local.get $2 local.get $3 - local.get $0 call $~lib/util/bytes/FILL local.get $0 ) @@ -3509,7 +3506,7 @@ if i32.const 1616 i32.const 80 - i32.const 270 + i32.const 275 i32.const 18 call $~lib/builtins/abort unreachable @@ -3837,7 +3834,7 @@ if i32.const 1616 i32.const 80 - i32.const 329 + i32.const 334 i32.const 18 call $~lib/builtins/abort unreachable @@ -32254,7 +32251,7 @@ if i32.const 32 i32.const 80 - i32.const 223 + i32.const 228 i32.const 60 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/array.release.wat b/tests/compiler/std/array.release.wat index 9353063b9e..161da1ab52 100644 --- a/tests/compiler/std/array.release.wat +++ b/tests/compiler/std/array.release.wat @@ -2718,7 +2718,7 @@ if i32.const 2640 i32.const 1104 - i32.const 270 + i32.const 275 i32.const 18 call $~lib/builtins/abort unreachable @@ -15354,7 +15354,7 @@ if i32.const 2640 i32.const 1104 - i32.const 329 + i32.const 334 i32.const 18 call $~lib/builtins/abort unreachable @@ -27232,7 +27232,7 @@ if i32.const 1056 i32.const 1104 - i32.const 223 + i32.const 228 i32.const 60 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/staticarray.debug.wat b/tests/compiler/std/staticarray.debug.wat index 054a0daee7..a1d25ce99a 100644 --- a/tests/compiler/std/staticarray.debug.wat +++ b/tests/compiler/std/staticarray.debug.wat @@ -10,10 +10,10 @@ (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $none_=>_i32 (func (result i32))) (type $i32_i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32 i32) (result i32))) - (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) + (type $i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32))) (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) (type $i32_f32_i32_=>_i32 (func (param i32 f32 i32) (result i32))) - (type $i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32))) + (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (global $std/staticarray/arr1 i32 (i32.const 32)) (global $~lib/shared/runtime/Runtime.Stub i32 (i32.const 0)) @@ -2908,9 +2908,9 @@ call $~lib/util/string/joinStringArray return ) - (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (local $5 i32) (local $6 i32) - (local $7 i32) local.get $3 i32.const 0 i32.lt_s @@ -2918,20 +2918,20 @@ local.get $1 local.get $3 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $3 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end @@ -2943,26 +2943,24 @@ local.get $1 local.get $4 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $4 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end local.set $4 - i32.const 0 - drop i32.const 4 i32.const 1 i32.eq @@ -3004,8 +3002,8 @@ local.get $3 local.get $4 i32.lt_s - local.set $7 - local.get $7 + local.set $6 + local.get $6 if local.get $0 local.get $3 @@ -3023,13 +3021,14 @@ end ) (func $~lib/staticarray/StaticArray#fill (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + i32.const 0 + drop local.get $0 local.get $0 call $~lib/staticarray/StaticArray#get:length local.get $1 local.get $2 local.get $3 - local.get $0 call $~lib/util/bytes/FILL local.get $0 ) @@ -7724,7 +7723,7 @@ if i32.const 656 i32.const 128 - i32.const 212 + i32.const 217 i32.const 60 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/staticarray.release.wat b/tests/compiler/std/staticarray.release.wat index db0acf8b53..3b7f3a0f7f 100644 --- a/tests/compiler/std/staticarray.release.wat +++ b/tests/compiler/std/staticarray.release.wat @@ -6749,7 +6749,7 @@ if i32.const 1680 i32.const 1152 - i32.const 212 + i32.const 217 i32.const 60 call $~lib/builtins/abort unreachable diff --git a/tests/compiler/std/typedarray.debug.wat b/tests/compiler/std/typedarray.debug.wat index c0e391c15d..8e417660d5 100644 --- a/tests/compiler/std/typedarray.debug.wat +++ b/tests/compiler/std/typedarray.debug.wat @@ -10,10 +10,10 @@ (type $i64_i64_=>_i32 (func (param i64 i64) (result i32))) (type $f32_i32_i32_=>_i32 (func (param f32 i32 i32) (result i32))) (type $f64_i32_i32_=>_i32 (func (param f64 i32 i32) (result i32))) + (type $i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32))) (type $f64_f64_=>_i32 (func (param f64 f64) (result i32))) - (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) (type $f32_f32_=>_i32 (func (param f32 f32) (result i32))) - (type $i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32))) + (type $i32_i32_i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32 i32 i32))) (type $i32_=>_none (func (param i32))) (type $i64_i64_i32_i32_=>_i64 (func (param i64 i64 i32 i32) (result i64))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) @@ -4342,9 +4342,9 @@ local.get $2 i32.store8 ) - (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (local $5 i32) (local $6 i32) - (local $7 i32) local.get $3 i32.const 0 i32.lt_s @@ -4352,20 +4352,20 @@ local.get $1 local.get $3 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $3 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end @@ -4377,26 +4377,24 @@ local.get $1 local.get $4 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $4 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end local.set $4 - i32.const 0 - drop i32.const 1 i32.const 1 i32.eq @@ -4423,7 +4421,6 @@ local.get $1 local.get $2 local.get $3 - i32.const 0 call $~lib/util/bytes/FILL local.get $0 ) @@ -4536,9 +4533,9 @@ end i32.const 1 ) - (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) + (func $~lib/util/bytes/FILL (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (local $5 i32) (local $6 i32) - (local $7 i32) local.get $3 i32.const 0 i32.lt_s @@ -4546,20 +4543,20 @@ local.get $1 local.get $3 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $3 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end @@ -4571,26 +4568,24 @@ local.get $1 local.get $4 i32.add - local.tee $6 + local.tee $5 i32.const 0 - local.tee $7 + local.tee $6 + local.get $5 local.get $6 - local.get $7 i32.gt_u select else local.get $4 - local.tee $7 - local.get $1 local.tee $6 - local.get $7 + local.get $1 + local.tee $5 local.get $6 + local.get $5 i32.lt_s select end local.set $4 - i32.const 0 - drop i32.const 4 i32.const 1 i32.eq @@ -4632,8 +4627,8 @@ local.get $3 local.get $4 i32.lt_s - local.set $7 - local.get $7 + local.set $6 + local.get $6 if local.get $0 local.get $3 @@ -4658,7 +4653,6 @@ local.get $1 local.get $2 local.get $3 - i32.const 0 call $~lib/util/bytes/FILL local.get $0 ) From af3b88f5e51e0c02d7c79550855b21e03a1012be Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Sat, 6 Aug 2022 13:03:24 +0300 Subject: [PATCH 6/6] don't use `this` return type --- std/assembly/array.ts | 8 ++--- std/assembly/staticarray.ts | 8 ++--- std/assembly/typedarray.ts | 66 ++++++++++++++++++------------------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/std/assembly/array.ts b/std/assembly/array.ts index a3da02fc8a..a020fdb775 100644 --- a/std/assembly/array.ts +++ b/std/assembly/array.ts @@ -154,7 +154,7 @@ export class Array { return value; } - fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): Array { if (isManaged()) { FILL(this.dataStart, this.length_, changetype(value), start, end); __link(changetype(this), changetype(value), false); @@ -251,7 +251,7 @@ export class Array { return out; } - copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): this { + copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): Array { var ptr = this.dataStart; var len = this.length_; @@ -422,12 +422,12 @@ export class Array { return result; } - reverse(): this { + reverse(): Array { REVERSE(this.dataStart, this.length_); return this; } - sort(comparator: (a: T, b: T) => i32 = COMPARATOR()): this { + sort(comparator: (a: T, b: T) => i32 = COMPARATOR()): Array { SORT(this.dataStart, this.length_, comparator); return this; } diff --git a/std/assembly/staticarray.ts b/std/assembly/staticarray.ts index 5d0cfddc86..6820cbf726 100644 --- a/std/assembly/staticarray.ts +++ b/std/assembly/staticarray.ts @@ -141,7 +141,7 @@ export class StaticArray { } } - fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: T, start: i32 = 0, end: i32 = i32.MAX_VALUE): StaticArray { if (isManaged()) { FILL(changetype(this), this.length, changetype(value), start, end); __link(changetype(this), changetype(value), false); @@ -151,7 +151,7 @@ export class StaticArray { return this; } - copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): this { + copyWithin(target: i32, start: i32, end: i32 = i32.MAX_VALUE): StaticArray { var ptr = changetype(this); var len = this.length; @@ -342,7 +342,7 @@ export class StaticArray { return false; } - sort(comparator: (a: T, b: T) => i32 = COMPARATOR()): this { + sort(comparator: (a: T, b: T) => i32 = COMPARATOR()): StaticArray { SORT(changetype(this), this.length, comparator); return this; } @@ -359,7 +359,7 @@ export class StaticArray { return unreachable(); } - reverse(): this { + reverse(): StaticArray { REVERSE(changetype(this), this.length); return this; } diff --git a/std/assembly/typedarray.ts b/std/assembly/typedarray.ts index 5761a1b94d..c5a90819f5 100644 --- a/std/assembly/typedarray.ts +++ b/std/assembly/typedarray.ts @@ -61,12 +61,12 @@ export class Int8Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int8Array { FILL(this.dataStart, this.length, u8(value), start, end); return this; } - sort(comparator: (a: i8, b: i8) => i32 = COMPARATOR()): this { + sort(comparator: (a: i8, b: i8) => i32 = COMPARATOR()): Int8Array { SORT(this.dataStart, this.length, comparator); return this; } @@ -125,7 +125,7 @@ export class Int8Array extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Int8Array { REVERSE(this.dataStart, this.length); return this; } @@ -203,12 +203,12 @@ export class Uint8Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8Array { FILL(this.dataStart, this.length, u8(value), start, end); return this; } - sort(comparator: (a: u8, b: u8) => i32 = COMPARATOR()): this { + sort(comparator: (a: u8, b: u8) => i32 = COMPARATOR()): Uint8Array { SORT(this.dataStart, this.length, comparator); return this; } @@ -267,7 +267,7 @@ export class Uint8Array extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Uint8Array { REVERSE(this.dataStart, this.length); return this; } @@ -345,13 +345,13 @@ export class Uint8ClampedArray extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint8ClampedArray { value = ~(value >> 31) & (((255 - value) >> 31) | value); FILL(this.dataStart, this.length, u8(value), start, end); return this; } - sort(comparator: (a: u8, b: u8) => i32 = COMPARATOR()): this { + sort(comparator: (a: u8, b: u8) => i32 = COMPARATOR()): Uint8ClampedArray { SORT(this.dataStart, this.length, comparator); return this; } @@ -410,7 +410,7 @@ export class Uint8ClampedArray extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Uint8ClampedArray { REVERSE(this.dataStart, this.length); return this; } @@ -488,12 +488,12 @@ export class Int16Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int16Array { FILL(this.dataStart, this.length, u16(value), start, end); return this; } - sort(comparator: (a: i16, b: i16) => i32 = COMPARATOR()): this { + sort(comparator: (a: i16, b: i16) => i32 = COMPARATOR()): Int16Array { SORT(this.dataStart, this.length, comparator); return this; } @@ -552,7 +552,7 @@ export class Int16Array extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Int16Array { REVERSE(this.dataStart, this.length); return this; } @@ -630,12 +630,12 @@ export class Uint16Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint16Array { FILL(this.dataStart, this.length, u16(value), start, end); return this; } - sort(comparator: (a: u16, b: u16) => i32 = COMPARATOR()): this { + sort(comparator: (a: u16, b: u16) => i32 = COMPARATOR()): Uint16Array { SORT(this.dataStart, this.length, comparator); return this; } @@ -694,7 +694,7 @@ export class Uint16Array extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Uint16Array { REVERSE(this.dataStart, this.length); return this; } @@ -772,12 +772,12 @@ export class Int32Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: i32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int32Array { FILL(this.dataStart, this.length, u32(value), start, end); return this; } - sort(comparator: (a: i32, b: i32) => i32 = COMPARATOR()): this { + sort(comparator: (a: i32, b: i32) => i32 = COMPARATOR()): Int32Array { SORT(this.dataStart, this.length, comparator); return this; } @@ -836,7 +836,7 @@ export class Int32Array extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Int32Array { REVERSE(this.dataStart, this.length); return this; } @@ -914,12 +914,12 @@ export class Uint32Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: u32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint32Array { FILL(this.dataStart, this.length, value, start, end); return this; } - sort(comparator: (a: u32, b: u32) => i32 = COMPARATOR()): this { + sort(comparator: (a: u32, b: u32) => i32 = COMPARATOR()): Uint32Array { SORT(this.dataStart, this.length, comparator); return this; } @@ -978,7 +978,7 @@ export class Uint32Array extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Uint32Array { REVERSE(this.dataStart, this.length); return this; } @@ -1056,12 +1056,12 @@ export class Int64Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: i64, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: i64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Int64Array { FILL(this.dataStart, this.length, u64(value), start, end); return this; } - sort(comparator: (a: i64, b: i64) => i32 = COMPARATOR()): this { + sort(comparator: (a: i64, b: i64) => i32 = COMPARATOR()): Int64Array { SORT(this.dataStart, this.length, comparator); return this; } @@ -1120,7 +1120,7 @@ export class Int64Array extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Int64Array { REVERSE(this.dataStart, this.length); return this; } @@ -1198,12 +1198,12 @@ export class Uint64Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: u64, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: u64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Uint64Array { FILL(this.dataStart, this.length, value, start, end); return this; } - sort(comparator: (a: u64, b: u64) => i32 = COMPARATOR()): this { + sort(comparator: (a: u64, b: u64) => i32 = COMPARATOR()): Uint64Array { SORT(this.dataStart, this.length, comparator); return this; } @@ -1262,7 +1262,7 @@ export class Uint64Array extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Uint64Array { REVERSE(this.dataStart, this.length); return this; } @@ -1340,12 +1340,12 @@ export class Float32Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: f32, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: f32, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float32Array { FILL(this.dataStart, this.length, value, start, end); return this; } - sort(comparator: (a: f32, b: f32) => i32 = COMPARATOR()): this { + sort(comparator: (a: f32, b: f32) => i32 = COMPARATOR()): Float32Array { SORT(this.dataStart, this.length, comparator); return this; } @@ -1404,7 +1404,7 @@ export class Float32Array extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Float32Array { REVERSE(this.dataStart, this.length); return this; } @@ -1482,12 +1482,12 @@ export class Float64Array extends ArrayBufferView { return LAST_INDEX_OF(this, searchElement, fromIndex); } - fill(value: f64, start: i32 = 0, end: i32 = i32.MAX_VALUE): this { + fill(value: f64, start: i32 = 0, end: i32 = i32.MAX_VALUE): Float64Array { FILL(this.dataStart, this.length, value, start, end); return this; } - sort(comparator: (a: f64, b: f64) => i32 = COMPARATOR()): this { + sort(comparator: (a: f64, b: f64) => i32 = COMPARATOR()): Float64Array { SORT(this.dataStart, this.length, comparator); return this; } @@ -1546,7 +1546,7 @@ export class Float64Array extends ArrayBufferView { FOREACH(this, fn); } - reverse(): this { + reverse(): Float64Array { REVERSE(this.dataStart, this.length); return this; }