From a1c00c2efff395277eac9a520b4d8cdbf03a685c Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 17:53:09 +0200 Subject: [PATCH 01/13] init --- std/assembly/arraybuffer.ts | 4 + std/assembly/dataview.ts | 4 + std/assembly/error.ts | 9 +- std/assembly/index.d.ts | 8 +- std/portable/index.d.ts | 40 +- .../compiler/inlining-recursive.untouched.wat | 4 +- tests/compiler/inlining.untouched.wat | 6 +- .../std/allocator_arena.untouched.wat | 4 +- .../compiler/std/array-literal.untouched.wat | 88 +- tests/compiler/std/array.optimized.wat | 87 +- tests/compiler/std/array.untouched.wat | 2866 +++++++++-------- tests/compiler/std/arraybuffer.untouched.wat | 30 +- tests/compiler/std/dataview.optimized.wat | 30 +- tests/compiler/std/dataview.untouched.wat | 1054 +++--- tests/compiler/std/gc-array.untouched.wat | 110 +- tests/compiler/std/math.untouched.wat | 2 +- tests/compiler/std/pointer.untouched.wat | 2 +- tests/compiler/std/static-array.untouched.wat | 158 +- tests/compiler/std/string-utf8.untouched.wat | 18 +- tests/compiler/std/string.optimized.wat | 6 +- tests/compiler/std/string.untouched.wat | 626 ++-- tests/compiler/std/typedarray.optimized.wat | 16 +- tests/compiler/std/typedarray.untouched.wat | 650 ++-- 23 files changed, 3138 insertions(+), 2684 deletions(-) diff --git a/std/assembly/arraybuffer.ts b/std/assembly/arraybuffer.ts index f8f2f4cd15..9117c44796 100644 --- a/std/assembly/arraybuffer.ts +++ b/std/assembly/arraybuffer.ts @@ -30,4 +30,8 @@ export class ArrayBuffer { memory.copy(changetype(buffer) + HEADER_SIZE, changetype(this) + HEADER_SIZE + begin, newLen); return buffer; } + + toString(): string { + return "[object ArrayBuffer]"; + } } diff --git a/std/assembly/dataview.ts b/std/assembly/dataview.ts index f3a4de3e34..0e65466ffb 100644 --- a/std/assembly/dataview.ts +++ b/std/assembly/dataview.ts @@ -177,6 +177,10 @@ export class DataView { HEADER_SIZE ); } + + toString(): string { + return "[object DataView]"; + } } @inline function checkOffset(byteOffset: i32, n: i32, byteLength: i32): void { diff --git a/std/assembly/error.ts b/std/assembly/error.ts index 4e40a15ff8..337abb4d66 100644 --- a/std/assembly/error.ts +++ b/std/assembly/error.ts @@ -1,12 +1,11 @@ export class Error { name: string = "Error"; - message: string; - stack: string = ""; // TODO + stack: string | null = null; // TODO - constructor(message: string = "") { - this.message = message; - } + constructor( + public message: string = "" + ) {} toString(): string { var message = this.message; diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index d48c8b5ae5..8458dc5688 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -621,15 +621,21 @@ declare class Error { message: string; /** Stack trace. */ - stack: string; + stack: string | null; /** Constructs a new error, optionally with a message. */ constructor(message?: string); + + /** Method returns a string representing the specified Error class. */ + toString(): string; } /** Class for indicating an error when a value is not in the set or range of allowed values. */ declare class RangeError extends Error { } +/** Class for indicating an error when a value is not of the expected type. */ +declare class TypeError extends Error { } + interface Boolean {} interface Function {} interface IArguments {} diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index b0f3aec0bc..f933272dea 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -297,6 +297,8 @@ declare class ArrayBuffer { constructor(length: i32); /** Returns a copy of this array buffer's bytes from begin, inclusive, up to end, exclusive. */ slice(begin?: i32, end?: i32): ArrayBuffer; + /** Returns a string representation of ArrayBuffer. */ + toString(): string; } /** The `DataView` view provides a low-level interface for reading and writing multiple number types in a binary `ArrayBuffer`, without having to care about the platform's endianness. */ @@ -310,37 +312,39 @@ declare class DataView { /** Constructs a new `DataView` with the given properties */ constructor(buffer: ArrayBuffer, byteOffset?: i32, byteLength?: i32); /** The `getFloat32()` method gets a signed 32-bit float (float) at the specified byte offset from the start of the `DataView`. */ - getFloat32(byteOffset: i32, littleEndian?: boolean): f32 + getFloat32(byteOffset: i32, littleEndian?: boolean): f32; /** The `getFloat64()` method gets a signed 64-bit float (double) at the specified byte offset from the start of the `DataView`. */ - getFloat64(byteOffset: i32, littleEndian?: boolean): f64 + getFloat64(byteOffset: i32, littleEndian?: boolean): f64; /** The `getInt8()` method gets a signed 8-bit integer (byte) at the specified byte offset from the start of the `DataView`. */ - getInt8(byteOffset: i32): i8 + getInt8(byteOffset: i32): i8; /** The `getInt16()` method gets a signed 16-bit integer (short) at the specified byte offset from the start of the `DataView`. */ - getInt16(byteOffset: i32, littleEndian?: boolean): i16 + getInt16(byteOffset: i32, littleEndian?: boolean): i16; /** The `getInt32()` method gets a signed 32-bit integer (long) at the specified byte offset from the start of the `DataView`. */ - getInt32(byteOffset: i32, littleEndian?: boolean): i32 + getInt32(byteOffset: i32, littleEndian?: boolean): i32; /** The `getUint8()` method gets an unsigned 8-bit integer (unsigned byte) at the specified byte offset from the start of the `DataView`. */ - getUint8(byteOffset: i32): u8 + getUint8(byteOffset: i32): u8; /** The `getUint16()` method gets an unsigned 16-bit integer (unsigned short) at the specified byte offset from the start of the `DataView`. */ - getUint16(byteOffset: i32, littleEndian?: boolean): u16 + getUint16(byteOffset: i32, littleEndian?: boolean): u16; /** The `getUint32()` method gets an unsigned 32-bit integer (unsigned long) at the specified byte offset from the start of the `DataView`. */ - getUint32(byteOffset: i32, littleEndian?: boolean): u32 + getUint32(byteOffset: i32, littleEndian?: boolean): u32; /** The `setFloat32()` method stores a signed 32-bit float (float) value at the specified byte offset from the start of the `DataView`. */ - setFloat32(byteOffset: i32, value: f32, littleEndian?: boolean): void + setFloat32(byteOffset: i32, value: f32, littleEndian?: boolean): void; /** The `setFloat64()` method stores a signed 64-bit float (double) value at the specified byte offset from the start of the `DataView`. */ - setFloat64(byteOffset: i32, value: f64, littleEndian?: boolean): void + setFloat64(byteOffset: i32, value: f64, littleEndian?: boolean): void; /** The `setInt8()` method stores a signed 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */ - setInt8(byteOffset: i32, value: i8): void + setInt8(byteOffset: i32, value: i8): void; /** The `setInt16()` method stores a signed 16-bit integer (short) value at the specified byte offset from the start of the `DataView`. */ - setInt16(byteOffset: i32, value: i16, littleEndian?: boolean): void + setInt16(byteOffset: i32, value: i16, littleEndian?: boolean): void; /** The `setInt32()` method stores a signed 32-bit integer (long) value at the specified byte offset from the start of the `DataView`. */ - setInt32(byteOffset: i32, value: i32, littleEndian?: boolean): void + setInt32(byteOffset: i32, value: i32, littleEndian?: boolean): void; /** The `setUint8()` method stores an unsigned 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */ - setUint8(byteOffset: i32, value: u8): void + setUint8(byteOffset: i32, value: u8): void; /** The `setUint16()` method stores an unsigned 16-bit integer (unsigned short) value at the specified byte offset from the start of the `DataView`. */ - setUint16(byteOffset: i32, value: u16, littleEndian?: boolean): void + setUint16(byteOffset: i32, value: u16, littleEndian?: boolean): void; /** The `setUint32()` method stores an unsigned 32-bit integer (unsigned long) value at the specified byte offset from the start of the `DataView`. */ - setUint32(byteOffset: i32, value: u32, littleEndian?: boolean): void + setUint32(byteOffset: i32, value: u32, littleEndian?: boolean): void; + /** Returns a string representation of DataView. */ + toString(): string; } declare class Array { @@ -439,8 +443,12 @@ declare class Error { constructor(message: string); message: string; stack: string | null; + toString(): string; } +declare class RangeError extends Error { } +declare class TypeError extends Error { } + declare class Set { constructor(entries?: T[]); readonly size: i32; diff --git a/tests/compiler/inlining-recursive.untouched.wat b/tests/compiler/inlining-recursive.untouched.wat index 04081e731b..074ea84a33 100644 --- a/tests/compiler/inlining-recursive.untouched.wat +++ b/tests/compiler/inlining-recursive.untouched.wat @@ -16,7 +16,9 @@ call $inlining-recursive/bar ) (func $inlining-recursive/bar (; 2 ;) (type $v) - call $inlining-recursive/baz + block $inlining-recursive/bar|inlined.0 + call $inlining-recursive/baz + end ) (func $null (; 3 ;) (type $v) ) diff --git a/tests/compiler/inlining.untouched.wat b/tests/compiler/inlining.untouched.wat index 8ae32ff48b..67133fb4d3 100644 --- a/tests/compiler/inlining.untouched.wat +++ b/tests/compiler/inlining.untouched.wat @@ -214,8 +214,10 @@ call $~lib/env/abort unreachable end - i32.const 0 - set_local $2 + block $inlining/func_iv|inlined.0 + i32.const 0 + set_local $2 + end block (result i32) i32.const 1 set_global $~argc diff --git a/tests/compiler/std/allocator_arena.untouched.wat b/tests/compiler/std/allocator_arena.untouched.wat index 8dd74e747b..c883c9aa34 100644 --- a/tests/compiler/std/allocator_arena.untouched.wat +++ b/tests/compiler/std/allocator_arena.untouched.wat @@ -1888,7 +1888,7 @@ call $~lib/env/abort unreachable end - block + block $~lib/memory/memory.fill|inlined.0 get_global $std/allocator_arena/ptr1 set_local $0 i32.const 18 @@ -1933,7 +1933,7 @@ end unreachable end - block + block $~lib/memory/memory.copy|inlined.0 get_global $std/allocator_arena/ptr2 set_local $2 get_global $std/allocator_arena/ptr1 diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index 38071b41dd..dca7119712 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -507,16 +507,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.0 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -579,16 +581,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.1 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -651,16 +655,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.2 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -739,16 +745,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.3 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 91439cc8ea..2acbc30ca4 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -2666,7 +2666,6 @@ (local $1 i32) (local $2 i32) (local $3 i32) - (local $4 i32) get_local $0 i32.load offset=4 tee_local $1 @@ -2697,10 +2696,11 @@ tee_local $1 i32.const 2 i32.shl - tee_local $4 call $~lib/internal/memory/memmove get_local $2 - get_local $4 + get_local $1 + i32.const 2 + i32.shl i32.add i32.const 0 i32.store offset=8 @@ -4097,12 +4097,11 @@ get_local $0 i32.const 4 i32.add - tee_local $2 + tee_local $1 f32.load offset=8 set_local $6 - get_local $2 + get_local $1 get_local $0 - tee_local $1 f32.load offset=8 f32.store offset=8 get_local $0 @@ -4687,12 +4686,11 @@ get_local $0 i32.const 8 i32.add - tee_local $2 + tee_local $1 f64.load offset=8 set_local $6 - get_local $2 + get_local $1 get_local $0 - tee_local $1 f64.load offset=8 f64.store offset=8 get_local $0 @@ -5049,27 +5047,27 @@ get_local $1 i32.const 1 i32.sub - set_local $4 + set_local $3 loop $repeat|0 - get_local $4 + get_local $3 i32.const 0 i32.le_s br_if $break|0 - get_local $4 - set_local $3 + get_local $3 + set_local $4 loop $continue|1 - get_local $3 + get_local $4 i32.const 1 i32.and get_local $7 - get_local $3 + get_local $4 i32.const 6 i32.shr_s i32.const 2 i32.shl i32.add i32.load - get_local $3 + get_local $4 i32.const 1 i32.shr_s i32.const 31 @@ -5079,15 +5077,15 @@ i32.and i32.eq if - get_local $3 + get_local $4 i32.const 1 i32.shr_s - set_local $3 + set_local $4 br $continue|1 end end get_local $0 - get_local $3 + get_local $4 i32.const 1 i32.shr_s tee_local $5 @@ -5095,9 +5093,9 @@ i32.shl i32.add i32.load offset=8 - set_local $3 + set_local $4 get_local $0 - get_local $4 + get_local $3 i32.const 2 i32.shl i32.add @@ -5105,7 +5103,7 @@ set_local $6 i32.const 2 set_global $~argc - get_local $3 + get_local $4 get_local $6 get_local $2 call_indirect (type $iii) @@ -5113,7 +5111,7 @@ i32.lt_s if get_local $7 - get_local $4 + get_local $3 i32.const 5 i32.shr_s i32.const 2 @@ -5123,18 +5121,18 @@ get_local $8 i32.load i32.const 1 - get_local $4 + get_local $3 i32.const 31 i32.and i32.shl i32.xor i32.store get_local $0 - get_local $4 + get_local $3 i32.const 2 i32.shl i32.add - get_local $3 + get_local $4 i32.store offset=8 get_local $0 get_local $5 @@ -5144,10 +5142,10 @@ get_local $6 i32.store offset=8 end - get_local $4 + get_local $3 i32.const 1 i32.sub - set_local $4 + set_local $3 br $repeat|0 unreachable end @@ -5157,9 +5155,9 @@ get_local $1 i32.const 1 i32.sub - set_local $4 + set_local $3 loop $repeat|2 - get_local $4 + get_local $3 i32.const 2 i32.lt_s br_if $break|2 @@ -5168,7 +5166,7 @@ set_local $6 get_local $0 get_local $0 - get_local $4 + get_local $3 i32.const 2 i32.shl i32.add @@ -5199,11 +5197,11 @@ i32.const 1 i32.and i32.add - tee_local $3 - get_local $4 + tee_local $4 + get_local $3 i32.lt_s if - get_local $3 + get_local $4 set_local $5 br $continue|3 end @@ -5222,11 +5220,11 @@ i32.shl i32.add i32.load offset=8 - set_local $3 + set_local $4 i32.const 2 set_global $~argc get_local $6 - get_local $3 + get_local $4 get_local $2 call_indirect (type $iii) i32.const 0 @@ -5257,7 +5255,7 @@ get_local $6 i32.store offset=8 get_local $0 - get_local $3 + get_local $4 i32.store offset=8 end get_local $5 @@ -5267,10 +5265,10 @@ br $continue|4 end end - get_local $4 + get_local $3 i32.const 1 i32.sub - set_local $4 + set_local $3 br $repeat|2 unreachable end @@ -5279,12 +5277,11 @@ get_local $0 i32.const 4 i32.add - tee_local $3 + tee_local $2 i32.load offset=8 set_local $1 - get_local $3 + get_local $2 get_local $0 - tee_local $2 i32.load offset=8 i32.store offset=8 get_local $0 @@ -7578,7 +7575,11 @@ i32.const 1 i32.shl call $~lib/internal/memory/memmove - get_local $3 + get_local $0 + get_local $4 + i32.const 1 + i32.shl + i32.add i32.const 46 i32.store16 offset=4 get_local $1 diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 920065a69b..f8117124d9 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -785,16 +785,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.0 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $~lib/array/Array.isArray | null> (; 8 ;) (type $ii) (param $0 i32) (result i32) @@ -1096,13 +1098,15 @@ i32.lt_s i32.eqz br_if $break|0 - get_local $4 - get_local $2 - i32.const 2 - i32.shl - i32.add - get_local $1 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + get_local $4 + get_local $2 + i32.const 2 + i32.shl + i32.add + get_local $1 + i32.store offset=8 + end get_local $2 i32.const 1 i32.add @@ -2692,54 +2696,60 @@ get_local $0 get_local $1 i32.store - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $5 - get_local $3 - get_local $4 - get_local $5 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.2 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $5 + get_local $3 + get_local $4 + get_local $5 + call $~lib/internal/memory/memset + end else get_local $1 call $~lib/internal/arraybuffer/allocateUnsafe set_local $5 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $3 - get_local $4 - get_local $3 - get_local $2 - call $~lib/internal/memory/memmove - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $6 - get_local $3 - get_local $4 - get_local $6 - call $~lib/internal/memory/memset + block $~lib/memory/memory.copy|inlined.0 + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $3 + get_local $4 + get_local $3 + get_local $2 + call $~lib/internal/memory/memmove + end + block $~lib/memory/memory.fill|inlined.3 + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $6 + get_local $3 + get_local $4 + get_local $6 + call $~lib/internal/memory/memset + end get_local $5 return end @@ -2815,13 +2825,15 @@ get_local $0 get_local $5 i32.store offset=4 - get_local $3 - get_local $2 - i32.const 2 - i32.shl - i32.add - get_local $1 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + get_local $3 + get_local $2 + i32.const 2 + i32.shl + i32.add + get_local $1 + i32.store offset=8 + end get_local $5 ) (func $~lib/array/Array#__get (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -3108,22 +3120,24 @@ get_local $11 if block - block $~lib/internal/arraybuffer/loadUnsafe|inlined.2 (result i32) + block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 + block $~lib/internal/arraybuffer/loadUnsafe|inlined.2 (result i32) + get_local $4 + get_local $9 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + end + set_local $6 get_local $4 - get_local $9 + get_local $8 i32.const 2 i32.shl i32.add - i32.load offset=8 + get_local $6 + i32.store offset=8 end - set_local $6 - get_local $4 - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $6 - i32.store offset=8 get_local $9 i32.const 1 i32.sub @@ -3301,35 +3315,39 @@ get_local $2 i32.store end - get_local $2 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - i32.const 4 - i32.add - set_local $6 - get_local $2 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $7 - get_local $3 - i32.const 1 - i32.sub - i32.const 2 - i32.shl - set_local $8 - get_local $6 - get_local $7 - get_local $8 - call $~lib/internal/memory/memmove - i32.const 0 - set_local $8 - get_local $2 - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $1 - i32.store offset=8 + block $~lib/memory/memory.copy|inlined.4 + get_local $2 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + i32.const 4 + i32.add + set_local $6 + get_local $2 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $7 + get_local $3 + i32.const 1 + i32.sub + i32.const 2 + i32.shl + set_local $8 + get_local $6 + get_local $7 + get_local $8 + call $~lib/internal/memory/memmove + end + block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 + i32.const 0 + set_local $8 + get_local $2 + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $1 + i32.store offset=8 + end get_local $0 get_local $5 i32.store offset=4 @@ -3375,33 +3393,37 @@ i32.const 1 i32.sub set_local $5 - get_local $2 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $3 - get_local $2 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - i32.const 4 - i32.add - set_local $6 - get_local $5 - i32.const 2 - i32.shl - set_local $7 - get_local $3 - get_local $6 - get_local $7 - call $~lib/internal/memory/memmove - i32.const 0 - set_local $7 - get_local $2 - get_local $5 - i32.const 2 - i32.shl - i32.add - get_local $7 - i32.store offset=8 + block $~lib/memory/memory.copy|inlined.5 + get_local $2 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $3 + get_local $2 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + i32.const 4 + i32.add + set_local $6 + get_local $5 + i32.const 2 + i32.shl + set_local $7 + get_local $3 + get_local $6 + get_local $7 + call $~lib/internal/memory/memmove + end + block $~lib/internal/arraybuffer/storeUnsafe|inlined.3 + i32.const 0 + set_local $7 + get_local $2 + get_local $5 + i32.const 2 + i32.shl + i32.add + get_local $7 + i32.store offset=8 + end get_local $0 get_local $5 i32.store offset=4 @@ -3442,29 +3464,33 @@ i32.load offset=8 end set_local $4 - block $~lib/internal/arraybuffer/loadUnsafe|inlined.5 (result i32) - get_local $1 - get_local $3 - i32.const 2 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.4 + block $~lib/internal/arraybuffer/loadUnsafe|inlined.5 (result i32) + get_local $1 + get_local $3 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + end + set_local $5 + get_local $1 + get_local $2 + i32.const 2 i32.shl i32.add - i32.load offset=8 + get_local $5 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafe|inlined.5 + get_local $1 + get_local $3 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 end - set_local $5 - get_local $1 - get_local $2 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - get_local $1 - get_local $3 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 end block get_local $2 @@ -3608,32 +3634,34 @@ get_local $0 i32.load set_local $6 - get_local $6 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $1 - i32.const 2 - i32.shl - i32.add - set_local $4 - get_local $6 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $1 - get_local $2 - i32.add - i32.const 2 - i32.shl - i32.add - set_local $5 - get_local $2 - i32.const 2 - i32.shl - set_local $7 - get_local $4 - get_local $5 - get_local $7 - call $~lib/internal/memory/memmove + block $~lib/memory/memory.copy|inlined.6 + get_local $6 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $1 + i32.const 2 + i32.shl + i32.add + set_local $4 + get_local $6 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $1 + get_local $2 + i32.add + i32.const 2 + i32.shl + i32.add + set_local $5 + get_local $2 + i32.const 2 + i32.shl + set_local $7 + get_local $4 + get_local $5 + get_local $7 + call $~lib/internal/memory/memmove + end get_local $0 get_local $3 get_local $2 @@ -3683,13 +3711,15 @@ i32.add i32.store offset=4 end - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.6 + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 + end ) (func $start~anonymous|1 (; 37 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) get_local $0 @@ -4124,16 +4154,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.4 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $~lib/array/Array#map (; 63 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -4175,7 +4207,7 @@ end i32.eqz br_if $break|0 - block + block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 block (result f32) i32.const 3 set_global $~argc @@ -4283,7 +4315,7 @@ end i32.eqz br_if $break|0 - block + block $~lib/internal/arraybuffer/storeUnsafe|inlined.7 block (result i32) i32.const 3 set_global $~argc @@ -4968,19 +5000,21 @@ end end end - get_local $6 - i32.const 1 - i32.add - set_local $8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $5 - f32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 + get_local $6 + i32.const 1 + i32.add + set_local $8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $5 + f32.store offset=8 + end end get_local $4 i32.const 1 @@ -5019,12 +5053,14 @@ br $~lib/memory/memory.allocate|inlined.1 end set_local $5 - i32.const 0 - set_local $6 - get_local $5 - get_local $6 - get_local $4 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.5 + i32.const 0 + set_local $6 + get_local $5 + get_local $6 + get_local $4 + call $~lib/internal/memory/memset + end block $break|0 get_local $2 i32.const 1 @@ -5129,24 +5165,28 @@ i32.shl i32.xor i32.store - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $9 - f32.store offset=8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - f32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.2 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $9 + f32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.3 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + f32.store offset=8 + end end end get_local $6 @@ -5183,9 +5223,31 @@ f32.load offset=8 end set_local $10 - i32.const 0 - set_local $8 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result f32) + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.4 + i32.const 0 + set_local $8 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result f32) + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + f32.load offset=8 + end + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $9 + f32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.5 get_local $0 get_local $1 i32.add @@ -5193,27 +5255,9 @@ i32.const 2 i32.shl i32.add - f32.load offset=8 + get_local $10 + f32.store offset=8 end - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $9 - f32.store offset=8 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $10 - f32.store offset=8 i32.const 1 set_local $8 block $break|3 @@ -5310,26 +5354,30 @@ i32.shl i32.xor i32.store - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - f32.store offset=8 - i32.const 0 - set_local $11 - get_local $0 - get_local $1 - i32.add - get_local $11 - i32.const 2 - i32.shl - i32.add - get_local $9 - f32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.6 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + f32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.7 + i32.const 0 + set_local $11 + get_local $0 + get_local $1 + i32.add + get_local $11 + i32.const 2 + i32.shl + i32.add + get_local $9 + f32.store offset=8 + end end get_local $8 i32.const 1 @@ -5372,41 +5420,45 @@ f32.load offset=8 end set_local $12 - i32.const 1 - set_local $6 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result f32) + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.8 + i32.const 1 + set_local $6 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result f32) + i32.const 0 + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + f32.load offset=8 + end + set_local $10 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $10 + f32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.9 i32.const 0 - set_local $7 + set_local $6 get_local $0 get_local $1 i32.add - get_local $7 + get_local $6 i32.const 2 i32.shl i32.add - f32.load offset=8 + get_local $12 + f32.store offset=8 end - set_local $10 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $10 - f32.store offset=8 - i32.const 0 - set_local $6 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $12 - f32.store offset=8 ) (func $~lib/array/Array#sort (; 98 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -5474,24 +5526,28 @@ i32.const 0 i32.lt_s if - i32.const 1 - set_local $4 - get_local $3 - get_local $4 - i32.const 2 - i32.shl - i32.add - get_local $6 - f32.store offset=8 - i32.const 0 - set_local $4 - get_local $3 - get_local $4 - i32.const 2 - i32.shl - i32.add - get_local $5 - f32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 + i32.const 1 + set_local $4 + get_local $3 + get_local $4 + i32.const 2 + i32.shl + i32.add + get_local $6 + f32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 + i32.const 0 + set_local $4 + get_local $3 + get_local $4 + i32.const 2 + i32.shl + i32.add + get_local $5 + f32.store offset=8 + end end get_local $0 return @@ -5735,19 +5791,21 @@ end end end - get_local $6 - i32.const 1 - i32.add - set_local $8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $5 - f64.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 + get_local $6 + i32.const 1 + i32.add + set_local $8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $5 + f64.store offset=8 + end end get_local $4 i32.const 1 @@ -5783,12 +5841,14 @@ br $~lib/memory/memory.allocate|inlined.2 end set_local $5 - i32.const 0 - set_local $6 - get_local $5 - get_local $6 - get_local $4 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.6 + i32.const 0 + set_local $6 + get_local $5 + get_local $6 + get_local $4 + call $~lib/internal/memory/memset + end block $break|0 get_local $2 i32.const 1 @@ -5893,24 +5953,28 @@ i32.shl i32.xor i32.store - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.2 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.3 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 + end end end get_local $6 @@ -5947,9 +6011,31 @@ f64.load offset=8 end set_local $10 - i32.const 0 - set_local $8 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result f64) + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.4 + i32.const 0 + set_local $8 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result f64) + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + f64.load offset=8 + end + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.5 get_local $0 get_local $1 i32.add @@ -5957,27 +6043,9 @@ i32.const 3 i32.shl i32.add - f64.load offset=8 + get_local $10 + f64.store offset=8 end - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 i32.const 1 set_local $8 block $break|3 @@ -6074,32 +6142,36 @@ i32.shl i32.xor i32.store - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 - i32.const 0 - set_local $11 - get_local $0 - get_local $1 - i32.add - get_local $11 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - end - get_local $8 - i32.const 1 - i32.shr_s - set_local $8 - end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.6 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.7 + i32.const 0 + set_local $11 + get_local $0 + get_local $1 + i32.add + get_local $11 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + end + end + get_local $8 + i32.const 1 + i32.shr_s + set_local $8 + end br $continue|4 end end @@ -6136,41 +6208,45 @@ f64.load offset=8 end set_local $12 - i32.const 1 - set_local $6 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result f64) + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.8 + i32.const 1 + set_local $6 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result f64) + i32.const 0 + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 3 + i32.shl + i32.add + f64.load offset=8 + end + set_local $10 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.9 i32.const 0 - set_local $7 + set_local $6 get_local $0 get_local $1 i32.add - get_local $7 + get_local $6 i32.const 3 i32.shl i32.add - f64.load offset=8 + get_local $12 + f64.store offset=8 end - set_local $10 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 - i32.const 0 - set_local $6 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $12 - f64.store offset=8 ) (func $~lib/array/Array#sort (; 105 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -6238,24 +6314,28 @@ i32.const 0 i32.lt_s if - i32.const 1 - set_local $4 - get_local $3 - get_local $4 - i32.const 3 - i32.shl - i32.add - get_local $6 - f64.store offset=8 - i32.const 0 - set_local $4 - get_local $3 - get_local $4 - i32.const 3 - i32.shl - i32.add - get_local $5 - f64.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + i32.const 1 + set_local $4 + get_local $3 + get_local $4 + i32.const 3 + i32.shl + i32.add + get_local $6 + f64.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 + i32.const 0 + set_local $4 + get_local $3 + get_local $4 + i32.const 3 + i32.shl + i32.add + get_local $5 + f64.store offset=8 + end end get_local $0 return @@ -6521,19 +6601,21 @@ end end end - get_local $6 - i32.const 1 - i32.add - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 + get_local $6 + i32.const 1 + i32.add + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + end end get_local $4 i32.const 1 @@ -6569,12 +6651,14 @@ br $~lib/memory/memory.allocate|inlined.3 end set_local $5 - i32.const 0 - set_local $6 - get_local $5 - get_local $6 - get_local $4 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.7 + i32.const 0 + set_local $6 + get_local $5 + get_local $6 + get_local $4 + call $~lib/internal/memory/memset + end block $break|0 get_local $2 i32.const 1 @@ -6679,24 +6763,28 @@ i32.shl i32.xor i32.store - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $9 - i32.store offset=8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.2 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $9 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.3 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + i32.store offset=8 + end end end get_local $6 @@ -6733,9 +6821,31 @@ i32.load offset=8 end set_local $10 - i32.const 0 - set_local $9 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result i32) + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.4 + i32.const 0 + set_local $9 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result i32) + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + end + set_local $8 + get_local $0 + get_local $1 + i32.add + get_local $9 + i32.const 2 + i32.shl + i32.add + get_local $8 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.5 get_local $0 get_local $1 i32.add @@ -6743,27 +6853,9 @@ i32.const 2 i32.shl i32.add - i32.load offset=8 + get_local $10 + i32.store offset=8 end - set_local $8 - get_local $0 - get_local $1 - i32.add - get_local $9 - i32.const 2 - i32.shl - i32.add - get_local $8 - i32.store offset=8 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $10 - i32.store offset=8 i32.const 1 set_local $8 block $break|3 @@ -6860,33 +6952,37 @@ i32.shl i32.xor i32.store - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - i32.store offset=8 - i32.const 0 - set_local $11 - get_local $0 - get_local $1 - i32.add - get_local $11 - i32.const 2 - i32.shl - i32.add - get_local $7 - i32.store offset=8 - end - get_local $8 - i32.const 1 - i32.shr_s - set_local $8 - end - br $continue|4 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.6 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.7 + i32.const 0 + set_local $11 + get_local $0 + get_local $1 + i32.add + get_local $11 + i32.const 2 + i32.shl + i32.add + get_local $7 + i32.store offset=8 + end + end + get_local $8 + i32.const 1 + i32.shr_s + set_local $8 + end + br $continue|4 end end end @@ -6922,9 +7018,33 @@ i32.load offset=8 end set_local $12 - i32.const 1 - set_local $6 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result i32) + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.8 + i32.const 1 + set_local $6 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result i32) + i32.const 0 + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $9 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + end + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $9 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.9 i32.const 0 set_local $9 get_local $0 @@ -6934,29 +7054,9 @@ i32.const 2 i32.shl i32.add - i32.load offset=8 + get_local $12 + i32.store offset=8 end - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $9 - i32.store offset=8 - i32.const 0 - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $9 - i32.const 2 - i32.shl - i32.add - get_local $12 - i32.store offset=8 ) (func $~lib/array/Array#sort (; 113 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -7024,24 +7124,28 @@ i32.const 0 i32.lt_s if - i32.const 1 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - i32.const 0 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.8 + i32.const 1 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafe|inlined.9 + i32.const 0 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 + end end get_local $0 return @@ -7177,19 +7281,21 @@ end end end - get_local $6 - i32.const 1 - i32.add - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 + get_local $6 + i32.const 1 + i32.add + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + end end get_local $4 i32.const 1 @@ -7225,12 +7331,14 @@ br $~lib/memory/memory.allocate|inlined.4 end set_local $5 - i32.const 0 - set_local $6 - get_local $5 - get_local $6 - get_local $4 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.8 + i32.const 0 + set_local $6 + get_local $5 + get_local $6 + get_local $4 + call $~lib/internal/memory/memset + end block $break|0 get_local $2 i32.const 1 @@ -7335,24 +7443,28 @@ i32.shl i32.xor i32.store - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $9 - i32.store offset=8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.2 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $9 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.3 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + i32.store offset=8 + end end end get_local $6 @@ -7389,9 +7501,31 @@ i32.load offset=8 end set_local $10 - i32.const 0 - set_local $9 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result i32) + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.4 + i32.const 0 + set_local $9 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result i32) + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + end + set_local $8 + get_local $0 + get_local $1 + i32.add + get_local $9 + i32.const 2 + i32.shl + i32.add + get_local $8 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.5 get_local $0 get_local $1 i32.add @@ -7399,27 +7533,9 @@ i32.const 2 i32.shl i32.add - i32.load offset=8 + get_local $10 + i32.store offset=8 end - set_local $8 - get_local $0 - get_local $1 - i32.add - get_local $9 - i32.const 2 - i32.shl - i32.add - get_local $8 - i32.store offset=8 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $10 - i32.store offset=8 i32.const 1 set_local $8 block $break|3 @@ -7516,26 +7632,30 @@ i32.shl i32.xor i32.store - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - i32.store offset=8 - i32.const 0 - set_local $11 - get_local $0 - get_local $1 - i32.add - get_local $11 - i32.const 2 - i32.shl - i32.add - get_local $7 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.6 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.7 + i32.const 0 + set_local $11 + get_local $0 + get_local $1 + i32.add + get_local $11 + i32.const 2 + i32.shl + i32.add + get_local $7 + i32.store offset=8 + end end get_local $8 i32.const 1 @@ -7578,41 +7698,45 @@ i32.load offset=8 end set_local $12 - i32.const 1 - set_local $6 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result i32) - i32.const 0 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.8 + i32.const 1 + set_local $6 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result i32) + i32.const 0 + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $9 + i32.const 2 + i32.shl + i32.add + i32.load offset=8 + end set_local $9 get_local $0 get_local $1 i32.add - get_local $9 + get_local $6 i32.const 2 i32.shl i32.add - i32.load offset=8 + get_local $9 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.9 + i32.const 0 + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $9 + i32.const 2 + i32.shl + i32.add + get_local $12 + i32.store offset=8 end - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $9 - i32.store offset=8 - i32.const 0 - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $9 - i32.const 2 - i32.shl - i32.add - get_local $12 - i32.store offset=8 ) (func $~lib/array/Array#sort (; 118 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -7680,24 +7804,28 @@ i32.const 0 i32.lt_s if - i32.const 1 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - i32.const 0 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 + i32.const 1 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 + i32.const 0 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 + end end get_local $0 return @@ -8034,16 +8162,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.9 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $~lib/array/Array>#__set (; 133 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -8089,13 +8219,15 @@ i32.add i32.store offset=4 end - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe,Array>|inlined.0 + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 + end ) (func $~lib/array/Array>#__get (; 134 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -8267,19 +8399,21 @@ end end end - get_local $6 - i32.const 1 - i32.add - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset,Array>|inlined.1 + get_local $6 + i32.const 1 + i32.add + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + end end get_local $4 i32.const 1 @@ -8357,24 +8491,28 @@ i32.const 0 i32.lt_s if - i32.const 1 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - i32.const 0 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe,Array>|inlined.1 + i32.const 1 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafe,Array>|inlined.2 + i32.const 0 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 + end end get_local $0 return @@ -8500,16 +8638,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.10 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $std/array/Proxy#constructor (; 142 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -8574,13 +8714,15 @@ i32.add i32.store offset=4 end - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe,Proxy>|inlined.0 + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 + end ) (func $std/array/createReverseOrderedElementsArray (; 144 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) @@ -8720,19 +8862,21 @@ end end end - get_local $6 - i32.const 1 - i32.add - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset,Proxy>|inlined.1 + get_local $6 + i32.const 1 + i32.add + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + end end get_local $4 i32.const 1 @@ -8810,24 +8954,28 @@ i32.const 0 i32.lt_s if - i32.const 1 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - i32.const 0 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe,Proxy>|inlined.1 + i32.const 1 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafe,Proxy>|inlined.2 + i32.const 0 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 + end end get_local $0 return @@ -9208,19 +9356,21 @@ end end end - get_local $6 - i32.const 1 - i32.add - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 + get_local $6 + i32.const 1 + i32.add + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + end end get_local $4 i32.const 1 @@ -9298,24 +9448,28 @@ i32.const 0 i32.lt_s if - i32.const 1 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - i32.const 0 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + i32.const 1 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 + i32.const 0 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 + end end get_local $0 return @@ -9572,16 +9726,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.11 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $~lib/internal/string/allocateUnsafe (; 164 ;) (type $ii) (param $0 i32) (result i32) @@ -9842,13 +9998,15 @@ i32.add i32.store offset=4 end - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 + end ) (func $std/array/createRandomStringArray (; 171 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) @@ -10184,24 +10342,28 @@ get_local $11 call $~lib/string/String#substring set_local $12 - get_local $10 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.4 + block $~lib/internal/string/freeUnsafe|inlined.0 block get_local $10 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.4 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.4 + block + get_local $10 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.4 + unreachable + end + unreachable + end end - unreachable end end get_local $12 @@ -10458,10 +10620,12 @@ get_local $2 call $~lib/internal/string/allocateUnsafe set_local $3 - get_local $3 - get_local $0 - get_local $2 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.0 + get_local $3 + get_local $0 + get_local $2 + call $~lib/internal/number/utoa32_lut + end get_local $1 if get_local $3 @@ -10511,10 +10675,12 @@ get_local $4 i32.add set_local $3 - get_local $0 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.1 + get_local $0 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa32_lut + end get_local $4 if get_local $0 @@ -10663,24 +10829,28 @@ get_local $10 call $~lib/string/String#substring set_local $11 - get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.5 + block $~lib/internal/string/freeUnsafe|inlined.1 block get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.5 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.5 + block + get_local $9 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.5 + unreachable + end + unreachable + end end - unreachable end end get_local $11 @@ -10701,10 +10871,12 @@ get_local $1 call $~lib/internal/string/allocateUnsafe set_local $2 - get_local $2 - get_local $0 - get_local $1 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.2 + get_local $2 + get_local $0 + get_local $1 + call $~lib/internal/number/utoa32_lut + end get_local $2 ) (func $~lib/internal/number/itoa (; 182 ;) (type $ii) (param $0 i32) (result i32) @@ -10734,10 +10906,12 @@ get_local $2 call $~lib/internal/number/decimalCount32 set_local $3 - get_local $0 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.3 + get_local $0 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa32_lut + end get_local $3 ) (func $~lib/array/Array#join (; 184 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -10880,24 +11054,28 @@ get_local $10 call $~lib/string/String#substring set_local $11 - get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.6 + block $~lib/internal/string/freeUnsafe|inlined.2 block get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.6 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.6 + block + get_local $9 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.6 + unreachable + end + unreachable + end end - unreachable end end get_local $11 @@ -11216,86 +11394,88 @@ get_local $14 i32.add set_global $~lib/internal/number/_K - block $~lib/internal/arraybuffer/loadUnsafe|inlined.2 (result i64) - get_local $16 - get_local $14 - i32.const 2 + block $~lib/internal/number/grisuRound|inlined.0 + block $~lib/internal/arraybuffer/loadUnsafe|inlined.2 (result i64) + get_local $16 + get_local $14 + i32.const 2 + i32.shl + i32.add + i64.load32_u offset=8 + end + get_local $7 + i64.extend_s/i32 + i64.shl + set_local $20 + get_local $0 + get_local $15 + i32.const 1 + i32.sub + i32.const 1 i32.shl i32.add - i64.load32_u offset=8 - end - get_local $7 - i64.extend_s/i32 - i64.shl - set_local $20 - get_local $0 - get_local $15 - i32.const 1 - i32.sub - i32.const 1 - i32.shl - i32.add - set_local $18 - get_local $18 - i32.load16_u offset=4 - set_local $21 - block $break|2 - loop $continue|2 - get_local $19 - get_local $10 - i64.lt_u - tee_local $22 - if (result i32) - get_local $5 - get_local $19 - i64.sub - get_local $20 - i64.ge_u - else - get_local $22 - end - tee_local $22 - if (result i32) + set_local $18 + get_local $18 + i32.load16_u offset=4 + set_local $21 + block $break|2 + loop $continue|2 get_local $19 - get_local $20 - i64.add get_local $10 i64.lt_u tee_local $22 if (result i32) - get_local $22 - else - get_local $10 + get_local $5 get_local $19 i64.sub - get_local $19 get_local $20 - i64.add - get_local $10 - i64.sub - i64.gt_u + i64.ge_u + else + get_local $22 end - else - get_local $22 - end - if - block - get_local $21 - i32.const 1 - i32.sub - set_local $21 + tee_local $22 + if (result i32) get_local $19 get_local $20 i64.add - set_local $19 + get_local $10 + i64.lt_u + tee_local $22 + if (result i32) + get_local $22 + else + get_local $10 + get_local $19 + i64.sub + get_local $19 + get_local $20 + i64.add + get_local $10 + i64.sub + i64.gt_u + end + else + get_local $22 + end + if + block + get_local $21 + i32.const 1 + i32.sub + set_local $21 + get_local $19 + get_local $20 + i64.add + set_local $19 + end + br $continue|2 end - br $continue|2 end end + get_local $18 + get_local $21 + i32.store16 offset=4 end - get_local $18 - get_local $21 - i32.store16 offset=4 get_local $15 return end @@ -11372,82 +11552,84 @@ i32.sub set_local $17 get_local $16 - get_local $17 - i32.const 2 - i32.shl - i32.add - i64.load32_u offset=8 - end - i64.mul - set_local $10 - get_local $0 - get_local $15 - i32.const 1 - i32.sub - i32.const 1 - i32.shl - i32.add - set_local $17 - get_local $17 - i32.load16_u offset=4 - set_local $21 - block $break|4 - loop $continue|4 - get_local $13 - get_local $10 - i64.lt_u - tee_local $18 - if (result i32) - get_local $5 - get_local $13 - i64.sub - get_local $8 - i64.ge_u - else - get_local $18 - end - tee_local $18 - if (result i32) + get_local $17 + i32.const 2 + i32.shl + i32.add + i64.load32_u offset=8 + end + i64.mul + set_local $10 + block $~lib/internal/number/grisuRound|inlined.1 + get_local $0 + get_local $15 + i32.const 1 + i32.sub + i32.const 1 + i32.shl + i32.add + set_local $17 + get_local $17 + i32.load16_u offset=4 + set_local $21 + block $break|4 + loop $continue|4 get_local $13 - get_local $8 - i64.add get_local $10 i64.lt_u tee_local $18 if (result i32) - get_local $18 - else - get_local $10 + get_local $5 get_local $13 i64.sub - get_local $13 get_local $8 - i64.add - get_local $10 - i64.sub - i64.gt_u + i64.ge_u + else + get_local $18 end - else - get_local $18 - end - if - block - get_local $21 - i32.const 1 - i32.sub - set_local $21 + tee_local $18 + if (result i32) get_local $13 get_local $8 i64.add - set_local $13 + get_local $10 + i64.lt_u + tee_local $18 + if (result i32) + get_local $18 + else + get_local $10 + get_local $13 + i64.sub + get_local $13 + get_local $8 + i64.add + get_local $10 + i64.sub + i64.gt_u + end + else + get_local $18 + end + if + block + get_local $21 + i32.const 1 + i32.sub + set_local $21 + get_local $13 + get_local $8 + i64.add + set_local $13 + end + br $continue|4 end - br $continue|4 end end + get_local $17 + get_local $21 + i32.store16 offset=4 end - get_local $17 - get_local $21 - i32.store16 offset=4 get_local $15 return end @@ -11559,26 +11741,28 @@ i32.shl i32.add set_local $4 - get_local $4 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 2 - i32.add - set_local $5 - get_local $4 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $6 - i32.const 0 - get_local $2 - i32.sub - i32.const 1 - i32.shl - set_local $7 - get_local $5 - get_local $6 - get_local $7 - call $~lib/internal/memory/memmove + block $~lib/memory/memory.copy|inlined.8 + get_local $4 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 2 + i32.add + set_local $5 + get_local $4 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + i32.const 0 + get_local $2 + i32.sub + i32.const 1 + i32.shl + set_local $7 + get_local $5 + get_local $6 + get_local $7 + call $~lib/internal/memory/memmove + end get_local $0 get_local $3 i32.const 1 @@ -11607,26 +11791,28 @@ get_local $3 i32.sub set_local $4 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - get_local $4 - i32.const 1 - i32.shl - i32.add - set_local $7 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $6 - get_local $1 - i32.const 1 - i32.shl - set_local $5 - get_local $7 - get_local $6 - get_local $5 - call $~lib/internal/memory/memmove + block $~lib/memory/memory.copy|inlined.9 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + get_local $4 + i32.const 1 + i32.shl + i32.add + set_local $7 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + get_local $1 + i32.const 1 + i32.shl + set_local $5 + get_local $7 + get_local $6 + get_local $5 + call $~lib/internal/memory/memmove + end get_local $0 get_global $~lib/internal/string/CharCode._0 get_global $~lib/internal/string/CharCode.DOT @@ -11696,10 +11882,12 @@ i32.const 1 i32.add set_local $7 - get_local $4 - get_local $5 - get_local $7 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.4 + get_local $4 + get_local $5 + get_local $7 + call $~lib/internal/number/utoa32_lut + end get_local $4 get_global $~lib/internal/string/CharCode.MINUS get_global $~lib/internal/string/CharCode.PLUS @@ -11718,26 +11906,28 @@ i32.const 1 i32.shl set_local $7 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 4 - i32.add - set_local $6 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 2 - i32.add - set_local $5 - get_local $7 - i32.const 2 - i32.sub - set_local $4 - get_local $6 - get_local $5 - get_local $4 - call $~lib/internal/memory/memmove + block $~lib/memory/memory.copy|inlined.10 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 4 + i32.add + set_local $6 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 2 + i32.add + set_local $5 + get_local $7 + i32.const 2 + i32.sub + set_local $4 + get_local $6 + get_local $5 + get_local $4 + call $~lib/internal/memory/memmove + end get_local $0 get_global $~lib/internal/string/CharCode.DOT i32.store16 offset=6 @@ -11774,10 +11964,12 @@ i32.const 1 i32.add set_local $8 - get_local $4 - get_local $5 - get_local $8 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.5 + get_local $4 + get_local $5 + get_local $8 + call $~lib/internal/number/utoa32_lut + end get_local $4 get_global $~lib/internal/string/CharCode.MINUS get_global $~lib/internal/string/CharCode.PLUS @@ -11874,7 +12066,7 @@ i32.add i32.sub set_local $4 - block + block $~lib/internal/number/normalizedBoundaries|inlined.0 get_local $6 i64.const 1 i64.shl @@ -11923,7 +12115,7 @@ get_local $8 set_global $~lib/internal/number/_exp end - block + block $~lib/internal/number/getCachedPower|inlined.0 get_global $~lib/internal/number/_exp set_local $10 i32.const -61 @@ -12273,24 +12465,28 @@ get_local $2 call $~lib/string/String#substring set_local $3 - get_local $1 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.7 + block $~lib/internal/string/freeUnsafe|inlined.3 block get_local $1 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.7 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.7 + block + get_local $1 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.7 + unreachable + end + unreachable + end end - unreachable end get_local $3 ) @@ -12354,18 +12550,20 @@ get_local $3 select set_local $5 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $6 - get_local $4 - i32.const 1 - i32.shl - set_local $7 - get_local $6 - get_local $5 - get_local $7 - call $~lib/internal/memory/memmove + block $~lib/memory/memory.copy|inlined.11 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + get_local $4 + i32.const 1 + i32.shl + set_local $7 + get_local $6 + get_local $5 + get_local $7 + call $~lib/internal/memory/memmove + end get_local $4 return end @@ -12516,24 +12714,28 @@ get_local $10 call $~lib/string/String#substring set_local $11 - get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.8 + block $~lib/internal/string/freeUnsafe|inlined.4 block get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.8 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.8 + block + get_local $9 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.8 + unreachable + end + unreachable + end end - unreachable end end get_local $11 @@ -12782,16 +12984,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.12 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 195 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -12947,24 +13151,28 @@ get_local $10 call $~lib/string/String#substring set_local $11 - get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.9 + block $~lib/internal/string/freeUnsafe|inlined.5 block get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.9 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.9 + block + get_local $9 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.9 + unreachable + end + unreachable + end end - unreachable end end get_local $11 @@ -13028,16 +13236,18 @@ get_local $4 i32.add set_local $3 - get_local $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - set_local $5 - get_local $0 - get_local $5 - get_local $3 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.6 + get_local $2 + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + set_local $5 + get_local $0 + get_local $5 + get_local $3 + call $~lib/internal/number/utoa32_lut + end get_local $4 if get_local $0 @@ -13186,24 +13396,28 @@ get_local $10 call $~lib/string/String#substring set_local $11 - get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.10 + block $~lib/internal/string/freeUnsafe|inlined.6 block get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.10 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.10 + block + get_local $9 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.10 + unreachable + end + unreachable + end end - unreachable end end get_local $11 @@ -13243,14 +13457,16 @@ i32.and call $~lib/internal/number/decimalCount32 set_local $3 - get_local $2 - i32.const 65535 - i32.and - set_local $4 - get_local $0 - get_local $4 - get_local $3 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.7 + get_local $2 + i32.const 65535 + i32.and + set_local $4 + get_local $0 + get_local $4 + get_local $3 + call $~lib/internal/number/utoa32_lut + end get_local $3 ) (func $~lib/array/Array#join (; 202 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -13393,24 +13609,28 @@ get_local $10 call $~lib/string/String#substring set_local $11 - get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.11 + block $~lib/internal/string/freeUnsafe|inlined.7 block get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.11 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.11 + block + get_local $9 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.11 + unreachable + end + unreachable + end end - unreachable end end get_local $11 @@ -13647,10 +13867,12 @@ get_local $3 call $~lib/internal/string/allocateUnsafe set_local $1 - get_local $1 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.8 + get_local $1 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa32_lut + end else get_local $0 call $~lib/internal/number/decimalCount64 @@ -13658,10 +13880,12 @@ get_local $3 call $~lib/internal/string/allocateUnsafe set_local $1 - get_local $1 - get_local $0 - get_local $3 - call $~lib/internal/number/utoa64_lut + block $~lib/internal/number/utoa64_core|inlined.0 + get_local $1 + get_local $0 + get_local $3 + call $~lib/internal/number/utoa64_lut + end end get_local $1 ) @@ -13701,18 +13925,22 @@ get_local $4 call $~lib/internal/number/decimalCount32 set_local $3 - get_local $0 - get_local $4 - get_local $3 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.9 + get_local $0 + get_local $4 + get_local $3 + call $~lib/internal/number/utoa32_lut + end else get_local $2 call $~lib/internal/number/decimalCount64 set_local $3 - get_local $0 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa64_lut + block $~lib/internal/number/utoa64_core|inlined.1 + get_local $0 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa64_lut + end end get_local $3 ) @@ -13856,24 +14084,28 @@ get_local $10 call $~lib/string/String#substring set_local $11 - get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.12 + block $~lib/internal/string/freeUnsafe|inlined.8 block get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.12 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.12 + block + get_local $9 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.12 + unreachable + end + unreachable + end end - unreachable end end get_local $11 @@ -13917,10 +14149,12 @@ get_local $4 call $~lib/internal/string/allocateUnsafe set_local $2 - get_local $2 - get_local $3 - get_local $4 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.10 + get_local $2 + get_local $3 + get_local $4 + call $~lib/internal/number/utoa32_lut + end else get_local $0 call $~lib/internal/number/decimalCount64 @@ -13930,10 +14164,12 @@ get_local $4 call $~lib/internal/string/allocateUnsafe set_local $2 - get_local $2 - get_local $0 - get_local $4 - call $~lib/internal/number/utoa64_lut + block $~lib/internal/number/utoa64_core|inlined.2 + get_local $2 + get_local $0 + get_local $4 + call $~lib/internal/number/utoa64_lut + end end get_local $1 if @@ -13993,20 +14229,24 @@ get_local $4 i32.add set_local $3 - get_local $0 - get_local $5 - get_local $3 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.11 + get_local $0 + get_local $5 + get_local $3 + call $~lib/internal/number/utoa32_lut + end else get_local $2 call $~lib/internal/number/decimalCount64 get_local $4 i32.add set_local $3 - get_local $0 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa64_lut + block $~lib/internal/number/utoa64_core|inlined.3 + get_local $0 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa64_lut + end end get_local $4 if @@ -14156,24 +14396,28 @@ get_local $10 call $~lib/string/String#substring set_local $11 - get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.13 + block $~lib/internal/string/freeUnsafe|inlined.9 block get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.13 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.13 + block + get_local $9 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.13 + unreachable + end + unreachable + end end - unreachable end end get_local $11 @@ -14335,14 +14579,16 @@ i32.and call $~lib/internal/number/decimalCount32 set_local $3 - get_local $2 - i32.const 255 - i32.and - set_local $4 - get_local $0 - get_local $4 - get_local $3 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.12 + get_local $2 + i32.const 255 + i32.and + set_local $4 + get_local $0 + get_local $4 + get_local $3 + call $~lib/internal/number/utoa32_lut + end get_local $3 ) (func $~lib/array/Array#join (; 216 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -14485,24 +14731,28 @@ get_local $10 call $~lib/string/String#substring set_local $11 - get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.14 + block $~lib/internal/string/freeUnsafe|inlined.10 block get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.14 - unreachable + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.14 + block + get_local $9 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.14 + unreachable + end + unreachable + end end - unreachable end end get_local $11 diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index c225962fb4..b9ce28f2b1 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -1939,20 +1939,22 @@ get_local $6 call $~lib/internal/arraybuffer/allocateUnsafe set_local $7 - get_local $7 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $1 - i32.add - set_local $5 - get_local $4 - get_local $5 - get_local $6 - call $~lib/internal/memory/memmove + block $~lib/memory/memory.copy|inlined.0 + get_local $7 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $1 + i32.add + set_local $5 + get_local $4 + get_local $5 + get_local $6 + call $~lib/internal/memory/memmove + end get_local $7 ) (func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index ed1cc0b32e..b986bd8e27 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -478,7 +478,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -553,7 +553,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -602,7 +602,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -639,7 +639,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -696,7 +696,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -739,7 +739,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -785,7 +785,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -822,7 +822,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -863,7 +863,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -909,7 +909,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -945,7 +945,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -966,7 +966,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -1007,7 +1007,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -1048,7 +1048,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable @@ -1080,7 +1080,7 @@ if i32.const 0 i32.const 136 - i32.const 184 + i32.const 188 i32.const 73 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index 8c464c5a4b..cd6cfa1624 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -438,16 +438,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.0 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -497,21 +499,23 @@ call $~lib/env/abort unreachable end - get_local $0 - i32.load - set_local $3 - get_local $0 - i32.load offset=4 - set_local $4 - get_local $3 - get_local $4 - i32.add - get_local $1 - i32.const 0 - i32.shl - i32.add - get_local $2 - i32.store8 offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.0 + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 0 + i32.shl + i32.add + get_local $2 + i32.store8 offset=8 + end ) (func $~lib/dataview/DataView#constructor (; 8 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (local $4 i32) @@ -602,31 +606,33 @@ (local $3 i32) (local $4 i32) (local $5 i32) - i32.const 4 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else + block $~lib/dataview/checkOffset|inlined.0 + i32.const 4 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else + get_local $1 + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $2 i32.const 1 @@ -696,31 +702,33 @@ (local $3 i32) (local $4 i32) (local $5 i32) - i32.const 8 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else + block $~lib/dataview/checkOffset|inlined.1 + i32.const 8 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else + get_local $1 + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $2 i32.const 1 @@ -751,31 +759,33 @@ (local $2 i32) (local $3 i32) (local $4 i32) - i32.const 1 - set_local $2 - get_local $0 - i32.load offset=8 - set_local $3 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $4 - if (result i32) - get_local $4 - else + block $~lib/dataview/checkOffset|inlined.2 + i32.const 1 + set_local $2 + get_local $0 + i32.load offset=8 + set_local $3 get_local $1 - get_local $2 - i32.add - get_local $3 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $4 + if (result i32) + get_local $4 + else + get_local $1 + get_local $2 + i32.add + get_local $3 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -807,31 +817,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 2 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else + block $~lib/dataview/checkOffset|inlined.3 + i32.const 2 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else + get_local $1 + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -871,31 +883,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 4 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else + block $~lib/dataview/checkOffset|inlined.4 + i32.const 4 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else + get_local $1 + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -960,31 +974,33 @@ (local $4 i32) (local $5 i32) (local $6 i64) - i32.const 8 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else + block $~lib/dataview/checkOffset|inlined.5 + i32.const 8 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else + get_local $1 + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1009,31 +1025,33 @@ (local $2 i32) (local $3 i32) (local $4 i32) - i32.const 1 - set_local $2 - get_local $0 - i32.load offset=8 - set_local $3 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $4 - if (result i32) - get_local $4 - else + block $~lib/dataview/checkOffset|inlined.6 + i32.const 1 + set_local $2 + get_local $0 + i32.load offset=8 + set_local $3 get_local $1 - get_local $2 - i32.add - get_local $3 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $4 + if (result i32) + get_local $4 + else + get_local $1 + get_local $2 + i32.add + get_local $3 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1063,31 +1081,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 2 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else + block $~lib/dataview/checkOffset|inlined.7 + i32.const 2 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else + get_local $1 + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1113,31 +1133,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 4 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else + block $~lib/dataview/checkOffset|inlined.8 + i32.const 4 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else + get_local $1 + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1163,31 +1185,33 @@ (local $4 i32) (local $5 i32) (local $6 i64) - i32.const 8 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else + block $~lib/dataview/checkOffset|inlined.9 + i32.const 8 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else + get_local $1 + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1212,31 +1236,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 4 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else + block $~lib/dataview/checkOffset|inlined.10 + i32.const 4 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else + get_local $1 + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $3 i32.const 1 @@ -1269,31 +1295,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 8 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else + block $~lib/dataview/checkOffset|inlined.11 + i32.const 8 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else + get_local $1 + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $3 i32.const 1 @@ -1326,31 +1354,33 @@ (local $3 i32) (local $4 i32) (local $5 i32) - i32.const 1 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else + block $~lib/dataview/checkOffset|inlined.12 + i32.const 1 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else + get_local $1 + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1366,31 +1396,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 2 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else + block $~lib/dataview/checkOffset|inlined.13 + i32.const 2 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else + get_local $1 + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1414,31 +1446,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 4 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else + block $~lib/dataview/checkOffset|inlined.14 + i32.const 4 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else + get_local $1 + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1462,31 +1496,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 8 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else + block $~lib/dataview/checkOffset|inlined.15 + i32.const 8 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else + get_local $1 + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1510,31 +1546,33 @@ (local $3 i32) (local $4 i32) (local $5 i32) - i32.const 1 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else + block $~lib/dataview/checkOffset|inlined.16 + i32.const 1 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else + get_local $1 + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1550,31 +1588,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 2 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else + block $~lib/dataview/checkOffset|inlined.17 + i32.const 2 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else + get_local $1 + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1598,31 +1638,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 4 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else + block $~lib/dataview/checkOffset|inlined.18 + i32.const 4 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else + get_local $1 + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load @@ -1646,31 +1688,33 @@ (local $4 i32) (local $5 i32) (local $6 i32) - i32.const 8 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else + block $~lib/dataview/checkOffset|inlined.19 + i32.const 8 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 184 - i32.const 73 - call $~lib/env/abort - unreachable + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else + get_local $1 + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable + end end get_local $0 i32.load diff --git a/tests/compiler/std/gc-array.untouched.wat b/tests/compiler/std/gc-array.untouched.wat index b4d953e084..918087bd56 100644 --- a/tests/compiler/std/gc-array.untouched.wat +++ b/tests/compiler/std/gc-array.untouched.wat @@ -2302,54 +2302,60 @@ get_local $0 get_local $1 i32.store - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $5 - get_local $3 - get_local $4 - get_local $5 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.0 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $5 + get_local $3 + get_local $4 + get_local $5 + call $~lib/internal/memory/memset + end else get_local $1 call $~lib/internal/arraybuffer/allocateUnsafe set_local $5 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $3 - get_local $4 - get_local $3 - get_local $2 - call $~lib/internal/memory/memmove - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $6 - get_local $3 - get_local $4 - get_local $6 - call $~lib/internal/memory/memset + block $~lib/memory/memory.copy|inlined.0 + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $3 + get_local $4 + get_local $3 + get_local $2 + call $~lib/internal/memory/memmove + end + block $~lib/memory/memory.fill|inlined.1 + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $6 + get_local $3 + get_local $4 + get_local $6 + call $~lib/internal/memory/memset + end get_local $5 return end @@ -2452,13 +2458,15 @@ i32.add i32.store offset=4 end - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 + end get_local $0 get_local $2 call $~lib/collector/itcm/__gc_link diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index abe4ce1a76..67110dcaa0 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -34704,7 +34704,7 @@ end unreachable end - block + block $~lib/math/NativeMathf.seedRandom|inlined.0 call $~lib/bindings/Math/random i64.reinterpret/f64 set_local $3 diff --git a/tests/compiler/std/pointer.untouched.wat b/tests/compiler/std/pointer.untouched.wat index 3224d902ec..ba6bdd4550 100644 --- a/tests/compiler/std/pointer.untouched.wat +++ b/tests/compiler/std/pointer.untouched.wat @@ -2220,7 +2220,7 @@ call $~lib/env/abort unreachable end - block + block $std/pointer/Pointer#set|inlined.0 get_global $std/pointer/buf set_local $0 i32.const 2 diff --git a/tests/compiler/std/static-array.untouched.wat b/tests/compiler/std/static-array.untouched.wat index bc73ca8be5..a912950b84 100644 --- a/tests/compiler/std/static-array.untouched.wat +++ b/tests/compiler/std/static-array.untouched.wat @@ -1900,54 +1900,60 @@ get_local $0 get_local $1 i32.store - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $5 - get_local $3 - get_local $4 - get_local $5 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.0 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $5 + get_local $3 + get_local $4 + get_local $5 + call $~lib/internal/memory/memset + end else get_local $1 call $~lib/internal/arraybuffer/allocateUnsafe set_local $5 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $3 - get_local $4 - get_local $3 - get_local $2 - call $~lib/internal/memory/memmove - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $6 - get_local $3 - get_local $4 - get_local $6 - call $~lib/internal/memory/memset + block $~lib/memory/memory.copy|inlined.0 + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $3 + get_local $4 + get_local $3 + get_local $2 + call $~lib/internal/memory/memmove + end + block $~lib/memory/memory.fill|inlined.1 + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $6 + get_local $3 + get_local $4 + get_local $6 + call $~lib/internal/memory/memset + end get_local $5 return end @@ -2018,13 +2024,15 @@ i32.add i32.store offset=4 end - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 + end ) (func $~lib/array/Array#__get (; 10 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) (local $2 i32) @@ -2091,13 +2099,15 @@ i32.add i32.store offset=4 end - get_local $3 - get_local $1 - i32.const 3 - i32.shl - i32.add - get_local $2 - i64.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + get_local $3 + get_local $1 + i32.const 3 + i32.shl + i32.add + get_local $2 + i64.store offset=8 + end ) (func $~lib/array/Array#__get (; 12 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) @@ -2164,13 +2174,15 @@ i32.add i32.store offset=4 end - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - f32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + f32.store offset=8 + end ) (func $~lib/array/Array#__get (; 14 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) @@ -2237,13 +2249,15 @@ i32.add i32.store offset=4 end - get_local $3 - get_local $1 - i32.const 3 - i32.shl - i32.add - get_local $2 - f64.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + get_local $3 + get_local $1 + i32.const 3 + i32.shl + i32.add + get_local $2 + f64.store offset=8 + end ) (func $start (; 16 ;) (type $v) (local $0 i32) diff --git a/tests/compiler/std/string-utf8.untouched.wat b/tests/compiler/std/string-utf8.untouched.wat index d1e08e4320..ed63c7fe42 100644 --- a/tests/compiler/std/string-utf8.untouched.wat +++ b/tests/compiler/std/string-utf8.untouched.wat @@ -2223,14 +2223,16 @@ i32.shr_u call $~lib/internal/string/allocateUnsafe set_local $7 - get_local $7 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $3 - get_local $3 - get_local $4 - get_local $5 - call $~lib/internal/memory/memmove + block $~lib/memory/memory.copy|inlined.0 + get_local $7 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $3 + get_local $3 + get_local $4 + get_local $5 + call $~lib/internal/memory/memmove + end block $~lib/memory/memory.free|inlined.0 block get_local $4 diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index a30befd17f..dea1390eee 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -4699,7 +4699,11 @@ i32.const 1 i32.shl call $~lib/internal/memory/memmove - get_local $3 + get_local $0 + get_local $4 + i32.const 1 + i32.shl + i32.add i32.const 46 i32.store16 offset=4 get_local $1 diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index 1747f75003..18bdc70846 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -2473,7 +2473,7 @@ i32.lt_s i32.eqz br_if $break|5 - block + block $~lib/memory/memory.copy|inlined.0 get_local $6 get_local $8 i32.add @@ -4137,16 +4137,18 @@ get_local $0 get_local $1 i32.store offset=4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.0 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 39 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -4197,54 +4199,60 @@ get_local $0 get_local $1 i32.store - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $5 - get_local $3 - get_local $4 - get_local $5 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.1 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $5 + get_local $3 + get_local $4 + get_local $5 + call $~lib/internal/memory/memset + end else get_local $1 call $~lib/internal/arraybuffer/allocateUnsafe set_local $5 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $3 - get_local $4 - get_local $3 - get_local $2 - call $~lib/internal/memory/memmove - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $6 - get_local $3 - get_local $4 - get_local $6 - call $~lib/internal/memory/memset + block $~lib/memory/memory.copy|inlined.2 + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $3 + get_local $4 + get_local $3 + get_local $2 + call $~lib/internal/memory/memmove + end + block $~lib/memory/memory.fill|inlined.2 + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $6 + get_local $3 + get_local $4 + get_local $6 + call $~lib/internal/memory/memset + end get_local $5 return end @@ -4320,13 +4328,15 @@ get_local $0 get_local $5 i32.store offset=4 - get_local $3 - get_local $2 - i32.const 2 - i32.shl - i32.add - get_local $1 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 + get_local $3 + get_local $2 + i32.const 2 + i32.shl + i32.add + get_local $1 + i32.store offset=8 + end get_local $5 ) (func $~lib/string/String#split (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -4440,13 +4450,15 @@ i32.add i32.load16_u offset=4 i32.store16 offset=4 - get_local $6 - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $8 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 + get_local $6 + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $8 + i32.store offset=8 + end end get_local $7 i32.const 1 @@ -4873,10 +4885,12 @@ get_local $2 call $~lib/internal/string/allocateUnsafe set_local $3 - get_local $3 - get_local $0 - get_local $2 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.0 + get_local $3 + get_local $0 + get_local $2 + call $~lib/internal/number/utoa32_lut + end get_local $1 if get_local $3 @@ -4900,10 +4914,12 @@ get_local $1 call $~lib/internal/string/allocateUnsafe set_local $2 - get_local $2 - get_local $0 - get_local $1 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.1 + get_local $2 + get_local $0 + get_local $1 + call $~lib/internal/number/utoa32_lut + end get_local $2 ) (func $~lib/internal/number/decimalCount64 (; 49 ;) (type $Ii) (param $0 i64) (result i32) @@ -5137,10 +5153,12 @@ get_local $3 call $~lib/internal/string/allocateUnsafe set_local $1 - get_local $1 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.2 + get_local $1 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa32_lut + end else get_local $0 call $~lib/internal/number/decimalCount64 @@ -5148,10 +5166,12 @@ get_local $3 call $~lib/internal/string/allocateUnsafe set_local $1 - get_local $1 - get_local $0 - get_local $3 - call $~lib/internal/number/utoa64_lut + block $~lib/internal/number/utoa64_core|inlined.0 + get_local $1 + get_local $0 + get_local $3 + call $~lib/internal/number/utoa64_lut + end end get_local $1 ) @@ -5193,10 +5213,12 @@ get_local $4 call $~lib/internal/string/allocateUnsafe set_local $2 - get_local $2 - get_local $3 - get_local $4 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.3 + get_local $2 + get_local $3 + get_local $4 + call $~lib/internal/number/utoa32_lut + end else get_local $0 call $~lib/internal/number/decimalCount64 @@ -5206,10 +5228,12 @@ get_local $4 call $~lib/internal/string/allocateUnsafe set_local $2 - get_local $2 - get_local $0 - get_local $4 - call $~lib/internal/number/utoa64_lut + block $~lib/internal/number/utoa64_core|inlined.1 + get_local $2 + get_local $0 + get_local $4 + call $~lib/internal/number/utoa64_lut + end end get_local $1 if @@ -5537,86 +5561,88 @@ get_local $14 i32.add set_global $~lib/internal/number/_K - block $~lib/internal/arraybuffer/loadUnsafe|inlined.6 (result i64) - get_local $16 - get_local $14 - i32.const 2 + block $~lib/internal/number/grisuRound|inlined.0 + block $~lib/internal/arraybuffer/loadUnsafe|inlined.6 (result i64) + get_local $16 + get_local $14 + i32.const 2 + i32.shl + i32.add + i64.load32_u offset=8 + end + get_local $7 + i64.extend_s/i32 + i64.shl + set_local $20 + get_local $0 + get_local $15 + i32.const 1 + i32.sub + i32.const 1 i32.shl i32.add - i64.load32_u offset=8 - end - get_local $7 - i64.extend_s/i32 - i64.shl - set_local $20 - get_local $0 - get_local $15 - i32.const 1 - i32.sub - i32.const 1 - i32.shl - i32.add - set_local $18 - get_local $18 - i32.load16_u offset=4 - set_local $21 - block $break|2 - loop $continue|2 - get_local $19 - get_local $10 - i64.lt_u - tee_local $22 - if (result i32) - get_local $5 - get_local $19 - i64.sub - get_local $20 - i64.ge_u - else - get_local $22 - end - tee_local $22 - if (result i32) + set_local $18 + get_local $18 + i32.load16_u offset=4 + set_local $21 + block $break|2 + loop $continue|2 get_local $19 - get_local $20 - i64.add get_local $10 i64.lt_u tee_local $22 if (result i32) - get_local $22 - else - get_local $10 + get_local $5 get_local $19 i64.sub - get_local $19 get_local $20 - i64.add - get_local $10 - i64.sub - i64.gt_u + i64.ge_u + else + get_local $22 end - else - get_local $22 - end - if - block - get_local $21 - i32.const 1 - i32.sub - set_local $21 + tee_local $22 + if (result i32) get_local $19 get_local $20 i64.add - set_local $19 + get_local $10 + i64.lt_u + tee_local $22 + if (result i32) + get_local $22 + else + get_local $10 + get_local $19 + i64.sub + get_local $19 + get_local $20 + i64.add + get_local $10 + i64.sub + i64.gt_u + end + else + get_local $22 + end + if + block + get_local $21 + i32.const 1 + i32.sub + set_local $21 + get_local $19 + get_local $20 + i64.add + set_local $19 + end + br $continue|2 end - br $continue|2 end end + get_local $18 + get_local $21 + i32.store16 offset=4 end - get_local $18 - get_local $21 - i32.store16 offset=4 get_local $15 return end @@ -5701,74 +5727,76 @@ end i64.mul set_local $10 - get_local $0 - get_local $15 - i32.const 1 - i32.sub - i32.const 1 - i32.shl - i32.add - set_local $17 - get_local $17 - i32.load16_u offset=4 - set_local $21 - block $break|4 - loop $continue|4 - get_local $13 - get_local $10 - i64.lt_u - tee_local $18 - if (result i32) - get_local $5 - get_local $13 - i64.sub - get_local $8 - i64.ge_u - else - get_local $18 - end - tee_local $18 - if (result i32) + block $~lib/internal/number/grisuRound|inlined.1 + get_local $0 + get_local $15 + i32.const 1 + i32.sub + i32.const 1 + i32.shl + i32.add + set_local $17 + get_local $17 + i32.load16_u offset=4 + set_local $21 + block $break|4 + loop $continue|4 get_local $13 - get_local $8 - i64.add get_local $10 i64.lt_u tee_local $18 if (result i32) - get_local $18 - else - get_local $10 + get_local $5 get_local $13 i64.sub - get_local $13 get_local $8 - i64.add - get_local $10 - i64.sub - i64.gt_u + i64.ge_u + else + get_local $18 end - else - get_local $18 - end - if - block - get_local $21 - i32.const 1 - i32.sub - set_local $21 + tee_local $18 + if (result i32) get_local $13 get_local $8 i64.add - set_local $13 + get_local $10 + i64.lt_u + tee_local $18 + if (result i32) + get_local $18 + else + get_local $10 + get_local $13 + i64.sub + get_local $13 + get_local $8 + i64.add + get_local $10 + i64.sub + i64.gt_u + end + else + get_local $18 + end + if + block + get_local $21 + i32.const 1 + i32.sub + set_local $21 + get_local $13 + get_local $8 + i64.add + set_local $13 + end + br $continue|4 end - br $continue|4 end end + get_local $17 + get_local $21 + i32.store16 offset=4 end - get_local $17 - get_local $21 - i32.store16 offset=4 get_local $15 return end @@ -5880,26 +5908,28 @@ i32.shl i32.add set_local $4 - get_local $4 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 2 - i32.add - set_local $5 - get_local $4 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $6 - i32.const 0 - get_local $2 - i32.sub - i32.const 1 - i32.shl - set_local $7 - get_local $5 - get_local $6 - get_local $7 - call $~lib/internal/memory/memmove + block $~lib/memory/memory.copy|inlined.3 + get_local $4 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 2 + i32.add + set_local $5 + get_local $4 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + i32.const 0 + get_local $2 + i32.sub + i32.const 1 + i32.shl + set_local $7 + get_local $5 + get_local $6 + get_local $7 + call $~lib/internal/memory/memmove + end get_local $0 get_local $3 i32.const 1 @@ -5928,26 +5958,28 @@ get_local $3 i32.sub set_local $4 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - get_local $4 - i32.const 1 - i32.shl - i32.add - set_local $7 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $6 - get_local $1 - i32.const 1 - i32.shl - set_local $5 - get_local $7 - get_local $6 - get_local $5 - call $~lib/internal/memory/memmove + block $~lib/memory/memory.copy|inlined.4 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + get_local $4 + i32.const 1 + i32.shl + i32.add + set_local $7 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + get_local $1 + i32.const 1 + i32.shl + set_local $5 + get_local $7 + get_local $6 + get_local $5 + call $~lib/internal/memory/memmove + end get_local $0 get_global $~lib/internal/string/CharCode._0 get_global $~lib/internal/string/CharCode.DOT @@ -6017,10 +6049,12 @@ i32.const 1 i32.add set_local $7 - get_local $4 - get_local $5 - get_local $7 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.4 + get_local $4 + get_local $5 + get_local $7 + call $~lib/internal/number/utoa32_lut + end get_local $4 get_global $~lib/internal/string/CharCode.MINUS get_global $~lib/internal/string/CharCode.PLUS @@ -6039,26 +6073,28 @@ i32.const 1 i32.shl set_local $7 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 4 - i32.add - set_local $6 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 2 - i32.add - set_local $5 - get_local $7 - i32.const 2 - i32.sub - set_local $4 - get_local $6 - get_local $5 - get_local $4 - call $~lib/internal/memory/memmove + block $~lib/memory/memory.copy|inlined.5 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 4 + i32.add + set_local $6 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 2 + i32.add + set_local $5 + get_local $7 + i32.const 2 + i32.sub + set_local $4 + get_local $6 + get_local $5 + get_local $4 + call $~lib/internal/memory/memmove + end get_local $0 get_global $~lib/internal/string/CharCode.DOT i32.store16 offset=6 @@ -6095,10 +6131,12 @@ i32.const 1 i32.add set_local $8 - get_local $4 - get_local $5 - get_local $8 - call $~lib/internal/number/utoa32_lut + block $~lib/internal/number/utoa32_core|inlined.5 + get_local $4 + get_local $5 + get_local $8 + call $~lib/internal/number/utoa32_lut + end get_local $4 get_global $~lib/internal/string/CharCode.MINUS get_global $~lib/internal/string/CharCode.PLUS @@ -6195,7 +6233,7 @@ i32.add i32.sub set_local $4 - block + block $~lib/internal/number/normalizedBoundaries|inlined.0 get_local $6 i64.const 1 i64.shl @@ -6244,7 +6282,7 @@ get_local $8 set_global $~lib/internal/number/_exp end - block + block $~lib/internal/number/getCachedPower|inlined.0 get_global $~lib/internal/number/_exp set_local $10 i32.const -61 @@ -6707,24 +6745,28 @@ get_local $2 call $~lib/string/String#substring set_local $3 - get_local $1 - i32.eqz - if - i32.const 0 - i32.const 112 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.0 + block $~lib/internal/string/freeUnsafe|inlined.0 block get_local $1 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.0 - unreachable + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.0 + block + get_local $1 + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.0 + unreachable + end + unreachable + end end - unreachable end get_local $3 ) diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 01147bfb35..e4ff89a220 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -1561,18 +1561,17 @@ get_local $0 get_local $1 i32.add - tee_local $2 + tee_local $0 i32.const 8 i32.add + tee_local $1 f64.load offset=8 set_local $7 - get_local $2 - i32.const 8 - i32.add - get_local $2 + get_local $1 + get_local $0 f64.load offset=8 f64.store offset=8 - get_local $2 + get_local $0 get_local $7 f64.store offset=8 ) @@ -1627,12 +1626,13 @@ get_local $3 get_local $2 i32.add - tee_local $1 i32.const 8 i32.add get_local $6 f64.store offset=8 - get_local $1 + get_local $3 + get_local $2 + i32.add get_local $5 f64.store offset=8 end diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 93c186f7d0..c68919af6a 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -484,16 +484,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.0 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -549,16 +551,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.1 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -614,16 +618,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.2 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -679,16 +685,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.3 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -744,16 +752,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.4 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -809,16 +819,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.5 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -874,16 +886,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.6 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -939,16 +953,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.7 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -1004,16 +1020,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.8 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -1069,16 +1087,18 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.9 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset + end get_local $0 if (result i32) get_local $0 @@ -1680,21 +1700,23 @@ call $~lib/env/abort unreachable end - get_local $0 - i32.load - set_local $3 - get_local $0 - i32.load offset=4 - set_local $4 - get_local $3 - get_local $4 - i32.add - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.0 + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 + end ) (func $~lib/internal/typedarray/TypedArray#__get (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -1846,21 +1868,23 @@ call $~lib/env/abort unreachable end - get_local $0 - i32.load - set_local $3 - get_local $0 - i32.load offset=4 - set_local $4 - get_local $3 - get_local $4 - i32.add - get_local $1 - i32.const 3 - i32.shl - i32.add - get_local $2 - f64.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.0 + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 3 + i32.shl + i32.add + get_local $2 + f64.store offset=8 + end ) (func $~lib/typedarray/Float64Array#subarray (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -2049,19 +2073,21 @@ end end end - get_local $6 - i32.const 1 - i32.add - set_local $8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $5 - f64.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.4 + get_local $6 + i32.const 1 + i32.add + set_local $8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $5 + f64.store offset=8 + end end get_local $4 i32.const 1 @@ -2100,12 +2126,14 @@ br $~lib/memory/memory.allocate|inlined.3 end set_local $5 - i32.const 0 - set_local $6 - get_local $5 - get_local $6 - get_local $4 - call $~lib/internal/memory/memset + block $~lib/memory/memory.fill|inlined.10 + i32.const 0 + set_local $6 + get_local $5 + get_local $6 + get_local $4 + call $~lib/internal/memory/memset + end block $break|0 get_local $2 i32.const 1 @@ -2210,24 +2238,28 @@ i32.shl i32.xor i32.store - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.5 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.6 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 + end end end get_local $6 @@ -2264,9 +2296,31 @@ f64.load offset=8 end set_local $10 - i32.const 0 - set_local $8 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.7 (result f64) + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.7 + i32.const 0 + set_local $8 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.7 (result f64) + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + f64.load offset=8 + end + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.8 get_local $0 get_local $1 i32.add @@ -2274,27 +2328,9 @@ i32.const 3 i32.shl i32.add - f64.load offset=8 + get_local $10 + f64.store offset=8 end - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 i32.const 1 set_local $8 block $break|3 @@ -2391,26 +2427,30 @@ i32.shl i32.xor i32.store - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 - i32.const 0 - set_local $11 - get_local $0 - get_local $1 - i32.add - get_local $11 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.9 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.10 + i32.const 0 + set_local $11 + get_local $0 + get_local $1 + i32.add + get_local $11 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + end end get_local $8 i32.const 1 @@ -2453,41 +2493,45 @@ f64.load offset=8 end set_local $12 - i32.const 1 - set_local $6 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.11 (result f64) + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.11 + i32.const 1 + set_local $6 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.11 (result f64) + i32.const 0 + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 3 + i32.shl + i32.add + f64.load offset=8 + end + set_local $10 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.12 i32.const 0 - set_local $7 + set_local $6 get_local $0 get_local $1 i32.add - get_local $7 + get_local $6 i32.const 3 i32.shl i32.add - f64.load offset=8 + get_local $12 + f64.store offset=8 end - set_local $10 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 - i32.const 0 - set_local $6 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $12 - f64.store offset=8 ) (func $~lib/internal/typedarray/TypedArray#sort (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -2557,28 +2601,32 @@ i32.const 0 i32.lt_s if - i32.const 1 - set_local $5 - get_local $4 - get_local $2 - i32.add - get_local $5 - i32.const 3 - i32.shl - i32.add - get_local $7 - f64.store offset=8 - i32.const 0 - set_local $5 - get_local $4 - get_local $2 - i32.add - get_local $5 - i32.const 3 - i32.shl - i32.add - get_local $6 - f64.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 + i32.const 1 + set_local $5 + get_local $4 + get_local $2 + i32.add + get_local $5 + i32.const 3 + i32.shl + i32.add + get_local $7 + f64.store offset=8 + end + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.2 + i32.const 0 + set_local $5 + get_local $4 + get_local $2 + i32.add + get_local $5 + i32.const 3 + i32.shl + i32.add + get_local $6 + f64.store offset=8 + end end get_local $0 return @@ -2705,21 +2753,23 @@ call $~lib/env/abort unreachable end - get_local $0 - i32.load - set_local $3 - get_local $0 - i32.load offset=4 - set_local $4 - get_local $3 - get_local $4 - i32.add - get_local $1 - i32.const 0 - i32.shl - i32.add - get_local $2 - i32.store8 offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.0 + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 0 + i32.shl + i32.add + get_local $2 + i32.store8 offset=8 + end ) (func $~lib/typedarray/Uint8ClampedArray#__set (; 30 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) @@ -2794,21 +2844,23 @@ call $~lib/env/abort unreachable end - get_local $0 - i32.load - set_local $3 - get_local $0 - i32.load offset=4 - set_local $4 - get_local $3 - get_local $4 - i32.add - get_local $1 - i32.const 0 - i32.shl - i32.add - get_local $2 - i32.store8 offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.0 + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 0 + i32.shl + i32.add + get_local $2 + i32.store8 offset=8 + end ) (func $~lib/internal/typedarray/TypedArray#fill (; 33 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (local $4 i32) @@ -3223,15 +3275,17 @@ i32.lt_s i32.eqz br_if $break|0 - get_local $4 - get_local $5 - i32.add - get_local $2 - i32.const 2 - i32.shl - i32.add - get_local $1 - i32.store offset=8 + block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 + get_local $4 + get_local $5 + i32.add + get_local $2 + i32.const 2 + i32.shl + i32.add + get_local $1 + i32.store offset=8 + end get_local $2 i32.const 1 i32.add From 5955690eb0297ab732c7c2f139b6c9c2709e20ff Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 18:00:41 +0200 Subject: [PATCH 02/13] update tests --- .../compiler/inlining-recursive.untouched.wat | 4 +- tests/compiler/inlining.untouched.wat | 6 +- .../std/allocator_arena.untouched.wat | 4 +- .../compiler/std/array-literal.untouched.wat | 88 +- tests/compiler/std/array.optimized.wat | 87 +- tests/compiler/std/array.untouched.wat | 2868 ++++++++--------- tests/compiler/std/arraybuffer.untouched.wat | 30 +- tests/compiler/std/dataview.untouched.wat | 1056 +++--- tests/compiler/std/gc-array.untouched.wat | 110 +- tests/compiler/std/math.untouched.wat | 2 +- tests/compiler/std/pointer.untouched.wat | 2 +- tests/compiler/std/static-array.untouched.wat | 158 +- tests/compiler/std/string-utf8.untouched.wat | 18 +- tests/compiler/std/string.optimized.wat | 6 +- tests/compiler/std/string.untouched.wat | 626 ++-- tests/compiler/std/typedarray.optimized.wat | 16 +- tests/compiler/std/typedarray.untouched.wat | 650 ++-- 17 files changed, 2649 insertions(+), 3082 deletions(-) diff --git a/tests/compiler/inlining-recursive.untouched.wat b/tests/compiler/inlining-recursive.untouched.wat index 074ea84a33..04081e731b 100644 --- a/tests/compiler/inlining-recursive.untouched.wat +++ b/tests/compiler/inlining-recursive.untouched.wat @@ -16,9 +16,7 @@ call $inlining-recursive/bar ) (func $inlining-recursive/bar (; 2 ;) (type $v) - block $inlining-recursive/bar|inlined.0 - call $inlining-recursive/baz - end + call $inlining-recursive/baz ) (func $null (; 3 ;) (type $v) ) diff --git a/tests/compiler/inlining.untouched.wat b/tests/compiler/inlining.untouched.wat index 67133fb4d3..8ae32ff48b 100644 --- a/tests/compiler/inlining.untouched.wat +++ b/tests/compiler/inlining.untouched.wat @@ -214,10 +214,8 @@ call $~lib/env/abort unreachable end - block $inlining/func_iv|inlined.0 - i32.const 0 - set_local $2 - end + i32.const 0 + set_local $2 block (result i32) i32.const 1 set_global $~argc diff --git a/tests/compiler/std/allocator_arena.untouched.wat b/tests/compiler/std/allocator_arena.untouched.wat index c883c9aa34..8dd74e747b 100644 --- a/tests/compiler/std/allocator_arena.untouched.wat +++ b/tests/compiler/std/allocator_arena.untouched.wat @@ -1888,7 +1888,7 @@ call $~lib/env/abort unreachable end - block $~lib/memory/memory.fill|inlined.0 + block get_global $std/allocator_arena/ptr1 set_local $0 i32.const 18 @@ -1933,7 +1933,7 @@ end unreachable end - block $~lib/memory/memory.copy|inlined.0 + block get_global $std/allocator_arena/ptr2 set_local $2 get_global $std/allocator_arena/ptr1 diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index dca7119712..38071b41dd 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -507,18 +507,16 @@ get_local $0 get_local $1 i32.store offset=4 - block $~lib/memory/memory.fill|inlined.0 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -581,18 +579,16 @@ get_local $0 get_local $1 i32.store offset=4 - block $~lib/memory/memory.fill|inlined.1 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -655,18 +651,16 @@ get_local $0 get_local $1 i32.store offset=4 - block $~lib/memory/memory.fill|inlined.2 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -745,18 +739,16 @@ get_local $0 get_local $1 i32.store offset=4 - block $~lib/memory/memory.fill|inlined.3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 2acbc30ca4..91439cc8ea 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -2666,6 +2666,7 @@ (local $1 i32) (local $2 i32) (local $3 i32) + (local $4 i32) get_local $0 i32.load offset=4 tee_local $1 @@ -2696,11 +2697,10 @@ tee_local $1 i32.const 2 i32.shl + tee_local $4 call $~lib/internal/memory/memmove get_local $2 - get_local $1 - i32.const 2 - i32.shl + get_local $4 i32.add i32.const 0 i32.store offset=8 @@ -4097,11 +4097,12 @@ get_local $0 i32.const 4 i32.add - tee_local $1 + tee_local $2 f32.load offset=8 set_local $6 - get_local $1 + get_local $2 get_local $0 + tee_local $1 f32.load offset=8 f32.store offset=8 get_local $0 @@ -4686,11 +4687,12 @@ get_local $0 i32.const 8 i32.add - tee_local $1 + tee_local $2 f64.load offset=8 set_local $6 - get_local $1 + get_local $2 get_local $0 + tee_local $1 f64.load offset=8 f64.store offset=8 get_local $0 @@ -5047,27 +5049,27 @@ get_local $1 i32.const 1 i32.sub - set_local $3 + set_local $4 loop $repeat|0 - get_local $3 + get_local $4 i32.const 0 i32.le_s br_if $break|0 - get_local $3 - set_local $4 + get_local $4 + set_local $3 loop $continue|1 - get_local $4 + get_local $3 i32.const 1 i32.and get_local $7 - get_local $4 + get_local $3 i32.const 6 i32.shr_s i32.const 2 i32.shl i32.add i32.load - get_local $4 + get_local $3 i32.const 1 i32.shr_s i32.const 31 @@ -5077,15 +5079,15 @@ i32.and i32.eq if - get_local $4 + get_local $3 i32.const 1 i32.shr_s - set_local $4 + set_local $3 br $continue|1 end end get_local $0 - get_local $4 + get_local $3 i32.const 1 i32.shr_s tee_local $5 @@ -5093,9 +5095,9 @@ i32.shl i32.add i32.load offset=8 - set_local $4 + set_local $3 get_local $0 - get_local $3 + get_local $4 i32.const 2 i32.shl i32.add @@ -5103,7 +5105,7 @@ set_local $6 i32.const 2 set_global $~argc - get_local $4 + get_local $3 get_local $6 get_local $2 call_indirect (type $iii) @@ -5111,7 +5113,7 @@ i32.lt_s if get_local $7 - get_local $3 + get_local $4 i32.const 5 i32.shr_s i32.const 2 @@ -5121,18 +5123,18 @@ get_local $8 i32.load i32.const 1 - get_local $3 + get_local $4 i32.const 31 i32.and i32.shl i32.xor i32.store get_local $0 - get_local $3 + get_local $4 i32.const 2 i32.shl i32.add - get_local $4 + get_local $3 i32.store offset=8 get_local $0 get_local $5 @@ -5142,10 +5144,10 @@ get_local $6 i32.store offset=8 end - get_local $3 + get_local $4 i32.const 1 i32.sub - set_local $3 + set_local $4 br $repeat|0 unreachable end @@ -5155,9 +5157,9 @@ get_local $1 i32.const 1 i32.sub - set_local $3 + set_local $4 loop $repeat|2 - get_local $3 + get_local $4 i32.const 2 i32.lt_s br_if $break|2 @@ -5166,7 +5168,7 @@ set_local $6 get_local $0 get_local $0 - get_local $3 + get_local $4 i32.const 2 i32.shl i32.add @@ -5197,11 +5199,11 @@ i32.const 1 i32.and i32.add - tee_local $4 - get_local $3 + tee_local $3 + get_local $4 i32.lt_s if - get_local $4 + get_local $3 set_local $5 br $continue|3 end @@ -5220,11 +5222,11 @@ i32.shl i32.add i32.load offset=8 - set_local $4 + set_local $3 i32.const 2 set_global $~argc get_local $6 - get_local $4 + get_local $3 get_local $2 call_indirect (type $iii) i32.const 0 @@ -5255,7 +5257,7 @@ get_local $6 i32.store offset=8 get_local $0 - get_local $4 + get_local $3 i32.store offset=8 end get_local $5 @@ -5265,10 +5267,10 @@ br $continue|4 end end - get_local $3 + get_local $4 i32.const 1 i32.sub - set_local $3 + set_local $4 br $repeat|2 unreachable end @@ -5277,11 +5279,12 @@ get_local $0 i32.const 4 i32.add - tee_local $2 + tee_local $3 i32.load offset=8 set_local $1 - get_local $2 + get_local $3 get_local $0 + tee_local $2 i32.load offset=8 i32.store offset=8 get_local $0 @@ -7575,11 +7578,7 @@ i32.const 1 i32.shl call $~lib/internal/memory/memmove - get_local $0 - get_local $4 - i32.const 1 - i32.shl - i32.add + get_local $3 i32.const 46 i32.store16 offset=4 get_local $1 diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index f8117124d9..920065a69b 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -785,18 +785,16 @@ get_local $0 get_local $1 i32.store offset=4 - block $~lib/memory/memory.fill|inlined.0 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $~lib/array/Array.isArray | null> (; 8 ;) (type $ii) (param $0 i32) (result i32) @@ -1098,15 +1096,13 @@ i32.lt_s i32.eqz br_if $break|0 - block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 - get_local $4 - get_local $2 - i32.const 2 - i32.shl - i32.add - get_local $1 - i32.store offset=8 - end + get_local $4 + get_local $2 + i32.const 2 + i32.shl + i32.add + get_local $1 + i32.store offset=8 get_local $2 i32.const 1 i32.add @@ -2696,60 +2692,54 @@ get_local $0 get_local $1 i32.store - block $~lib/memory/memory.fill|inlined.2 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $5 - get_local $3 - get_local $4 - get_local $5 - call $~lib/internal/memory/memset - end + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $5 + get_local $3 + get_local $4 + get_local $5 + call $~lib/internal/memory/memset else get_local $1 call $~lib/internal/arraybuffer/allocateUnsafe set_local $5 - block $~lib/memory/memory.copy|inlined.0 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $3 - get_local $4 - get_local $3 - get_local $2 - call $~lib/internal/memory/memmove - end - block $~lib/memory/memory.fill|inlined.3 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $6 - get_local $3 - get_local $4 - get_local $6 - call $~lib/internal/memory/memset - end + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $3 + get_local $4 + get_local $3 + get_local $2 + call $~lib/internal/memory/memmove + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $6 + get_local $3 + get_local $4 + get_local $6 + call $~lib/internal/memory/memset get_local $5 return end @@ -2825,15 +2815,13 @@ get_local $0 get_local $5 i32.store offset=4 - block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 - get_local $3 - get_local $2 - i32.const 2 - i32.shl - i32.add - get_local $1 - i32.store offset=8 - end + get_local $3 + get_local $2 + i32.const 2 + i32.shl + i32.add + get_local $1 + i32.store offset=8 get_local $5 ) (func $~lib/array/Array#__get (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -3120,24 +3108,22 @@ get_local $11 if block - block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 - block $~lib/internal/arraybuffer/loadUnsafe|inlined.2 (result i32) - get_local $4 - get_local $9 - i32.const 2 - i32.shl - i32.add - i32.load offset=8 - end - set_local $6 + block $~lib/internal/arraybuffer/loadUnsafe|inlined.2 (result i32) get_local $4 - get_local $8 + get_local $9 i32.const 2 i32.shl i32.add - get_local $6 - i32.store offset=8 + i32.load offset=8 end + set_local $6 + get_local $4 + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $6 + i32.store offset=8 get_local $9 i32.const 1 i32.sub @@ -3315,39 +3301,35 @@ get_local $2 i32.store end - block $~lib/memory/memory.copy|inlined.4 - get_local $2 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - i32.const 4 - i32.add - set_local $6 - get_local $2 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $7 - get_local $3 - i32.const 1 - i32.sub - i32.const 2 - i32.shl - set_local $8 - get_local $6 - get_local $7 - get_local $8 - call $~lib/internal/memory/memmove - end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 - i32.const 0 - set_local $8 - get_local $2 - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $1 - i32.store offset=8 - end + get_local $2 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + i32.const 4 + i32.add + set_local $6 + get_local $2 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $7 + get_local $3 + i32.const 1 + i32.sub + i32.const 2 + i32.shl + set_local $8 + get_local $6 + get_local $7 + get_local $8 + call $~lib/internal/memory/memmove + i32.const 0 + set_local $8 + get_local $2 + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $1 + i32.store offset=8 get_local $0 get_local $5 i32.store offset=4 @@ -3393,37 +3375,33 @@ i32.const 1 i32.sub set_local $5 - block $~lib/memory/memory.copy|inlined.5 - get_local $2 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $3 - get_local $2 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - i32.const 4 - i32.add - set_local $6 - get_local $5 - i32.const 2 - i32.shl - set_local $7 - get_local $3 - get_local $6 - get_local $7 - call $~lib/internal/memory/memmove - end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.3 - i32.const 0 - set_local $7 - get_local $2 - get_local $5 - i32.const 2 - i32.shl - i32.add - get_local $7 - i32.store offset=8 - end + get_local $2 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $3 + get_local $2 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + i32.const 4 + i32.add + set_local $6 + get_local $5 + i32.const 2 + i32.shl + set_local $7 + get_local $3 + get_local $6 + get_local $7 + call $~lib/internal/memory/memmove + i32.const 0 + set_local $7 + get_local $2 + get_local $5 + i32.const 2 + i32.shl + i32.add + get_local $7 + i32.store offset=8 get_local $0 get_local $5 i32.store offset=4 @@ -3464,33 +3442,29 @@ i32.load offset=8 end set_local $4 - block $~lib/internal/arraybuffer/storeUnsafe|inlined.4 - block $~lib/internal/arraybuffer/loadUnsafe|inlined.5 (result i32) - get_local $1 - get_local $3 - i32.const 2 - i32.shl - i32.add - i32.load offset=8 - end - set_local $5 - get_local $1 - get_local $2 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.5 + block $~lib/internal/arraybuffer/loadUnsafe|inlined.5 (result i32) get_local $1 get_local $3 i32.const 2 i32.shl i32.add - get_local $4 - i32.store offset=8 + i32.load offset=8 end + set_local $5 + get_local $1 + get_local $2 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + get_local $1 + get_local $3 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 end block get_local $2 @@ -3634,34 +3608,32 @@ get_local $0 i32.load set_local $6 - block $~lib/memory/memory.copy|inlined.6 - get_local $6 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $1 - i32.const 2 - i32.shl - i32.add - set_local $4 - get_local $6 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $1 - get_local $2 - i32.add - i32.const 2 - i32.shl - i32.add - set_local $5 - get_local $2 - i32.const 2 - i32.shl - set_local $7 - get_local $4 - get_local $5 - get_local $7 - call $~lib/internal/memory/memmove - end + get_local $6 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $1 + i32.const 2 + i32.shl + i32.add + set_local $4 + get_local $6 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $1 + get_local $2 + i32.add + i32.const 2 + i32.shl + i32.add + set_local $5 + get_local $2 + i32.const 2 + i32.shl + set_local $7 + get_local $4 + get_local $5 + get_local $7 + call $~lib/internal/memory/memmove get_local $0 get_local $3 get_local $2 @@ -3711,15 +3683,13 @@ i32.add i32.store offset=4 end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.6 - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 - end + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 ) (func $start~anonymous|1 (; 37 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) get_local $0 @@ -4154,18 +4124,16 @@ get_local $0 get_local $1 i32.store offset=4 - block $~lib/memory/memory.fill|inlined.4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $~lib/array/Array#map (; 63 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -4207,7 +4175,7 @@ end i32.eqz br_if $break|0 - block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + block block (result f32) i32.const 3 set_global $~argc @@ -4315,7 +4283,7 @@ end i32.eqz br_if $break|0 - block $~lib/internal/arraybuffer/storeUnsafe|inlined.7 + block block (result i32) i32.const 3 set_global $~argc @@ -5000,21 +4968,19 @@ end end end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 - get_local $6 - i32.const 1 - i32.add - set_local $8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $5 - f32.store offset=8 - end + get_local $6 + i32.const 1 + i32.add + set_local $8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $5 + f32.store offset=8 end get_local $4 i32.const 1 @@ -5053,14 +5019,12 @@ br $~lib/memory/memory.allocate|inlined.1 end set_local $5 - block $~lib/memory/memory.fill|inlined.5 - i32.const 0 - set_local $6 - get_local $5 - get_local $6 - get_local $4 - call $~lib/internal/memory/memset - end + i32.const 0 + set_local $6 + get_local $5 + get_local $6 + get_local $4 + call $~lib/internal/memory/memset block $break|0 get_local $2 i32.const 1 @@ -5165,28 +5129,24 @@ i32.shl i32.xor i32.store - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.2 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $9 - f32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.3 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - f32.store offset=8 - end + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $9 + f32.store offset=8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + f32.store offset=8 end end get_local $6 @@ -5223,31 +5183,9 @@ f32.load offset=8 end set_local $10 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.4 - i32.const 0 - set_local $8 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result f32) - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - f32.load offset=8 - end - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $9 - f32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.5 + i32.const 0 + set_local $8 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result f32) get_local $0 get_local $1 i32.add @@ -5255,9 +5193,27 @@ i32.const 2 i32.shl i32.add - get_local $10 - f32.store offset=8 + f32.load offset=8 end + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $9 + f32.store offset=8 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $10 + f32.store offset=8 i32.const 1 set_local $8 block $break|3 @@ -5354,32 +5310,28 @@ i32.shl i32.xor i32.store - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.6 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - f32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.7 - i32.const 0 - set_local $11 - get_local $0 - get_local $1 - i32.add - get_local $11 - i32.const 2 - i32.shl - i32.add - get_local $9 - f32.store offset=8 - end - end - get_local $8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + f32.store offset=8 + i32.const 0 + set_local $11 + get_local $0 + get_local $1 + i32.add + get_local $11 + i32.const 2 + i32.shl + i32.add + get_local $9 + f32.store offset=8 + end + get_local $8 i32.const 1 i32.shr_s set_local $8 @@ -5420,45 +5372,41 @@ f32.load offset=8 end set_local $12 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.8 - i32.const 1 - set_local $6 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result f32) - i32.const 0 - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - f32.load offset=8 - end - set_local $10 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $10 - f32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.9 + i32.const 1 + set_local $6 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result f32) i32.const 0 - set_local $6 + set_local $7 get_local $0 get_local $1 i32.add - get_local $6 + get_local $7 i32.const 2 i32.shl i32.add - get_local $12 - f32.store offset=8 + f32.load offset=8 end + set_local $10 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $10 + f32.store offset=8 + i32.const 0 + set_local $6 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $12 + f32.store offset=8 ) (func $~lib/array/Array#sort (; 98 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -5526,28 +5474,24 @@ i32.const 0 i32.lt_s if - block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 - i32.const 1 - set_local $4 - get_local $3 - get_local $4 - i32.const 2 - i32.shl - i32.add - get_local $6 - f32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 - i32.const 0 - set_local $4 - get_local $3 - get_local $4 - i32.const 2 - i32.shl - i32.add - get_local $5 - f32.store offset=8 - end + i32.const 1 + set_local $4 + get_local $3 + get_local $4 + i32.const 2 + i32.shl + i32.add + get_local $6 + f32.store offset=8 + i32.const 0 + set_local $4 + get_local $3 + get_local $4 + i32.const 2 + i32.shl + i32.add + get_local $5 + f32.store offset=8 end get_local $0 return @@ -5791,21 +5735,19 @@ end end end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 - get_local $6 - i32.const 1 - i32.add - set_local $8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $5 - f64.store offset=8 - end + get_local $6 + i32.const 1 + i32.add + set_local $8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $5 + f64.store offset=8 end get_local $4 i32.const 1 @@ -5841,14 +5783,12 @@ br $~lib/memory/memory.allocate|inlined.2 end set_local $5 - block $~lib/memory/memory.fill|inlined.6 - i32.const 0 - set_local $6 - get_local $5 - get_local $6 - get_local $4 - call $~lib/internal/memory/memset - end + i32.const 0 + set_local $6 + get_local $5 + get_local $6 + get_local $4 + call $~lib/internal/memory/memset block $break|0 get_local $2 i32.const 1 @@ -5953,28 +5893,24 @@ i32.shl i32.xor i32.store - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.2 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.3 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 - end + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 end end get_local $6 @@ -6011,31 +5947,9 @@ f64.load offset=8 end set_local $10 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.4 - i32.const 0 - set_local $8 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result f64) - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - f64.load offset=8 - end - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.5 + i32.const 0 + set_local $8 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result f64) get_local $0 get_local $1 i32.add @@ -6043,9 +5957,27 @@ i32.const 3 i32.shl i32.add - get_local $10 - f64.store offset=8 + f64.load offset=8 end + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 i32.const 1 set_local $8 block $break|3 @@ -6142,44 +6074,40 @@ i32.shl i32.xor i32.store - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.6 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.7 - i32.const 0 - set_local $11 - get_local $0 - get_local $1 - i32.add - get_local $11 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - end - end - get_local $8 - i32.const 1 - i32.shr_s - set_local $8 - end - br $continue|4 - end - end - end - end - get_local $6 - i32.const 1 - i32.sub + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 + i32.const 0 + set_local $11 + get_local $0 + get_local $1 + i32.add + get_local $11 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + end + get_local $8 + i32.const 1 + i32.shr_s + set_local $8 + end + br $continue|4 + end + end + end + end + get_local $6 + i32.const 1 + i32.sub set_local $6 br $repeat|2 unreachable @@ -6208,45 +6136,41 @@ f64.load offset=8 end set_local $12 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.8 - i32.const 1 - set_local $6 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result f64) - i32.const 0 - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 3 - i32.shl - i32.add - f64.load offset=8 - end - set_local $10 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.9 + i32.const 1 + set_local $6 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result f64) i32.const 0 - set_local $6 + set_local $7 get_local $0 get_local $1 i32.add - get_local $6 + get_local $7 i32.const 3 i32.shl i32.add - get_local $12 - f64.store offset=8 + f64.load offset=8 end + set_local $10 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 + i32.const 0 + set_local $6 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $12 + f64.store offset=8 ) (func $~lib/array/Array#sort (; 105 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -6314,28 +6238,24 @@ i32.const 0 i32.lt_s if - block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 - i32.const 1 - set_local $4 - get_local $3 - get_local $4 - i32.const 3 - i32.shl - i32.add - get_local $6 - f64.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 - i32.const 0 - set_local $4 - get_local $3 - get_local $4 - i32.const 3 - i32.shl - i32.add - get_local $5 - f64.store offset=8 - end + i32.const 1 + set_local $4 + get_local $3 + get_local $4 + i32.const 3 + i32.shl + i32.add + get_local $6 + f64.store offset=8 + i32.const 0 + set_local $4 + get_local $3 + get_local $4 + i32.const 3 + i32.shl + i32.add + get_local $5 + f64.store offset=8 end get_local $0 return @@ -6601,21 +6521,19 @@ end end end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 - get_local $6 - i32.const 1 - i32.add - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - end + get_local $6 + i32.const 1 + i32.add + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 end get_local $4 i32.const 1 @@ -6651,14 +6569,12 @@ br $~lib/memory/memory.allocate|inlined.3 end set_local $5 - block $~lib/memory/memory.fill|inlined.7 - i32.const 0 - set_local $6 - get_local $5 - get_local $6 - get_local $4 - call $~lib/internal/memory/memset - end + i32.const 0 + set_local $6 + get_local $5 + get_local $6 + get_local $4 + call $~lib/internal/memory/memset block $break|0 get_local $2 i32.const 1 @@ -6763,28 +6679,24 @@ i32.shl i32.xor i32.store - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.2 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $9 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.3 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - i32.store offset=8 - end + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $9 + i32.store offset=8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + i32.store offset=8 end end get_local $6 @@ -6821,31 +6733,9 @@ i32.load offset=8 end set_local $10 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.4 - i32.const 0 - set_local $9 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result i32) - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - i32.load offset=8 - end - set_local $8 - get_local $0 - get_local $1 - i32.add - get_local $9 - i32.const 2 - i32.shl - i32.add - get_local $8 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.5 + i32.const 0 + set_local $9 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result i32) get_local $0 get_local $1 i32.add @@ -6853,9 +6743,27 @@ i32.const 2 i32.shl i32.add - get_local $10 - i32.store offset=8 + i32.load offset=8 end + set_local $8 + get_local $0 + get_local $1 + i32.add + get_local $9 + i32.const 2 + i32.shl + i32.add + get_local $8 + i32.store offset=8 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $10 + i32.store offset=8 i32.const 1 set_local $8 block $break|3 @@ -6952,30 +6860,26 @@ i32.shl i32.xor i32.store - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.6 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.7 - i32.const 0 - set_local $11 - get_local $0 - get_local $1 - i32.add - get_local $11 - i32.const 2 - i32.shl - i32.add - get_local $7 - i32.store offset=8 - end + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + i32.store offset=8 + i32.const 0 + set_local $11 + get_local $0 + get_local $1 + i32.add + get_local $11 + i32.const 2 + i32.shl + i32.add + get_local $7 + i32.store offset=8 end get_local $8 i32.const 1 @@ -7018,33 +6922,9 @@ i32.load offset=8 end set_local $12 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.8 - i32.const 1 - set_local $6 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result i32) - i32.const 0 - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $9 - i32.const 2 - i32.shl - i32.add - i32.load offset=8 - end - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $9 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.9 + i32.const 1 + set_local $6 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result i32) i32.const 0 set_local $9 get_local $0 @@ -7054,9 +6934,29 @@ i32.const 2 i32.shl i32.add - get_local $12 - i32.store offset=8 + i32.load offset=8 end + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $9 + i32.store offset=8 + i32.const 0 + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $9 + i32.const 2 + i32.shl + i32.add + get_local $12 + i32.store offset=8 ) (func $~lib/array/Array#sort (; 113 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -7124,28 +7024,24 @@ i32.const 0 i32.lt_s if - block $~lib/internal/arraybuffer/storeUnsafe|inlined.8 - i32.const 1 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.9 - i32.const 0 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 - end + i32.const 1 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + i32.const 0 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 end get_local $0 return @@ -7281,21 +7177,19 @@ end end end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 - get_local $6 - i32.const 1 - i32.add - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - end + get_local $6 + i32.const 1 + i32.add + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 end get_local $4 i32.const 1 @@ -7331,14 +7225,12 @@ br $~lib/memory/memory.allocate|inlined.4 end set_local $5 - block $~lib/memory/memory.fill|inlined.8 - i32.const 0 - set_local $6 - get_local $5 - get_local $6 - get_local $4 - call $~lib/internal/memory/memset - end + i32.const 0 + set_local $6 + get_local $5 + get_local $6 + get_local $4 + call $~lib/internal/memory/memset block $break|0 get_local $2 i32.const 1 @@ -7443,28 +7335,24 @@ i32.shl i32.xor i32.store - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.2 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $9 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.3 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - i32.store offset=8 - end + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $9 + i32.store offset=8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + i32.store offset=8 end end get_local $6 @@ -7501,31 +7389,9 @@ i32.load offset=8 end set_local $10 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.4 - i32.const 0 - set_local $9 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result i32) - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - i32.load offset=8 - end - set_local $8 - get_local $0 - get_local $1 - i32.add - get_local $9 - i32.const 2 - i32.shl - i32.add - get_local $8 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.5 + i32.const 0 + set_local $9 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.5 (result i32) get_local $0 get_local $1 i32.add @@ -7533,9 +7399,27 @@ i32.const 2 i32.shl i32.add - get_local $10 - i32.store offset=8 + i32.load offset=8 end + set_local $8 + get_local $0 + get_local $1 + i32.add + get_local $9 + i32.const 2 + i32.shl + i32.add + get_local $8 + i32.store offset=8 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $10 + i32.store offset=8 i32.const 1 set_local $8 block $break|3 @@ -7632,30 +7516,26 @@ i32.shl i32.xor i32.store - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.6 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 2 - i32.shl - i32.add - get_local $10 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.7 - i32.const 0 - set_local $11 - get_local $0 - get_local $1 - i32.add - get_local $11 - i32.const 2 - i32.shl - i32.add - get_local $7 - i32.store offset=8 - end + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 2 + i32.shl + i32.add + get_local $10 + i32.store offset=8 + i32.const 0 + set_local $11 + get_local $0 + get_local $1 + i32.add + get_local $11 + i32.const 2 + i32.shl + i32.add + get_local $7 + i32.store offset=8 end get_local $8 i32.const 1 @@ -7698,33 +7578,9 @@ i32.load offset=8 end set_local $12 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.8 - i32.const 1 - set_local $6 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result i32) - i32.const 0 - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $9 - i32.const 2 - i32.shl - i32.add - i32.load offset=8 - end - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $9 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.9 + i32.const 1 + set_local $6 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.9 (result i32) i32.const 0 set_local $9 get_local $0 @@ -7734,9 +7590,29 @@ i32.const 2 i32.shl i32.add - get_local $12 - i32.store offset=8 + i32.load offset=8 end + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $9 + i32.store offset=8 + i32.const 0 + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $9 + i32.const 2 + i32.shl + i32.add + get_local $12 + i32.store offset=8 ) (func $~lib/array/Array#sort (; 118 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -7804,28 +7680,24 @@ i32.const 0 i32.lt_s if - block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 - i32.const 1 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 - i32.const 0 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 - end + i32.const 1 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + i32.const 0 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 end get_local $0 return @@ -8162,18 +8034,16 @@ get_local $0 get_local $1 i32.store offset=4 - block $~lib/memory/memory.fill|inlined.9 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $~lib/array/Array>#__set (; 133 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -8219,15 +8089,13 @@ i32.add i32.store offset=4 end - block $~lib/internal/arraybuffer/storeUnsafe,Array>|inlined.0 - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 - end + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 ) (func $~lib/array/Array>#__get (; 134 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -8399,21 +8267,19 @@ end end end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset,Array>|inlined.1 - get_local $6 - i32.const 1 - i32.add - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - end + get_local $6 + i32.const 1 + i32.add + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 end get_local $4 i32.const 1 @@ -8491,28 +8357,24 @@ i32.const 0 i32.lt_s if - block $~lib/internal/arraybuffer/storeUnsafe,Array>|inlined.1 - i32.const 1 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafe,Array>|inlined.2 - i32.const 0 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 - end + i32.const 1 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + i32.const 0 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 end get_local $0 return @@ -8638,18 +8500,16 @@ get_local $0 get_local $1 i32.store offset=4 - block $~lib/memory/memory.fill|inlined.10 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $std/array/Proxy#constructor (; 142 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -8714,15 +8574,13 @@ i32.add i32.store offset=4 end - block $~lib/internal/arraybuffer/storeUnsafe,Proxy>|inlined.0 - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 - end + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 ) (func $std/array/createReverseOrderedElementsArray (; 144 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) @@ -8862,21 +8720,19 @@ end end end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset,Proxy>|inlined.1 - get_local $6 - i32.const 1 - i32.add - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - end + get_local $6 + i32.const 1 + i32.add + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 end get_local $4 i32.const 1 @@ -8954,28 +8810,24 @@ i32.const 0 i32.lt_s if - block $~lib/internal/arraybuffer/storeUnsafe,Proxy>|inlined.1 - i32.const 1 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafe,Proxy>|inlined.2 - i32.const 0 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 - end + i32.const 1 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + i32.const 0 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 end get_local $0 return @@ -9346,31 +9198,29 @@ i32.const 2 i32.shl i32.add - get_local $7 - i32.store offset=8 - else - br $break|1 - end - end - br $continue|1 - end - end - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 - get_local $6 - i32.const 1 - i32.add - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 + get_local $7 + i32.store offset=8 + else + br $break|1 + end + end + br $continue|1 + end + end end + get_local $6 + i32.const 1 + i32.add + set_local $7 + get_local $0 + get_local $1 + i32.add + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 end get_local $4 i32.const 1 @@ -9448,28 +9298,24 @@ i32.const 0 i32.lt_s if - block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 - i32.const 1 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $5 - i32.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 - i32.const 0 - set_local $6 - get_local $3 - get_local $6 - i32.const 2 - i32.shl - i32.add - get_local $4 - i32.store offset=8 - end + i32.const 1 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $5 + i32.store offset=8 + i32.const 0 + set_local $6 + get_local $3 + get_local $6 + i32.const 2 + i32.shl + i32.add + get_local $4 + i32.store offset=8 end get_local $0 return @@ -9726,18 +9572,16 @@ get_local $0 get_local $1 i32.store offset=4 - block $~lib/memory/memory.fill|inlined.11 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $~lib/internal/string/allocateUnsafe (; 164 ;) (type $ii) (param $0 i32) (result i32) @@ -9998,15 +9842,13 @@ i32.add i32.store offset=4 end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 - end + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 ) (func $std/array/createRandomStringArray (; 171 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) @@ -10342,28 +10184,24 @@ get_local $11 call $~lib/string/String#substring set_local $12 - block $~lib/internal/string/freeUnsafe|inlined.0 + get_local $10 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.4 block get_local $10 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.4 - block - get_local $10 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.4 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.4 + unreachable end + unreachable end end get_local $12 @@ -10620,12 +10458,10 @@ get_local $2 call $~lib/internal/string/allocateUnsafe set_local $3 - block $~lib/internal/number/utoa32_core|inlined.0 - get_local $3 - get_local $0 - get_local $2 - call $~lib/internal/number/utoa32_lut - end + get_local $3 + get_local $0 + get_local $2 + call $~lib/internal/number/utoa32_lut get_local $1 if get_local $3 @@ -10675,12 +10511,10 @@ get_local $4 i32.add set_local $3 - block $~lib/internal/number/utoa32_core|inlined.1 - get_local $0 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa32_lut - end + get_local $0 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa32_lut get_local $4 if get_local $0 @@ -10829,28 +10663,24 @@ get_local $10 call $~lib/string/String#substring set_local $11 - block $~lib/internal/string/freeUnsafe|inlined.1 + get_local $9 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.5 block get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.5 - block - get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.5 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.5 + unreachable end + unreachable end end get_local $11 @@ -10871,12 +10701,10 @@ get_local $1 call $~lib/internal/string/allocateUnsafe set_local $2 - block $~lib/internal/number/utoa32_core|inlined.2 - get_local $2 - get_local $0 - get_local $1 - call $~lib/internal/number/utoa32_lut - end + get_local $2 + get_local $0 + get_local $1 + call $~lib/internal/number/utoa32_lut get_local $2 ) (func $~lib/internal/number/itoa (; 182 ;) (type $ii) (param $0 i32) (result i32) @@ -10906,12 +10734,10 @@ get_local $2 call $~lib/internal/number/decimalCount32 set_local $3 - block $~lib/internal/number/utoa32_core|inlined.3 - get_local $0 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa32_lut - end + get_local $0 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa32_lut get_local $3 ) (func $~lib/array/Array#join (; 184 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -11054,28 +10880,24 @@ get_local $10 call $~lib/string/String#substring set_local $11 - block $~lib/internal/string/freeUnsafe|inlined.2 + get_local $9 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.6 block get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.6 - block - get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.6 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.6 + unreachable end + unreachable end end get_local $11 @@ -11394,88 +11216,86 @@ get_local $14 i32.add set_global $~lib/internal/number/_K - block $~lib/internal/number/grisuRound|inlined.0 - block $~lib/internal/arraybuffer/loadUnsafe|inlined.2 (result i64) - get_local $16 - get_local $14 - i32.const 2 - i32.shl - i32.add - i64.load32_u offset=8 - end - get_local $7 - i64.extend_s/i32 - i64.shl - set_local $20 - get_local $0 - get_local $15 - i32.const 1 - i32.sub - i32.const 1 + block $~lib/internal/arraybuffer/loadUnsafe|inlined.2 (result i64) + get_local $16 + get_local $14 + i32.const 2 i32.shl i32.add - set_local $18 - get_local $18 - i32.load16_u offset=4 - set_local $21 - block $break|2 - loop $continue|2 + i64.load32_u offset=8 + end + get_local $7 + i64.extend_s/i32 + i64.shl + set_local $20 + get_local $0 + get_local $15 + i32.const 1 + i32.sub + i32.const 1 + i32.shl + i32.add + set_local $18 + get_local $18 + i32.load16_u offset=4 + set_local $21 + block $break|2 + loop $continue|2 + get_local $19 + get_local $10 + i64.lt_u + tee_local $22 + if (result i32) + get_local $5 + get_local $19 + i64.sub + get_local $20 + i64.ge_u + else + get_local $22 + end + tee_local $22 + if (result i32) get_local $19 + get_local $20 + i64.add get_local $10 i64.lt_u tee_local $22 if (result i32) - get_local $5 + get_local $22 + else + get_local $10 get_local $19 i64.sub - get_local $20 - i64.ge_u - else - get_local $22 - end - tee_local $22 - if (result i32) get_local $19 get_local $20 i64.add get_local $10 - i64.lt_u - tee_local $22 - if (result i32) - get_local $22 - else - get_local $10 - get_local $19 - i64.sub - get_local $19 - get_local $20 - i64.add - get_local $10 - i64.sub - i64.gt_u - end - else - get_local $22 + i64.sub + i64.gt_u end - if - block - get_local $21 - i32.const 1 - i32.sub - set_local $21 - get_local $19 - get_local $20 - i64.add - set_local $19 - end - br $continue|2 + else + get_local $22 + end + if + block + get_local $21 + i32.const 1 + i32.sub + set_local $21 + get_local $19 + get_local $20 + i64.add + set_local $19 end + br $continue|2 end end - get_local $18 - get_local $21 - i32.store16 offset=4 end + get_local $18 + get_local $21 + i32.store16 offset=4 get_local $15 return end @@ -11560,76 +11380,74 @@ end i64.mul set_local $10 - block $~lib/internal/number/grisuRound|inlined.1 - get_local $0 - get_local $15 - i32.const 1 - i32.sub - i32.const 1 - i32.shl - i32.add - set_local $17 - get_local $17 - i32.load16_u offset=4 - set_local $21 - block $break|4 - loop $continue|4 + get_local $0 + get_local $15 + i32.const 1 + i32.sub + i32.const 1 + i32.shl + i32.add + set_local $17 + get_local $17 + i32.load16_u offset=4 + set_local $21 + block $break|4 + loop $continue|4 + get_local $13 + get_local $10 + i64.lt_u + tee_local $18 + if (result i32) + get_local $5 + get_local $13 + i64.sub + get_local $8 + i64.ge_u + else + get_local $18 + end + tee_local $18 + if (result i32) get_local $13 + get_local $8 + i64.add get_local $10 i64.lt_u tee_local $18 if (result i32) - get_local $5 + get_local $18 + else + get_local $10 get_local $13 i64.sub - get_local $8 - i64.ge_u - else - get_local $18 - end - tee_local $18 - if (result i32) get_local $13 get_local $8 i64.add get_local $10 - i64.lt_u - tee_local $18 - if (result i32) - get_local $18 - else - get_local $10 - get_local $13 - i64.sub - get_local $13 - get_local $8 - i64.add - get_local $10 - i64.sub - i64.gt_u - end - else - get_local $18 + i64.sub + i64.gt_u end - if - block - get_local $21 - i32.const 1 - i32.sub - set_local $21 - get_local $13 - get_local $8 - i64.add - set_local $13 - end - br $continue|4 + else + get_local $18 + end + if + block + get_local $21 + i32.const 1 + i32.sub + set_local $21 + get_local $13 + get_local $8 + i64.add + set_local $13 end + br $continue|4 end end - get_local $17 - get_local $21 - i32.store16 offset=4 end + get_local $17 + get_local $21 + i32.store16 offset=4 get_local $15 return end @@ -11741,28 +11559,26 @@ i32.shl i32.add set_local $4 - block $~lib/memory/memory.copy|inlined.8 - get_local $4 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 2 - i32.add - set_local $5 - get_local $4 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $6 - i32.const 0 - get_local $2 - i32.sub - i32.const 1 - i32.shl - set_local $7 - get_local $5 - get_local $6 - get_local $7 - call $~lib/internal/memory/memmove - end + get_local $4 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 2 + i32.add + set_local $5 + get_local $4 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + i32.const 0 + get_local $2 + i32.sub + i32.const 1 + i32.shl + set_local $7 + get_local $5 + get_local $6 + get_local $7 + call $~lib/internal/memory/memmove get_local $0 get_local $3 i32.const 1 @@ -11791,28 +11607,26 @@ get_local $3 i32.sub set_local $4 - block $~lib/memory/memory.copy|inlined.9 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - get_local $4 - i32.const 1 - i32.shl - i32.add - set_local $7 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $6 - get_local $1 - i32.const 1 - i32.shl - set_local $5 - get_local $7 - get_local $6 - get_local $5 - call $~lib/internal/memory/memmove - end + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + get_local $4 + i32.const 1 + i32.shl + i32.add + set_local $7 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + get_local $1 + i32.const 1 + i32.shl + set_local $5 + get_local $7 + get_local $6 + get_local $5 + call $~lib/internal/memory/memmove get_local $0 get_global $~lib/internal/string/CharCode._0 get_global $~lib/internal/string/CharCode.DOT @@ -11882,12 +11696,10 @@ i32.const 1 i32.add set_local $7 - block $~lib/internal/number/utoa32_core|inlined.4 - get_local $4 - get_local $5 - get_local $7 - call $~lib/internal/number/utoa32_lut - end + get_local $4 + get_local $5 + get_local $7 + call $~lib/internal/number/utoa32_lut get_local $4 get_global $~lib/internal/string/CharCode.MINUS get_global $~lib/internal/string/CharCode.PLUS @@ -11906,28 +11718,26 @@ i32.const 1 i32.shl set_local $7 - block $~lib/memory/memory.copy|inlined.10 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 4 - i32.add - set_local $6 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 2 - i32.add - set_local $5 - get_local $7 - i32.const 2 - i32.sub - set_local $4 - get_local $6 - get_local $5 - get_local $4 - call $~lib/internal/memory/memmove - end + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 4 + i32.add + set_local $6 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 2 + i32.add + set_local $5 + get_local $7 + i32.const 2 + i32.sub + set_local $4 + get_local $6 + get_local $5 + get_local $4 + call $~lib/internal/memory/memmove get_local $0 get_global $~lib/internal/string/CharCode.DOT i32.store16 offset=6 @@ -11964,12 +11774,10 @@ i32.const 1 i32.add set_local $8 - block $~lib/internal/number/utoa32_core|inlined.5 - get_local $4 - get_local $5 - get_local $8 - call $~lib/internal/number/utoa32_lut - end + get_local $4 + get_local $5 + get_local $8 + call $~lib/internal/number/utoa32_lut get_local $4 get_global $~lib/internal/string/CharCode.MINUS get_global $~lib/internal/string/CharCode.PLUS @@ -12066,7 +11874,7 @@ i32.add i32.sub set_local $4 - block $~lib/internal/number/normalizedBoundaries|inlined.0 + block get_local $6 i64.const 1 i64.shl @@ -12115,7 +11923,7 @@ get_local $8 set_global $~lib/internal/number/_exp end - block $~lib/internal/number/getCachedPower|inlined.0 + block get_global $~lib/internal/number/_exp set_local $10 i32.const -61 @@ -12465,28 +12273,24 @@ get_local $2 call $~lib/string/String#substring set_local $3 - block $~lib/internal/string/freeUnsafe|inlined.3 + get_local $1 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.7 block get_local $1 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.7 - block - get_local $1 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.7 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.7 + unreachable end + unreachable end get_local $3 ) @@ -12550,20 +12354,18 @@ get_local $3 select set_local $5 - block $~lib/memory/memory.copy|inlined.11 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $6 - get_local $4 - i32.const 1 - i32.shl - set_local $7 - get_local $6 - get_local $5 - get_local $7 - call $~lib/internal/memory/memmove - end + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + get_local $4 + i32.const 1 + i32.shl + set_local $7 + get_local $6 + get_local $5 + get_local $7 + call $~lib/internal/memory/memmove get_local $4 return end @@ -12714,28 +12516,24 @@ get_local $10 call $~lib/string/String#substring set_local $11 - block $~lib/internal/string/freeUnsafe|inlined.4 + get_local $9 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.8 block get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.8 - block - get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.8 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.8 + unreachable end + unreachable end end get_local $11 @@ -12982,20 +12780,18 @@ get_local $3 i32.store get_local $0 - get_local $1 - i32.store offset=4 - block $~lib/memory/memory.fill|inlined.12 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $1 + i32.store offset=4 + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 195 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -13151,28 +12947,24 @@ get_local $10 call $~lib/string/String#substring set_local $11 - block $~lib/internal/string/freeUnsafe|inlined.5 + get_local $9 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.9 block get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.9 - block - get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.9 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.9 + unreachable end + unreachable end end get_local $11 @@ -13236,18 +13028,16 @@ get_local $4 i32.add set_local $3 - block $~lib/internal/number/utoa32_core|inlined.6 - get_local $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - set_local $5 - get_local $0 - get_local $5 - get_local $3 - call $~lib/internal/number/utoa32_lut - end + get_local $2 + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + set_local $5 + get_local $0 + get_local $5 + get_local $3 + call $~lib/internal/number/utoa32_lut get_local $4 if get_local $0 @@ -13396,28 +13186,24 @@ get_local $10 call $~lib/string/String#substring set_local $11 - block $~lib/internal/string/freeUnsafe|inlined.6 + get_local $9 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.10 block get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.10 - block - get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.10 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.10 + unreachable end + unreachable end end get_local $11 @@ -13457,16 +13243,14 @@ i32.and call $~lib/internal/number/decimalCount32 set_local $3 - block $~lib/internal/number/utoa32_core|inlined.7 - get_local $2 - i32.const 65535 - i32.and - set_local $4 - get_local $0 - get_local $4 - get_local $3 - call $~lib/internal/number/utoa32_lut - end + get_local $2 + i32.const 65535 + i32.and + set_local $4 + get_local $0 + get_local $4 + get_local $3 + call $~lib/internal/number/utoa32_lut get_local $3 ) (func $~lib/array/Array#join (; 202 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -13609,28 +13393,24 @@ get_local $10 call $~lib/string/String#substring set_local $11 - block $~lib/internal/string/freeUnsafe|inlined.7 + get_local $9 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.11 block get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.11 - block - get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.11 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.11 + unreachable end + unreachable end end get_local $11 @@ -13867,12 +13647,10 @@ get_local $3 call $~lib/internal/string/allocateUnsafe set_local $1 - block $~lib/internal/number/utoa32_core|inlined.8 - get_local $1 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa32_lut - end + get_local $1 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa32_lut else get_local $0 call $~lib/internal/number/decimalCount64 @@ -13880,12 +13658,10 @@ get_local $3 call $~lib/internal/string/allocateUnsafe set_local $1 - block $~lib/internal/number/utoa64_core|inlined.0 - get_local $1 - get_local $0 - get_local $3 - call $~lib/internal/number/utoa64_lut - end + get_local $1 + get_local $0 + get_local $3 + call $~lib/internal/number/utoa64_lut end get_local $1 ) @@ -13925,22 +13701,18 @@ get_local $4 call $~lib/internal/number/decimalCount32 set_local $3 - block $~lib/internal/number/utoa32_core|inlined.9 - get_local $0 - get_local $4 - get_local $3 - call $~lib/internal/number/utoa32_lut - end + get_local $0 + get_local $4 + get_local $3 + call $~lib/internal/number/utoa32_lut else get_local $2 call $~lib/internal/number/decimalCount64 set_local $3 - block $~lib/internal/number/utoa64_core|inlined.1 - get_local $0 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa64_lut - end + get_local $0 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa64_lut end get_local $3 ) @@ -14084,28 +13856,24 @@ get_local $10 call $~lib/string/String#substring set_local $11 - block $~lib/internal/string/freeUnsafe|inlined.8 + get_local $9 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.12 block get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.12 - block - get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.12 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.12 + unreachable end + unreachable end end get_local $11 @@ -14149,12 +13917,10 @@ get_local $4 call $~lib/internal/string/allocateUnsafe set_local $2 - block $~lib/internal/number/utoa32_core|inlined.10 - get_local $2 - get_local $3 - get_local $4 - call $~lib/internal/number/utoa32_lut - end + get_local $2 + get_local $3 + get_local $4 + call $~lib/internal/number/utoa32_lut else get_local $0 call $~lib/internal/number/decimalCount64 @@ -14164,12 +13930,10 @@ get_local $4 call $~lib/internal/string/allocateUnsafe set_local $2 - block $~lib/internal/number/utoa64_core|inlined.2 - get_local $2 - get_local $0 - get_local $4 - call $~lib/internal/number/utoa64_lut - end + get_local $2 + get_local $0 + get_local $4 + call $~lib/internal/number/utoa64_lut end get_local $1 if @@ -14229,24 +13993,20 @@ get_local $4 i32.add set_local $3 - block $~lib/internal/number/utoa32_core|inlined.11 - get_local $0 - get_local $5 - get_local $3 - call $~lib/internal/number/utoa32_lut - end + get_local $0 + get_local $5 + get_local $3 + call $~lib/internal/number/utoa32_lut else get_local $2 call $~lib/internal/number/decimalCount64 get_local $4 i32.add set_local $3 - block $~lib/internal/number/utoa64_core|inlined.3 - get_local $0 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa64_lut - end + get_local $0 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa64_lut end get_local $4 if @@ -14396,28 +14156,24 @@ get_local $10 call $~lib/string/String#substring set_local $11 - block $~lib/internal/string/freeUnsafe|inlined.9 + get_local $9 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.13 block get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.13 - block - get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.13 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.13 + unreachable end + unreachable end end get_local $11 @@ -14579,16 +14335,14 @@ i32.and call $~lib/internal/number/decimalCount32 set_local $3 - block $~lib/internal/number/utoa32_core|inlined.12 - get_local $2 - i32.const 255 - i32.and - set_local $4 - get_local $0 - get_local $4 - get_local $3 - call $~lib/internal/number/utoa32_lut - end + get_local $2 + i32.const 255 + i32.and + set_local $4 + get_local $0 + get_local $4 + get_local $3 + call $~lib/internal/number/utoa32_lut get_local $3 ) (func $~lib/array/Array#join (; 216 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) @@ -14731,28 +14485,24 @@ get_local $10 call $~lib/string/String#substring set_local $11 - block $~lib/internal/string/freeUnsafe|inlined.10 + get_local $9 + i32.eqz + if + i32.const 0 + i32.const 2704 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.14 block get_local $9 - i32.eqz - if - i32.const 0 - i32.const 2704 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.14 - block - get_local $9 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.14 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.14 + unreachable end + unreachable end end get_local $11 diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index b9ce28f2b1..c225962fb4 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -1939,22 +1939,20 @@ get_local $6 call $~lib/internal/arraybuffer/allocateUnsafe set_local $7 - block $~lib/memory/memory.copy|inlined.0 - get_local $7 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $1 - i32.add - set_local $5 - get_local $4 - get_local $5 - get_local $6 - call $~lib/internal/memory/memmove - end + get_local $7 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $1 + i32.add + set_local $5 + get_local $4 + get_local $5 + get_local $6 + call $~lib/internal/memory/memmove get_local $7 ) (func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index cd6cfa1624..5a0f81457a 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -438,18 +438,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.0 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -499,23 +497,21 @@ call $~lib/env/abort unreachable end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.0 - get_local $0 - i32.load - set_local $3 - get_local $0 - i32.load offset=4 - set_local $4 - get_local $3 - get_local $4 - i32.add - get_local $1 - i32.const 0 - i32.shl - i32.add - get_local $2 - i32.store8 offset=8 - end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 0 + i32.shl + i32.add + get_local $2 + i32.store8 offset=8 ) (func $~lib/dataview/DataView#constructor (; 8 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (local $4 i32) @@ -606,33 +602,31 @@ (local $3 i32) (local $4 i32) (local $5 i32) - block $~lib/dataview/checkOffset|inlined.0 - i32.const 4 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 + i32.const 4 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else - get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $2 i32.const 1 @@ -702,33 +696,31 @@ (local $3 i32) (local $4 i32) (local $5 i32) - block $~lib/dataview/checkOffset|inlined.1 - i32.const 8 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 + i32.const 8 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else - get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $2 i32.const 1 @@ -759,33 +751,31 @@ (local $2 i32) (local $3 i32) (local $4 i32) - block $~lib/dataview/checkOffset|inlined.2 - i32.const 1 - set_local $2 - get_local $0 - i32.load offset=8 - set_local $3 + i32.const 1 + set_local $2 + get_local $0 + i32.load offset=8 + set_local $3 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $4 + if (result i32) + get_local $4 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $4 - if (result i32) - get_local $4 - else - get_local $1 - get_local $2 - i32.add - get_local $3 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $2 + i32.add + get_local $3 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -817,33 +807,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.3 - i32.const 2 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 + i32.const 2 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else - get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -883,33 +871,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.4 - i32.const 4 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 + i32.const 4 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else - get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -974,33 +960,31 @@ (local $4 i32) (local $5 i32) (local $6 i64) - block $~lib/dataview/checkOffset|inlined.5 - i32.const 8 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 + i32.const 8 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else - get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1025,33 +1009,31 @@ (local $2 i32) (local $3 i32) (local $4 i32) - block $~lib/dataview/checkOffset|inlined.6 - i32.const 1 - set_local $2 - get_local $0 - i32.load offset=8 - set_local $3 - get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $4 - if (result i32) - get_local $4 - else - get_local $1 - get_local $2 - i32.add - get_local $3 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + i32.const 1 + set_local $2 + get_local $0 + i32.load offset=8 + set_local $3 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $4 + if (result i32) + get_local $4 + else + get_local $1 + get_local $2 + i32.add + get_local $3 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1081,33 +1063,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.7 - i32.const 2 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 + i32.const 2 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else - get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1133,33 +1113,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.8 - i32.const 4 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 + i32.const 4 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else - get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1185,33 +1163,31 @@ (local $4 i32) (local $5 i32) (local $6 i64) - block $~lib/dataview/checkOffset|inlined.9 - i32.const 8 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 + i32.const 8 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else - get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1236,33 +1212,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.10 - i32.const 4 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 + i32.const 4 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else - get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $3 i32.const 1 @@ -1295,33 +1269,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.11 - i32.const 8 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 + i32.const 8 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else - get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $3 i32.const 1 @@ -1354,33 +1326,31 @@ (local $3 i32) (local $4 i32) (local $5 i32) - block $~lib/dataview/checkOffset|inlined.12 - i32.const 1 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 + i32.const 1 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else - get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1396,33 +1366,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.13 - i32.const 2 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 + i32.const 2 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else - get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1446,33 +1414,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.14 - i32.const 4 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 + i32.const 4 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else - get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1496,33 +1462,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.15 - i32.const 8 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 + i32.const 8 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else - get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1546,33 +1510,31 @@ (local $3 i32) (local $4 i32) (local $5 i32) - block $~lib/dataview/checkOffset|inlined.16 - i32.const 1 - set_local $3 - get_local $0 - i32.load offset=8 - set_local $4 + i32.const 1 + set_local $3 + get_local $0 + i32.load offset=8 + set_local $4 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $5 + if (result i32) + get_local $5 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $5 - if (result i32) - get_local $5 - else - get_local $1 - get_local $3 - i32.add - get_local $4 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $3 + i32.add + get_local $4 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1588,33 +1550,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.17 - i32.const 2 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 + i32.const 2 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else - get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1638,33 +1598,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.18 - i32.const 4 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 + i32.const 4 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else - get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load @@ -1688,33 +1646,31 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/dataview/checkOffset|inlined.19 - i32.const 8 - set_local $4 - get_local $0 - i32.load offset=8 - set_local $5 + i32.const 8 + set_local $4 + get_local $0 + i32.load offset=8 + set_local $5 + get_local $1 + get_global $~lib/internal/arraybuffer/MAX_BLENGTH + i32.gt_u + tee_local $6 + if (result i32) + get_local $6 + else get_local $1 - get_global $~lib/internal/arraybuffer/MAX_BLENGTH - i32.gt_u - tee_local $6 - if (result i32) - get_local $6 - else - get_local $1 - get_local $4 - i32.add - get_local $5 - i32.gt_s - end - if - i32.const 0 - i32.const 136 - i32.const 188 - i32.const 73 - call $~lib/env/abort - unreachable - end + get_local $4 + i32.add + get_local $5 + i32.gt_s + end + if + i32.const 0 + i32.const 136 + i32.const 188 + i32.const 73 + call $~lib/env/abort + unreachable end get_local $0 i32.load diff --git a/tests/compiler/std/gc-array.untouched.wat b/tests/compiler/std/gc-array.untouched.wat index 918087bd56..b4d953e084 100644 --- a/tests/compiler/std/gc-array.untouched.wat +++ b/tests/compiler/std/gc-array.untouched.wat @@ -2302,60 +2302,54 @@ get_local $0 get_local $1 i32.store - block $~lib/memory/memory.fill|inlined.0 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $5 - get_local $3 - get_local $4 - get_local $5 - call $~lib/internal/memory/memset - end + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $5 + get_local $3 + get_local $4 + get_local $5 + call $~lib/internal/memory/memset else get_local $1 call $~lib/internal/arraybuffer/allocateUnsafe set_local $5 - block $~lib/memory/memory.copy|inlined.0 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $3 - get_local $4 - get_local $3 - get_local $2 - call $~lib/internal/memory/memmove - end - block $~lib/memory/memory.fill|inlined.1 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $6 - get_local $3 - get_local $4 - get_local $6 - call $~lib/internal/memory/memset - end + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $3 + get_local $4 + get_local $3 + get_local $2 + call $~lib/internal/memory/memmove + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $6 + get_local $3 + get_local $4 + get_local $6 + call $~lib/internal/memory/memset get_local $5 return end @@ -2458,15 +2452,13 @@ i32.add i32.store offset=4 end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 - end + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 get_local $0 get_local $2 call $~lib/collector/itcm/__gc_link diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index 67110dcaa0..abe4ce1a76 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -34704,7 +34704,7 @@ end unreachable end - block $~lib/math/NativeMathf.seedRandom|inlined.0 + block call $~lib/bindings/Math/random i64.reinterpret/f64 set_local $3 diff --git a/tests/compiler/std/pointer.untouched.wat b/tests/compiler/std/pointer.untouched.wat index ba6bdd4550..3224d902ec 100644 --- a/tests/compiler/std/pointer.untouched.wat +++ b/tests/compiler/std/pointer.untouched.wat @@ -2220,7 +2220,7 @@ call $~lib/env/abort unreachable end - block $std/pointer/Pointer#set|inlined.0 + block get_global $std/pointer/buf set_local $0 i32.const 2 diff --git a/tests/compiler/std/static-array.untouched.wat b/tests/compiler/std/static-array.untouched.wat index a912950b84..bc73ca8be5 100644 --- a/tests/compiler/std/static-array.untouched.wat +++ b/tests/compiler/std/static-array.untouched.wat @@ -1900,60 +1900,54 @@ get_local $0 get_local $1 i32.store - block $~lib/memory/memory.fill|inlined.0 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $5 - get_local $3 - get_local $4 - get_local $5 - call $~lib/internal/memory/memset - end + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $5 + get_local $3 + get_local $4 + get_local $5 + call $~lib/internal/memory/memset else get_local $1 call $~lib/internal/arraybuffer/allocateUnsafe set_local $5 - block $~lib/memory/memory.copy|inlined.0 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $3 - get_local $4 - get_local $3 - get_local $2 - call $~lib/internal/memory/memmove - end - block $~lib/memory/memory.fill|inlined.1 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $6 - get_local $3 - get_local $4 - get_local $6 - call $~lib/internal/memory/memset - end + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $3 + get_local $4 + get_local $3 + get_local $2 + call $~lib/internal/memory/memmove + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $6 + get_local $3 + get_local $4 + get_local $6 + call $~lib/internal/memory/memset get_local $5 return end @@ -2024,15 +2018,13 @@ i32.add i32.store offset=4 end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 - end + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 ) (func $~lib/array/Array#__get (; 10 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) (local $2 i32) @@ -2099,15 +2091,13 @@ i32.add i32.store offset=4 end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 - get_local $3 - get_local $1 - i32.const 3 - i32.shl - i32.add - get_local $2 - i64.store offset=8 - end + get_local $3 + get_local $1 + i32.const 3 + i32.shl + i32.add + get_local $2 + i64.store offset=8 ) (func $~lib/array/Array#__get (; 12 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) @@ -2174,15 +2164,13 @@ i32.add i32.store offset=4 end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 - get_local $3 - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - f32.store offset=8 - end + get_local $3 + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + f32.store offset=8 ) (func $~lib/array/Array#__get (; 14 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) @@ -2249,15 +2237,13 @@ i32.add i32.store offset=4 end - block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 - get_local $3 - get_local $1 - i32.const 3 - i32.shl - i32.add - get_local $2 - f64.store offset=8 - end + get_local $3 + get_local $1 + i32.const 3 + i32.shl + i32.add + get_local $2 + f64.store offset=8 ) (func $start (; 16 ;) (type $v) (local $0 i32) diff --git a/tests/compiler/std/string-utf8.untouched.wat b/tests/compiler/std/string-utf8.untouched.wat index ed63c7fe42..d1e08e4320 100644 --- a/tests/compiler/std/string-utf8.untouched.wat +++ b/tests/compiler/std/string-utf8.untouched.wat @@ -2223,16 +2223,14 @@ i32.shr_u call $~lib/internal/string/allocateUnsafe set_local $7 - block $~lib/memory/memory.copy|inlined.0 - get_local $7 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $3 - get_local $3 - get_local $4 - get_local $5 - call $~lib/internal/memory/memmove - end + get_local $7 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $3 + get_local $3 + get_local $4 + get_local $5 + call $~lib/internal/memory/memmove block $~lib/memory/memory.free|inlined.0 block get_local $4 diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index dea1390eee..a30befd17f 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -4699,11 +4699,7 @@ i32.const 1 i32.shl call $~lib/internal/memory/memmove - get_local $0 - get_local $4 - i32.const 1 - i32.shl - i32.add + get_local $3 i32.const 46 i32.store16 offset=4 get_local $1 diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index 18bdc70846..1747f75003 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -2473,7 +2473,7 @@ i32.lt_s i32.eqz br_if $break|5 - block $~lib/memory/memory.copy|inlined.0 + block get_local $6 get_local $8 i32.add @@ -4137,18 +4137,16 @@ get_local $0 get_local $1 i32.store offset=4 - block $~lib/memory/memory.fill|inlined.0 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 ) (func $~lib/array/Array#__unchecked_set (; 39 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) @@ -4199,60 +4197,54 @@ get_local $0 get_local $1 i32.store - block $~lib/memory/memory.fill|inlined.1 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $5 - get_local $3 - get_local $4 - get_local $5 - call $~lib/internal/memory/memset - end + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $5 + get_local $3 + get_local $4 + get_local $5 + call $~lib/internal/memory/memset else get_local $1 call $~lib/internal/arraybuffer/allocateUnsafe set_local $5 - block $~lib/memory/memory.copy|inlined.2 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - get_local $0 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $3 - get_local $4 - get_local $3 - get_local $2 - call $~lib/internal/memory/memmove - end - block $~lib/memory/memory.fill|inlined.2 - get_local $5 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - get_local $2 - i32.add - set_local $3 - i32.const 0 - set_local $4 - get_local $1 - get_local $2 - i32.sub - set_local $6 - get_local $3 - get_local $4 - get_local $6 - call $~lib/internal/memory/memset - end + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + get_local $0 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $3 + get_local $4 + get_local $3 + get_local $2 + call $~lib/internal/memory/memmove + get_local $5 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + get_local $2 + i32.add + set_local $3 + i32.const 0 + set_local $4 + get_local $1 + get_local $2 + i32.sub + set_local $6 + get_local $3 + get_local $4 + get_local $6 + call $~lib/internal/memory/memset get_local $5 return end @@ -4328,15 +4320,13 @@ get_local $0 get_local $5 i32.store offset=4 - block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 - get_local $3 - get_local $2 - i32.const 2 - i32.shl - i32.add - get_local $1 - i32.store offset=8 - end + get_local $3 + get_local $2 + i32.const 2 + i32.shl + i32.add + get_local $1 + i32.store offset=8 get_local $5 ) (func $~lib/string/String#split (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -4450,15 +4440,13 @@ i32.add i32.load16_u offset=4 i32.store16 offset=4 - block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 - get_local $6 - get_local $7 - i32.const 2 - i32.shl - i32.add - get_local $8 - i32.store offset=8 - end + get_local $6 + get_local $7 + i32.const 2 + i32.shl + i32.add + get_local $8 + i32.store offset=8 end get_local $7 i32.const 1 @@ -4885,12 +4873,10 @@ get_local $2 call $~lib/internal/string/allocateUnsafe set_local $3 - block $~lib/internal/number/utoa32_core|inlined.0 - get_local $3 - get_local $0 - get_local $2 - call $~lib/internal/number/utoa32_lut - end + get_local $3 + get_local $0 + get_local $2 + call $~lib/internal/number/utoa32_lut get_local $1 if get_local $3 @@ -4914,12 +4900,10 @@ get_local $1 call $~lib/internal/string/allocateUnsafe set_local $2 - block $~lib/internal/number/utoa32_core|inlined.1 - get_local $2 - get_local $0 - get_local $1 - call $~lib/internal/number/utoa32_lut - end + get_local $2 + get_local $0 + get_local $1 + call $~lib/internal/number/utoa32_lut get_local $2 ) (func $~lib/internal/number/decimalCount64 (; 49 ;) (type $Ii) (param $0 i64) (result i32) @@ -5153,12 +5137,10 @@ get_local $3 call $~lib/internal/string/allocateUnsafe set_local $1 - block $~lib/internal/number/utoa32_core|inlined.2 - get_local $1 - get_local $2 - get_local $3 - call $~lib/internal/number/utoa32_lut - end + get_local $1 + get_local $2 + get_local $3 + call $~lib/internal/number/utoa32_lut else get_local $0 call $~lib/internal/number/decimalCount64 @@ -5166,12 +5148,10 @@ get_local $3 call $~lib/internal/string/allocateUnsafe set_local $1 - block $~lib/internal/number/utoa64_core|inlined.0 - get_local $1 - get_local $0 - get_local $3 - call $~lib/internal/number/utoa64_lut - end + get_local $1 + get_local $0 + get_local $3 + call $~lib/internal/number/utoa64_lut end get_local $1 ) @@ -5213,12 +5193,10 @@ get_local $4 call $~lib/internal/string/allocateUnsafe set_local $2 - block $~lib/internal/number/utoa32_core|inlined.3 - get_local $2 - get_local $3 - get_local $4 - call $~lib/internal/number/utoa32_lut - end + get_local $2 + get_local $3 + get_local $4 + call $~lib/internal/number/utoa32_lut else get_local $0 call $~lib/internal/number/decimalCount64 @@ -5228,12 +5206,10 @@ get_local $4 call $~lib/internal/string/allocateUnsafe set_local $2 - block $~lib/internal/number/utoa64_core|inlined.1 - get_local $2 - get_local $0 - get_local $4 - call $~lib/internal/number/utoa64_lut - end + get_local $2 + get_local $0 + get_local $4 + call $~lib/internal/number/utoa64_lut end get_local $1 if @@ -5561,88 +5537,86 @@ get_local $14 i32.add set_global $~lib/internal/number/_K - block $~lib/internal/number/grisuRound|inlined.0 - block $~lib/internal/arraybuffer/loadUnsafe|inlined.6 (result i64) - get_local $16 - get_local $14 - i32.const 2 - i32.shl - i32.add - i64.load32_u offset=8 - end - get_local $7 - i64.extend_s/i32 - i64.shl - set_local $20 - get_local $0 - get_local $15 - i32.const 1 - i32.sub - i32.const 1 + block $~lib/internal/arraybuffer/loadUnsafe|inlined.6 (result i64) + get_local $16 + get_local $14 + i32.const 2 i32.shl i32.add - set_local $18 - get_local $18 - i32.load16_u offset=4 - set_local $21 - block $break|2 - loop $continue|2 + i64.load32_u offset=8 + end + get_local $7 + i64.extend_s/i32 + i64.shl + set_local $20 + get_local $0 + get_local $15 + i32.const 1 + i32.sub + i32.const 1 + i32.shl + i32.add + set_local $18 + get_local $18 + i32.load16_u offset=4 + set_local $21 + block $break|2 + loop $continue|2 + get_local $19 + get_local $10 + i64.lt_u + tee_local $22 + if (result i32) + get_local $5 + get_local $19 + i64.sub + get_local $20 + i64.ge_u + else + get_local $22 + end + tee_local $22 + if (result i32) get_local $19 + get_local $20 + i64.add get_local $10 i64.lt_u tee_local $22 if (result i32) - get_local $5 + get_local $22 + else + get_local $10 get_local $19 i64.sub - get_local $20 - i64.ge_u - else - get_local $22 - end - tee_local $22 - if (result i32) get_local $19 get_local $20 i64.add get_local $10 - i64.lt_u - tee_local $22 - if (result i32) - get_local $22 - else - get_local $10 - get_local $19 - i64.sub - get_local $19 - get_local $20 - i64.add - get_local $10 - i64.sub - i64.gt_u - end - else - get_local $22 + i64.sub + i64.gt_u end - if - block - get_local $21 - i32.const 1 - i32.sub - set_local $21 - get_local $19 - get_local $20 - i64.add - set_local $19 - end - br $continue|2 + else + get_local $22 + end + if + block + get_local $21 + i32.const 1 + i32.sub + set_local $21 + get_local $19 + get_local $20 + i64.add + set_local $19 end + br $continue|2 end end - get_local $18 - get_local $21 - i32.store16 offset=4 end + get_local $18 + get_local $21 + i32.store16 offset=4 get_local $15 return end @@ -5727,76 +5701,74 @@ end i64.mul set_local $10 - block $~lib/internal/number/grisuRound|inlined.1 - get_local $0 - get_local $15 - i32.const 1 - i32.sub - i32.const 1 - i32.shl - i32.add - set_local $17 - get_local $17 - i32.load16_u offset=4 - set_local $21 - block $break|4 - loop $continue|4 + get_local $0 + get_local $15 + i32.const 1 + i32.sub + i32.const 1 + i32.shl + i32.add + set_local $17 + get_local $17 + i32.load16_u offset=4 + set_local $21 + block $break|4 + loop $continue|4 + get_local $13 + get_local $10 + i64.lt_u + tee_local $18 + if (result i32) + get_local $5 get_local $13 + i64.sub + get_local $8 + i64.ge_u + else + get_local $18 + end + tee_local $18 + if (result i32) + get_local $13 + get_local $8 + i64.add get_local $10 i64.lt_u tee_local $18 if (result i32) - get_local $5 + get_local $18 + else + get_local $10 get_local $13 i64.sub - get_local $8 - i64.ge_u - else - get_local $18 - end - tee_local $18 - if (result i32) get_local $13 get_local $8 i64.add get_local $10 - i64.lt_u - tee_local $18 - if (result i32) - get_local $18 - else - get_local $10 - get_local $13 - i64.sub - get_local $13 - get_local $8 - i64.add - get_local $10 - i64.sub - i64.gt_u - end - else - get_local $18 + i64.sub + i64.gt_u end - if - block - get_local $21 - i32.const 1 - i32.sub - set_local $21 - get_local $13 - get_local $8 - i64.add - set_local $13 - end - br $continue|4 + else + get_local $18 + end + if + block + get_local $21 + i32.const 1 + i32.sub + set_local $21 + get_local $13 + get_local $8 + i64.add + set_local $13 end + br $continue|4 end end - get_local $17 - get_local $21 - i32.store16 offset=4 end + get_local $17 + get_local $21 + i32.store16 offset=4 get_local $15 return end @@ -5908,28 +5880,26 @@ i32.shl i32.add set_local $4 - block $~lib/memory/memory.copy|inlined.3 - get_local $4 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 2 - i32.add - set_local $5 - get_local $4 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $6 - i32.const 0 - get_local $2 - i32.sub - i32.const 1 - i32.shl - set_local $7 - get_local $5 - get_local $6 - get_local $7 - call $~lib/internal/memory/memmove - end + get_local $4 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 2 + i32.add + set_local $5 + get_local $4 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + i32.const 0 + get_local $2 + i32.sub + i32.const 1 + i32.shl + set_local $7 + get_local $5 + get_local $6 + get_local $7 + call $~lib/internal/memory/memmove get_local $0 get_local $3 i32.const 1 @@ -5958,28 +5928,26 @@ get_local $3 i32.sub set_local $4 - block $~lib/memory/memory.copy|inlined.4 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - get_local $4 - i32.const 1 - i32.shl - i32.add - set_local $7 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - set_local $6 - get_local $1 - i32.const 1 - i32.shl - set_local $5 - get_local $7 - get_local $6 - get_local $5 - call $~lib/internal/memory/memmove - end + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + get_local $4 + i32.const 1 + i32.shl + i32.add + set_local $7 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + get_local $1 + i32.const 1 + i32.shl + set_local $5 + get_local $7 + get_local $6 + get_local $5 + call $~lib/internal/memory/memmove get_local $0 get_global $~lib/internal/string/CharCode._0 get_global $~lib/internal/string/CharCode.DOT @@ -6049,12 +6017,10 @@ i32.const 1 i32.add set_local $7 - block $~lib/internal/number/utoa32_core|inlined.4 - get_local $4 - get_local $5 - get_local $7 - call $~lib/internal/number/utoa32_lut - end + get_local $4 + get_local $5 + get_local $7 + call $~lib/internal/number/utoa32_lut get_local $4 get_global $~lib/internal/string/CharCode.MINUS get_global $~lib/internal/string/CharCode.PLUS @@ -6073,28 +6039,26 @@ i32.const 1 i32.shl set_local $7 - block $~lib/memory/memory.copy|inlined.5 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 4 - i32.add - set_local $6 - get_local $0 - get_global $~lib/internal/string/HEADER_SIZE - i32.add - i32.const 2 - i32.add - set_local $5 - get_local $7 - i32.const 2 - i32.sub - set_local $4 - get_local $6 - get_local $5 - get_local $4 - call $~lib/internal/memory/memmove - end + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 4 + i32.add + set_local $6 + get_local $0 + get_global $~lib/internal/string/HEADER_SIZE + i32.add + i32.const 2 + i32.add + set_local $5 + get_local $7 + i32.const 2 + i32.sub + set_local $4 + get_local $6 + get_local $5 + get_local $4 + call $~lib/internal/memory/memmove get_local $0 get_global $~lib/internal/string/CharCode.DOT i32.store16 offset=6 @@ -6131,12 +6095,10 @@ i32.const 1 i32.add set_local $8 - block $~lib/internal/number/utoa32_core|inlined.5 - get_local $4 - get_local $5 - get_local $8 - call $~lib/internal/number/utoa32_lut - end + get_local $4 + get_local $5 + get_local $8 + call $~lib/internal/number/utoa32_lut get_local $4 get_global $~lib/internal/string/CharCode.MINUS get_global $~lib/internal/string/CharCode.PLUS @@ -6233,7 +6195,7 @@ i32.add i32.sub set_local $4 - block $~lib/internal/number/normalizedBoundaries|inlined.0 + block get_local $6 i64.const 1 i64.shl @@ -6282,7 +6244,7 @@ get_local $8 set_global $~lib/internal/number/_exp end - block $~lib/internal/number/getCachedPower|inlined.0 + block get_global $~lib/internal/number/_exp set_local $10 i32.const -61 @@ -6745,28 +6707,24 @@ get_local $2 call $~lib/string/String#substring set_local $3 - block $~lib/internal/string/freeUnsafe|inlined.0 + get_local $1 + i32.eqz + if + i32.const 0 + i32.const 112 + i32.const 28 + i32.const 4 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.0 block get_local $1 - i32.eqz - if - i32.const 0 - i32.const 112 - i32.const 28 - i32.const 4 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.free|inlined.0 - block - get_local $1 - call $~lib/allocator/arena/__memory_free - br $~lib/memory/memory.free|inlined.0 - unreachable - end - unreachable - end + call $~lib/allocator/arena/__memory_free + br $~lib/memory/memory.free|inlined.0 + unreachable end + unreachable end get_local $3 ) diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index e4ff89a220..01147bfb35 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -1561,17 +1561,18 @@ get_local $0 get_local $1 i32.add - tee_local $0 + tee_local $2 i32.const 8 i32.add - tee_local $1 f64.load offset=8 set_local $7 - get_local $1 - get_local $0 + get_local $2 + i32.const 8 + i32.add + get_local $2 f64.load offset=8 f64.store offset=8 - get_local $0 + get_local $2 get_local $7 f64.store offset=8 ) @@ -1626,13 +1627,12 @@ get_local $3 get_local $2 i32.add + tee_local $1 i32.const 8 i32.add get_local $6 f64.store offset=8 - get_local $3 - get_local $2 - i32.add + get_local $1 get_local $5 f64.store offset=8 end diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index c68919af6a..93c186f7d0 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -484,18 +484,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.0 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -551,18 +549,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.1 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -618,18 +614,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.2 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -685,18 +679,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.3 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -752,18 +744,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.4 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -819,18 +809,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.5 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -886,18 +874,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.6 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -953,18 +939,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.7 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -1020,18 +1004,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.8 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -1087,18 +1069,16 @@ get_local $2 call $~lib/internal/arraybuffer/allocateUnsafe set_local $3 - block $~lib/memory/memory.fill|inlined.9 - get_local $3 - get_global $~lib/internal/arraybuffer/HEADER_SIZE - i32.add - set_local $4 - i32.const 0 - set_local $5 - get_local $4 - get_local $5 - get_local $2 - call $~lib/internal/memory/memset - end + get_local $3 + get_global $~lib/internal/arraybuffer/HEADER_SIZE + i32.add + set_local $4 + i32.const 0 + set_local $5 + get_local $4 + get_local $5 + get_local $2 + call $~lib/internal/memory/memset get_local $0 if (result i32) get_local $0 @@ -1700,23 +1680,21 @@ call $~lib/env/abort unreachable end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.0 - get_local $0 - i32.load - set_local $3 - get_local $0 - i32.load offset=4 - set_local $4 - get_local $3 - get_local $4 - i32.add - get_local $1 - i32.const 2 - i32.shl - i32.add - get_local $2 - i32.store offset=8 - end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 2 + i32.shl + i32.add + get_local $2 + i32.store offset=8 ) (func $~lib/internal/typedarray/TypedArray#__get (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -1868,23 +1846,21 @@ call $~lib/env/abort unreachable end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.0 - get_local $0 - i32.load - set_local $3 - get_local $0 - i32.load offset=4 - set_local $4 - get_local $3 - get_local $4 - i32.add - get_local $1 - i32.const 3 - i32.shl - i32.add - get_local $2 - f64.store offset=8 - end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 3 + i32.shl + i32.add + get_local $2 + f64.store offset=8 ) (func $~lib/typedarray/Float64Array#subarray (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -2073,21 +2049,19 @@ end end end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.4 - get_local $6 - i32.const 1 - i32.add - set_local $8 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $5 - f64.store offset=8 - end + get_local $6 + i32.const 1 + i32.add + set_local $8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $5 + f64.store offset=8 end get_local $4 i32.const 1 @@ -2126,14 +2100,12 @@ br $~lib/memory/memory.allocate|inlined.3 end set_local $5 - block $~lib/memory/memory.fill|inlined.10 - i32.const 0 - set_local $6 - get_local $5 - get_local $6 - get_local $4 - call $~lib/internal/memory/memset - end + i32.const 0 + set_local $6 + get_local $5 + get_local $6 + get_local $4 + call $~lib/internal/memory/memset block $break|0 get_local $2 i32.const 1 @@ -2238,28 +2210,24 @@ i32.shl i32.xor i32.store - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.5 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.6 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 - end + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 end end get_local $6 @@ -2296,31 +2264,9 @@ f64.load offset=8 end set_local $10 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.7 - i32.const 0 - set_local $8 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.7 (result f64) - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - f64.load offset=8 - end - set_local $9 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.8 + i32.const 0 + set_local $8 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.7 (result f64) get_local $0 get_local $1 i32.add @@ -2328,9 +2274,27 @@ i32.const 3 i32.shl i32.add - get_local $10 - f64.store offset=8 + f64.load offset=8 end + set_local $9 + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 i32.const 1 set_local $8 block $break|3 @@ -2427,30 +2391,26 @@ i32.shl i32.xor i32.store - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.9 - get_local $0 - get_local $1 - i32.add - get_local $8 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.10 - i32.const 0 - set_local $11 - get_local $0 - get_local $1 - i32.add - get_local $11 - i32.const 3 - i32.shl - i32.add - get_local $9 - f64.store offset=8 - end + get_local $0 + get_local $1 + i32.add + get_local $8 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 + i32.const 0 + set_local $11 + get_local $0 + get_local $1 + i32.add + get_local $11 + i32.const 3 + i32.shl + i32.add + get_local $9 + f64.store offset=8 end get_local $8 i32.const 1 @@ -2493,45 +2453,41 @@ f64.load offset=8 end set_local $12 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.11 - i32.const 1 - set_local $6 - block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.11 (result f64) - i32.const 0 - set_local $7 - get_local $0 - get_local $1 - i32.add - get_local $7 - i32.const 3 - i32.shl - i32.add - f64.load offset=8 - end - set_local $10 - get_local $0 - get_local $1 - i32.add - get_local $6 - i32.const 3 - i32.shl - i32.add - get_local $10 - f64.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.12 + i32.const 1 + set_local $6 + block $~lib/internal/arraybuffer/loadUnsafeWithOffset|inlined.11 (result f64) i32.const 0 - set_local $6 + set_local $7 get_local $0 get_local $1 i32.add - get_local $6 + get_local $7 i32.const 3 i32.shl i32.add - get_local $12 - f64.store offset=8 + f64.load offset=8 end + set_local $10 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $10 + f64.store offset=8 + i32.const 0 + set_local $6 + get_local $0 + get_local $1 + i32.add + get_local $6 + i32.const 3 + i32.shl + i32.add + get_local $12 + f64.store offset=8 ) (func $~lib/internal/typedarray/TypedArray#sort (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -2601,32 +2557,28 @@ i32.const 0 i32.lt_s if - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 - i32.const 1 - set_local $5 - get_local $4 - get_local $2 - i32.add - get_local $5 - i32.const 3 - i32.shl - i32.add - get_local $7 - f64.store offset=8 - end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.2 - i32.const 0 - set_local $5 - get_local $4 - get_local $2 - i32.add - get_local $5 - i32.const 3 - i32.shl - i32.add - get_local $6 - f64.store offset=8 - end + i32.const 1 + set_local $5 + get_local $4 + get_local $2 + i32.add + get_local $5 + i32.const 3 + i32.shl + i32.add + get_local $7 + f64.store offset=8 + i32.const 0 + set_local $5 + get_local $4 + get_local $2 + i32.add + get_local $5 + i32.const 3 + i32.shl + i32.add + get_local $6 + f64.store offset=8 end get_local $0 return @@ -2753,23 +2705,21 @@ call $~lib/env/abort unreachable end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.0 - get_local $0 - i32.load - set_local $3 - get_local $0 - i32.load offset=4 - set_local $4 - get_local $3 - get_local $4 - i32.add - get_local $1 - i32.const 0 - i32.shl - i32.add - get_local $2 - i32.store8 offset=8 - end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 0 + i32.shl + i32.add + get_local $2 + i32.store8 offset=8 ) (func $~lib/typedarray/Uint8ClampedArray#__set (; 30 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) @@ -2844,23 +2794,21 @@ call $~lib/env/abort unreachable end - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.0 - get_local $0 - i32.load - set_local $3 - get_local $0 - i32.load offset=4 - set_local $4 - get_local $3 - get_local $4 - i32.add - get_local $1 - i32.const 0 - i32.shl - i32.add - get_local $2 - i32.store8 offset=8 - end + get_local $0 + i32.load + set_local $3 + get_local $0 + i32.load offset=4 + set_local $4 + get_local $3 + get_local $4 + i32.add + get_local $1 + i32.const 0 + i32.shl + i32.add + get_local $2 + i32.store8 offset=8 ) (func $~lib/internal/typedarray/TypedArray#fill (; 33 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (local $4 i32) @@ -3275,17 +3223,15 @@ i32.lt_s i32.eqz br_if $break|0 - block $~lib/internal/arraybuffer/storeUnsafeWithOffset|inlined.1 - get_local $4 - get_local $5 - i32.add - get_local $2 - i32.const 2 - i32.shl - i32.add - get_local $1 - i32.store offset=8 - end + get_local $4 + get_local $5 + i32.add + get_local $2 + i32.const 2 + i32.shl + i32.add + get_local $1 + i32.store offset=8 get_local $2 i32.const 1 i32.add From aed29ef2a648fb53b7bf909a89def388f3431e0e Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 18:16:37 +0200 Subject: [PATCH 03/13] add Error#name for portable --- std/portable/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index f933272dea..ed1f8452df 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -440,9 +440,10 @@ interface RegExp {} interface IArguments {} declare class Error { - constructor(message: string); - message: string; + name: string; stack: string | null; + message: string; + constructor(message: string); toString(): string; } From 389e965db9beb6976faadc24c2b86b8fa38a5d89 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 18:25:50 +0200 Subject: [PATCH 04/13] revert stack type --- std/assembly/error.ts | 2 +- std/assembly/index.d.ts | 2 +- std/portable/index.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/std/assembly/error.ts b/std/assembly/error.ts index 337abb4d66..5ec7076058 100644 --- a/std/assembly/error.ts +++ b/std/assembly/error.ts @@ -1,7 +1,7 @@ export class Error { name: string = "Error"; - stack: string | null = null; // TODO + stack: string = ""; // TODO constructor( public message: string = "" diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 8458dc5688..213c3553e7 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -621,7 +621,7 @@ declare class Error { message: string; /** Stack trace. */ - stack: string | null; + stack?: string; /** Constructs a new error, optionally with a message. */ constructor(message?: string); diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index ed1f8452df..bfd50bad1f 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -441,7 +441,7 @@ interface IArguments {} declare class Error { name: string; - stack: string | null; + stack?: string; message: string; constructor(message: string); toString(): string; From 81bd2b1e01f964656cc4fc750e9ec0dbd296e139 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 18:28:36 +0200 Subject: [PATCH 05/13] finalize --- std/assembly/index.d.ts | 42 +++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 213c3553e7..cb093080d6 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -447,45 +447,47 @@ declare class DataView { /** Constructs a new `DataView` with the given properties */ constructor(buffer: ArrayBuffer, byteOffset?: i32, byteLength?: i32); /** The `getFloat32()` method gets a signed 32-bit float (float) at the specified byte offset from the start of the `DataView`. */ - getFloat32(byteOffset: i32, littleEndian?: boolean): f32 + getFloat32(byteOffset: i32, littleEndian?: boolean): f32; /** The `getFloat64()` method gets a signed 64-bit float (double) at the specified byte offset from the start of the `DataView`. */ - getFloat64(byteOffset: i32, littleEndian?: boolean): f64 + getFloat64(byteOffset: i32, littleEndian?: boolean): f64; /** The `getInt8()` method gets a signed 8-bit integer (byte) at the specified byte offset from the start of the `DataView`. */ - getInt8(byteOffset: i32): i8 + getInt8(byteOffset: i32): i8; /** The `getInt16()` method gets a signed 16-bit integer (short) at the specified byte offset from the start of the `DataView`. */ - getInt16(byteOffset: i32, littleEndian?: boolean): i16 + getInt16(byteOffset: i32, littleEndian?: boolean): i16; /** The `getInt32()` method gets a signed 32-bit integer (long) at the specified byte offset from the start of the `DataView`. */ - getInt32(byteOffset: i32, littleEndian?: boolean): i32 + getInt32(byteOffset: i32, littleEndian?: boolean): i32; /** The `getInt64()` method gets a signed 64-bit integer (long long) at the specified byte offset from the start of the `DataView`. */ - getInt64(byteOffset: i32, littleEndian?: boolean): i64 + getInt64(byteOffset: i32, littleEndian?: boolean): i64; /** The `getUint8()` method gets an unsigned 8-bit integer (unsigned byte) at the specified byte offset from the start of the `DataView`. */ - getUint8(byteOffset: i32): u8 + getUint8(byteOffset: i32): u8; /** The `getUint16()` method gets an unsigned 16-bit integer (unsigned short) at the specified byte offset from the start of the `DataView`. */ - getUint16(byteOffset: i32, littleEndian?: boolean): u16 + getUint16(byteOffset: i32, littleEndian?: boolean): u16; /** The `getUint32()` method gets an unsigned 32-bit integer (unsigned long) at the specified byte offset from the start of the `DataView`. */ - getUint32(byteOffset: i32, littleEndian?: boolean): u32 + getUint32(byteOffset: i32, littleEndian?: boolean): u32; /** The `getUint64()` method gets an unsigned 64-bit integer (unsigned long long) at the specified byte offset from the start of the `DataView`. */ - getUint64(byteOffset: i32, littleEndian?: boolean): u64 + getUint64(byteOffset: i32, littleEndian?: boolean): u64; /** The `setFloat32()` method stores a signed 32-bit float (float) value at the specified byte offset from the start of the `DataView`. */ - setFloat32(byteOffset: i32, value: f32, littleEndian?: boolean): void + setFloat32(byteOffset: i32, value: f32, littleEndian?: boolean): void; /** The `setFloat64()` method stores a signed 64-bit float (double) value at the specified byte offset from the start of the `DataView`. */ - setFloat64(byteOffset: i32, value: f64, littleEndian?: boolean): void + setFloat64(byteOffset: i32, value: f64, littleEndian?: boolean): void; /** The `setInt8()` method stores a signed 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */ - setInt8(byteOffset: i32, value: i8): void + setInt8(byteOffset: i32, value: i8): void; /** The `setInt16()` method stores a signed 16-bit integer (short) value at the specified byte offset from the start of the `DataView`. */ - setInt16(byteOffset: i32, value: i16, littleEndian?: boolean): void + setInt16(byteOffset: i32, value: i16, littleEndian?: boolean): void; /** The `setInt32()` method stores a signed 32-bit integer (long) value at the specified byte offset from the start of the `DataView`. */ - setInt32(byteOffset: i32, value: i32, littleEndian?: boolean): void + setInt32(byteOffset: i32, value: i32, littleEndian?: boolean): void; /** The `setInt64()` method stores a signed 64-bit integer (long long) value at the specified byte offset from the start of the `DataView`. */ - setInt64(byteOffset: i32, value: i64, littleEndian?: boolean): void + setInt64(byteOffset: i32, value: i64, littleEndian?: boolean): void; /** The `setUint8()` method stores an unsigned 8-bit integer (byte) value at the specified byte offset from the start of the `DataView`. */ - setUint8(byteOffset: i32, value: u8): void + setUint8(byteOffset: i32, value: u8): void; /** The `setUint16()` method stores an unsigned 16-bit integer (unsigned short) value at the specified byte offset from the start of the `DataView`. */ - setUint16(byteOffset: i32, value: u16, littleEndian?: boolean): void + setUint16(byteOffset: i32, value: u16, littleEndian?: boolean): void; /** The `setUint32()` method stores an unsigned 32-bit integer (unsigned long) value at the specified byte offset from the start of the `DataView`. */ - setUint32(byteOffset: i32, value: u32, littleEndian?: boolean): void + setUint32(byteOffset: i32, value: u32, littleEndian?: boolean): void; /** The `setUint64()` method stores an unsigned 64-bit integer (unsigned long long) value at the specified byte offset from the start of the `DataView`. */ - setUint64(byteOffset: i32, value: u64, littleEndian?: boolean): void + setUint64(byteOffset: i32, value: u64, littleEndian?: boolean): void; + /** Returns a string representation of DataView. */ + toString(): string; } /** Interface for a typed view on an array buffer. */ From ae77d89375fcef24b3f8e377f6fc5318650e9344 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 18:33:08 +0200 Subject: [PATCH 06/13] add Map/Set#toString() --- std/assembly/index.d.ts | 2 ++ std/assembly/map.ts | 4 ++++ std/assembly/set.ts | 4 ++++ std/portable/index.d.ts | 2 ++ 4 files changed, 12 insertions(+) diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index cb093080d6..b12283aef0 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -652,6 +652,7 @@ declare class Map { get(key: K): V; delete(key: K): bool; clear(): void; + toString(): string; } declare class Set { @@ -660,6 +661,7 @@ declare class Set { add(value: T): void; delete(value: T): bool; clear(): void; + toString(): string; } interface SymbolConstructor { diff --git a/std/assembly/map.ts b/std/assembly/map.ts index 59c498de8b..6106fb72c9 100644 --- a/std/assembly/map.ts +++ b/std/assembly/map.ts @@ -165,6 +165,10 @@ export class Map { this.entriesOffset = this.entriesCount; } + toString(): string { + return "[object Map]"; + } + private __gc(): void { __gc_mark(changetype(this.buckets)); // tslint:disable-line var entries = this.entries; diff --git a/std/assembly/set.ts b/std/assembly/set.ts index 48a933e520..01b91f0161 100644 --- a/std/assembly/set.ts +++ b/std/assembly/set.ts @@ -153,6 +153,10 @@ export class Set { this.entriesOffset = this.entriesCount; } + toString(): string { + return "[object Set]"; + } + private __gc(): void { __gc_mark(changetype(this.buckets)); // tslint:disable-line var entries = this.entries; diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index bfd50bad1f..5b04758c4c 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -457,6 +457,7 @@ declare class Set { add(value: T): void; delete(value: T): bool; clear(): void; + toString(): string; [Symbol.iterator](): Iterator; } @@ -471,6 +472,7 @@ declare class Map { keys(): Iterable; values(): Iterable; delete(key: K): bool; + toString(): string; [Symbol.iterator](): Iterator<[K,V]>; } From afd54a3e7237e092ba7be381d6ae5cdbbcf6cabc Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 19:07:15 +0200 Subject: [PATCH 07/13] Add Symbol#toString --- std/assembly/index.d.ts | 1 + std/assembly/symbol.ts | 10 +- std/portable/index.d.ts | 1 + tests/compiler/std/symbol.optimized.wat | 1337 +++++++++++++++++- tests/compiler/std/symbol.ts | 3 + tests/compiler/std/symbol.untouched.wat | 1637 ++++++++++++++++++++++- 6 files changed, 2962 insertions(+), 27 deletions(-) diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index b12283aef0..64953a1200 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -668,6 +668,7 @@ interface SymbolConstructor { (description?: string | null): symbol; for(key: string): symbol; keyFor(sym: symbol): string | null; + toString(): string; } declare const Symbol: SymbolConstructor; diff --git a/std/assembly/symbol.ts b/std/assembly/symbol.ts index 2064cbc312..21bb7c3c2e 100644 --- a/std/assembly/symbol.ts +++ b/std/assembly/symbol.ts @@ -4,7 +4,15 @@ var stringToId: Map; var idToString: Map; var nextId: usize = 12; // Symbol.unscopables + 1 -@unmanaged export class symbol {} +@unmanaged export class symbol { + toString(): string { + var id = changetype(this); + if (idToString !== null && idToString.has(id)) { + return "Symbol(" + idToString.get(id) + ")"; + } + return "Symbol()"; + } +} type Symbol = symbol; diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index 5b04758c4c..d2dae237fe 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -480,6 +480,7 @@ interface SymbolConstructor { (description?: string | null): symbol; for(key: string): symbol; keyFor(sym: symbol): string | null; + toString(): string; readonly iterator: symbol; } declare const Symbol: SymbolConstructor; diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index 866633bf48..0cb2e3b5dc 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -11,12 +11,20 @@ (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$i (func (result i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) + (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) "\03\00\00\001\002\003") (data (i32.const 24) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s") (data (i32.const 56) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 104) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") + (data (i32.const 168) "\07\00\00\00S\00y\00m\00b\00o\00l\00(") + (data (i32.const 192) "\04\00\00\00n\00u\00l\00l") + (data (i32.const 208) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 248) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 304) "\01\00\00\00)") + (data (i32.const 312) "\08\00\00\00S\00y\00m\00b\00o\00l\00(\00)") + (data (i32.const 336) "\0b\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)") (table $0 1 anyfunc) (elem (i32.const 0) $null) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) @@ -1103,7 +1111,1264 @@ call $~lib/map/Map#set get_local $0 ) - (func $~lib/symbol/Symbol.keyFor (; 18 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#has (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + get_local $0 + get_local $1 + get_local $1 + call $~lib/internal/hash/hash32 + call $~lib/map/Map#find + i32.const 0 + i32.ne + ) + (func $~lib/map/Map#get (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + get_local $0 + get_local $1 + get_local $1 + call $~lib/internal/hash/hash32 + call $~lib/map/Map#find + tee_local $0 + if (result i32) + get_local $0 + i32.load offset=4 + else + unreachable + end + tee_local $0 + ) + (func $~lib/symbol/Symbol.keyFor (; 20 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + get_global $~lib/symbol/idToString + i32.const 0 + i32.ne + tee_local $1 + if + get_global $~lib/symbol/idToString + get_local $0 + call $~lib/map/Map#has + set_local $1 + end + get_local $1 + if (result i32) + get_global $~lib/symbol/idToString + get_local $0 + call $~lib/map/Map#get + else + i32.const 0 + end + tee_local $0 + ) + (func $~lib/internal/string/allocateUnsafe (; 21 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + get_local $0 + i32.const 0 + i32.gt_s + tee_local $1 + if + get_local $0 + i32.const 536870910 + i32.le_s + set_local $1 + end + get_local $1 + i32.eqz + if + i32.const 0 + i32.const 248 + i32.const 14 + i32.const 2 + call $~lib/env/abort + unreachable + end + get_local $0 + i32.const 1 + i32.shl + i32.const 4 + i32.add + call $~lib/allocator/arena/__memory_allocate + tee_local $1 + get_local $0 + i32.store + get_local $1 + ) + (func $~lib/internal/memory/memcpy (; 22 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + loop $continue|0 + get_local $2 + if (result i32) + get_local $1 + i32.const 3 + i32.and + else + get_local $2 + end + tee_local $3 + if + get_local $0 + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + br $continue|0 + end + end + get_local $0 + i32.const 3 + i32.and + i32.eqz + if + loop $continue|1 + get_local $2 + i32.const 16 + i32.ge_u + if + get_local $0 + get_local $1 + i32.load + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $1 + i32.const 4 + i32.add + i32.load + i32.store + get_local $0 + i32.const 8 + i32.add + get_local $1 + i32.const 8 + i32.add + i32.load + i32.store + get_local $0 + i32.const 12 + i32.add + get_local $1 + i32.const 12 + i32.add + i32.load + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + br $continue|1 + end + end + get_local $2 + i32.const 8 + i32.and + if + get_local $0 + get_local $1 + i32.load + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $1 + i32.const 4 + i32.add + i32.load + i32.store + get_local $0 + i32.const 8 + i32.add + set_local $0 + get_local $1 + i32.const 8 + i32.add + set_local $1 + end + get_local $2 + i32.const 4 + i32.and + if + get_local $0 + get_local $1 + i32.load + i32.store + get_local $0 + i32.const 4 + i32.add + set_local $0 + get_local $1 + i32.const 4 + i32.add + set_local $1 + end + get_local $2 + i32.const 2 + i32.and + if + get_local $0 + get_local $1 + i32.load16_u + i32.store16 + get_local $0 + i32.const 2 + i32.add + set_local $0 + get_local $1 + i32.const 2 + i32.add + set_local $1 + end + get_local $2 + i32.const 1 + i32.and + if + get_local $1 + set_local $3 + get_local $0 + get_local $1 + i32.load8_u + i32.store8 + end + return + end + get_local $2 + i32.const 32 + i32.ge_u + if + block $break|2 + block $case2|2 + block $case1|2 + get_local $0 + i32.const 3 + i32.and + tee_local $3 + i32.const 1 + i32.ne + if + get_local $3 + i32.const 2 + i32.eq + br_if $case1|2 + get_local $3 + i32.const 3 + i32.eq + br_if $case2|2 + br $break|2 + end + get_local $1 + i32.load + set_local $5 + get_local $0 + get_local $1 + tee_local $3 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $1 + set_local $0 + get_local $1 + get_local $3 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + i32.const 1 + i32.add + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + get_local $2 + i32.const 3 + i32.sub + set_local $2 + loop $continue|3 + get_local $2 + i32.const 17 + i32.ge_u + if + get_local $0 + get_local $5 + i32.const 24 + i32.shr_u + get_local $1 + i32.const 1 + i32.add + i32.load + tee_local $3 + i32.const 8 + i32.shl + i32.or + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $3 + i32.const 24 + i32.shr_u + get_local $1 + i32.const 5 + i32.add + i32.load + tee_local $5 + i32.const 8 + i32.shl + i32.or + i32.store + get_local $0 + i32.const 8 + i32.add + get_local $5 + i32.const 24 + i32.shr_u + get_local $1 + i32.const 9 + i32.add + i32.load + tee_local $3 + i32.const 8 + i32.shl + i32.or + i32.store + get_local $0 + i32.const 12 + i32.add + get_local $3 + i32.const 24 + i32.shr_u + get_local $1 + i32.const 13 + i32.add + i32.load + tee_local $5 + i32.const 8 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + br $continue|3 + end + end + br $break|2 + end + get_local $1 + i32.load + set_local $5 + get_local $0 + get_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + i32.const 1 + i32.add + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + get_local $2 + i32.const 2 + i32.sub + set_local $2 + loop $continue|4 + get_local $2 + i32.const 18 + i32.ge_u + if + get_local $0 + get_local $5 + i32.const 16 + i32.shr_u + get_local $1 + i32.const 2 + i32.add + i32.load + tee_local $3 + i32.const 16 + i32.shl + i32.or + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $3 + i32.const 16 + i32.shr_u + get_local $1 + i32.const 6 + i32.add + i32.load + tee_local $5 + i32.const 16 + i32.shl + i32.or + i32.store + get_local $0 + i32.const 8 + i32.add + get_local $5 + i32.const 16 + i32.shr_u + get_local $1 + i32.const 10 + i32.add + i32.load + tee_local $3 + i32.const 16 + i32.shl + i32.or + i32.store + get_local $0 + i32.const 12 + i32.add + get_local $3 + i32.const 16 + i32.shr_u + get_local $1 + i32.const 14 + i32.add + i32.load + tee_local $5 + i32.const 16 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + br $continue|4 + end + end + br $break|2 + end + get_local $1 + i32.load + set_local $5 + get_local $0 + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + loop $continue|5 + get_local $2 + i32.const 19 + i32.ge_u + if + get_local $0 + get_local $5 + i32.const 8 + i32.shr_u + get_local $1 + i32.const 3 + i32.add + i32.load + tee_local $3 + i32.const 24 + i32.shl + i32.or + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $3 + i32.const 8 + i32.shr_u + get_local $1 + i32.const 7 + i32.add + i32.load + tee_local $5 + i32.const 24 + i32.shl + i32.or + i32.store + get_local $0 + i32.const 8 + i32.add + get_local $5 + i32.const 8 + i32.shr_u + get_local $1 + i32.const 11 + i32.add + i32.load + tee_local $3 + i32.const 24 + i32.shl + i32.or + i32.store + get_local $0 + i32.const 12 + i32.add + get_local $3 + i32.const 8 + i32.shr_u + get_local $1 + i32.const 15 + i32.add + i32.load + tee_local $5 + i32.const 24 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + br $continue|5 + end + end + end + end + get_local $2 + i32.const 16 + i32.and + if + get_local $0 + get_local $1 + tee_local $3 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $1 + set_local $0 + get_local $1 + get_local $3 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + i32.const 1 + i32.add + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + end + get_local $2 + i32.const 8 + i32.and + if + get_local $0 + get_local $1 + tee_local $3 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $1 + set_local $0 + get_local $1 + get_local $3 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + i32.const 1 + i32.add + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + end + get_local $2 + i32.const 4 + i32.and + if + get_local $0 + get_local $1 + tee_local $3 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $1 + set_local $0 + get_local $1 + get_local $3 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $3 + set_local $0 + get_local $3 + get_local $1 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + i32.const 1 + i32.add + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + end + get_local $2 + i32.const 2 + i32.and + if + get_local $0 + get_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + i32.const 1 + i32.add + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + end + get_local $2 + i32.const 1 + i32.and + if + get_local $1 + set_local $3 + get_local $0 + get_local $1 + i32.load8_u + i32.store8 + end + ) + (func $~lib/internal/memory/memmove (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + get_local $0 + get_local $1 + i32.eq + if + return + end + get_local $1 + get_local $2 + i32.add + get_local $0 + i32.le_u + tee_local $3 + i32.eqz + if + get_local $0 + get_local $2 + i32.add + get_local $1 + i32.le_u + set_local $3 + end + get_local $3 + if + get_local $0 + get_local $1 + get_local $2 + call $~lib/internal/memory/memcpy + return + end + get_local $0 + get_local $1 + i32.lt_u + if + get_local $1 + i32.const 7 + i32.and + get_local $0 + i32.const 7 + i32.and + i32.eq + if + loop $continue|0 + get_local $0 + i32.const 7 + i32.and + if + get_local $2 + i32.eqz + if + return + end + get_local $2 + i32.const 1 + i32.sub + set_local $2 + get_local $0 + tee_local $4 + tee_local $3 + i32.const 1 + i32.add + set_local $0 + get_local $1 + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + br $continue|0 + end + end + loop $continue|1 + get_local $2 + i32.const 8 + i32.ge_u + if + get_local $0 + get_local $1 + i64.load + i64.store + get_local $2 + i32.const 8 + i32.sub + set_local $2 + get_local $0 + i32.const 8 + i32.add + set_local $0 + get_local $1 + i32.const 8 + i32.add + set_local $1 + br $continue|1 + end + end + end + loop $continue|2 + get_local $2 + if + get_local $0 + tee_local $4 + tee_local $3 + i32.const 1 + i32.add + set_local $0 + get_local $1 + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + br $continue|2 + end + end + else + get_local $1 + i32.const 7 + i32.and + get_local $0 + i32.const 7 + i32.and + i32.eq + if + loop $continue|3 + get_local $0 + get_local $2 + i32.add + i32.const 7 + i32.and + if + get_local $2 + i32.eqz + if + return + end + get_local $0 + get_local $2 + i32.const 1 + i32.sub + tee_local $2 + i32.add + get_local $1 + get_local $2 + i32.add + i32.load8_u + i32.store8 + br $continue|3 + end + end + loop $continue|4 + get_local $2 + i32.const 8 + i32.ge_u + if + get_local $0 + get_local $2 + i32.const 8 + i32.sub + tee_local $2 + i32.add + get_local $1 + get_local $2 + i32.add + i64.load + i64.store + br $continue|4 + end + end + end + loop $continue|5 + get_local $2 + if + get_local $0 + get_local $2 + i32.const 1 + i32.sub + tee_local $2 + i32.add + get_local $1 + get_local $2 + i32.add + i32.load8_u + i32.store8 + br $continue|5 + end + end + end + ) + (func $~lib/internal/string/copyUnsafe (; 24 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + get_local $0 + get_local $1 + i32.const 1 + i32.shl + i32.add + i32.const 4 + i32.add + get_local $2 + i32.const 4 + i32.add + get_local $3 + i32.const 1 + i32.shl + call $~lib/internal/memory/memmove + ) + (func $~lib/string/String#concat (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + get_local $0 + i32.eqz + if + i32.const 0 + i32.const 208 + i32.const 110 + i32.const 4 + call $~lib/env/abort + unreachable + end + get_local $1 + i32.eqz + if + i32.const 192 + set_local $1 + end + get_local $0 + i32.load + tee_local $3 + get_local $1 + i32.load + tee_local $4 + i32.add + tee_local $2 + i32.eqz + if + i32.const 240 + return + end + get_local $2 + call $~lib/internal/string/allocateUnsafe + tee_local $2 + i32.const 0 + get_local $0 + get_local $3 + call $~lib/internal/string/copyUnsafe + get_local $2 + get_local $3 + get_local $1 + get_local $4 + call $~lib/internal/string/copyUnsafe + get_local $2 + ) + (func $~lib/string/String.__concat (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + get_local $0 + i32.eqz + if + i32.const 192 + set_local $0 + end + get_local $0 + get_local $1 + call $~lib/string/String#concat + ) + (func $~lib/symbol/symbol#toString (; 27 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) get_global $~lib/symbol/idToString i32.const 0 @@ -1112,35 +2377,25 @@ if get_global $~lib/symbol/idToString get_local $0 - get_local $0 - call $~lib/internal/hash/hash32 - call $~lib/map/Map#find - i32.const 0 - i32.ne + call $~lib/map/Map#has set_local $1 end get_local $1 - if (result i32) + if + i32.const 168 get_global $~lib/symbol/idToString get_local $0 - get_local $0 - call $~lib/internal/hash/hash32 - call $~lib/map/Map#find - tee_local $0 - if (result i32) - get_local $0 - i32.load offset=4 - else - unreachable - end - else - i32.const 0 + call $~lib/map/Map#get + call $~lib/string/String.__concat + i32.const 304 + call $~lib/string/String.__concat + return end - tee_local $0 + i32.const 312 ) - (func $start (; 19 ;) (type $v) + (func $start (; 28 ;) (type $v) (local $0 i32) - i32.const 168 + i32.const 368 set_global $~lib/allocator/arena/startOffset get_global $~lib/allocator/arena/startOffset set_global $~lib/allocator/arena/offset @@ -1248,8 +2503,44 @@ call $~lib/env/abort unreachable end + get_global $~lib/symbol/nextId + tee_local $0 + i32.const 1 + i32.add + set_global $~lib/symbol/nextId + get_local $0 + i32.eqz + if + unreachable + end + get_local $0 + call $~lib/symbol/symbol#toString + i32.const 312 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 24 + i32.const 25 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/symbol/sym3 + call $~lib/symbol/symbol#toString + i32.const 336 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 24 + i32.const 26 + i32.const 0 + call $~lib/env/abort + unreachable + end ) - (func $null (; 20 ;) (type $v) + (func $null (; 29 ;) (type $v) nop ) ) diff --git a/tests/compiler/std/symbol.ts b/tests/compiler/std/symbol.ts index ace259df5a..0344c8f28e 100644 --- a/tests/compiler/std/symbol.ts +++ b/tests/compiler/std/symbol.ts @@ -22,6 +22,9 @@ var key4 = Symbol.keyFor(sym4); assert(key3 == "123"); assert(key3 == key4); +assert(Symbol().toString() == "Symbol()"); +assert(sym3.toString() == "Symbol(123)"); + Symbol.hasInstance; Symbol.concatSpreadable; // ... diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 65b4aa93ee..186072f685 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -7,6 +7,7 @@ (type $iii (func (param i32 i32) (result i32))) (type $iiiiii (func (param i32 i32 i32 i32 i32) (result i32))) (type $iiv (func (param i32 i32))) + (type $iiiiiv (func (param i32 i32 i32 i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (memory $0 1) @@ -14,6 +15,14 @@ (data (i32.const 24) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s\00") (data (i32.const 56) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") (data (i32.const 104) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") + (data (i32.const 168) "\07\00\00\00S\00y\00m\00b\00o\00l\00(\00") + (data (i32.const 192) "\04\00\00\00n\00u\00l\00l\00") + (data (i32.const 208) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 240) "\00\00\00\00") + (data (i32.const 248) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 304) "\01\00\00\00)\00") + (data (i32.const 312) "\08\00\00\00S\00y\00m\00b\00o\00l\00(\00)\00") + (data (i32.const 336) "\0b\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)\00") (table $0 1 anyfunc) (elem (i32.const 0) $null) (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) @@ -43,9 +52,10 @@ (global $std/symbol/key2 (mut i32) (i32.const 0)) (global $std/symbol/key3 (mut i32) (i32.const 0)) (global $std/symbol/key4 (mut i32) (i32.const 0)) + (global $~lib/internal/string/MAX_LENGTH i32 (i32.const 536870910)) (global $~lib/symbol/Symbol.hasInstance i32 (i32.const 1)) (global $~lib/symbol/Symbol.concatSpreadable i32 (i32.const 2)) - (global $HEAP_BASE i32 (i32.const 164)) + (global $HEAP_BASE i32 (i32.const 364)) (export "memory" (memory $0)) (export "table" (table $0)) (start $start) @@ -1512,7 +1522,1601 @@ i32.const 0 end ) - (func $start (; 28 ;) (type $v) + (func $~lib/internal/string/allocateUnsafe (; 28 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + get_local $0 + i32.const 0 + i32.gt_s + tee_local $1 + if (result i32) + get_local $0 + get_global $~lib/internal/string/MAX_LENGTH + i32.le_s + else + get_local $1 + end + i32.eqz + if + i32.const 0 + i32.const 248 + i32.const 14 + i32.const 2 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.allocate|inlined.1 (result i32) + get_global $~lib/internal/string/HEADER_SIZE + get_local $0 + i32.const 1 + i32.shl + i32.add + set_local $1 + get_local $1 + call $~lib/allocator/arena/__memory_allocate + br $~lib/memory/memory.allocate|inlined.1 + end + set_local $2 + get_local $2 + get_local $0 + i32.store + get_local $2 + ) + (func $~lib/internal/memory/memcpy (; 29 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + block $break|0 + loop $continue|0 + get_local $2 + if (result i32) + get_local $1 + i32.const 3 + i32.and + else + get_local $2 + end + if + block + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + end + br $continue|0 + end + end + end + get_local $0 + i32.const 3 + i32.and + i32.const 0 + i32.eq + if + block $break|1 + loop $continue|1 + get_local $2 + i32.const 16 + i32.ge_u + if + block + get_local $0 + get_local $1 + i32.load + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $1 + i32.const 4 + i32.add + i32.load + i32.store + get_local $0 + i32.const 8 + i32.add + get_local $1 + i32.const 8 + i32.add + i32.load + i32.store + get_local $0 + i32.const 12 + i32.add + get_local $1 + i32.const 12 + i32.add + i32.load + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + end + br $continue|1 + end + end + end + get_local $2 + i32.const 8 + i32.and + if + get_local $0 + get_local $1 + i32.load + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $1 + i32.const 4 + i32.add + i32.load + i32.store + get_local $0 + i32.const 8 + i32.add + set_local $0 + get_local $1 + i32.const 8 + i32.add + set_local $1 + end + get_local $2 + i32.const 4 + i32.and + if + get_local $0 + get_local $1 + i32.load + i32.store + get_local $0 + i32.const 4 + i32.add + set_local $0 + get_local $1 + i32.const 4 + i32.add + set_local $1 + end + get_local $2 + i32.const 2 + i32.and + if + get_local $0 + get_local $1 + i32.load16_u + i32.store16 + get_local $0 + i32.const 2 + i32.add + set_local $0 + get_local $1 + i32.const 2 + i32.add + set_local $1 + end + get_local $2 + i32.const 1 + i32.and + if + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + end + return + end + get_local $2 + i32.const 32 + i32.ge_u + if + block $break|2 + block $case2|2 + block $case1|2 + block $case0|2 + get_local $0 + i32.const 3 + i32.and + set_local $5 + get_local $5 + i32.const 1 + i32.eq + br_if $case0|2 + get_local $5 + i32.const 2 + i32.eq + br_if $case1|2 + get_local $5 + i32.const 3 + i32.eq + br_if $case2|2 + br $break|2 + end + block + get_local $1 + i32.load + set_local $3 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + get_local $2 + i32.const 3 + i32.sub + set_local $2 + block $break|3 + loop $continue|3 + get_local $2 + i32.const 17 + i32.ge_u + if + block + get_local $1 + i32.const 1 + i32.add + i32.load + set_local $4 + get_local $0 + get_local $3 + i32.const 24 + i32.shr_u + get_local $4 + i32.const 8 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 5 + i32.add + i32.load + set_local $3 + get_local $0 + i32.const 4 + i32.add + get_local $4 + i32.const 24 + i32.shr_u + get_local $3 + i32.const 8 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 9 + i32.add + i32.load + set_local $4 + get_local $0 + i32.const 8 + i32.add + get_local $3 + i32.const 24 + i32.shr_u + get_local $4 + i32.const 8 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 13 + i32.add + i32.load + set_local $3 + get_local $0 + i32.const 12 + i32.add + get_local $4 + i32.const 24 + i32.shr_u + get_local $3 + i32.const 8 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + end + br $continue|3 + end + end + end + br $break|2 + unreachable + end + unreachable + end + block + get_local $1 + i32.load + set_local $3 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + get_local $2 + i32.const 2 + i32.sub + set_local $2 + block $break|4 + loop $continue|4 + get_local $2 + i32.const 18 + i32.ge_u + if + block + get_local $1 + i32.const 2 + i32.add + i32.load + set_local $4 + get_local $0 + get_local $3 + i32.const 16 + i32.shr_u + get_local $4 + i32.const 16 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 6 + i32.add + i32.load + set_local $3 + get_local $0 + i32.const 4 + i32.add + get_local $4 + i32.const 16 + i32.shr_u + get_local $3 + i32.const 16 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 10 + i32.add + i32.load + set_local $4 + get_local $0 + i32.const 8 + i32.add + get_local $3 + i32.const 16 + i32.shr_u + get_local $4 + i32.const 16 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 14 + i32.add + i32.load + set_local $3 + get_local $0 + i32.const 12 + i32.add + get_local $4 + i32.const 16 + i32.shr_u + get_local $3 + i32.const 16 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + end + br $continue|4 + end + end + end + br $break|2 + unreachable + end + unreachable + end + block + get_local $1 + i32.load + set_local $3 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + block $break|5 + loop $continue|5 + get_local $2 + i32.const 19 + i32.ge_u + if + block + get_local $1 + i32.const 3 + i32.add + i32.load + set_local $4 + get_local $0 + get_local $3 + i32.const 8 + i32.shr_u + get_local $4 + i32.const 24 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 7 + i32.add + i32.load + set_local $3 + get_local $0 + i32.const 4 + i32.add + get_local $4 + i32.const 8 + i32.shr_u + get_local $3 + i32.const 24 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 11 + i32.add + i32.load + set_local $4 + get_local $0 + i32.const 8 + i32.add + get_local $3 + i32.const 8 + i32.shr_u + get_local $4 + i32.const 24 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 15 + i32.add + i32.load + set_local $3 + get_local $0 + i32.const 12 + i32.add + get_local $4 + i32.const 8 + i32.shr_u + get_local $3 + i32.const 24 + i32.shl + i32.or + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + end + br $continue|5 + end + end + end + br $break|2 + unreachable + end + unreachable + end + end + get_local $2 + i32.const 16 + i32.and + if + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + end + get_local $2 + i32.const 8 + i32.and + if + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + end + get_local $2 + i32.const 4 + i32.and + if + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + end + get_local $2 + i32.const 2 + i32.and + if + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + end + get_local $2 + i32.const 1 + i32.and + if + block (result i32) + get_local $0 + tee_local $5 + i32.const 1 + i32.add + set_local $0 + get_local $5 + end + block (result i32) + get_local $1 + tee_local $5 + i32.const 1 + i32.add + set_local $1 + get_local $5 + end + i32.load8_u + i32.store8 + end + ) + (func $~lib/internal/memory/memmove (; 30 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + get_local $0 + get_local $1 + i32.eq + if + return + end + get_local $1 + get_local $2 + i32.add + get_local $0 + i32.le_u + tee_local $3 + if (result i32) + get_local $3 + else + get_local $0 + get_local $2 + i32.add + get_local $1 + i32.le_u + end + if + get_local $0 + get_local $1 + get_local $2 + call $~lib/internal/memory/memcpy + return + end + get_local $0 + get_local $1 + i32.lt_u + if + get_local $1 + i32.const 7 + i32.and + get_local $0 + i32.const 7 + i32.and + i32.eq + if + block $break|0 + loop $continue|0 + get_local $0 + i32.const 7 + i32.and + if + block + get_local $2 + i32.eqz + if + return + end + get_local $2 + i32.const 1 + i32.sub + set_local $2 + block (result i32) + get_local $0 + tee_local $3 + i32.const 1 + i32.add + set_local $0 + get_local $3 + end + block (result i32) + get_local $1 + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $3 + end + i32.load8_u + i32.store8 + end + br $continue|0 + end + end + end + block $break|1 + loop $continue|1 + get_local $2 + i32.const 8 + i32.ge_u + if + block + get_local $0 + get_local $1 + i64.load + i64.store + get_local $2 + i32.const 8 + i32.sub + set_local $2 + get_local $0 + i32.const 8 + i32.add + set_local $0 + get_local $1 + i32.const 8 + i32.add + set_local $1 + end + br $continue|1 + end + end + end + end + block $break|2 + loop $continue|2 + get_local $2 + if + block + block (result i32) + get_local $0 + tee_local $3 + i32.const 1 + i32.add + set_local $0 + get_local $3 + end + block (result i32) + get_local $1 + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $3 + end + i32.load8_u + i32.store8 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + end + br $continue|2 + end + end + end + else + get_local $1 + i32.const 7 + i32.and + get_local $0 + i32.const 7 + i32.and + i32.eq + if + block $break|3 + loop $continue|3 + get_local $0 + get_local $2 + i32.add + i32.const 7 + i32.and + if + block + get_local $2 + i32.eqz + if + return + end + get_local $0 + get_local $2 + i32.const 1 + i32.sub + tee_local $2 + i32.add + get_local $1 + get_local $2 + i32.add + i32.load8_u + i32.store8 + end + br $continue|3 + end + end + end + block $break|4 + loop $continue|4 + get_local $2 + i32.const 8 + i32.ge_u + if + block + get_local $2 + i32.const 8 + i32.sub + set_local $2 + get_local $0 + get_local $2 + i32.add + get_local $1 + get_local $2 + i32.add + i64.load + i64.store + end + br $continue|4 + end + end + end + end + block $break|5 + loop $continue|5 + get_local $2 + if + get_local $0 + get_local $2 + i32.const 1 + i32.sub + tee_local $2 + i32.add + get_local $1 + get_local $2 + i32.add + i32.load8_u + i32.store8 + br $continue|5 + end + end + end + end + ) + (func $~lib/internal/string/copyUnsafe (; 31 ;) (type $iiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + get_local $0 + get_local $1 + i32.const 1 + i32.shl + i32.add + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $5 + get_local $2 + get_local $3 + i32.const 1 + i32.shl + i32.add + get_global $~lib/internal/string/HEADER_SIZE + i32.add + set_local $6 + get_local $4 + i32.const 1 + i32.shl + set_local $7 + get_local $5 + get_local $6 + get_local $7 + call $~lib/internal/memory/memmove + ) + (func $~lib/string/String#concat (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + get_local $0 + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 208 + i32.const 110 + i32.const 4 + call $~lib/env/abort + unreachable + end + get_local $1 + i32.const 0 + i32.eq + if + i32.const 192 + set_local $1 + end + get_local $0 + i32.load + set_local $2 + get_local $1 + i32.load + set_local $3 + get_local $2 + get_local $3 + i32.add + set_local $4 + get_local $4 + i32.const 0 + i32.eq + if + i32.const 240 + return + end + get_local $4 + call $~lib/internal/string/allocateUnsafe + set_local $5 + get_local $5 + i32.const 0 + get_local $0 + i32.const 0 + get_local $2 + call $~lib/internal/string/copyUnsafe + get_local $5 + get_local $2 + get_local $1 + i32.const 0 + get_local $3 + call $~lib/internal/string/copyUnsafe + get_local $5 + ) + (func $~lib/string/String.__concat (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + get_local $0 + i32.eqz + if + i32.const 192 + set_local $0 + end + get_local $0 + get_local $1 + call $~lib/string/String#concat + ) + (func $~lib/symbol/symbol#toString (; 34 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + get_local $0 + set_local $1 + get_global $~lib/symbol/idToString + i32.const 0 + i32.ne + tee_local $2 + if (result i32) + get_global $~lib/symbol/idToString + get_local $1 + call $~lib/map/Map#has + else + get_local $2 + end + if + i32.const 168 + get_global $~lib/symbol/idToString + get_local $1 + call $~lib/map/Map#get + call $~lib/string/String.__concat + i32.const 304 + call $~lib/string/String.__concat + return + end + i32.const 312 + ) + (func $start (; 35 ;) (type $v) get_global $HEAP_BASE get_global $~lib/internal/allocator/AL_MASK i32.add @@ -1619,11 +3223,38 @@ call $~lib/env/abort unreachable end + i32.const 0 + call $~lib/symbol/Symbol + call $~lib/symbol/symbol#toString + i32.const 312 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 24 + i32.const 25 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/symbol/sym3 + call $~lib/symbol/symbol#toString + i32.const 336 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 24 + i32.const 26 + i32.const 0 + call $~lib/env/abort + unreachable + end get_global $~lib/symbol/Symbol.hasInstance drop get_global $~lib/symbol/Symbol.concatSpreadable drop ) - (func $null (; 29 ;) (type $v) + (func $null (; 36 ;) (type $v) ) ) From bb913676e86833901ec48cda24f19a2669dd2a64 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 19:30:25 +0200 Subject: [PATCH 08/13] fixes --- std/assembly/index.d.ts | 2 +- std/portable/index.d.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 64953a1200..14e29c1747 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -668,8 +668,8 @@ interface SymbolConstructor { (description?: string | null): symbol; for(key: string): symbol; keyFor(sym: symbol): string | null; - toString(): string; } + declare const Symbol: SymbolConstructor; interface IMath { diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index d2dae237fe..5b04758c4c 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -480,7 +480,6 @@ interface SymbolConstructor { (description?: string | null): symbol; for(key: string): symbol; keyFor(sym: symbol): string | null; - toString(): string; readonly iterator: symbol; } declare const Symbol: SymbolConstructor; From 871ae22f17c67d1f8f905a255bcb1d88464d688f Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 21:46:58 +0200 Subject: [PATCH 09/13] improve Symbol#toString. Add more tests. Minor fixes --- std/assembly/index.d.ts | 12 ++ std/assembly/symbol.ts | 42 ++-- std/portable/index.d.ts | 12 ++ tests/compiler/std/symbol.optimized.wat | 163 +++++++++++++--- tests/compiler/std/symbol.ts | 7 +- tests/compiler/std/symbol.untouched.wat | 249 +++++++++++++++++++++--- 6 files changed, 423 insertions(+), 62 deletions(-) diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 14e29c1747..25c7e0372e 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -665,6 +665,18 @@ declare class Set { } interface SymbolConstructor { + hasInstance: symbol; + isConcatSpreadable: symbol; + isRegExp: symbol; + iterator: symbol; + match: symbol; + replace: symbol; + search: symbol; + species: symbol; + split: symbol; + toPrimitive: symbol; + toStringTag: symbol; + unscopables: symbol; (description?: string | null): symbol; for(key: string): symbol; keyFor(sym: symbol): string | null; diff --git a/std/assembly/symbol.ts b/std/assembly/symbol.ts index 21bb7c3c2e..4e9f9a728e 100644 --- a/std/assembly/symbol.ts +++ b/std/assembly/symbol.ts @@ -7,10 +7,22 @@ var nextId: usize = 12; // Symbol.unscopables + 1 @unmanaged export class symbol { toString(): string { var id = changetype(this); - if (idToString !== null && idToString.has(id)) { - return "Symbol(" + idToString.get(id) + ")"; + var str: string | null = null; + switch (id) { + case 1: { str = "hasInstance"; break; } + case 2: { str = "isConcatSpreadable"; break; } + case 3: { str = "isRegExp"; break; } + case 4: { str = "match"; break; } + case 5: { str = "replace"; break; } + case 6: { str = "search"; break; } + case 7: { str = "species"; break; } + case 8: { str = "split"; break; } + case 9: { str = "toPrimitive"; break; } + case 10: { str = "toStringTag"; break; } + case 11: { str = "unscopables"; break; } } - return "Symbol()"; + if (idToString !== null && idToString.has(id)) str = idToString.get(id); + return str ? "Symbol(" + str + ")" : "Symbol()"; } } @@ -25,18 +37,18 @@ export function Symbol(description: string | null = null): symbol { export namespace Symbol { // well-known symbols - export const hasInstance = changetype(1); - export const concatSpreadable = changetype(2); - export const isRegExp = changetype(3); - export const iterator = changetype(3); - export const match = changetype(4); - export const replace = changetype(5); - export const search = changetype(6); - export const species = changetype(7); - export const split = changetype(8); - export const toPrimitive = changetype(9); - export const toStringTag = changetype(10); - export const unscopables = changetype(11); + export const hasInstance = changetype(1); + export const isConcatSpreadable = changetype(2); + export const isRegExp = changetype(3); + export const iterator = changetype(3); + export const match = changetype(4); + export const replace = changetype(5); + export const search = changetype(6); + export const species = changetype(7); + export const split = changetype(8); + export const toPrimitive = changetype(9); + export const toStringTag = changetype(10); + export const unscopables = changetype(11); /* tslint:disable */// not valid TS export function for(key: string): symbol { diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index 5b04758c4c..4629402b13 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -477,6 +477,18 @@ declare class Map { } interface SymbolConstructor { + hasInstance: symbol; + isConcatSpreadable: symbol; + isRegExp: symbol; + iterator: symbol; + match: symbol; + replace: symbol; + search: symbol; + species: symbol; + split: symbol; + toPrimitive: symbol; + toStringTag: symbol; + unscopables: symbol; (description?: string | null): symbol; for(key: string): symbol; keyFor(sym: symbol): string | null; diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index 0cb2e3b5dc..e040895395 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -18,13 +18,26 @@ (data (i32.const 24) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s") (data (i32.const 56) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 104) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") - (data (i32.const 168) "\07\00\00\00S\00y\00m\00b\00o\00l\00(") - (data (i32.const 192) "\04\00\00\00n\00u\00l\00l") - (data (i32.const 208) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") - (data (i32.const 248) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") - (data (i32.const 304) "\01\00\00\00)") - (data (i32.const 312) "\08\00\00\00S\00y\00m\00b\00o\00l\00(\00)") - (data (i32.const 336) "\0b\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)") + (data (i32.const 168) "\0b\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e") + (data (i32.const 200) "\12\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e") + (data (i32.const 240) "\08\00\00\00i\00s\00R\00e\00g\00E\00x\00p") + (data (i32.const 264) "\05\00\00\00m\00a\00t\00c\00h") + (data (i32.const 280) "\07\00\00\00r\00e\00p\00l\00a\00c\00e") + (data (i32.const 304) "\06\00\00\00s\00e\00a\00r\00c\00h") + (data (i32.const 320) "\07\00\00\00s\00p\00e\00c\00i\00e\00s") + (data (i32.const 344) "\05\00\00\00s\00p\00l\00i\00t") + (data (i32.const 360) "\0b\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e") + (data (i32.const 392) "\0b\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g") + (data (i32.const 424) "\0b\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s") + (data (i32.const 456) "\07\00\00\00S\00y\00m\00b\00o\00l\00(") + (data (i32.const 480) "\04\00\00\00n\00u\00l\00l") + (data (i32.const 496) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 536) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 592) "\01\00\00\00)") + (data (i32.const 600) "\08\00\00\00S\00y\00m\00b\00o\00l\00(\00)") + (data (i32.const 624) "\0b\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)") + (data (i32.const 656) "\13\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)") + (data (i32.const 704) "\1a\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)") (table $0 1 anyfunc) (elem (i32.const 0) $null) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) @@ -40,6 +53,8 @@ (global $std/symbol/key2 (mut i32) (i32.const 0)) (global $std/symbol/key3 (mut i32) (i32.const 0)) (global $std/symbol/key4 (mut i32) (i32.const 0)) + (global $std/symbol/hasInstance (mut i32) (i32.const 0)) + (global $std/symbol/isConcatSpreadable (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "table" (table $0)) (start $start) @@ -1173,7 +1188,7 @@ i32.eqz if i32.const 0 - i32.const 248 + i32.const 536 i32.const 14 i32.const 2 call $~lib/env/abort @@ -2318,7 +2333,7 @@ i32.eqz if i32.const 0 - i32.const 208 + i32.const 496 i32.const 110 i32.const 4 call $~lib/env/abort @@ -2327,7 +2342,7 @@ get_local $1 i32.eqz if - i32.const 192 + i32.const 480 set_local $1 end get_local $0 @@ -2340,7 +2355,7 @@ tee_local $2 i32.eqz if - i32.const 240 + i32.const 528 return end get_local $2 @@ -2361,7 +2376,7 @@ get_local $0 i32.eqz if - i32.const 192 + i32.const 480 set_local $0 end get_local $0 @@ -2370,32 +2385,106 @@ ) (func $~lib/symbol/symbol#toString (; 27 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + (local $2 i32) + block $break|0 + block $case10|0 + block $case9|0 + block $case8|0 + block $case7|0 + block $case6|0 + block $case5|0 + block $case4|0 + block $case3|0 + block $case2|0 + block $case1|0 + get_local $0 + tee_local $2 + i32.const 1 + i32.ne + if + block $tablify|0 + get_local $2 + i32.const 2 + i32.sub + br_table $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 $case6|0 $case7|0 $case8|0 $case9|0 $case10|0 $tablify|0 + end + br $break|0 + end + i32.const 168 + set_local $1 + br $break|0 + end + i32.const 200 + set_local $1 + br $break|0 + end + i32.const 240 + set_local $1 + br $break|0 + end + i32.const 264 + set_local $1 + br $break|0 + end + i32.const 280 + set_local $1 + br $break|0 + end + i32.const 304 + set_local $1 + br $break|0 + end + i32.const 320 + set_local $1 + br $break|0 + end + i32.const 344 + set_local $1 + br $break|0 + end + i32.const 360 + set_local $1 + br $break|0 + end + i32.const 392 + set_local $1 + br $break|0 + end + i32.const 424 + set_local $1 + end get_global $~lib/symbol/idToString i32.const 0 i32.ne - tee_local $1 + tee_local $2 if get_global $~lib/symbol/idToString get_local $0 call $~lib/map/Map#has - set_local $1 + set_local $2 end - get_local $1 + get_local $2 if - i32.const 168 get_global $~lib/symbol/idToString get_local $0 call $~lib/map/Map#get + set_local $1 + end + get_local $1 + if (result i32) + i32.const 456 + get_local $1 call $~lib/string/String.__concat - i32.const 304 + i32.const 592 call $~lib/string/String.__concat - return + else + i32.const 600 end - i32.const 312 + tee_local $0 ) (func $start (; 28 ;) (type $v) (local $0 i32) - i32.const 368 + i32.const 760 set_global $~lib/allocator/arena/startOffset get_global $~lib/allocator/arena/startOffset set_global $~lib/allocator/arena/offset @@ -2515,7 +2604,7 @@ end get_local $0 call $~lib/symbol/symbol#toString - i32.const 312 + i32.const 600 call $~lib/string/String.__eq i32.eqz if @@ -2528,7 +2617,7 @@ end get_global $std/symbol/sym3 call $~lib/symbol/symbol#toString - i32.const 336 + i32.const 624 call $~lib/string/String.__eq i32.eqz if @@ -2539,6 +2628,36 @@ call $~lib/env/abort unreachable end + i32.const 1 + set_global $std/symbol/hasInstance + i32.const 2 + set_global $std/symbol/isConcatSpreadable + get_global $std/symbol/hasInstance + call $~lib/symbol/symbol#toString + i32.const 656 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 24 + i32.const 30 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/symbol/isConcatSpreadable + call $~lib/symbol/symbol#toString + i32.const 704 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 24 + i32.const 31 + i32.const 0 + call $~lib/env/abort + unreachable + end ) (func $null (; 29 ;) (type $v) nop diff --git a/tests/compiler/std/symbol.ts b/tests/compiler/std/symbol.ts index 0344c8f28e..e5168b36aa 100644 --- a/tests/compiler/std/symbol.ts +++ b/tests/compiler/std/symbol.ts @@ -25,6 +25,11 @@ assert(key3 == key4); assert(Symbol().toString() == "Symbol()"); assert(sym3.toString() == "Symbol(123)"); +var hasInstance = Symbol.hasInstance; +var isConcatSpreadable = Symbol.isConcatSpreadable; +assert(hasInstance.toString() == "Symbol(hasInstance)"); +assert(isConcatSpreadable.toString() == "Symbol(isConcatSpreadable)"); + Symbol.hasInstance; -Symbol.concatSpreadable; +Symbol.isConcatSpreadable; // ... diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 186072f685..21981822d2 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -15,14 +15,27 @@ (data (i32.const 24) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s\00") (data (i32.const 56) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") (data (i32.const 104) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") - (data (i32.const 168) "\07\00\00\00S\00y\00m\00b\00o\00l\00(\00") - (data (i32.const 192) "\04\00\00\00n\00u\00l\00l\00") - (data (i32.const 208) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 240) "\00\00\00\00") - (data (i32.const 248) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 304) "\01\00\00\00)\00") - (data (i32.const 312) "\08\00\00\00S\00y\00m\00b\00o\00l\00(\00)\00") - (data (i32.const 336) "\0b\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)\00") + (data (i32.const 168) "\0b\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00") + (data (i32.const 200) "\12\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00") + (data (i32.const 240) "\08\00\00\00i\00s\00R\00e\00g\00E\00x\00p\00") + (data (i32.const 264) "\05\00\00\00m\00a\00t\00c\00h\00") + (data (i32.const 280) "\07\00\00\00r\00e\00p\00l\00a\00c\00e\00") + (data (i32.const 304) "\06\00\00\00s\00e\00a\00r\00c\00h\00") + (data (i32.const 320) "\07\00\00\00s\00p\00e\00c\00i\00e\00s\00") + (data (i32.const 344) "\05\00\00\00s\00p\00l\00i\00t\00") + (data (i32.const 360) "\0b\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e\00") + (data (i32.const 392) "\0b\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g\00") + (data (i32.const 424) "\0b\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s\00") + (data (i32.const 456) "\07\00\00\00S\00y\00m\00b\00o\00l\00(\00") + (data (i32.const 480) "\04\00\00\00n\00u\00l\00l\00") + (data (i32.const 496) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 528) "\00\00\00\00") + (data (i32.const 536) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 592) "\01\00\00\00)\00") + (data (i32.const 600) "\08\00\00\00S\00y\00m\00b\00o\00l\00(\00)\00") + (data (i32.const 624) "\0b\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)\00") + (data (i32.const 656) "\13\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)\00") + (data (i32.const 704) "\1a\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)\00") (table $0 1 anyfunc) (elem (i32.const 0) $null) (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) @@ -54,8 +67,10 @@ (global $std/symbol/key4 (mut i32) (i32.const 0)) (global $~lib/internal/string/MAX_LENGTH i32 (i32.const 536870910)) (global $~lib/symbol/Symbol.hasInstance i32 (i32.const 1)) - (global $~lib/symbol/Symbol.concatSpreadable i32 (i32.const 2)) - (global $HEAP_BASE i32 (i32.const 364)) + (global $std/symbol/hasInstance (mut i32) (i32.const 0)) + (global $~lib/symbol/Symbol.isConcatSpreadable i32 (i32.const 2)) + (global $std/symbol/isConcatSpreadable (mut i32) (i32.const 0)) + (global $HEAP_BASE i32 (i32.const 760)) (export "memory" (memory $0)) (export "table" (table $0)) (start $start) @@ -1539,7 +1554,7 @@ i32.eqz if i32.const 0 - i32.const 248 + i32.const 536 i32.const 14 i32.const 2 call $~lib/env/abort @@ -3030,7 +3045,7 @@ i32.eqz if i32.const 0 - i32.const 208 + i32.const 496 i32.const 110 i32.const 4 call $~lib/env/abort @@ -3040,7 +3055,7 @@ i32.const 0 i32.eq if - i32.const 192 + i32.const 480 set_local $1 end get_local $0 @@ -3057,7 +3072,7 @@ i32.const 0 i32.eq if - i32.const 240 + i32.const 528 return end get_local $4 @@ -3081,7 +3096,7 @@ get_local $0 i32.eqz if - i32.const 192 + i32.const 480 set_local $0 end get_local $0 @@ -3091,30 +3106,186 @@ (func $~lib/symbol/symbol#toString (; 34 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) + (local $3 i32) get_local $0 set_local $1 + i32.const 0 + set_local $2 + block $break|0 + block $case10|0 + block $case9|0 + block $case8|0 + block $case7|0 + block $case6|0 + block $case5|0 + block $case4|0 + block $case3|0 + block $case2|0 + block $case1|0 + block $case0|0 + get_local $1 + set_local $3 + get_local $3 + i32.const 1 + i32.eq + br_if $case0|0 + get_local $3 + i32.const 2 + i32.eq + br_if $case1|0 + get_local $3 + i32.const 3 + i32.eq + br_if $case2|0 + get_local $3 + i32.const 4 + i32.eq + br_if $case3|0 + get_local $3 + i32.const 5 + i32.eq + br_if $case4|0 + get_local $3 + i32.const 6 + i32.eq + br_if $case5|0 + get_local $3 + i32.const 7 + i32.eq + br_if $case6|0 + get_local $3 + i32.const 8 + i32.eq + br_if $case7|0 + get_local $3 + i32.const 9 + i32.eq + br_if $case8|0 + get_local $3 + i32.const 10 + i32.eq + br_if $case9|0 + get_local $3 + i32.const 11 + i32.eq + br_if $case10|0 + br $break|0 + end + block + i32.const 168 + set_local $2 + br $break|0 + unreachable + end + unreachable + end + block + i32.const 200 + set_local $2 + br $break|0 + unreachable + end + unreachable + end + block + i32.const 240 + set_local $2 + br $break|0 + unreachable + end + unreachable + end + block + i32.const 264 + set_local $2 + br $break|0 + unreachable + end + unreachable + end + block + i32.const 280 + set_local $2 + br $break|0 + unreachable + end + unreachable + end + block + i32.const 304 + set_local $2 + br $break|0 + unreachable + end + unreachable + end + block + i32.const 320 + set_local $2 + br $break|0 + unreachable + end + unreachable + end + block + i32.const 344 + set_local $2 + br $break|0 + unreachable + end + unreachable + end + block + i32.const 360 + set_local $2 + br $break|0 + unreachable + end + unreachable + end + block + i32.const 392 + set_local $2 + br $break|0 + unreachable + end + unreachable + end + block + i32.const 424 + set_local $2 + br $break|0 + unreachable + end + unreachable + end get_global $~lib/symbol/idToString i32.const 0 i32.ne - tee_local $2 + tee_local $3 if (result i32) get_global $~lib/symbol/idToString get_local $1 call $~lib/map/Map#has else - get_local $2 + get_local $3 end if - i32.const 168 get_global $~lib/symbol/idToString get_local $1 call $~lib/map/Map#get + set_local $2 + end + get_local $2 + if (result i32) + i32.const 456 + get_local $2 call $~lib/string/String.__concat - i32.const 304 + i32.const 592 call $~lib/string/String.__concat - return + else + i32.const 600 end - i32.const 312 ) (func $start (; 35 ;) (type $v) get_global $HEAP_BASE @@ -3226,7 +3397,7 @@ i32.const 0 call $~lib/symbol/Symbol call $~lib/symbol/symbol#toString - i32.const 312 + i32.const 600 call $~lib/string/String.__eq i32.eqz if @@ -3239,7 +3410,7 @@ end get_global $std/symbol/sym3 call $~lib/symbol/symbol#toString - i32.const 336 + i32.const 624 call $~lib/string/String.__eq i32.eqz if @@ -3251,8 +3422,38 @@ unreachable end get_global $~lib/symbol/Symbol.hasInstance + set_global $std/symbol/hasInstance + get_global $~lib/symbol/Symbol.isConcatSpreadable + set_global $std/symbol/isConcatSpreadable + get_global $std/symbol/hasInstance + call $~lib/symbol/symbol#toString + i32.const 656 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 24 + i32.const 30 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/symbol/isConcatSpreadable + call $~lib/symbol/symbol#toString + i32.const 704 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 24 + i32.const 31 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $~lib/symbol/Symbol.hasInstance drop - get_global $~lib/symbol/Symbol.concatSpreadable + get_global $~lib/symbol/Symbol.isConcatSpreadable drop ) (func $null (; 36 ;) (type $v) From c4764c77992f24ebcda8d40e63fef7ea9ef68dad Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 21:53:57 +0200 Subject: [PATCH 10/13] fixes --- std/assembly/index.d.ts | 24 ++++++++++++------------ std/portable/index.d.ts | 25 ++++++++++++------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 25c7e0372e..ff77568def 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -665,18 +665,18 @@ declare class Set { } interface SymbolConstructor { - hasInstance: symbol; - isConcatSpreadable: symbol; - isRegExp: symbol; - iterator: symbol; - match: symbol; - replace: symbol; - search: symbol; - species: symbol; - split: symbol; - toPrimitive: symbol; - toStringTag: symbol; - unscopables: symbol; + readonly hasInstance: symbol; + readonly isConcatSpreadable: symbol; + readonly isRegExp: symbol; + readonly iterator: symbol; + readonly match: symbol; + readonly replace: symbol; + readonly search: symbol; + readonly species: symbol; + readonly split: symbol; + readonly toPrimitive: symbol; + readonly toStringTag: symbol; + readonly unscopables: symbol; (description?: string | null): symbol; for(key: string): symbol; keyFor(sym: symbol): string | null; diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index 4629402b13..99a0c90881 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -477,22 +477,21 @@ declare class Map { } interface SymbolConstructor { - hasInstance: symbol; - isConcatSpreadable: symbol; - isRegExp: symbol; - iterator: symbol; - match: symbol; - replace: symbol; - search: symbol; - species: symbol; - split: symbol; - toPrimitive: symbol; - toStringTag: symbol; - unscopables: symbol; + readonly hasInstance: symbol; + readonly isConcatSpreadable: symbol; + readonly isRegExp: symbol; + readonly iterator: symbol; + readonly match: symbol; + readonly replace: symbol; + readonly search: symbol; + readonly species: symbol; + readonly split: symbol; + readonly toPrimitive: symbol; + readonly toStringTag: symbol; + readonly unscopables: symbol; (description?: string | null): symbol; for(key: string): symbol; keyFor(sym: symbol): string | null; - readonly iterator: symbol; } declare const Symbol: SymbolConstructor; From f0529fd6e1803190bedb9236543716397784d367 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 23:12:53 +0200 Subject: [PATCH 11/13] update Symbol#toString --- std/assembly/symbol.ts | 5 +- tests/compiler/std/symbol.optimized.wat | 99 ++++++------- tests/compiler/std/symbol.untouched.wat | 181 ++++++++++++------------ 3 files changed, 149 insertions(+), 136 deletions(-) diff --git a/std/assembly/symbol.ts b/std/assembly/symbol.ts index 4e9f9a728e..99a781e4eb 100644 --- a/std/assembly/symbol.ts +++ b/std/assembly/symbol.ts @@ -20,8 +20,11 @@ var nextId: usize = 12; // Symbol.unscopables + 1 case 9: { str = "toPrimitive"; break; } case 10: { str = "toStringTag"; break; } case 11: { str = "unscopables"; break; } + default: { + if (idToString !== null && idToString.has(id)) str = idToString.get(id); + break; + } } - if (idToString !== null && idToString.has(id)) str = idToString.get(id); return str ? "Symbol(" + str + ")" : "Symbol()"; } } diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index e040895395..f6a05f4047 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -2387,88 +2387,91 @@ (local $1 i32) (local $2 i32) block $break|0 - block $case10|0 - block $case9|0 - block $case8|0 - block $case7|0 - block $case6|0 - block $case5|0 - block $case4|0 - block $case3|0 - block $case2|0 - block $case1|0 - get_local $0 - tee_local $2 - i32.const 1 - i32.ne - if - block $tablify|0 - get_local $2 - i32.const 2 - i32.sub - br_table $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 $case6|0 $case7|0 $case8|0 $case9|0 $case10|0 $tablify|0 + block $case11|0 + block $case10|0 + block $case9|0 + block $case8|0 + block $case7|0 + block $case6|0 + block $case5|0 + block $case4|0 + block $case3|0 + block $case2|0 + block $case1|0 + get_local $0 + tee_local $2 + i32.const 1 + i32.ne + if + block $tablify|0 + get_local $2 + i32.const 2 + i32.sub + br_table $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 $case6|0 $case7|0 $case8|0 $case9|0 $case10|0 $tablify|0 + end + br $case11|0 end + i32.const 168 + set_local $1 br $break|0 end - i32.const 168 + i32.const 200 set_local $1 br $break|0 end - i32.const 200 + i32.const 240 set_local $1 br $break|0 end - i32.const 240 + i32.const 264 set_local $1 br $break|0 end - i32.const 264 + i32.const 280 set_local $1 br $break|0 end - i32.const 280 + i32.const 304 set_local $1 br $break|0 end - i32.const 304 + i32.const 320 set_local $1 br $break|0 end - i32.const 320 + i32.const 344 set_local $1 br $break|0 end - i32.const 344 + i32.const 360 set_local $1 br $break|0 end - i32.const 360 + i32.const 392 set_local $1 br $break|0 end - i32.const 392 + i32.const 424 set_local $1 br $break|0 end - i32.const 424 - set_local $1 - end - get_global $~lib/symbol/idToString - i32.const 0 - i32.ne - tee_local $2 - if - get_global $~lib/symbol/idToString - get_local $0 - call $~lib/map/Map#has - set_local $2 - end - get_local $2 - if get_global $~lib/symbol/idToString - get_local $0 - call $~lib/map/Map#get - set_local $1 + i32.const 0 + i32.ne + tee_local $2 + if + get_global $~lib/symbol/idToString + get_local $0 + call $~lib/map/Map#has + set_local $2 + end + get_local $2 + if + get_global $~lib/symbol/idToString + get_local $0 + call $~lib/map/Map#get + set_local $1 + end end get_local $1 if (result i32) diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 21981822d2..31686de2ac 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -3112,67 +3112,76 @@ i32.const 0 set_local $2 block $break|0 - block $case10|0 - block $case9|0 - block $case8|0 - block $case7|0 - block $case6|0 - block $case5|0 - block $case4|0 - block $case3|0 - block $case2|0 - block $case1|0 - block $case0|0 - get_local $1 - set_local $3 - get_local $3 - i32.const 1 - i32.eq - br_if $case0|0 - get_local $3 - i32.const 2 - i32.eq - br_if $case1|0 - get_local $3 - i32.const 3 - i32.eq - br_if $case2|0 - get_local $3 - i32.const 4 - i32.eq - br_if $case3|0 - get_local $3 - i32.const 5 - i32.eq - br_if $case4|0 - get_local $3 - i32.const 6 - i32.eq - br_if $case5|0 - get_local $3 - i32.const 7 - i32.eq - br_if $case6|0 - get_local $3 - i32.const 8 - i32.eq - br_if $case7|0 - get_local $3 - i32.const 9 - i32.eq - br_if $case8|0 - get_local $3 - i32.const 10 - i32.eq - br_if $case9|0 - get_local $3 - i32.const 11 - i32.eq - br_if $case10|0 - br $break|0 + block $case11|0 + block $case10|0 + block $case9|0 + block $case8|0 + block $case7|0 + block $case6|0 + block $case5|0 + block $case4|0 + block $case3|0 + block $case2|0 + block $case1|0 + block $case0|0 + get_local $1 + set_local $3 + get_local $3 + i32.const 1 + i32.eq + br_if $case0|0 + get_local $3 + i32.const 2 + i32.eq + br_if $case1|0 + get_local $3 + i32.const 3 + i32.eq + br_if $case2|0 + get_local $3 + i32.const 4 + i32.eq + br_if $case3|0 + get_local $3 + i32.const 5 + i32.eq + br_if $case4|0 + get_local $3 + i32.const 6 + i32.eq + br_if $case5|0 + get_local $3 + i32.const 7 + i32.eq + br_if $case6|0 + get_local $3 + i32.const 8 + i32.eq + br_if $case7|0 + get_local $3 + i32.const 9 + i32.eq + br_if $case8|0 + get_local $3 + i32.const 10 + i32.eq + br_if $case9|0 + get_local $3 + i32.const 11 + i32.eq + br_if $case10|0 + br $case11|0 + end + block + i32.const 168 + set_local $2 + br $break|0 + unreachable + end + unreachable end block - i32.const 168 + i32.const 200 set_local $2 br $break|0 unreachable @@ -3180,7 +3189,7 @@ unreachable end block - i32.const 200 + i32.const 240 set_local $2 br $break|0 unreachable @@ -3188,7 +3197,7 @@ unreachable end block - i32.const 240 + i32.const 264 set_local $2 br $break|0 unreachable @@ -3196,7 +3205,7 @@ unreachable end block - i32.const 264 + i32.const 280 set_local $2 br $break|0 unreachable @@ -3204,7 +3213,7 @@ unreachable end block - i32.const 280 + i32.const 304 set_local $2 br $break|0 unreachable @@ -3212,7 +3221,7 @@ unreachable end block - i32.const 304 + i32.const 320 set_local $2 br $break|0 unreachable @@ -3220,7 +3229,7 @@ unreachable end block - i32.const 320 + i32.const 344 set_local $2 br $break|0 unreachable @@ -3228,7 +3237,7 @@ unreachable end block - i32.const 344 + i32.const 360 set_local $2 br $break|0 unreachable @@ -3236,7 +3245,7 @@ unreachable end block - i32.const 360 + i32.const 392 set_local $2 br $break|0 unreachable @@ -3244,7 +3253,7 @@ unreachable end block - i32.const 392 + i32.const 424 set_local $2 br $break|0 unreachable @@ -3252,30 +3261,28 @@ unreachable end block - i32.const 424 - set_local $2 + get_global $~lib/symbol/idToString + i32.const 0 + i32.ne + tee_local $3 + if (result i32) + get_global $~lib/symbol/idToString + get_local $1 + call $~lib/map/Map#has + else + get_local $3 + end + if + get_global $~lib/symbol/idToString + get_local $1 + call $~lib/map/Map#get + set_local $2 + end br $break|0 unreachable end unreachable end - get_global $~lib/symbol/idToString - i32.const 0 - i32.ne - tee_local $3 - if (result i32) - get_global $~lib/symbol/idToString - get_local $1 - call $~lib/map/Map#has - else - get_local $3 - end - if - get_global $~lib/symbol/idToString - get_local $1 - call $~lib/map/Map#get - set_local $2 - end get_local $2 if (result i32) i32.const 456 From 34409c64165b63c35310e81ebfe48b7ab8ee586c Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 12 Nov 2018 23:15:46 +0200 Subject: [PATCH 12/13] simplify Simbol#toString --- std/assembly/symbol.ts | 4 +- tests/compiler/std/symbol.optimized.wat | 74 ++++++++++++------------ tests/compiler/std/symbol.untouched.wat | 75 ++++++++++++------------- 3 files changed, 72 insertions(+), 81 deletions(-) diff --git a/std/assembly/symbol.ts b/std/assembly/symbol.ts index 99a781e4eb..e0059a6a03 100644 --- a/std/assembly/symbol.ts +++ b/std/assembly/symbol.ts @@ -7,7 +7,7 @@ var nextId: usize = 12; // Symbol.unscopables + 1 @unmanaged export class symbol { toString(): string { var id = changetype(this); - var str: string | null = null; + var str = ""; switch (id) { case 1: { str = "hasInstance"; break; } case 2: { str = "isConcatSpreadable"; break; } @@ -25,7 +25,7 @@ var nextId: usize = 12; // Symbol.unscopables + 1 break; } } - return str ? "Symbol(" + str + ")" : "Symbol()"; + return "Symbol(" + str + ")"; } } diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index f6a05f4047..5217be339d 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -18,20 +18,20 @@ (data (i32.const 24) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s") (data (i32.const 56) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 104) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") - (data (i32.const 168) "\0b\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e") - (data (i32.const 200) "\12\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e") - (data (i32.const 240) "\08\00\00\00i\00s\00R\00e\00g\00E\00x\00p") - (data (i32.const 264) "\05\00\00\00m\00a\00t\00c\00h") - (data (i32.const 280) "\07\00\00\00r\00e\00p\00l\00a\00c\00e") - (data (i32.const 304) "\06\00\00\00s\00e\00a\00r\00c\00h") - (data (i32.const 320) "\07\00\00\00s\00p\00e\00c\00i\00e\00s") - (data (i32.const 344) "\05\00\00\00s\00p\00l\00i\00t") - (data (i32.const 360) "\0b\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e") - (data (i32.const 392) "\0b\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g") - (data (i32.const 424) "\0b\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s") - (data (i32.const 456) "\07\00\00\00S\00y\00m\00b\00o\00l\00(") - (data (i32.const 480) "\04\00\00\00n\00u\00l\00l") - (data (i32.const 496) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 176) "\0b\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e") + (data (i32.const 208) "\12\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e") + (data (i32.const 248) "\08\00\00\00i\00s\00R\00e\00g\00E\00x\00p") + (data (i32.const 272) "\05\00\00\00m\00a\00t\00c\00h") + (data (i32.const 288) "\07\00\00\00r\00e\00p\00l\00a\00c\00e") + (data (i32.const 312) "\06\00\00\00s\00e\00a\00r\00c\00h") + (data (i32.const 328) "\07\00\00\00s\00p\00e\00c\00i\00e\00s") + (data (i32.const 352) "\05\00\00\00s\00p\00l\00i\00t") + (data (i32.const 368) "\0b\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e") + (data (i32.const 400) "\0b\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g") + (data (i32.const 432) "\0b\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s") + (data (i32.const 464) "\07\00\00\00S\00y\00m\00b\00o\00l\00(") + (data (i32.const 488) "\04\00\00\00n\00u\00l\00l") + (data (i32.const 504) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") (data (i32.const 536) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") (data (i32.const 592) "\01\00\00\00)") (data (i32.const 600) "\08\00\00\00S\00y\00m\00b\00o\00l\00(\00)") @@ -2333,7 +2333,7 @@ i32.eqz if i32.const 0 - i32.const 496 + i32.const 504 i32.const 110 i32.const 4 call $~lib/env/abort @@ -2342,7 +2342,7 @@ get_local $1 i32.eqz if - i32.const 480 + i32.const 488 set_local $1 end get_local $0 @@ -2355,7 +2355,7 @@ tee_local $2 i32.eqz if - i32.const 528 + i32.const 168 return end get_local $2 @@ -2376,7 +2376,7 @@ get_local $0 i32.eqz if - i32.const 480 + i32.const 488 set_local $0 end get_local $0 @@ -2386,6 +2386,8 @@ (func $~lib/symbol/symbol#toString (; 27 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) + i32.const 168 + set_local $1 block $break|0 block $case11|0 block $case10|0 @@ -2411,47 +2413,47 @@ end br $case11|0 end - i32.const 168 + i32.const 176 set_local $1 br $break|0 end - i32.const 200 + i32.const 208 set_local $1 br $break|0 end - i32.const 240 + i32.const 248 set_local $1 br $break|0 end - i32.const 264 + i32.const 272 set_local $1 br $break|0 end - i32.const 280 + i32.const 288 set_local $1 br $break|0 end - i32.const 304 + i32.const 312 set_local $1 br $break|0 end - i32.const 320 + i32.const 328 set_local $1 br $break|0 end - i32.const 344 + i32.const 352 set_local $1 br $break|0 end - i32.const 360 + i32.const 368 set_local $1 br $break|0 end - i32.const 392 + i32.const 400 set_local $1 br $break|0 end - i32.const 424 + i32.const 432 set_local $1 br $break|0 end @@ -2473,17 +2475,11 @@ set_local $1 end end + i32.const 464 get_local $1 - if (result i32) - i32.const 456 - get_local $1 - call $~lib/string/String.__concat - i32.const 592 - call $~lib/string/String.__concat - else - i32.const 600 - end - tee_local $0 + call $~lib/string/String.__concat + i32.const 592 + call $~lib/string/String.__concat ) (func $start (; 28 ;) (type $v) (local $0 i32) diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 31686de2ac..4a9142d406 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -15,21 +15,21 @@ (data (i32.const 24) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s\00") (data (i32.const 56) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") (data (i32.const 104) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") - (data (i32.const 168) "\0b\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00") - (data (i32.const 200) "\12\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00") - (data (i32.const 240) "\08\00\00\00i\00s\00R\00e\00g\00E\00x\00p\00") - (data (i32.const 264) "\05\00\00\00m\00a\00t\00c\00h\00") - (data (i32.const 280) "\07\00\00\00r\00e\00p\00l\00a\00c\00e\00") - (data (i32.const 304) "\06\00\00\00s\00e\00a\00r\00c\00h\00") - (data (i32.const 320) "\07\00\00\00s\00p\00e\00c\00i\00e\00s\00") - (data (i32.const 344) "\05\00\00\00s\00p\00l\00i\00t\00") - (data (i32.const 360) "\0b\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e\00") - (data (i32.const 392) "\0b\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g\00") - (data (i32.const 424) "\0b\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s\00") - (data (i32.const 456) "\07\00\00\00S\00y\00m\00b\00o\00l\00(\00") - (data (i32.const 480) "\04\00\00\00n\00u\00l\00l\00") - (data (i32.const 496) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 528) "\00\00\00\00") + (data (i32.const 168) "\00\00\00\00") + (data (i32.const 176) "\0b\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00") + (data (i32.const 208) "\12\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00") + (data (i32.const 248) "\08\00\00\00i\00s\00R\00e\00g\00E\00x\00p\00") + (data (i32.const 272) "\05\00\00\00m\00a\00t\00c\00h\00") + (data (i32.const 288) "\07\00\00\00r\00e\00p\00l\00a\00c\00e\00") + (data (i32.const 312) "\06\00\00\00s\00e\00a\00r\00c\00h\00") + (data (i32.const 328) "\07\00\00\00s\00p\00e\00c\00i\00e\00s\00") + (data (i32.const 352) "\05\00\00\00s\00p\00l\00i\00t\00") + (data (i32.const 368) "\0b\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e\00") + (data (i32.const 400) "\0b\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g\00") + (data (i32.const 432) "\0b\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s\00") + (data (i32.const 464) "\07\00\00\00S\00y\00m\00b\00o\00l\00(\00") + (data (i32.const 488) "\04\00\00\00n\00u\00l\00l\00") + (data (i32.const 504) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") (data (i32.const 536) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") (data (i32.const 592) "\01\00\00\00)\00") (data (i32.const 600) "\08\00\00\00S\00y\00m\00b\00o\00l\00(\00)\00") @@ -3045,7 +3045,7 @@ i32.eqz if i32.const 0 - i32.const 496 + i32.const 504 i32.const 110 i32.const 4 call $~lib/env/abort @@ -3055,7 +3055,7 @@ i32.const 0 i32.eq if - i32.const 480 + i32.const 488 set_local $1 end get_local $0 @@ -3072,7 +3072,7 @@ i32.const 0 i32.eq if - i32.const 528 + i32.const 168 return end get_local $4 @@ -3096,7 +3096,7 @@ get_local $0 i32.eqz if - i32.const 480 + i32.const 488 set_local $0 end get_local $0 @@ -3109,7 +3109,7 @@ (local $3 i32) get_local $0 set_local $1 - i32.const 0 + i32.const 168 set_local $2 block $break|0 block $case11|0 @@ -3173,7 +3173,7 @@ br $case11|0 end block - i32.const 168 + i32.const 176 set_local $2 br $break|0 unreachable @@ -3181,7 +3181,7 @@ unreachable end block - i32.const 200 + i32.const 208 set_local $2 br $break|0 unreachable @@ -3189,7 +3189,7 @@ unreachable end block - i32.const 240 + i32.const 248 set_local $2 br $break|0 unreachable @@ -3197,7 +3197,7 @@ unreachable end block - i32.const 264 + i32.const 272 set_local $2 br $break|0 unreachable @@ -3205,7 +3205,7 @@ unreachable end block - i32.const 280 + i32.const 288 set_local $2 br $break|0 unreachable @@ -3213,7 +3213,7 @@ unreachable end block - i32.const 304 + i32.const 312 set_local $2 br $break|0 unreachable @@ -3221,7 +3221,7 @@ unreachable end block - i32.const 320 + i32.const 328 set_local $2 br $break|0 unreachable @@ -3229,7 +3229,7 @@ unreachable end block - i32.const 344 + i32.const 352 set_local $2 br $break|0 unreachable @@ -3237,7 +3237,7 @@ unreachable end block - i32.const 360 + i32.const 368 set_local $2 br $break|0 unreachable @@ -3245,7 +3245,7 @@ unreachable end block - i32.const 392 + i32.const 400 set_local $2 br $break|0 unreachable @@ -3253,7 +3253,7 @@ unreachable end block - i32.const 424 + i32.const 432 set_local $2 br $break|0 unreachable @@ -3283,16 +3283,11 @@ end unreachable end + i32.const 464 get_local $2 - if (result i32) - i32.const 456 - get_local $2 - call $~lib/string/String.__concat - i32.const 592 - call $~lib/string/String.__concat - else - i32.const 600 - end + call $~lib/string/String.__concat + i32.const 592 + call $~lib/string/String.__concat ) (func $start (; 35 ;) (type $v) get_global $HEAP_BASE From 860572a2ffebef588cbf00aface945d57b18b440 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Tue, 13 Nov 2018 02:15:59 +0200 Subject: [PATCH 13/13] add SyntaxError which required for JSON.parse --- std/assembly/error.ts | 9 ++++++++- std/assembly/index.d.ts | 3 +++ std/portable/index.d.ts | 21 +++++++++++++++++++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/std/assembly/error.ts b/std/assembly/error.ts index 5ec7076058..9c694f57a1 100644 --- a/std/assembly/error.ts +++ b/std/assembly/error.ts @@ -1,6 +1,6 @@ export class Error { - name: string = "Error"; + name: string = "Error"; stack: string = ""; // TODO constructor( @@ -28,3 +28,10 @@ export class TypeError extends Error { this.name = "TypeError"; } } + +export class SyntaxError extends Error { + constructor(message: string = "") { + super(message); + this.name = "SyntaxError"; + } +} diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index ff77568def..bf673a8783 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -638,6 +638,9 @@ declare class RangeError extends Error { } /** Class for indicating an error when a value is not of the expected type. */ declare class TypeError extends Error { } +/** Class for indicating an error when trying to interpret syntactically invalid code. */ +declare class SyntaxError extends Error { } + interface Boolean {} interface Function {} interface IArguments {} diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index 99a0c90881..65128275ec 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -439,17 +439,34 @@ interface RegExp {} interface IArguments {} +/** Class for representing a runtime error. Base class of all errors. */ declare class Error { + + /** Error name. */ name: string; - stack?: string; + + /** Message provided on construction. */ message: string; - constructor(message: string); + + /** Stack trace. */ + stack?: string; + + /** Constructs a new error, optionally with a message. */ + constructor(message?: string); + + /** Method returns a string representing the specified Error class. */ toString(): string; } +/** Class for indicating an error when a value is not in the set or range of allowed values. */ declare class RangeError extends Error { } + +/** Class for indicating an error when a value is not of the expected type. */ declare class TypeError extends Error { } +/** Class for indicating an error when trying to interpret syntactically invalid code. */ +declare class SyntaxError extends Error { } + declare class Set { constructor(entries?: T[]); readonly size: i32;