diff --git a/std/assembly/encoding.ts b/std/assembly/encoding.ts deleted file mode 100644 index 1599b159c2..0000000000 --- a/std/assembly/encoding.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { BLOCK, BLOCK_OVERHEAD } from "rt/common"; - -export namespace Encoding { - - export namespace UTF8 { - - export function byteLength(str: string, nullTerminated: bool = false): i32 { - var strOff = changetype(str); - var strEnd = strOff + changetype(changetype(str) - BLOCK_OVERHEAD).rtSize; - var bufLen = nullTerminated ? 1 : 0; - while (strOff < strEnd) { - let c1 = load(strOff); - if (c1 < 128) { - if (nullTerminated && !c1) break; - bufLen += 1; strOff += 2; - } else if (c1 < 2048) { - bufLen += 2; strOff += 2; - } else { - if ((c1 & 0xFC00) == 0xD800 && strOff + 2 < strEnd) { - if ((load(strOff, 2) & 0xFC00) == 0xDC00) { - strOff += 4; bufLen += 4; - continue; - } - } - strOff += 2; bufLen += 3; - } - } - return bufLen; - } - - export function encode(str: string, nullTerminated: bool = false): ArrayBuffer { - var strOff = changetype(str); - var strEnd = changetype(str) + changetype(changetype(str) - BLOCK_OVERHEAD).rtSize; - var buf = __alloc(UTF8.byteLength(str, nullTerminated), idof()); - var bufOff = buf; - while (strOff < strEnd) { - let c1 = load(strOff); - if (c1 < 128) { - if (nullTerminated && !c1) break; - store(bufOff, c1); - bufOff += 1; strOff += 2; - } else if (c1 < 2048) { - store(bufOff, c1 >> 6 | 192); - store(bufOff, c1 & 63 | 128, 1); - bufOff += 2; strOff += 2; - } else { - if ((c1 & 0xFC00) == 0xD800 && strOff + 2 < strEnd) { - let c2 = load(strOff, 2); - if ((c2 & 0xFC00) == 0xDC00) { - c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); - store(bufOff, c1 >> 18 | 240); - store(bufOff, c1 >> 12 & 63 | 128, 1); - store(bufOff, c1 >> 6 & 63 | 128, 2); - store(bufOff, c1 & 63 | 128, 3); - strOff += 4; bufOff += 4; - continue; - } - } - store(bufOff, c1 >> 12 | 224); - store(bufOff, c1 >> 6 & 63 | 128, 1); - store(bufOff, c1 & 63 | 128, 2); - strOff += 2; bufOff += 3; - } - } - if (nullTerminated) { - assert(strOff <= strEnd); - buf = __realloc(buf, bufOff - buf + 1); - store(bufOff, 0); - } else { - assert(strOff == strEnd); - } - return changetype(buf); // retains - } - - export function decode(buf: ArrayBuffer, nullTerminated: bool = false): string { - return decodeUnsafe(changetype(buf), buf.byteLength, nullTerminated); - } - - // @ts-ignore: decorator - @unsafe - export function decodeUnsafe(buf: usize, len: usize, nullTerminated: bool = false): string { - var bufOff = buf; - var bufEnd = buf + len; - assert(bufEnd >= bufOff); // guard wraparound - var str = __alloc(len << 1, idof()); // max is one u16 char per u8 byte - var strOff = str; - while (bufOff < bufEnd) { - let cp = load(bufOff++); - if (cp < 128) { - if (nullTerminated && !cp) break; - store(strOff, cp); - strOff += 2; - } else if (cp > 191 && cp < 224) { - // if (bufEnd - bufOff < 1) break; - store(strOff, (cp & 31) << 6 | load(bufOff++) & 63); - strOff += 2; - } else if (cp > 239 && cp < 365) { - // if (bufEnd - bufOff < 3) break; - cp = ( - (cp & 7) << 18 | - (load(bufOff) & 63) << 12 | - (load(bufOff, 1) & 63) << 6 | - load(bufOff, 2) & 63 - ) - 0x10000; - bufOff += 3; - store(strOff, 0xD800 + (cp >> 10)); - store(strOff, 0xDC00 + (cp & 1023), 2); - strOff += 4; - } else { - // if (bufEnd - bufOff < 2) break; - store(strOff, - (cp & 15) << 12 | - (load(bufOff) & 63) << 6 | - load(bufOff, 1) & 63 - ); - bufOff += 2; strOff += 2; - } - } - return changetype(__realloc(str, strOff - str)); // retains - } - } - - export namespace UTF16 { - - export function byteLength(str: string): i32 { - return str.length << 1; - } - - export function encode(str: string): ArrayBuffer { - var size = changetype(changetype(str) - BLOCK_OVERHEAD).rtSize; - var buf = __alloc(size, idof()); - memory.copy(buf, changetype(str), size); - return changetype(buf); // retains - } - - export function decode(buf: ArrayBuffer): string { - return decodeUnsafe(changetype(buf), buf.byteLength); - } - - // @ts-ignore: decorator - @unsafe - export function decodeUnsafe(buf: usize, len: usize): string { - var str = __alloc(len &= ~1, idof()); - memory.copy(str, buf, len); - return changetype(str); // retains - } - } -} diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 98ddaecf8c..abf1720dde 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -1221,15 +1221,11 @@ declare class FixedArray { /** Class representing a sequence of characters. */ declare class String { - static fromCharCode(ls: i32, hs?: i32): string; static fromCharCodes(arr: u16[]): string; static fromCodePoint(code: i32): string; static fromCodePoints(arr: i32[]): string; - readonly length: i32; - readonly lengthUTF8: i32; - charAt(index: u32): string; charCodeAt(index: u32): u16; concat(other: string): string; @@ -1253,21 +1249,28 @@ declare class String { slice(beginIndex: i32, endIndex?: i32): string; split(separator?: string, limit?: i32): string[]; toString(): string; - static fromUTF8(ptr: usize, len: usize): string; - toUTF8(): usize; } - -declare namespace Encoding { +declare namespace String { + /** Encoding helpers for UTF-8. */ export namespace UTF8 { + /** Calculates the byte length of the specified string when encoded as UTF-8, optionally null terminated. */ export function byteLength(str: string, nullTerminated?: bool): i32; + /** Encodes the specified string to UTF-8 bytes, optionally null terminated. */ export function encode(str: string, nullTerminated?: bool): ArrayBuffer; + /** Decodes the specified buffer from UTF-8 bytes to a string, optionally null terminated. */ export function decode(buf: ArrayBuffer, nullTerminated?: bool): string; + /** Decodes raw UTF-8 bytes to a string, optionally null terminated. */ export function decodeUnsafe(buf: usize, len: usize, nullTerminated?: bool): string; } + /** Encoding helpers for UTF-16. */ export namespace UTF16 { + /** Calculates the byte length of the specified string when encoded as UTF-16. */ export function byteLength(str: string): i32; + /** Encodes the specified string to UTF-16 bytes. */ export function encode(str: string): ArrayBuffer; + /** Decodes the specified buffer from UTF-16 bytes to a string. */ export function decode(buf: ArrayBuffer): string; + /** Decodes raw UTF-16 bytes to a string. */ export function decodeUnsafe(buf: usize, len: usize): string; } } diff --git a/std/assembly/string.ts b/std/assembly/string.ts index 15160d9756..a520a75b00 100644 --- a/std/assembly/string.ts +++ b/std/assembly/string.ts @@ -512,121 +512,163 @@ import { idof } from "./builtins"; toString(): String { return this; } +} - get lengthUTF8(): i32 { - var len = 1; // null terminated - var pos: usize = 0; - var end = this.length; - while (pos < end) { - let c = load(changetype(this) + (pos << 1)); - if (c < 128) { - len += 1; ++pos; - } else if (c < 2048) { - len += 2; ++pos; - } else { - if ( - (c & 0xFC00) == 0xD800 && pos + 1 < end && - (load(changetype(this) + ((pos + 1) << 1)) & 0xFC00) == 0xDC00 - ) { - len += 4; pos += 2; +// @ts-ignore: nolib +export type string = String; + +export function parseInt(str: string, radix: i32 = 0): f64 { + return strtol(str, radix); +} + +export function parseFloat(str: string): f64 { + return strtod(str); +} + +// Encoding helpers +export namespace String { + + export namespace UTF8 { + + export function byteLength(str: string, nullTerminated: bool = false): i32 { + var strOff = changetype(str); + var strEnd = strOff + changetype(changetype(str) - BLOCK_OVERHEAD).rtSize; + var bufLen = nullTerminated ? 1 : 0; + while (strOff < strEnd) { + let c1 = load(strOff); + if (c1 < 128) { + if (nullTerminated && !c1) break; + bufLen += 1; strOff += 2; + } else if (c1 < 2048) { + bufLen += 2; strOff += 2; } else { - len += 3; ++pos; + if ((c1 & 0xFC00) == 0xD800 && strOff + 2 < strEnd) { + if ((load(strOff, 2) & 0xFC00) == 0xDC00) { + strOff += 4; bufLen += 4; + continue; + } + } + strOff += 2; bufLen += 3; } } + return bufLen; } - return len; - } - - static fromUTF8(ptr: usize, len: usize): String { - if (len < 1) return changetype(""); - var ptrPos = 0; - var buf = __alloc(len << 1, 0); - var bufPos = 0; - while (ptrPos < len) { - let cp = load(ptr + ptrPos++); - if (cp < 128) { - store(buf + bufPos, cp); - bufPos += 2; - } else if (cp > 191 && cp < 224) { - assert(ptrPos + 1 <= len); - store(buf + bufPos, (cp & 31) << 6 | load(ptr + ptrPos++) & 63); - bufPos += 2; - } else if (cp > 239 && cp < 365) { - assert(ptrPos + 3 <= len); - cp = ( - (cp & 7) << 18 | - (load(ptr + ptrPos++) & 63) << 12 | - (load(ptr + ptrPos++) & 63) << 6 | - load(ptr + ptrPos++) & 63 - ) - 0x10000; - store(buf + bufPos, 0xD800 + (cp >> 10)); - bufPos += 2; - store(buf + bufPos, 0xDC00 + (cp & 1023)); - bufPos += 2; + + export function encode(str: string, nullTerminated: bool = false): ArrayBuffer { + var strOff = changetype(str); + var strEnd = changetype(str) + changetype(changetype(str) - BLOCK_OVERHEAD).rtSize; + var buf = __alloc(UTF8.byteLength(str, nullTerminated), idof()); + var bufOff = buf; + while (strOff < strEnd) { + let c1 = load(strOff); + if (c1 < 128) { + if (nullTerminated && !c1) break; + store(bufOff, c1); + bufOff += 1; strOff += 2; + } else if (c1 < 2048) { + store(bufOff, c1 >> 6 | 192); + store(bufOff, c1 & 63 | 128, 1); + bufOff += 2; strOff += 2; + } else { + if ((c1 & 0xFC00) == 0xD800 && strOff + 2 < strEnd) { + let c2 = load(strOff, 2); + if ((c2 & 0xFC00) == 0xDC00) { + c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); + store(bufOff, c1 >> 18 | 240); + store(bufOff, c1 >> 12 & 63 | 128, 1); + store(bufOff, c1 >> 6 & 63 | 128, 2); + store(bufOff, c1 & 63 | 128, 3); + strOff += 4; bufOff += 4; + continue; + } + } + store(bufOff, c1 >> 12 | 224); + store(bufOff, c1 >> 6 & 63 | 128, 1); + store(bufOff, c1 & 63 | 128, 2); + strOff += 2; bufOff += 3; + } + } + if (nullTerminated) { + assert(strOff <= strEnd); + buf = __realloc(buf, bufOff - buf + 1); + store(bufOff, 0); } else { - assert(ptrPos + 2 <= len); - store(buf + bufPos, - (cp & 15) << 12 | - (load(ptr + ptrPos++) & 63) << 6 | - load(ptr + ptrPos++) & 63 - ); - bufPos += 2; + assert(strOff == strEnd); } + return changetype(buf); // retains } - assert(ptrPos == len); - var out = __alloc(bufPos, idof()); - memory.copy(out, buf, bufPos); - __free(buf); - return changetype(out); // retains - } - toUTF8(): usize { - var buf = __alloc(this.lengthUTF8, 0); - var pos: usize = 0; - var end = this.length; - var off: usize = 0; - while (pos < end) { - let c1 = load(changetype(this) + (pos << 1)); - if (c1 < 128) { - store(buf + off, c1); - ++off; ++pos; - } else if (c1 < 2048) { - let ptr = buf + off; - store(ptr, c1 >> 6 | 192); - store(ptr, c1 & 63 | 128, 1); - off += 2; ++pos; - } else { - let ptr = buf + off; - if ((c1 & 0xFC00) == 0xD800 && pos + 1 < end) { - let c2 = load(changetype(this) + ((pos + 1) << 1)); - if ((c2 & 0xFC00) == 0xDC00) { - c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); - store(ptr, c1 >> 18 | 240); - store(ptr, c1 >> 12 & 63 | 128, 1); - store(ptr, c1 >> 6 & 63 | 128, 2); - store(ptr, c1 & 63 | 128, 3); - off += 4; pos += 2; - continue; - } + export function decode(buf: ArrayBuffer, nullTerminated: bool = false): string { + return decodeUnsafe(changetype(buf), buf.byteLength, nullTerminated); + } + + // @ts-ignore: decorator + @unsafe + export function decodeUnsafe(buf: usize, len: usize, nullTerminated: bool = false): string { + var bufOff = buf; + var bufEnd = buf + len; + assert(bufEnd >= bufOff); // guard wraparound + var str = __alloc(len << 1, idof()); // max is one u16 char per u8 byte + var strOff = str; + while (bufOff < bufEnd) { + let cp = load(bufOff++); + if (cp < 128) { + if (nullTerminated && !cp) break; + store(strOff, cp); + strOff += 2; + } else if (cp > 191 && cp < 224) { + // if (bufEnd - bufOff < 1) break; + store(strOff, (cp & 31) << 6 | load(bufOff++) & 63); + strOff += 2; + } else if (cp > 239 && cp < 365) { + // if (bufEnd - bufOff < 3) break; + cp = ( + (cp & 7) << 18 | + (load(bufOff) & 63) << 12 | + (load(bufOff, 1) & 63) << 6 | + load(bufOff, 2) & 63 + ) - 0x10000; + bufOff += 3; + store(strOff, 0xD800 + (cp >> 10)); + store(strOff, 0xDC00 + (cp & 1023), 2); + strOff += 4; + } else { + // if (bufEnd - bufOff < 2) break; + store(strOff, + (cp & 15) << 12 | + (load(bufOff) & 63) << 6 | + load(bufOff, 1) & 63 + ); + bufOff += 2; strOff += 2; } - store(ptr, c1 >> 12 | 224); - store(ptr, c1 >> 6 & 63 | 128, 1); - store(ptr, c1 & 63 | 128, 2); - off += 3; ++pos; } + return changetype(__realloc(str, strOff - str)); // retains } - store(buf + off, 0); - return buf; } -} -// @ts-ignore: nolib -export type string = String; + export namespace UTF16 { -export function parseInt(str: string, radix: i32 = 0): f64 { - return strtol(str, radix); -} + export function byteLength(str: string): i32 { + return str.length << 1; + } -export function parseFloat(str: string): f64 { - return strtod(str); + export function encode(str: string): ArrayBuffer { + var size = changetype(changetype(str) - BLOCK_OVERHEAD).rtSize; + var buf = __alloc(size, idof()); + memory.copy(buf, changetype(str), size); + return changetype(buf); // retains + } + + export function decode(buf: ArrayBuffer): string { + return decodeUnsafe(changetype(buf), buf.byteLength); + } + + // @ts-ignore: decorator + @unsafe + export function decodeUnsafe(buf: usize, len: usize): string { + var str = __alloc(len &= ~1, idof()); + memory.copy(str, buf, len); + return changetype(str); // retains + } + } } diff --git a/tests/compiler/std/encoding.json b/tests/compiler/std/encoding.json deleted file mode 100644 index b1da366ff4..0000000000 --- a/tests/compiler/std/encoding.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "asc_flags": [ - "--runtime none" - ] -} \ No newline at end of file diff --git a/tests/compiler/std/encoding.optimized.wat b/tests/compiler/std/encoding.optimized.wat deleted file mode 100644 index 150ee0f67a..0000000000 --- a/tests/compiler/std/encoding.optimized.wat +++ /dev/null @@ -1,1826 +0,0 @@ -(module - (type $FUNCSIG$v (func)) - (type $FUNCSIG$ii (func (param i32) (result i32))) - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) - (type $FUNCSIG$viii (func (param i32 i32 i32))) - (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 8) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00\01\d87\dch\00i\00R\d8b\df") - (data (i32.const 40) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00s\00t\00d\00/\00e\00n\00c\00o\00d\00i\00n\00g\00.\00t\00s") - (data (i32.const 92) "\01\00\00\00\01") - (data (i32.const 104) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00\01\d87\dc") - (data (i32.const 128) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00h") - (data (i32.const 152) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00h\00i") - (data (i32.const 176) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00R\d8b\df") - (data (i32.const 200) " \00\00\00\01\00\00\00\01\00\00\00 \00\00\00~\00l\00i\00b\00/\00e\00n\00c\00o\00d\00i\00n\00g\00.\00t\00s") - (data (i32.const 248) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\001\002\003\00\00\004\005\006") - (data (i32.const 280) "\06\00\00\00\01\00\00\00\01\00\00\00\06\00\00\001\002\003") - (data (i32.const 304) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00h\00i\00R\d8b\df") - (global $std/encoding/str i32 (i32.const 24)) - (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) - (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (export "memory" (memory $0)) - (start $start) - (func $~lib/string/String#get:length (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=12 - i32.const 1 - i32.shr_u - ) - (func $~lib/encoding/Encoding.UTF16.byteLength (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - call $~lib/string/String#get:length - i32.const 1 - i32.shl - ) - (func $~lib/rt/stub/__alloc (; 3 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $0 - i32.const 1073741808 - i32.gt_u - if - unreachable - end - global.get $~lib/rt/stub/offset - i32.const 16 - i32.add - local.tee $3 - local.get $0 - i32.const 1 - local.get $0 - i32.const 1 - i32.gt_u - select - i32.add - i32.const 15 - i32.add - i32.const -16 - i32.and - local.tee $2 - memory.size - local.tee $4 - i32.const 16 - i32.shl - i32.gt_u - if - local.get $4 - local.get $2 - local.get $3 - i32.sub - i32.const 65535 - i32.add - i32.const -65536 - i32.and - i32.const 16 - i32.shr_u - local.tee $5 - local.get $4 - local.get $5 - i32.gt_s - select - memory.grow - i32.const 0 - i32.lt_s - if - local.get $5 - memory.grow - i32.const 0 - i32.lt_s - if - unreachable - end - end - end - local.get $2 - global.set $~lib/rt/stub/offset - local.get $3 - i32.const 16 - i32.sub - local.tee $2 - local.get $1 - i32.store offset=8 - local.get $2 - local.get $0 - i32.store offset=12 - local.get $3 - ) - (func $~lib/memory/memory.copy (; 4 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - block $~lib/util/memory/memmove|inlined.0 - local.get $2 - local.set $3 - local.get $0 - local.get $1 - i32.eq - br_if $~lib/util/memory/memmove|inlined.0 - local.get $0 - local.get $1 - i32.lt_u - if - local.get $1 - i32.const 7 - i32.and - local.get $0 - i32.const 7 - i32.and - i32.eq - if - loop $continue|0 - local.get $0 - i32.const 7 - i32.and - if - local.get $3 - i32.eqz - br_if $~lib/util/memory/memmove|inlined.0 - local.get $3 - i32.const 1 - i32.sub - local.set $3 - local.get $0 - local.tee $2 - i32.const 1 - i32.add - local.set $0 - local.get $1 - local.tee $4 - i32.const 1 - i32.add - local.set $1 - local.get $2 - local.get $4 - i32.load8_u - i32.store8 - br $continue|0 - end - end - loop $continue|1 - local.get $3 - i32.const 8 - i32.lt_u - i32.eqz - if - local.get $0 - local.get $1 - i64.load - i64.store - local.get $3 - i32.const 8 - i32.sub - local.set $3 - local.get $0 - i32.const 8 - i32.add - local.set $0 - local.get $1 - i32.const 8 - i32.add - local.set $1 - br $continue|1 - end - end - end - loop $continue|2 - local.get $3 - if - local.get $0 - local.tee $2 - i32.const 1 - i32.add - local.set $0 - local.get $1 - local.tee $4 - i32.const 1 - i32.add - local.set $1 - local.get $2 - local.get $4 - i32.load8_u - i32.store8 - local.get $3 - i32.const 1 - i32.sub - local.set $3 - br $continue|2 - end - end - else - local.get $1 - i32.const 7 - i32.and - local.get $0 - i32.const 7 - i32.and - i32.eq - if - loop $continue|3 - local.get $0 - local.get $3 - i32.add - i32.const 7 - i32.and - if - local.get $3 - i32.eqz - br_if $~lib/util/memory/memmove|inlined.0 - local.get $0 - local.get $3 - i32.const 1 - i32.sub - local.tee $3 - i32.add - local.get $1 - local.get $3 - i32.add - i32.load8_u - i32.store8 - br $continue|3 - end - end - loop $continue|4 - local.get $3 - i32.const 8 - i32.lt_u - i32.eqz - if - local.get $0 - local.get $3 - i32.const 8 - i32.sub - local.tee $3 - i32.add - local.get $1 - local.get $3 - i32.add - i64.load - i64.store - br $continue|4 - end - end - end - loop $continue|5 - local.get $3 - if - local.get $0 - local.get $3 - i32.const 1 - i32.sub - local.tee $3 - i32.add - local.get $1 - local.get $3 - i32.add - i32.load8_u - i32.store8 - br $continue|5 - end - end - end - end - ) - (func $~lib/encoding/Encoding.UTF16.encode (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=12 - local.tee $1 - i32.const 0 - call $~lib/rt/stub/__alloc - local.tee $2 - local.get $0 - local.get $1 - call $~lib/memory/memory.copy - local.get $2 - ) - (func $~lib/arraybuffer/ArrayBuffer#get:byteLength (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=12 - ) - (func $std/encoding/testUTF16Encode (; 7 ;) (type $FUNCSIG$v) - (local $0 i32) - global.get $std/encoding/str - call $~lib/encoding/Encoding.UTF16.encode - local.tee $0 - call $~lib/arraybuffer/ArrayBuffer#get:byteLength - i32.const 12 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 15 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 16 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=1 - i32.const 216 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 17 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=2 - i32.const 55 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 18 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=3 - i32.const 220 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 19 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=4 - i32.const 104 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 20 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=5 - if - i32.const 0 - i32.const 56 - i32.const 21 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=6 - i32.const 105 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 22 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=7 - if - i32.const 0 - i32.const 56 - i32.const 23 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=8 - i32.const 82 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 24 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=9 - i32.const 216 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 25 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=10 - i32.const 98 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 26 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=11 - i32.const 223 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 27 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - ) - (func $~lib/encoding/Encoding.UTF16.decodeUnsafe (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - local.get $1 - i32.const -2 - i32.and - local.tee $1 - i32.const 1 - call $~lib/rt/stub/__alloc - local.tee $2 - local.get $0 - local.get $1 - call $~lib/memory/memory.copy - local.get $2 - ) - (func $~lib/util/string/compareImpl (; 9 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - loop $continue|0 - local.get $2 - if (result i32) - local.get $0 - i32.load16_u - local.get $1 - i32.load16_u - i32.sub - local.tee $3 - i32.eqz - else - i32.const 0 - end - if - local.get $2 - i32.const 1 - i32.sub - local.set $2 - local.get $0 - i32.const 2 - i32.add - local.set $0 - local.get $1 - i32.const 2 - i32.add - local.set $1 - br $continue|0 - end - end - local.get $3 - ) - (func $~lib/string/String.__eq (; 10 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - local.get $0 - local.get $1 - i32.eq - if - i32.const 1 - return - end - block $folding-inner0 - local.get $1 - i32.eqz - i32.const 1 - local.get $0 - select - br_if $folding-inner0 - local.get $0 - call $~lib/string/String#get:length - local.tee $2 - local.get $1 - call $~lib/string/String#get:length - i32.ne - br_if $folding-inner0 - local.get $0 - local.get $1 - local.get $2 - call $~lib/util/string/compareImpl - i32.eqz - return - end - i32.const 0 - ) - (func $std/encoding/testUTF16Decode (; 11 ;) (type $FUNCSIG$v) - (local $0 i32) - global.get $std/encoding/str - call $~lib/encoding/Encoding.UTF16.encode - local.tee $0 - local.get $0 - call $~lib/arraybuffer/ArrayBuffer#get:byteLength - call $~lib/encoding/Encoding.UTF16.decodeUnsafe - global.get $std/encoding/str - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 33 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - ) - (func $std/encoding/testUTF16DecodeUnsafe (; 12 ;) (type $FUNCSIG$v) - (local $0 i32) - (local $1 i32) - global.get $std/encoding/str - call $~lib/encoding/Encoding.UTF16.encode - local.set $0 - global.get $std/encoding/str - call $~lib/encoding/Encoding.UTF16.byteLength - local.set $1 - local.get $0 - i32.const 0 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe - i32.const 104 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 42 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe - global.get $std/encoding/str - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 43 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 4 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe - i32.const 120 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 44 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 4 - i32.add - i32.const 2 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe - i32.const 144 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 45 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 4 - i32.add - i32.const 4 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe - i32.const 168 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 46 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 8 - i32.add - i32.const 4 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe - i32.const 192 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 47 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 12 - i32.add - i32.const 0 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe - i32.const 104 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 48 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - ) - (func $~lib/encoding/Encoding.UTF8.byteLength (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=12 - local.get $0 - i32.add - local.set $4 - i32.const 1 - i32.const 0 - local.get $1 - select - local.set $2 - loop $continue|0 - block $break|0 - local.get $0 - local.get $4 - i32.ge_u - br_if $break|0 - local.get $0 - i32.load16_u - local.tee $3 - i32.const 128 - i32.lt_u - if (result i32) - local.get $3 - i32.eqz - i32.const 0 - local.get $1 - select - br_if $break|0 - local.get $2 - i32.const 1 - i32.add - else - local.get $3 - i32.const 2048 - i32.lt_u - if (result i32) - local.get $2 - i32.const 2 - i32.add - else - local.get $0 - i32.const 2 - i32.add - local.get $4 - i32.lt_u - i32.const 0 - local.get $3 - i32.const 64512 - i32.and - i32.const 55296 - i32.eq - select - if - local.get $0 - i32.load16_u offset=2 - i32.const 64512 - i32.and - i32.const 56320 - i32.eq - if - local.get $0 - i32.const 4 - i32.add - local.set $0 - local.get $2 - i32.const 4 - i32.add - local.set $2 - br $continue|0 - end - end - local.get $2 - i32.const 3 - i32.add - end - end - local.set $2 - local.get $0 - i32.const 2 - i32.add - local.set $0 - br $continue|0 - end - end - local.get $2 - ) - (func $std/encoding/testUTF8Length (; 14 ;) (type $FUNCSIG$v) - global.get $std/encoding/str - i32.const 0 - call $~lib/encoding/Encoding.UTF8.byteLength - i32.const 10 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 55 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - global.get $std/encoding/str - i32.const 1 - call $~lib/encoding/Encoding.UTF8.byteLength - i32.const 11 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 56 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - ) - (func $~lib/rt/stub/__realloc (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - local.get $1 - local.get $0 - i32.const 16 - i32.sub - local.tee $2 - i32.load offset=12 - local.tee $3 - i32.gt_u - if - local.get $1 - local.get $2 - i32.load offset=8 - call $~lib/rt/stub/__alloc - local.tee $1 - local.get $0 - local.get $3 - call $~lib/memory/memory.copy - local.get $1 - local.set $0 - else - local.get $2 - local.get $1 - i32.store offset=12 - end - local.get $0 - ) - (func $~lib/encoding/Encoding.UTF8.encode (; 16 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=12 - local.get $0 - i32.add - local.set $4 - local.get $0 - local.get $1 - call $~lib/encoding/Encoding.UTF8.byteLength - i32.const 0 - call $~lib/rt/stub/__alloc - local.tee $5 - local.set $2 - loop $continue|0 - block $break|0 - local.get $0 - local.get $4 - i32.ge_u - br_if $break|0 - local.get $0 - i32.load16_u - local.tee $3 - i32.const 128 - i32.lt_u - if (result i32) - local.get $3 - i32.eqz - i32.const 0 - local.get $1 - select - br_if $break|0 - local.get $2 - local.get $3 - i32.store8 - local.get $2 - i32.const 1 - i32.add - else - local.get $3 - i32.const 2048 - i32.lt_u - if (result i32) - local.get $2 - local.get $3 - i32.const 6 - i32.shr_u - i32.const 192 - i32.or - i32.store8 - local.get $2 - local.get $3 - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=1 - local.get $2 - i32.const 2 - i32.add - else - local.get $0 - i32.const 2 - i32.add - local.get $4 - i32.lt_u - i32.const 0 - local.get $3 - i32.const 64512 - i32.and - i32.const 55296 - i32.eq - select - if - local.get $0 - i32.load16_u offset=2 - local.tee $6 - i32.const 64512 - i32.and - i32.const 56320 - i32.eq - if - local.get $2 - local.get $3 - i32.const 1023 - i32.and - i32.const 10 - i32.shl - i32.const 65536 - i32.add - local.get $6 - i32.const 1023 - i32.and - i32.add - local.tee $3 - i32.const 18 - i32.shr_u - i32.const 240 - i32.or - i32.store8 - local.get $2 - local.get $3 - i32.const 12 - i32.shr_u - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=1 - local.get $2 - local.get $3 - i32.const 6 - i32.shr_u - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=2 - local.get $2 - local.get $3 - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=3 - local.get $0 - i32.const 4 - i32.add - local.set $0 - local.get $2 - i32.const 4 - i32.add - local.set $2 - br $continue|0 - end - end - local.get $2 - local.get $3 - i32.const 12 - i32.shr_u - i32.const 224 - i32.or - i32.store8 - local.get $2 - local.get $3 - i32.const 6 - i32.shr_u - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=1 - local.get $2 - local.get $3 - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=2 - local.get $2 - i32.const 3 - i32.add - end - end - local.set $2 - local.get $0 - i32.const 2 - i32.add - local.set $0 - br $continue|0 - end - end - local.get $1 - if - local.get $0 - local.get $4 - i32.gt_u - if - i32.const 0 - i32.const 216 - i32.const 66 - i32.const 8 - call $~lib/builtins/abort - unreachable - end - local.get $5 - local.get $2 - local.get $5 - i32.sub - i32.const 1 - i32.add - call $~lib/rt/stub/__realloc - local.set $5 - local.get $2 - i32.const 0 - i32.store8 - else - local.get $0 - local.get $4 - i32.ne - if - i32.const 0 - i32.const 216 - i32.const 70 - i32.const 8 - call $~lib/builtins/abort - unreachable - end - end - local.get $5 - ) - (func $std/encoding/testUTF8Encode (; 17 ;) (type $FUNCSIG$v) - (local $0 i32) - global.get $std/encoding/str - i32.const 0 - call $~lib/encoding/Encoding.UTF8.encode - local.tee $0 - call $~lib/arraybuffer/ArrayBuffer#get:byteLength - i32.const 10 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 63 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u - i32.const 240 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 64 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=1 - i32.const 144 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 65 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=2 - i32.const 144 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 66 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=3 - i32.const 183 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 67 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=4 - i32.const 104 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 68 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=5 - i32.const 105 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 69 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=6 - i32.const 240 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 70 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=7 - i32.const 164 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 71 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=8 - i32.const 173 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 72 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=9 - i32.const 162 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 73 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - ) - (func $std/encoding/testUTF8EncodeNullTerminated (; 18 ;) (type $FUNCSIG$v) - (local $0 i32) - global.get $std/encoding/str - i32.const 1 - call $~lib/encoding/Encoding.UTF8.encode - local.tee $0 - call $~lib/arraybuffer/ArrayBuffer#get:byteLength - i32.const 11 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 80 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u - i32.const 240 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 81 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=1 - i32.const 144 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 82 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=2 - i32.const 144 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 83 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=3 - i32.const 183 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 84 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=4 - i32.const 104 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 85 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=5 - i32.const 105 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 86 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=6 - i32.const 240 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 87 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=7 - i32.const 164 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 88 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=8 - i32.const 173 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 89 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=9 - i32.const 162 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 90 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load8_u offset=10 - if - i32.const 0 - i32.const 56 - i32.const 91 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - ) - (func $~lib/encoding/Encoding.UTF8.decodeUnsafe (; 19 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - local.get $0 - local.get $1 - i32.add - local.tee $6 - local.get $0 - i32.lt_u - if - i32.const 0 - i32.const 216 - i32.const 84 - i32.const 6 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 1 - i32.shl - i32.const 1 - call $~lib/rt/stub/__alloc - local.tee $5 - local.set $3 - loop $continue|0 - block $break|0 - local.get $0 - local.get $6 - i32.ge_u - br_if $break|0 - local.get $0 - local.tee $1 - i32.const 1 - i32.add - local.set $0 - local.get $1 - i32.load8_u - local.tee $4 - i32.const 128 - i32.lt_u - if - local.get $4 - i32.eqz - i32.const 0 - local.get $2 - select - br_if $break|0 - local.get $3 - local.get $4 - i32.store16 - local.get $3 - i32.const 2 - i32.add - local.set $3 - else - local.get $4 - i32.const 224 - i32.lt_u - i32.const 0 - local.get $4 - i32.const 191 - i32.gt_u - select - if - local.get $0 - local.tee $1 - i32.const 1 - i32.add - local.set $0 - local.get $3 - local.get $1 - i32.load8_u - i32.const 63 - i32.and - local.get $4 - i32.const 31 - i32.and - i32.const 6 - i32.shl - i32.or - i32.store16 - local.get $3 - i32.const 2 - i32.add - local.set $3 - else - local.get $4 - i32.const 365 - i32.lt_u - i32.const 0 - local.get $4 - i32.const 239 - i32.gt_u - select - if (result i32) - local.get $3 - local.get $0 - i32.load8_u offset=2 - i32.const 63 - i32.and - local.get $4 - i32.const 7 - i32.and - i32.const 18 - i32.shl - local.get $0 - i32.load8_u - i32.const 63 - i32.and - i32.const 12 - i32.shl - i32.or - local.get $0 - i32.load8_u offset=1 - i32.const 63 - i32.and - i32.const 6 - i32.shl - i32.or - i32.or - i32.const 65536 - i32.sub - local.tee $1 - i32.const 10 - i32.shr_u - i32.const 55296 - i32.add - i32.store16 - local.get $3 - local.get $1 - i32.const 1023 - i32.and - i32.const 56320 - i32.add - i32.store16 offset=2 - local.get $3 - i32.const 4 - i32.add - local.set $3 - local.get $0 - i32.const 3 - i32.add - else - local.get $3 - local.get $0 - i32.load8_u offset=1 - i32.const 63 - i32.and - local.get $4 - i32.const 15 - i32.and - i32.const 12 - i32.shl - local.get $0 - i32.load8_u - i32.const 63 - i32.and - i32.const 6 - i32.shl - i32.or - i32.or - i32.store16 - local.get $3 - i32.const 2 - i32.add - local.set $3 - local.get $0 - i32.const 2 - i32.add - end - local.set $0 - end - end - br $continue|0 - end - end - local.get $5 - local.get $3 - local.get $5 - i32.sub - call $~lib/rt/stub/__realloc - ) - (func $~lib/encoding/Encoding.UTF8.decode (; 20 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - local.get $0 - local.get $0 - call $~lib/arraybuffer/ArrayBuffer#get:byteLength - local.get $1 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe - ) - (func $std/encoding/testUTF8Decode (; 21 ;) (type $FUNCSIG$v) - global.get $std/encoding/str - i32.const 0 - call $~lib/encoding/Encoding.UTF8.encode - i32.const 0 - call $~lib/encoding/Encoding.UTF8.decode - global.get $std/encoding/str - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 97 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - ) - (func $std/encoding/testUTF8DecodeNullTerminated (; 22 ;) (type $FUNCSIG$v) - (local $0 i32) - global.get $std/encoding/str - i32.const 1 - call $~lib/encoding/Encoding.UTF8.encode - i32.const 1 - call $~lib/encoding/Encoding.UTF8.decode - global.get $std/encoding/str - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 103 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - i32.const 264 - i32.const 1 - call $~lib/encoding/Encoding.UTF8.byteLength - i32.const 4 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 105 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - i32.const 264 - i32.const 1 - call $~lib/encoding/Encoding.UTF8.encode - local.tee $0 - call $~lib/arraybuffer/ArrayBuffer#get:byteLength - i32.const 4 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 107 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - i32.const 296 - i32.const 1 - call $~lib/encoding/Encoding.UTF8.byteLength - i32.const 4 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 109 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 1 - call $~lib/encoding/Encoding.UTF8.decode - i32.const 296 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 110 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - i32.const 264 - i32.const 0 - call $~lib/encoding/Encoding.UTF8.encode - i32.const 1 - call $~lib/encoding/Encoding.UTF8.decode - i32.const 296 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 112 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - ) - (func $std/encoding/testUTF8DecodeUnsafe (; 23 ;) (type $FUNCSIG$v) - (local $0 i32) - (local $1 i32) - global.get $std/encoding/str - i32.const 1 - call $~lib/encoding/Encoding.UTF8.encode - local.set $0 - global.get $std/encoding/str - i32.const 0 - call $~lib/encoding/Encoding.UTF8.byteLength - local.set $1 - local.get $0 - i32.const 0 - i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe - i32.const 104 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 121 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe - global.get $std/encoding/str - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 122 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 4 - i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe - i32.const 120 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 123 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 4 - i32.add - i32.const 2 - i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe - i32.const 168 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 124 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 6 - i32.add - i32.const 4 - i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe - i32.const 192 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 125 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 10 - i32.add - i32.const 0 - i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe - i32.const 104 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 126 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 4 - i32.add - i32.const 100 - i32.const 1 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe - i32.const 320 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 128 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 6 - i32.add - i32.const 100 - i32.const 1 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe - i32.const 192 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 129 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 10 - i32.add - i32.const 100 - i32.const 1 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe - i32.const 104 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 130 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - ) - (func $start:std/encoding (; 24 ;) (type $FUNCSIG$v) - global.get $std/encoding/str - call $~lib/encoding/Encoding.UTF16.byteLength - i32.const 12 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 8 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - i32.const 336 - global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset - global.set $~lib/rt/stub/offset - call $std/encoding/testUTF16Encode - call $std/encoding/testUTF16Decode - call $std/encoding/testUTF16DecodeUnsafe - call $std/encoding/testUTF8Length - call $std/encoding/testUTF8Encode - call $std/encoding/testUTF8EncodeNullTerminated - call $std/encoding/testUTF8Decode - call $std/encoding/testUTF8DecodeNullTerminated - call $std/encoding/testUTF8DecodeUnsafe - ) - (func $start (; 25 ;) (type $FUNCSIG$v) - call $start:std/encoding - ) - (func $null (; 26 ;) (type $FUNCSIG$v) - nop - ) -) diff --git a/tests/compiler/std/string-encoding.json b/tests/compiler/std/string-encoding.json new file mode 100644 index 0000000000..9f7878d475 --- /dev/null +++ b/tests/compiler/std/string-encoding.json @@ -0,0 +1,6 @@ +{ + "asc_flags": [ + "--runtime half", + "--use ASC_RTRACE=1" + ] +} \ No newline at end of file diff --git a/tests/compiler/std/string-encoding.optimized.wat b/tests/compiler/std/string-encoding.optimized.wat new file mode 100644 index 0000000000..ec17fe9732 --- /dev/null +++ b/tests/compiler/std/string-encoding.optimized.wat @@ -0,0 +1,3630 @@ +(module + (type $FUNCSIG$v (func)) + (type $FUNCSIG$ii (func (param i32) (result i32))) + (type $FUNCSIG$vi (func (param i32))) + (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) + (type $FUNCSIG$vii (func (param i32 i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) + (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) + (type $FUNCSIG$viii (func (param i32 i32 i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) + (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) + (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) + (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) + (memory $0 1) + (data (i32.const 8) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00\01\d87\dch\00i\00R\d8b\df") + (data (i32.const 40) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s") + (data (i32.const 88) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") + (data (i32.const 136) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e") + (data (i32.const 192) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s") + (data (i32.const 232) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") + (data (i32.const 288) ",\00\00\00\01\00\00\00\01\00\00\00,\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00-\00e\00n\00c\00o\00d\00i\00n\00g\00.\00t\00s") + (data (i32.const 356) "\01\00\00\00\01") + (data (i32.const 368) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00\01\d87\dc") + (data (i32.const 392) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00h") + (data (i32.const 416) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00h\00i") + (data (i32.const 440) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00R\d8b\df") + (data (i32.const 464) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 512) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\001\002\003\00\00\004\005\006") + (data (i32.const 544) "\06\00\00\00\01\00\00\00\01\00\00\00\06\00\00\001\002\003") + (data (i32.const 568) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00h\00i\00R\d8b\df") + (data (i32.const 592) "\03\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10") + (global $std/string-encoding/str i32 (i32.const 24)) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) + (global $~lib/rt/pure/END (mut i32) (i32.const 0)) + (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) + (export "memory" (memory $0)) + (start $start) + (func $~lib/rt/pure/increment (; 5 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const -268435456 + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const -268435456 + i32.and + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 104 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + local.get $0 + call $~lib/rt/rtrace/onincrement + local.get $0 + i32.load + i32.const 1 + i32.and + if + i32.const 0 + i32.const 56 + i32.const 107 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/pure/__retain (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 620 + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/increment + end + local.get $0 + ) + (func $~lib/string/String#get:length (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + i32.const 1 + i32.shr_u + ) + (func $~lib/rt/tlsf/removeBlock (; 8 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.tee $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 277 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const -4 + i32.and + local.tee $2 + i32.const 16 + i32.ge_u + if (result i32) + local.get $2 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 279 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 256 + i32.lt_u + if (result i32) + local.get $2 + i32.const 4 + i32.shr_u + local.set $2 + i32.const 0 + else + local.get $2 + i32.const 31 + local.get $2 + i32.clz + i32.sub + local.tee $3 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $2 + local.get $3 + i32.const 7 + i32.sub + end + local.tee $3 + i32.const 23 + i32.lt_u + if (result i32) + local.get $2 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 292 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=20 + local.set $4 + local.get $1 + i32.load offset=16 + local.tee $5 + if + local.get $5 + local.get $4 + i32.store offset=20 + end + local.get $4 + if + local.get $4 + local.get $5 + i32.store offset=16 + end + local.get $3 + i32.const 4 + i32.shl + local.get $2 + i32.add + i32.const 2 + i32.shl + local.get $0 + i32.add + i32.load offset=96 + local.get $1 + i32.eq + if + local.get $3 + i32.const 4 + i32.shl + local.get $2 + i32.add + i32.const 2 + i32.shl + local.get $0 + i32.add + local.get $4 + i32.store offset=96 + local.get $4 + i32.eqz + if + local.get $3 + i32.const 2 + i32.shl + local.get $0 + i32.add + local.get $3 + i32.const 2 + i32.shl + local.get $0 + i32.add + i32.load offset=4 + i32.const 1 + local.get $2 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $1 + i32.store offset=4 + local.get $1 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $3 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 205 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.tee $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 207 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.tee $5 + i32.const 1 + i32.and + if + local.get $3 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const -4 + i32.and + i32.add + local.tee $2 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 + i32.const 3 + i32.and + local.get $2 + i32.or + local.tee $3 + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $5 + end + end + local.get $3 + i32.const 2 + i32.and + if + local.get $1 + i32.const 4 + i32.sub + i32.load + local.tee $2 + i32.load + local.tee $6 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 228 + i32.const 15 + call $~lib/builtins/abort + unreachable + end + local.get $6 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $3 + i32.const -4 + i32.and + i32.add + local.tee $7 + i32.const 1073741808 + i32.lt_u + if (result i32) + local.get $0 + local.get $2 + call $~lib/rt/tlsf/removeBlock + local.get $2 + local.get $6 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $3 + i32.store + local.get $2 + else + local.get $1 + end + local.set $1 + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $3 + i32.const -4 + i32.and + local.tee $2 + i32.const 16 + i32.ge_u + if (result i32) + local.get $2 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 243 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $4 + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + i32.ne + if + i32.const 0 + i32.const 104 + i32.const 244 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $2 + i32.const 256 + i32.lt_u + if (result i32) + local.get $2 + i32.const 4 + i32.shr_u + local.set $4 + i32.const 0 + else + local.get $2 + i32.const 31 + local.get $2 + i32.clz + i32.sub + local.tee $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $4 + local.get $2 + i32.const 7 + i32.sub + end + local.tee $3 + i32.const 23 + i32.lt_u + if (result i32) + local.get $4 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 260 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + local.get $0 + i32.add + i32.load offset=96 + local.set $2 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $2 + i32.store offset=20 + local.get $2 + if + local.get $2 + local.get $1 + i32.store offset=16 + end + local.get $3 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + local.get $0 + i32.add + local.get $1 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $3 + i32.shl + i32.or + i32.store + local.get $3 + i32.const 2 + i32.shl + local.get $0 + i32.add + local.get $3 + i32.const 2 + i32.shl + local.get $0 + i32.add + i32.load offset=4 + i32.const 1 + local.get $4 + i32.shl + i32.or + i32.store offset=4 + ) + (func $~lib/rt/tlsf/freeBlock (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $1 + i32.load + local.tee $2 + i32.const 1 + i32.and + if + i32.const 0 + i32.const 104 + i32.const 537 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.get $2 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + local.get $1 + call $~lib/rt/rtrace/onfree + ) + (func $~lib/rt/__typeinfo (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 592 + i32.load + i32.gt_u + if + i32.const 152 + i32.const 208 + i32.const 22 + i32.const 27 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 3 + i32.shl + i32.const 596 + i32.add + i32.load + ) + (func $~lib/rt/tlsf/addMemory (; 12 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $1 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $1 + local.get $2 + i32.le_u + select + select + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 386 + i32.const 4 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=1568 + local.tee $3 + if + local.get $1 + local.get $3 + i32.const 16 + i32.add + i32.lt_u + if + i32.const 0 + i32.const 104 + i32.const 396 + i32.const 15 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.sub + local.get $3 + i32.eq + if + local.get $3 + i32.load + local.set $4 + local.get $1 + i32.const 16 + i32.sub + local.set $1 + end + else + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.lt_u + if + i32.const 0 + i32.const 104 + i32.const 408 + i32.const 4 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.tee $2 + i32.const 48 + i32.lt_u + if + return + end + local.get $1 + local.get $4 + i32.const 2 + i32.and + local.get $2 + i32.const 32 + i32.sub + i32.const 1 + i32.or + i32.or + i32.store + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $2 + i32.add + i32.const 16 + i32.sub + local.tee $2 + i32.const 2 + i32.store + local.get $0 + local.get $2 + i32.store offset=1568 + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + ) + (func $~lib/rt/tlsf/initializeRoot (; 13 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + i32.const 1 + memory.size + local.tee $0 + i32.gt_s + if (result i32) + i32.const 1 + local.get $0 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + i32.const 624 + i32.const 0 + i32.store + i32.const 2192 + i32.const 0 + i32.store + i32.const 0 + local.set $0 + loop $loop|0 + block $break|0 + local.get $0 + i32.const 23 + i32.ge_u + br_if $break|0 + local.get $0 + i32.const 2 + i32.shl + i32.const 624 + i32.add + i32.const 0 + i32.store offset=4 + i32.const 0 + local.set $1 + loop $loop|1 + block $break|1 + local.get $1 + i32.const 16 + i32.ge_u + br_if $break|1 + local.get $0 + i32.const 4 + i32.shl + local.get $1 + i32.add + i32.const 2 + i32.shl + i32.const 624 + i32.add + i32.const 0 + i32.store offset=96 + local.get $1 + i32.const 1 + i32.add + local.set $1 + br $loop|1 + end + end + local.get $0 + i32.const 1 + i32.add + local.set $0 + br $loop|0 + end + end + i32.const 624 + i32.const 2208 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + i32.const 624 + global.set $~lib/rt/tlsf/ROOT + ) + (func $~lib/rt/tlsf/prepareSize (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 1073741808 + i32.ge_u + if + i32.const 248 + i32.const 104 + i32.const 448 + i32.const 29 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.add + i32.const -16 + i32.and + local.tee $0 + i32.const 16 + local.get $0 + i32.const 16 + i32.gt_u + select + ) + (func $~lib/rt/tlsf/searchBlock (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $1 + i32.const 256 + i32.lt_u + if (result i32) + local.get $1 + i32.const 4 + i32.shr_u + local.set $1 + i32.const 0 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + local.get $1 + i32.add + i32.const 1 + i32.sub + local.set $1 + end + local.get $1 + i32.const 31 + local.get $1 + i32.clz + i32.sub + local.tee $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $1 + local.get $2 + i32.const 7 + i32.sub + end + local.tee $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $1 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 338 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 2 + i32.shl + local.get $0 + i32.add + i32.load offset=4 + i32.const -1 + local.get $1 + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $1 + i32.ctz + local.get $2 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + local.get $0 + i32.add + i32.load offset=96 + else + local.get $0 + i32.load + i32.const -1 + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $1 + i32.ctz + local.tee $1 + i32.const 2 + i32.shl + local.get $0 + i32.add + i32.load offset=4 + local.tee $2 + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 351 + i32.const 17 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.ctz + local.get $1 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + local.get $0 + i32.add + i32.load offset=96 + else + i32.const 0 + end + end + ) + (func $~lib/rt/tlsf/growMemory (; 16 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + memory.size + local.tee $2 + local.get $1 + i32.const 65535 + i32.add + i32.const -65536 + i32.and + i32.const 16 + i32.shr_u + local.tee $1 + local.get $2 + local.get $1 + i32.gt_s + select + memory.grow + i32.const 0 + i32.lt_s + if + local.get $1 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + local.get $0 + local.get $2 + i32.const 16 + i32.shl + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + ) + (func $~lib/rt/tlsf/prepareBlock (; 17 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + local.get $1 + i32.load + local.set $3 + local.get $2 + i32.const 15 + i32.and + if + i32.const 0 + i32.const 104 + i32.const 365 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const -4 + i32.and + local.get $2 + i32.sub + local.tee $4 + i32.const 32 + i32.ge_u + if + local.get $1 + local.get $3 + i32.const 2 + i32.and + local.get $2 + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + local.tee $1 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const -2 + i32.and + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + i32.load + i32.const -3 + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + local.get $0 + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.tee $3 + call $~lib/rt/tlsf/searchBlock + local.tee $2 + i32.eqz + if + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.tee $2 + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 478 + i32.const 15 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + i32.load + i32.const -4 + i32.and + local.get $3 + i32.lt_u + if + i32.const 0 + i32.const 104 + i32.const 480 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 0 + i32.store offset=4 + local.get $2 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $2 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $2 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + local.get $2 + call $~lib/rt/rtrace/onalloc + local.get $2 + ) + (func $~lib/rt/tlsf/__alloc (; 19 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + global.get $~lib/rt/tlsf/ROOT + local.tee $2 + if (result i32) + local.get $2 + else + call $~lib/rt/tlsf/initializeRoot + global.get $~lib/rt/tlsf/ROOT + end + local.get $0 + call $~lib/rt/tlsf/allocateBlock + local.tee $0 + local.get $1 + i32.store offset=8 + local.get $0 + i32.const 16 + i32.add + ) + (func $~lib/memory/memory.copy (; 20 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + block $~lib/util/memory/memmove|inlined.0 + local.get $2 + local.set $3 + local.get $0 + local.get $1 + i32.eq + br_if $~lib/util/memory/memmove|inlined.0 + local.get $0 + local.get $1 + i32.lt_u + if + local.get $1 + i32.const 7 + i32.and + local.get $0 + i32.const 7 + i32.and + i32.eq + if + loop $continue|0 + local.get $0 + i32.const 7 + i32.and + if + local.get $3 + i32.eqz + br_if $~lib/util/memory/memmove|inlined.0 + local.get $3 + i32.const 1 + i32.sub + local.set $3 + local.get $0 + local.tee $2 + i32.const 1 + i32.add + local.set $0 + local.get $1 + local.tee $4 + i32.const 1 + i32.add + local.set $1 + local.get $2 + local.get $4 + i32.load8_u + i32.store8 + br $continue|0 + end + end + loop $continue|1 + local.get $3 + i32.const 8 + i32.lt_u + i32.eqz + if + local.get $0 + local.get $1 + i64.load + i64.store + local.get $3 + i32.const 8 + i32.sub + local.set $3 + local.get $0 + i32.const 8 + i32.add + local.set $0 + local.get $1 + i32.const 8 + i32.add + local.set $1 + br $continue|1 + end + end + end + loop $continue|2 + local.get $3 + if + local.get $0 + local.tee $2 + i32.const 1 + i32.add + local.set $0 + local.get $1 + local.tee $4 + i32.const 1 + i32.add + local.set $1 + local.get $2 + local.get $4 + i32.load8_u + i32.store8 + local.get $3 + i32.const 1 + i32.sub + local.set $3 + br $continue|2 + end + end + else + local.get $1 + i32.const 7 + i32.and + local.get $0 + i32.const 7 + i32.and + i32.eq + if + loop $continue|3 + local.get $0 + local.get $3 + i32.add + i32.const 7 + i32.and + if + local.get $3 + i32.eqz + br_if $~lib/util/memory/memmove|inlined.0 + local.get $0 + local.get $3 + i32.const 1 + i32.sub + local.tee $3 + i32.add + local.get $1 + local.get $3 + i32.add + i32.load8_u + i32.store8 + br $continue|3 + end + end + loop $continue|4 + local.get $3 + i32.const 8 + i32.lt_u + i32.eqz + if + local.get $0 + local.get $3 + i32.const 8 + i32.sub + local.tee $3 + i32.add + local.get $1 + local.get $3 + i32.add + i64.load + i64.store + br $continue|4 + end + end + end + loop $continue|5 + local.get $3 + if + local.get $0 + local.get $3 + i32.const 1 + i32.sub + local.tee $3 + i32.add + local.get $1 + local.get $3 + i32.add + i32.load8_u + i32.store8 + br $continue|5 + end + end + end + end + ) + (func $~lib/rt/tlsf/__free (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) + global.get $~lib/rt/tlsf/ROOT + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 567 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $0 + select + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 568 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/rt/tlsf/ROOT + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/rt/pure/growRoots (; 22 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + global.get $~lib/rt/pure/CUR + global.get $~lib/rt/pure/ROOTS + local.tee $1 + i32.sub + local.tee $2 + i32.const 1 + i32.shl + local.tee $0 + i32.const 256 + local.get $0 + i32.const 256 + i32.gt_u + select + local.tee $3 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $0 + i32.const 16 + i32.sub + call $~lib/rt/rtrace/onfree + local.get $0 + local.get $1 + local.get $2 + call $~lib/memory/memory.copy + local.get $1 + if + local.get $1 + i32.const 16 + i32.sub + call $~lib/rt/rtrace/onalloc + local.get $1 + call $~lib/rt/tlsf/__free + end + local.get $0 + global.set $~lib/rt/pure/ROOTS + local.get $0 + local.get $2 + i32.add + global.set $~lib/rt/pure/CUR + local.get $0 + local.get $3 + i32.add + global.set $~lib/rt/pure/END + ) + (func $~lib/rt/pure/appendRoot (; 23 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + global.get $~lib/rt/pure/CUR + local.tee $1 + global.get $~lib/rt/pure/END + i32.ge_u + if + call $~lib/rt/pure/growRoots + global.get $~lib/rt/pure/CUR + local.set $1 + end + local.get $1 + local.get $0 + i32.store + local.get $1 + i32.const 4 + i32.add + global.set $~lib/rt/pure/CUR + ) + (func $~lib/rt/pure/decrement (; 24 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.tee $2 + i32.const 268435455 + i32.and + local.set $1 + local.get $0 + call $~lib/rt/rtrace/ondecrement + local.get $0 + i32.load + i32.const 1 + i32.and + if + i32.const 0 + i32.const 56 + i32.const 115 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 1 + i32.eq + if + local.get $0 + i32.const 16 + i32.add + i32.const 1 + call $~lib/rt/__visit_members + local.get $2 + i32.const -2147483648 + i32.and + if + local.get $0 + i32.const -2147483648 + i32.store offset=4 + else + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + end + else + local.get $1 + i32.const 0 + i32.le_u + if + i32.const 0 + i32.const 56 + i32.const 124 + i32.const 15 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=8 + call $~lib/rt/__typeinfo + i32.const 16 + i32.and + if + local.get $0 + local.get $1 + i32.const 1 + i32.sub + local.get $2 + i32.const -268435456 + i32.and + i32.or + i32.store offset=4 + else + local.get $0 + local.get $1 + i32.const 1 + i32.sub + i32.const -1342177280 + i32.or + i32.store offset=4 + local.get $2 + i32.const -2147483648 + i32.and + i32.eqz + if + local.get $0 + call $~lib/rt/pure/appendRoot + end + end + end + ) + (func $~lib/rt/pure/__release (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) + local.get $0 + i32.const 620 + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $~lib/string/String.UTF16.byteLength (; 26 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + local.get $0 + call $~lib/rt/pure/__retain + drop + local.get $0 + call $~lib/string/String#get:length + i32.const 1 + i32.shl + local.get $0 + call $~lib/rt/pure/__release + ) + (func $~lib/string/String.UTF16.encode (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + call $~lib/rt/pure/__retain + drop + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + local.tee $1 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $2 + local.get $0 + local.get $1 + call $~lib/memory/memory.copy + local.get $2 + call $~lib/rt/pure/__retain + local.get $0 + call $~lib/rt/pure/__release + ) + (func $~lib/arraybuffer/ArrayBuffer#get:byteLength (; 28 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + ) + (func $std/string-encoding/testUTF16Encode (; 29 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + global.get $std/string-encoding/str + call $~lib/string/String.UTF16.encode + local.tee $1 + local.tee $0 + call $~lib/arraybuffer/ArrayBuffer#get:byteLength + i32.const 12 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 15 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u + i32.const 1 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 16 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=1 + i32.const 216 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 17 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=2 + i32.const 55 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 18 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=3 + i32.const 220 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 19 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=4 + i32.const 104 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 20 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=5 + if + i32.const 0 + i32.const 304 + i32.const 21 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=6 + i32.const 105 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 22 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=7 + if + i32.const 0 + i32.const 304 + i32.const 23 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=8 + i32.const 82 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 24 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=9 + i32.const 216 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 25 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=10 + i32.const 98 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 26 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=11 + i32.const 223 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 27 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/pure/__release + ) + (func $~lib/string/String.UTF16.decodeUnsafe (; 30 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $1 + i32.const -2 + i32.and + local.tee $1 + i32.const 1 + call $~lib/rt/tlsf/__alloc + local.tee $2 + local.get $0 + local.get $1 + call $~lib/memory/memory.copy + local.get $2 + call $~lib/rt/pure/__retain + ) + (func $~lib/util/string/compareImpl (; 31 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $0 + call $~lib/rt/pure/__retain + drop + local.get $1 + call $~lib/rt/pure/__retain + drop + local.get $0 + local.set $3 + local.get $1 + local.set $4 + loop $continue|0 + local.get $2 + if (result i32) + local.get $3 + i32.load16_u + local.get $4 + i32.load16_u + i32.sub + local.tee $5 + i32.eqz + else + i32.const 0 + end + if + local.get $2 + i32.const 1 + i32.sub + local.set $2 + local.get $3 + i32.const 2 + i32.add + local.set $3 + local.get $4 + i32.const 2 + i32.add + local.set $4 + br $continue|0 + end + end + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + local.get $5 + ) + (func $~lib/string/String.__eq (; 32 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $0 + call $~lib/rt/pure/__retain + drop + local.get $1 + call $~lib/rt/pure/__retain + drop + local.get $0 + local.get $1 + i32.eq + if + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + i32.const 1 + return + end + block $folding-inner0 + local.get $1 + i32.eqz + i32.const 1 + local.get $0 + select + if + br $folding-inner0 + end + local.get $0 + call $~lib/string/String#get:length + local.tee $2 + local.get $1 + call $~lib/string/String#get:length + i32.ne + if + br $folding-inner0 + end + local.get $0 + local.get $1 + local.get $2 + call $~lib/util/string/compareImpl + i32.eqz + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + return + end + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + i32.const 0 + ) + (func $std/string-encoding/testUTF16Decode (; 33 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + global.get $std/string-encoding/str + call $~lib/string/String.UTF16.encode + local.tee $0 + call $~lib/rt/pure/__retain + drop + local.get $0 + local.get $0 + call $~lib/arraybuffer/ArrayBuffer#get:byteLength + call $~lib/string/String.UTF16.decodeUnsafe + local.set $1 + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + global.get $std/string-encoding/str + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 33 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/pure/__release + local.get $0 + call $~lib/rt/pure/__release + ) + (func $std/string-encoding/testUTF16DecodeUnsafe (; 34 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + global.get $std/string-encoding/str + call $~lib/string/String.UTF16.encode + local.set $0 + global.get $std/string-encoding/str + call $~lib/string/String.UTF16.byteLength + local.set $1 + local.get $0 + i32.const 0 + call $~lib/string/String.UTF16.decodeUnsafe + local.tee $2 + i32.const 368 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 42 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + call $~lib/string/String.UTF16.decodeUnsafe + local.tee $3 + global.get $std/string-encoding/str + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 43 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 4 + call $~lib/string/String.UTF16.decodeUnsafe + local.tee $4 + i32.const 384 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 44 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 4 + i32.add + i32.const 2 + call $~lib/string/String.UTF16.decodeUnsafe + local.tee $5 + i32.const 408 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 45 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 4 + i32.add + i32.const 4 + call $~lib/string/String.UTF16.decodeUnsafe + local.tee $6 + i32.const 432 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 46 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 8 + i32.add + i32.const 4 + call $~lib/string/String.UTF16.decodeUnsafe + local.tee $7 + i32.const 456 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 47 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 12 + i32.add + i32.const 0 + call $~lib/string/String.UTF16.decodeUnsafe + local.tee $1 + i32.const 368 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 48 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $2 + call $~lib/rt/pure/__release + local.get $3 + call $~lib/rt/pure/__release + local.get $4 + call $~lib/rt/pure/__release + local.get $5 + call $~lib/rt/pure/__release + local.get $6 + call $~lib/rt/pure/__release + local.get $7 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + local.get $0 + call $~lib/rt/pure/__release + ) + (func $~lib/string/String.UTF8.byteLength (; 35 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $0 + call $~lib/rt/pure/__retain + drop + local.get $0 + local.tee $2 + local.get $2 + i32.const 16 + i32.sub + i32.load offset=12 + i32.add + local.set $5 + i32.const 1 + i32.const 0 + local.get $1 + select + local.set $3 + loop $continue|0 + block $break|0 + local.get $2 + local.get $5 + i32.ge_u + br_if $break|0 + local.get $2 + i32.load16_u + local.tee $4 + i32.const 128 + i32.lt_u + if + local.get $4 + i32.eqz + i32.const 0 + local.get $1 + select + br_if $break|0 + local.get $3 + i32.const 1 + i32.add + local.set $3 + else + local.get $4 + i32.const 2048 + i32.lt_u + if + local.get $3 + i32.const 2 + i32.add + local.set $3 + else + local.get $2 + i32.const 2 + i32.add + local.get $5 + i32.lt_u + i32.const 0 + local.get $4 + i32.const 64512 + i32.and + i32.const 55296 + i32.eq + select + if + local.get $2 + i32.load16_u offset=2 + i32.const 64512 + i32.and + i32.const 56320 + i32.eq + if + local.get $2 + i32.const 4 + i32.add + local.set $2 + local.get $3 + i32.const 4 + i32.add + local.set $3 + br $continue|0 + end + end + local.get $3 + i32.const 3 + i32.add + local.set $3 + end + end + local.get $2 + i32.const 2 + i32.add + local.set $2 + br $continue|0 + end + end + local.get $0 + call $~lib/rt/pure/__release + local.get $3 + ) + (func $std/string-encoding/testUTF8Length (; 36 ;) (type $FUNCSIG$v) + global.get $std/string-encoding/str + i32.const 0 + call $~lib/string/String.UTF8.byteLength + i32.const 10 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 55 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + global.get $std/string-encoding/str + i32.const 1 + call $~lib/string/String.UTF8.byteLength + i32.const 11 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 56 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/tlsf/reallocateBlock (; 37 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + local.get $2 + call $~lib/rt/tlsf/prepareSize + local.set $3 + local.get $1 + i32.load + local.tee $4 + i32.const 1 + i32.and + if (result i32) + i32.const 0 + else + local.get $1 + i32.load offset=4 + i32.const -268435456 + i32.and + i32.eqz + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 495 + i32.const 4 + call $~lib/builtins/abort + unreachable + end + local.get $3 + local.get $4 + i32.const -4 + i32.and + i32.le_u + if + local.get $0 + local.get $1 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + local.get $1 + local.get $2 + i32.store offset=12 + local.get $1 + return + end + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $6 + i32.load + local.tee $5 + i32.const 1 + i32.and + if + local.get $4 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const -4 + i32.and + i32.add + local.tee $5 + local.get $3 + i32.ge_u + if + local.get $0 + local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $4 + i32.const 3 + i32.and + local.get $5 + i32.or + i32.store + local.get $1 + local.get $2 + i32.store offset=12 + local.get $0 + local.get $1 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + local.get $1 + return + end + end + local.get $0 + local.get $2 + call $~lib/rt/tlsf/allocateBlock + local.tee $3 + local.get $1 + i32.load offset=8 + i32.store offset=8 + local.get $3 + i32.const 16 + i32.add + local.get $1 + i32.const 16 + i32.add + local.get $2 + call $~lib/memory/memory.copy + local.get $1 + local.get $4 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + local.get $1 + call $~lib/rt/rtrace/onfree + local.get $3 + ) + (func $~lib/rt/tlsf/__realloc (; 38 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + global.get $~lib/rt/tlsf/ROOT + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 559 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $0 + select + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 560 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/rt/tlsf/ROOT + local.get $0 + i32.const 16 + i32.sub + local.get $1 + call $~lib/rt/tlsf/reallocateBlock + i32.const 16 + i32.add + ) + (func $~lib/string/String.UTF8.encode (; 39 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + local.get $0 + call $~lib/rt/pure/__retain + drop + local.get $0 + local.tee $3 + local.get $3 + i32.const 16 + i32.sub + i32.load offset=12 + i32.add + local.set $5 + local.get $3 + local.get $1 + call $~lib/string/String.UTF8.byteLength + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $6 + local.set $2 + loop $continue|0 + block $break|0 + local.get $3 + local.get $5 + i32.ge_u + br_if $break|0 + local.get $3 + i32.load16_u + local.tee $4 + i32.const 128 + i32.lt_u + if + local.get $4 + i32.eqz + i32.const 0 + local.get $1 + select + br_if $break|0 + local.get $2 + local.get $4 + i32.store8 + local.get $2 + i32.const 1 + i32.add + local.set $2 + else + local.get $4 + i32.const 2048 + i32.lt_u + if + local.get $2 + local.get $4 + i32.const 6 + i32.shr_u + i32.const 192 + i32.or + i32.store8 + local.get $2 + local.get $4 + i32.const 63 + i32.and + i32.const 128 + i32.or + i32.store8 offset=1 + local.get $2 + i32.const 2 + i32.add + local.set $2 + else + local.get $3 + i32.const 2 + i32.add + local.get $5 + i32.lt_u + i32.const 0 + local.get $4 + i32.const 64512 + i32.and + i32.const 55296 + i32.eq + select + if + local.get $3 + i32.load16_u offset=2 + local.tee $7 + i32.const 64512 + i32.and + i32.const 56320 + i32.eq + if + local.get $2 + local.get $4 + i32.const 1023 + i32.and + i32.const 10 + i32.shl + i32.const 65536 + i32.add + local.get $7 + i32.const 1023 + i32.and + i32.add + local.tee $4 + i32.const 18 + i32.shr_u + i32.const 240 + i32.or + i32.store8 + local.get $2 + local.get $4 + i32.const 12 + i32.shr_u + i32.const 63 + i32.and + i32.const 128 + i32.or + i32.store8 offset=1 + local.get $2 + local.get $4 + i32.const 6 + i32.shr_u + i32.const 63 + i32.and + i32.const 128 + i32.or + i32.store8 offset=2 + local.get $2 + local.get $4 + i32.const 63 + i32.and + i32.const 128 + i32.or + i32.store8 offset=3 + local.get $3 + i32.const 4 + i32.add + local.set $3 + local.get $2 + i32.const 4 + i32.add + local.set $2 + br $continue|0 + end + end + local.get $2 + local.get $4 + i32.const 12 + i32.shr_u + i32.const 224 + i32.or + i32.store8 + local.get $2 + local.get $4 + i32.const 6 + i32.shr_u + i32.const 63 + i32.and + i32.const 128 + i32.or + i32.store8 offset=1 + local.get $2 + local.get $4 + i32.const 63 + i32.and + i32.const 128 + i32.or + i32.store8 offset=2 + local.get $2 + i32.const 3 + i32.add + local.set $2 + end + end + local.get $3 + i32.const 2 + i32.add + local.set $3 + br $continue|0 + end + end + local.get $1 + if + local.get $3 + local.get $5 + i32.gt_u + if + i32.const 0 + i32.const 480 + i32.const 592 + i32.const 8 + call $~lib/builtins/abort + unreachable + end + local.get $6 + local.get $2 + local.get $6 + i32.sub + i32.const 1 + i32.add + call $~lib/rt/tlsf/__realloc + local.set $6 + local.get $2 + i32.const 0 + i32.store8 + else + local.get $3 + local.get $5 + i32.ne + if + i32.const 0 + i32.const 480 + i32.const 596 + i32.const 8 + call $~lib/builtins/abort + unreachable + end + end + local.get $6 + call $~lib/rt/pure/__retain + local.get $0 + call $~lib/rt/pure/__release + ) + (func $std/string-encoding/testUTF8Encode (; 40 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + global.get $std/string-encoding/str + i32.const 0 + call $~lib/string/String.UTF8.encode + local.tee $1 + local.tee $0 + call $~lib/arraybuffer/ArrayBuffer#get:byteLength + i32.const 10 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 63 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u + i32.const 240 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 64 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=1 + i32.const 144 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 65 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=2 + i32.const 144 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 66 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=3 + i32.const 183 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 67 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=4 + i32.const 104 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 68 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=5 + i32.const 105 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 69 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=6 + i32.const 240 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 70 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=7 + i32.const 164 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 71 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=8 + i32.const 173 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 72 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=9 + i32.const 162 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 73 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/pure/__release + ) + (func $std/string-encoding/testUTF8EncodeNullTerminated (; 41 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + global.get $std/string-encoding/str + i32.const 1 + call $~lib/string/String.UTF8.encode + local.tee $1 + local.tee $0 + call $~lib/arraybuffer/ArrayBuffer#get:byteLength + i32.const 11 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 80 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u + i32.const 240 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 81 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=1 + i32.const 144 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 82 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=2 + i32.const 144 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 83 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=3 + i32.const 183 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 84 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=4 + i32.const 104 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 85 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=5 + i32.const 105 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 86 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=6 + i32.const 240 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 87 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=7 + i32.const 164 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 88 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=8 + i32.const 173 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 89 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=9 + i32.const 162 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 90 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load8_u offset=10 + if + i32.const 0 + i32.const 304 + i32.const 91 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/pure/__release + ) + (func $~lib/string/String.UTF8.decodeUnsafe (; 42 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + local.get $0 + local.get $1 + i32.add + local.tee $6 + local.get $0 + i32.lt_u + if + i32.const 0 + i32.const 480 + i32.const 610 + i32.const 6 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 1 + i32.shl + i32.const 1 + call $~lib/rt/tlsf/__alloc + local.tee $5 + local.set $3 + loop $continue|0 + block $break|0 + local.get $0 + local.get $6 + i32.ge_u + br_if $break|0 + local.get $0 + local.tee $1 + i32.const 1 + i32.add + local.set $0 + local.get $1 + i32.load8_u + local.tee $4 + i32.const 128 + i32.lt_u + if + local.get $4 + i32.eqz + i32.const 0 + local.get $2 + select + br_if $break|0 + local.get $3 + local.get $4 + i32.store16 + local.get $3 + i32.const 2 + i32.add + local.set $3 + else + local.get $4 + i32.const 224 + i32.lt_u + i32.const 0 + local.get $4 + i32.const 191 + i32.gt_u + select + if + local.get $0 + local.tee $1 + i32.const 1 + i32.add + local.set $0 + local.get $3 + local.get $1 + i32.load8_u + i32.const 63 + i32.and + local.get $4 + i32.const 31 + i32.and + i32.const 6 + i32.shl + i32.or + i32.store16 + local.get $3 + i32.const 2 + i32.add + local.set $3 + else + local.get $4 + i32.const 365 + i32.lt_u + i32.const 0 + local.get $4 + i32.const 239 + i32.gt_u + select + if (result i32) + local.get $3 + local.get $0 + i32.load8_u offset=2 + i32.const 63 + i32.and + local.get $4 + i32.const 7 + i32.and + i32.const 18 + i32.shl + local.get $0 + i32.load8_u + i32.const 63 + i32.and + i32.const 12 + i32.shl + i32.or + local.get $0 + i32.load8_u offset=1 + i32.const 63 + i32.and + i32.const 6 + i32.shl + i32.or + i32.or + i32.const 65536 + i32.sub + local.tee $1 + i32.const 10 + i32.shr_u + i32.const 55296 + i32.add + i32.store16 + local.get $3 + local.get $1 + i32.const 1023 + i32.and + i32.const 56320 + i32.add + i32.store16 offset=2 + local.get $3 + i32.const 4 + i32.add + local.set $3 + local.get $0 + i32.const 3 + i32.add + else + local.get $3 + local.get $0 + i32.load8_u offset=1 + i32.const 63 + i32.and + local.get $4 + i32.const 15 + i32.and + i32.const 12 + i32.shl + local.get $0 + i32.load8_u + i32.const 63 + i32.and + i32.const 6 + i32.shl + i32.or + i32.or + i32.store16 + local.get $3 + i32.const 2 + i32.add + local.set $3 + local.get $0 + i32.const 2 + i32.add + end + local.set $0 + end + end + br $continue|0 + end + end + local.get $5 + local.get $3 + local.get $5 + i32.sub + call $~lib/rt/tlsf/__realloc + call $~lib/rt/pure/__retain + ) + (func $~lib/string/String.UTF8.decode (; 43 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + local.get $0 + call $~lib/rt/pure/__retain + drop + local.get $0 + local.get $0 + call $~lib/arraybuffer/ArrayBuffer#get:byteLength + local.get $1 + call $~lib/string/String.UTF8.decodeUnsafe + local.get $0 + call $~lib/rt/pure/__release + ) + (func $std/string-encoding/testUTF8Decode (; 44 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + global.get $std/string-encoding/str + i32.const 0 + call $~lib/string/String.UTF8.encode + local.tee $0 + i32.const 0 + call $~lib/string/String.UTF8.decode + local.tee $1 + global.get $std/string-encoding/str + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 97 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/pure/__release + local.get $0 + call $~lib/rt/pure/__release + ) + (func $std/string-encoding/testUTF8DecodeNullTerminated (; 45 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + global.get $std/string-encoding/str + i32.const 1 + call $~lib/string/String.UTF8.encode + local.tee $3 + i32.const 1 + call $~lib/string/String.UTF8.decode + local.tee $4 + global.get $std/string-encoding/str + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 103 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + i32.const 528 + call $~lib/rt/pure/__retain + local.tee $0 + i32.const 1 + call $~lib/string/String.UTF8.byteLength + i32.const 4 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 105 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 1 + call $~lib/string/String.UTF8.encode + local.tee $2 + call $~lib/arraybuffer/ArrayBuffer#get:byteLength + i32.const 4 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 107 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + i32.const 560 + call $~lib/rt/pure/__retain + local.tee $1 + i32.const 1 + call $~lib/string/String.UTF8.byteLength + i32.const 4 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 109 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 1 + call $~lib/string/String.UTF8.decode + local.tee $5 + local.get $1 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 110 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 0 + call $~lib/string/String.UTF8.encode + local.tee $6 + i32.const 1 + call $~lib/string/String.UTF8.decode + local.tee $7 + local.get $1 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 112 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $4 + call $~lib/rt/pure/__release + local.get $5 + call $~lib/rt/pure/__release + local.get $7 + call $~lib/rt/pure/__release + local.get $3 + call $~lib/rt/pure/__release + local.get $0 + call $~lib/rt/pure/__release + local.get $2 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + local.get $6 + call $~lib/rt/pure/__release + ) + (func $std/string-encoding/testUTF8DecodeUnsafe (; 46 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + global.get $std/string-encoding/str + i32.const 1 + call $~lib/string/String.UTF8.encode + local.set $0 + global.get $std/string-encoding/str + i32.const 0 + call $~lib/string/String.UTF8.byteLength + local.set $1 + local.get $0 + i32.const 0 + i32.const 0 + call $~lib/string/String.UTF8.decodeUnsafe + local.tee $2 + i32.const 368 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 121 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 0 + call $~lib/string/String.UTF8.decodeUnsafe + local.tee $3 + global.get $std/string-encoding/str + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 122 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 4 + i32.const 0 + call $~lib/string/String.UTF8.decodeUnsafe + local.tee $4 + i32.const 384 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 123 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 4 + i32.add + i32.const 2 + i32.const 0 + call $~lib/string/String.UTF8.decodeUnsafe + local.tee $5 + i32.const 432 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 124 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 6 + i32.add + i32.const 4 + i32.const 0 + call $~lib/string/String.UTF8.decodeUnsafe + local.tee $6 + i32.const 456 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 125 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 10 + i32.add + i32.const 0 + i32.const 0 + call $~lib/string/String.UTF8.decodeUnsafe + local.tee $7 + i32.const 368 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 126 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 4 + i32.add + i32.const 100 + i32.const 1 + call $~lib/string/String.UTF8.decodeUnsafe + local.tee $8 + i32.const 584 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 128 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 6 + i32.add + i32.const 100 + i32.const 1 + call $~lib/string/String.UTF8.decodeUnsafe + local.tee $9 + i32.const 456 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 129 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 10 + i32.add + i32.const 100 + i32.const 1 + call $~lib/string/String.UTF8.decodeUnsafe + local.tee $1 + i32.const 368 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 130 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $2 + call $~lib/rt/pure/__release + local.get $3 + call $~lib/rt/pure/__release + local.get $4 + call $~lib/rt/pure/__release + local.get $5 + call $~lib/rt/pure/__release + local.get $6 + call $~lib/rt/pure/__release + local.get $7 + call $~lib/rt/pure/__release + local.get $8 + call $~lib/rt/pure/__release + local.get $9 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + local.get $0 + call $~lib/rt/pure/__release + ) + (func $start:std/string-encoding (; 47 ;) (type $FUNCSIG$v) + global.get $std/string-encoding/str + call $~lib/string/String.UTF16.byteLength + i32.const 12 + i32.ne + if + i32.const 0 + i32.const 304 + i32.const 8 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + call $std/string-encoding/testUTF16Encode + call $std/string-encoding/testUTF16Decode + call $std/string-encoding/testUTF16DecodeUnsafe + call $std/string-encoding/testUTF8Length + call $std/string-encoding/testUTF8Encode + call $std/string-encoding/testUTF8EncodeNullTerminated + call $std/string-encoding/testUTF8Decode + call $std/string-encoding/testUTF8DecodeNullTerminated + call $std/string-encoding/testUTF8DecodeUnsafe + ) + (func $start (; 48 ;) (type $FUNCSIG$v) + call $start:std/string-encoding + ) + (func $~lib/rt/pure/markGray (; 49 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const 1879048192 + i32.and + i32.const 268435456 + i32.ne + if + local.get $0 + local.get $1 + i32.const -1879048193 + i32.and + i32.const 268435456 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 2 + call $~lib/rt/__visit_members + end + ) + (func $~lib/rt/pure/scanBlack (; 50 ;) (type $FUNCSIG$vi) (param $0 i32) + local.get $0 + local.get $0 + i32.load offset=4 + i32.const -1879048193 + i32.and + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 4 + call $~lib/rt/__visit_members + ) + (func $~lib/rt/pure/scan (; 51 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const 1879048192 + i32.and + i32.const 268435456 + i32.eq + if + local.get $1 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + if + local.get $0 + call $~lib/rt/pure/scanBlack + else + local.get $0 + local.get $1 + i32.const -1879048193 + i32.and + i32.const 536870912 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 3 + call $~lib/rt/__visit_members + end + end + ) + (func $~lib/rt/pure/collectWhite (; 52 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const 1879048192 + i32.and + i32.const 536870912 + i32.eq + if (result i32) + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + else + i32.const 0 + end + if + local.get $0 + local.get $1 + i32.const -1879048193 + i32.and + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 5 + call $~lib/rt/__visit_members + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + end + ) + (func $~lib/rt/pure/__visit (; 53 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + local.get $0 + i32.const 620 + i32.lt_u + if + return + end + local.get $0 + i32.const 16 + i32.sub + local.set $0 + block $break|0 + block $case5|0 + block $case4|0 + block $case3|0 + block $case2|0 + block $case1|0 + local.get $1 + i32.const 1 + i32.ne + if + local.get $1 + i32.const 2 + i32.eq + br_if $case1|0 + block $tablify|0 + local.get $1 + i32.const 3 + i32.sub + br_table $case2|0 $case3|0 $case4|0 $tablify|0 + end + br $case5|0 + end + local.get $0 + call $~lib/rt/pure/decrement + br $break|0 + end + local.get $0 + i32.load offset=4 + i32.const 268435455 + i32.and + i32.const 0 + i32.le_u + if + i32.const 0 + i32.const 56 + i32.const 75 + i32.const 17 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $0 + i32.load offset=4 + i32.const 1 + i32.sub + i32.store offset=4 + local.get $0 + call $~lib/rt/pure/markGray + br $break|0 + end + local.get $0 + call $~lib/rt/pure/scan + br $break|0 + end + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const -268435456 + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const -268435456 + i32.and + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 86 + i32.const 6 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + local.get $1 + i32.const 1879048192 + i32.and + if + local.get $0 + call $~lib/rt/pure/scanBlack + end + br $break|0 + end + local.get $0 + call $~lib/rt/pure/collectWhite + br $break|0 + end + i32.const 0 + i32.const 56 + i32.const 97 + i32.const 24 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/__visit_members (; 54 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + block $switch$1$default + block $switch$1$case$4 + block $switch$1$case$2 + local.get $0 + i32.const 8 + i32.sub + i32.load + br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default + end + return + end + local.get $0 + i32.load + local.tee $0 + if + local.get $0 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + unreachable + ) + (func $null (; 55 ;) (type $FUNCSIG$v) + nop + ) +) diff --git a/tests/compiler/std/encoding.ts b/tests/compiler/std/string-encoding.ts similarity index 54% rename from tests/compiler/std/encoding.ts rename to tests/compiler/std/string-encoding.ts index 65ed13a33e..12e428224f 100644 --- a/tests/compiler/std/encoding.ts +++ b/tests/compiler/std/string-encoding.ts @@ -5,12 +5,12 @@ var str = "𐐷hi𤭢"; // UTF-16 function testUTF16Length(): void { - assert(Encoding.UTF16.byteLength(str) == 12); + assert(String.UTF16.byteLength(str) == 12); } testUTF16Length(); function testUTF16Encode(): void { - var buf = Encoding.UTF16.encode(str); + var buf = String.UTF16.encode(str); var ptr = changetype(buf); assert(buf.byteLength == 12); assert(load(ptr, 0) == 0x01); @@ -29,36 +29,36 @@ function testUTF16Encode(): void { testUTF16Encode(); function testUTF16Decode(): void { - var buf = Encoding.UTF16.encode(str); - assert(Encoding.UTF16.decode(buf) == str); + var buf = String.UTF16.encode(str); + assert(String.UTF16.decode(buf) == str); } testUTF16Decode(); function testUTF16DecodeUnsafe(): void { - var buf = Encoding.UTF16.encode(str); - var len = Encoding.UTF16.byteLength(str); + var buf = String.UTF16.encode(str); + var len = String.UTF16.byteLength(str); var ptr = changetype(buf); - assert(Encoding.UTF16.decodeUnsafe(ptr, 0) == ""); - assert(Encoding.UTF16.decodeUnsafe(ptr, len) == str); - assert(Encoding.UTF16.decodeUnsafe(ptr, 4) == "𐐷"); - assert(Encoding.UTF16.decodeUnsafe(ptr + 4, 2) == "h"); - assert(Encoding.UTF16.decodeUnsafe(ptr + 4, 4) == "hi"); - assert(Encoding.UTF16.decodeUnsafe(ptr + 8, 4) == "𤭢"); - assert(Encoding.UTF16.decodeUnsafe(ptr + 12, 0) == ""); + assert(String.UTF16.decodeUnsafe(ptr, 0) == ""); + assert(String.UTF16.decodeUnsafe(ptr, len) == str); + assert(String.UTF16.decodeUnsafe(ptr, 4) == "𐐷"); + assert(String.UTF16.decodeUnsafe(ptr + 4, 2) == "h"); + assert(String.UTF16.decodeUnsafe(ptr + 4, 4) == "hi"); + assert(String.UTF16.decodeUnsafe(ptr + 8, 4) == "𤭢"); + assert(String.UTF16.decodeUnsafe(ptr + 12, 0) == ""); } testUTF16DecodeUnsafe(); // UTF-8 function testUTF8Length(): void { - assert(Encoding.UTF8.byteLength(str) == 10); - assert(Encoding.UTF8.byteLength(str, true) == 11); + assert(String.UTF8.byteLength(str) == 10); + assert(String.UTF8.byteLength(str, true) == 11); } testUTF8Length(); function testUTF8Encode(): void { - var buf = Encoding.UTF8.encode(str); + var buf = String.UTF8.encode(str); var ptr = changetype(buf); assert(buf.byteLength == 10); assert(load(ptr, 0) == 0xF0); @@ -75,7 +75,7 @@ function testUTF8Encode(): void { testUTF8Encode(); function testUTF8EncodeNullTerminated(): void { - var buf = Encoding.UTF8.encode(str, true); + var buf = String.UTF8.encode(str, true); var ptr = changetype(buf); assert(buf.byteLength == 11); assert(load(ptr, 0) == 0xF0); @@ -93,40 +93,40 @@ function testUTF8EncodeNullTerminated(): void { testUTF8EncodeNullTerminated(); function testUTF8Decode(): void { - var buf = Encoding.UTF8.encode(str); - assert(Encoding.UTF8.decode(buf) == str); + var buf = String.UTF8.encode(str); + assert(String.UTF8.decode(buf) == str); } testUTF8Decode(); function testUTF8DecodeNullTerminated(): void { - var buf = Encoding.UTF8.encode(str, true); - assert(Encoding.UTF8.decode(buf, true) == str); + var buf = String.UTF8.encode(str, true); + assert(String.UTF8.decode(buf, true) == str); var str2 = "123\0456"; - assert(Encoding.UTF8.byteLength(str2, true) == 4); - var buf2 = Encoding.UTF8.encode(str2, true); + assert(String.UTF8.byteLength(str2, true) == 4); + var buf2 = String.UTF8.encode(str2, true); assert(buf2.byteLength == 4); var str3 = "123"; - assert(Encoding.UTF8.byteLength(str3, true) == 4); - assert(Encoding.UTF8.decode(buf2, true) == str3); - var buf3 = Encoding.UTF8.encode(str2, false); - assert(Encoding.UTF8.decode(buf3, true) == str3); + assert(String.UTF8.byteLength(str3, true) == 4); + assert(String.UTF8.decode(buf2, true) == str3); + var buf3 = String.UTF8.encode(str2, false); + assert(String.UTF8.decode(buf3, true) == str3); } testUTF8DecodeNullTerminated(); function testUTF8DecodeUnsafe(): void { - var buf = Encoding.UTF8.encode(str, true); - var len = Encoding.UTF8.byteLength(str, false); // ! + var buf = String.UTF8.encode(str, true); + var len = String.UTF8.byteLength(str, false); // ! var ptr = changetype(buf); - assert(Encoding.UTF8.decodeUnsafe(ptr, 0) == ""); - assert(Encoding.UTF8.decodeUnsafe(ptr, len) == str); - assert(Encoding.UTF8.decodeUnsafe(ptr, 4) == "𐐷"); - assert(Encoding.UTF8.decodeUnsafe(ptr + 4, 2) == "hi"); - assert(Encoding.UTF8.decodeUnsafe(ptr + 6, 4) == "𤭢"); - assert(Encoding.UTF8.decodeUnsafe(ptr + 10, 0) == ""); + assert(String.UTF8.decodeUnsafe(ptr, 0) == ""); + assert(String.UTF8.decodeUnsafe(ptr, len) == str); + assert(String.UTF8.decodeUnsafe(ptr, 4) == "𐐷"); + assert(String.UTF8.decodeUnsafe(ptr + 4, 2) == "hi"); + assert(String.UTF8.decodeUnsafe(ptr + 6, 4) == "𤭢"); + assert(String.UTF8.decodeUnsafe(ptr + 10, 0) == ""); - assert(Encoding.UTF8.decodeUnsafe(ptr + 4, 100, true) == "hi𤭢"); - assert(Encoding.UTF8.decodeUnsafe(ptr + 6, 100, true) == "𤭢"); - assert(Encoding.UTF8.decodeUnsafe(ptr + 10, 100, true) == ""); + assert(String.UTF8.decodeUnsafe(ptr + 4, 100, true) == "hi𤭢"); + assert(String.UTF8.decodeUnsafe(ptr + 6, 100, true) == "𤭢"); + assert(String.UTF8.decodeUnsafe(ptr + 10, 100, true) == ""); } testUTF8DecodeUnsafe(); diff --git a/tests/compiler/std/encoding.untouched.wat b/tests/compiler/std/string-encoding.untouched.wat similarity index 53% rename from tests/compiler/std/encoding.untouched.wat rename to tests/compiler/std/string-encoding.untouched.wat index f1fa2f99ba..0e777741e6 100644 --- a/tests/compiler/std/encoding.untouched.wat +++ b/tests/compiler/std/string-encoding.untouched.wat @@ -3,36 +3,108 @@ (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) + (type $FUNCSIG$vii (func (param i32 i32))) (type $FUNCSIG$iii (func (param i32 i32) (result i32))) + (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$viii (func (param i32 i32 i32))) (type $FUNCSIG$iiiiii (func (param i32 i32 i32 i32 i32) (result i32))) - (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (import "rtrace" "onincrement" (func $~lib/rt/rtrace/onincrement (param i32))) + (import "rtrace" "ondecrement" (func $~lib/rt/rtrace/ondecrement (param i32))) + (import "rtrace" "onfree" (func $~lib/rt/rtrace/onfree (param i32))) + (import "rtrace" "onalloc" (func $~lib/rt/rtrace/onalloc (param i32))) (memory $0 1) (data (i32.const 8) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00\01\d87\dch\00i\00R\d8b\df") - (data (i32.const 40) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00s\00t\00d\00/\00e\00n\00c\00o\00d\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 88) "\00\00\00\00\01\00\00\00\01\00\00\00\00\00\00\00") - (data (i32.const 104) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00\01\d87\dc") - (data (i32.const 128) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00h\00") - (data (i32.const 152) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00h\00i\00") - (data (i32.const 176) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00R\d8b\df") - (data (i32.const 200) " \00\00\00\01\00\00\00\01\00\00\00 \00\00\00~\00l\00i\00b\00/\00e\00n\00c\00o\00d\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 248) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\001\002\003\00\00\004\005\006\00") - (data (i32.const 280) "\06\00\00\00\01\00\00\00\01\00\00\00\06\00\00\001\002\003\00") - (data (i32.const 304) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00h\00i\00R\d8b\df") + (data (i32.const 40) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") + (data (i32.const 88) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") + (data (i32.const 136) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00") + (data (i32.const 192) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00") + (data (i32.const 232) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") + (data (i32.const 288) ",\00\00\00\01\00\00\00\01\00\00\00,\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00-\00e\00n\00c\00o\00d\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 352) "\00\00\00\00\01\00\00\00\01\00\00\00\00\00\00\00") + (data (i32.const 368) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00\01\d87\dc") + (data (i32.const 392) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00h\00") + (data (i32.const 416) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00h\00i\00") + (data (i32.const 440) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00R\d8b\df") + (data (i32.const 464) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 512) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\001\002\003\00\00\004\005\006\00") + (data (i32.const 544) "\06\00\00\00\01\00\00\00\01\00\00\00\06\00\00\001\002\003\00") + (data (i32.const 568) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00h\00i\00R\d8b\df") + (data (i32.const 592) "\03\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00") (table $0 1 funcref) (elem (i32.const 0) $null) - (global $std/encoding/str (mut i32) (i32.const 24)) - (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) - (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) + (global $std/string-encoding/str (mut i32) (i32.const 24)) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) + (global $~lib/rt/pure/END (mut i32) (i32.const 0)) + (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/heap/__heap_base i32 (i32.const 328)) + (global $~lib/rt/__rtti_base i32 (i32.const 592)) + (global $~lib/heap/__heap_base i32 (i32.const 620)) (export "memory" (memory $0)) (start $start) - (func $~lib/rt/stub/__retain (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/rt/pure/increment (; 5 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 104 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + local.get $0 + call $~lib/rt/rtrace/onincrement + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 107 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/pure/__retain (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/increment + end local.get $0 ) - (func $~lib/string/String#get:length (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/string/String#get:length (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 16 i32.sub @@ -40,131 +112,1362 @@ i32.const 1 i32.shr_u ) - (func $~lib/rt/stub/__release (; 3 ;) (type $FUNCSIG$vi) (param $0 i32) - nop - ) - (func $~lib/encoding/Encoding.UTF16.byteLength (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - local.get $0 - call $~lib/rt/stub/__retain - drop - local.get $0 - call $~lib/string/String#get:length - i32.const 1 - i32.shl - local.set $1 - local.get $0 - call $~lib/rt/stub/__release + (func $~lib/rt/tlsf/removeBlock (; 8 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) local.get $1 - ) - (func $std/encoding/testUTF16Length (; 5 ;) (type $FUNCSIG$v) - global.get $std/encoding/str - call $~lib/encoding/Encoding.UTF16.byteLength - i32.const 12 - i32.eq + i32.load + local.set $2 + local.get $2 + i32.const 1 + i32.and i32.eqz if i32.const 0 - i32.const 56 + i32.const 104 + i32.const 277 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $3 + local.get $3 + i32.const 16 + i32.ge_u + if (result i32) + local.get $3 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 279 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $4 + local.get $3 + i32.const 4 + i32.shr_u + local.set $5 + else + i32.const 31 + local.get $3 + i32.clz + i32.sub + local.set $4 + local.get $3 + local.get $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $5 + local.get $4 i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $4 + end + local.get $4 + i32.const 23 + i32.lt_u + if (result i32) + local.get $5 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 292 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=16 + local.set $6 + local.get $1 + i32.load offset=20 + local.set $7 + local.get $6 + if + local.get $6 + local.get $7 + i32.store offset=20 + end + local.get $7 + if + local.get $7 + local.get $6 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.set $10 + local.get $4 + local.set $9 + local.get $5 + local.set $8 + local.get $10 + local.get $9 + i32.const 4 + i32.shl + local.get $8 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.set $11 + local.get $4 + local.set $10 + local.get $5 + local.set $9 + local.get $7 + local.set $8 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add i32.const 2 + i32.shl + i32.add + local.get $8 + i32.store offset=96 + local.get $7 + i32.eqz + if + local.get $0 + local.set $9 + local.get $4 + local.set $8 + local.get $9 + local.get $8 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $9 + local.get $0 + local.set $8 + local.get $4 + local.set $11 + local.get $9 + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $9 + local.set $10 + local.get $8 + local.get $11 + i32.const 2 + i32.shl + i32.add + local.get $10 + i32.store offset=4 + local.get $9 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 205 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.set $2 + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 207 + i32.const 13 call $~lib/builtins/abort unreachable end + local.get $1 + local.set $3 + local.get $3 + i32.const 16 + i32.add + local.get $3 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + local.get $5 + i32.const 1 + i32.and + if + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $3 + local.get $3 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $2 + i32.const 3 + i32.and + local.get $3 + i32.or + local.tee $2 + i32.store + local.get $1 + local.set $6 + local.get $6 + i32.const 16 + i32.add + local.get $6 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + end + end + local.get $2 + i32.const 2 + i32.and + if + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.sub + i32.load + local.set $6 + local.get $6 + i32.load + local.set $3 + local.get $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 228 + i32.const 15 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $7 + local.get $7 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $6 + local.get $3 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $2 + i32.store + local.get $6 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $8 + local.get $8 + i32.const 16 + i32.ge_u + if (result i32) + local.get $8 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 243 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.add + local.get $8 + i32.add + local.get $4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 244 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $8 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $9 + local.get $8 + i32.const 4 + i32.shr_u + local.set $10 + else + i32.const 31 + local.get $8 + i32.clz + i32.sub + local.set $9 + local.get $8 + local.get $9 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $10 + local.get $9 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $9 + end + local.get $9 + i32.const 23 + i32.lt_u + if (result i32) + local.get $10 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 260 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $7 + local.get $9 + local.set $3 + local.get $10 + local.set $6 + local.get $7 + local.get $3 + i32.const 4 + i32.shl + local.get $6 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $11 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $11 + i32.store offset=20 + local.get $11 + if + local.get $11 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.set $12 + local.get $9 + local.set $7 + local.get $10 + local.set $3 + local.get $1 + local.set $6 + local.get $12 + local.get $7 + i32.const 4 + i32.shl + local.get $3 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $9 + i32.shl + i32.or + i32.store + local.get $0 + local.set $13 + local.get $9 + local.set $12 + local.get $0 + local.set $3 + local.get $9 + local.set $6 + local.get $3 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 1 + local.get $10 + i32.shl + i32.or + local.set $7 + local.get $13 + local.get $12 + i32.const 2 + i32.shl + i32.add + local.get $7 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/freeBlock (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $1 + i32.load + local.set $2 + local.get $2 + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 537 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.get $2 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + local.get $1 + call $~lib/rt/rtrace/onfree + ) + (func $~lib/rt/__typeinfo (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + global.get $~lib/rt/__rtti_base + local.set $1 + local.get $0 + local.get $1 + i32.load + i32.gt_u + if + i32.const 152 + i32.const 208 + i32.const 22 + i32.const 27 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 4 + i32.add + local.get $0 + i32.const 8 + i32.mul + i32.add + i32.load + ) + (func $~lib/rt/tlsf/addMemory (; 12 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + local.get $1 + local.get $2 + i32.le_u + if (result i32) + local.get $1 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 386 + i32.const 4 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + local.set $4 + i32.const 0 + local.set $5 + local.get $4 + if + local.get $1 + local.get $4 + i32.const 16 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 396 + i32.const 15 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.sub + local.get $4 + i32.eq + if + local.get $1 + i32.const 16 + i32.sub + local.set $1 + local.get $4 + i32.load + local.set $5 + else + nop + end + else + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 408 + i32.const 4 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.set $6 + local.get $6 + i32.const 48 + i32.lt_u + if + i32.const 0 + return + end + local.get $6 + i32.const 2 + i32.const 16 + i32.mul + i32.sub + local.set $7 + local.get $1 + local.set $8 + local.get $8 + local.get $7 + i32.const 1 + i32.or + local.get $5 + i32.const 2 + i32.and + i32.or + i32.store + local.get $8 + i32.const 0 + i32.store offset=16 + local.get $8 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $6 + i32.add + i32.const 16 + i32.sub + local.set $4 + local.get $4 + i32.const 0 + i32.const 2 + i32.or + i32.store + local.get $0 + local.set $9 + local.get $4 + local.set $3 + local.get $9 + local.get $3 + i32.store offset=1568 + local.get $0 + local.get $8 + call $~lib/rt/tlsf/insertBlock + i32.const 1 + ) + (func $~lib/rt/tlsf/initializeRoot (; 13 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + global.get $~lib/heap/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $0 + memory.size + local.set $1 + local.get $0 + i32.const 1572 + i32.add + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $2 + local.get $2 + local.get $1 + i32.gt_s + if (result i32) + local.get $2 + local.get $1 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + local.get $0 + local.set $3 + local.get $3 + i32.const 0 + i32.store + local.get $3 + local.set $5 + i32.const 0 + local.set $4 + local.get $5 + local.get $4 + i32.store offset=1568 + block $break|0 + i32.const 0 + local.set $5 + loop $loop|0 + local.get $5 + i32.const 23 + i32.lt_u + i32.eqz + br_if $break|0 + local.get $3 + local.set $7 + local.get $5 + local.set $6 + i32.const 0 + local.set $4 + local.get $7 + local.get $6 + i32.const 2 + i32.shl + i32.add + local.get $4 + i32.store offset=4 + block $break|1 + i32.const 0 + local.set $7 + loop $loop|1 + local.get $7 + i32.const 16 + i32.lt_u + i32.eqz + br_if $break|1 + local.get $3 + local.set $9 + local.get $5 + local.set $8 + local.get $7 + local.set $6 + i32.const 0 + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $6 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $4 + i32.store offset=96 + local.get $7 + i32.const 1 + i32.add + local.set $7 + br $loop|1 + end + unreachable + end + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $loop|0 + end + unreachable + end + local.get $3 + local.get $0 + i32.const 1572 + i32.add + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + local.get $3 + global.set $~lib/rt/tlsf/ROOT + ) + (func $~lib/rt/tlsf/prepareSize (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1073741808 + i32.ge_u + if + i32.const 248 + i32.const 104 + i32.const 448 + i32.const 29 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.tee $1 + i32.const 16 + local.tee $2 + local.get $1 + local.get $2 + i32.gt_u + select + ) + (func $~lib/rt/tlsf/searchBlock (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $2 + local.get $1 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $1 + end + local.set $4 + i32.const 31 + local.get $4 + i32.clz + i32.sub + local.set $2 + local.get $4 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $3 + local.get $2 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $2 + end + local.get $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $3 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 338 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $5 + local.get $2 + local.set $4 + local.get $5 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.shl + i32.and + local.set $6 + i32.const 0 + local.set $7 + local.get $6 + i32.eqz + if + local.get $0 + i32.load + i32.const 0 + i32.const -1 + i32.xor + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.set $5 + local.get $5 + i32.eqz + if + i32.const 0 + local.set $7 + else + local.get $5 + i32.ctz + local.set $2 + local.get $0 + local.set $8 + local.get $2 + local.set $4 + local.get $8 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $6 + local.get $6 + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 351 + i32.const 17 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + else + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + local.get $7 + ) + (func $~lib/rt/tlsf/growMemory (; 16 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + memory.size + local.set $2 + local.get $1 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $3 + local.get $2 + local.tee $4 + local.get $3 + local.tee $5 + local.get $4 + local.get $5 + i32.gt_s + select + local.set $6 + local.get $6 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $3 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + memory.size + local.set $7 + local.get $0 + local.get $2 + i32.const 16 + i32.shl + local.get $7 + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop ) - (func $~lib/rt/stub/__alloc (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) + (func $~lib/rt/tlsf/prepareBlock (; 17 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - local.get $0 - i32.const 1073741808 - i32.gt_u + local.get $1 + i32.load + local.set $3 + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.eqz if + i32.const 0 + i32.const 104 + i32.const 365 + i32.const 13 + call $~lib/builtins/abort unreachable end - global.get $~lib/rt/stub/offset - i32.const 16 - i32.add - local.set $2 - local.get $2 - local.get $0 - local.tee $3 - i32.const 1 - local.tee $4 local.get $3 - local.get $4 - i32.gt_u - select - i32.add - i32.const 15 - i32.add - i32.const 15 + i32.const 3 i32.const -1 i32.xor i32.and - local.set $5 - memory.size - local.set $6 - local.get $5 - local.get $6 - i32.const 16 - i32.shl - i32.gt_u + local.get $2 + i32.sub + local.set $4 + local.get $4 + i32.const 32 + i32.ge_u if - local.get $5 + local.get $1 local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + local.set $5 + local.get $5 + local.get $4 + i32.const 16 i32.sub - i32.const 65535 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $5 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const 1 + i32.const -1 + i32.xor + i32.and + i32.store + local.get $1 + local.set $5 + local.get $5 + i32.const 16 i32.add - i32.const 65535 + local.get $5 + i32.load + i32.const 3 i32.const -1 i32.xor i32.and + i32.add + local.get $1 + local.set $5 + local.get $5 i32.const 16 - i32.shr_u + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + i32.load + i32.const 2 + i32.const -1 + i32.xor + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.set $2 + local.get $0 + local.get $2 + call $~lib/rt/tlsf/searchBlock + local.set $3 + local.get $3 + i32.eqz + if + local.get $0 + local.get $2 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $2 + call $~lib/rt/tlsf/searchBlock local.set $3 - local.get $6 - local.tee $4 local.get $3 - local.tee $7 - local.get $4 - local.get $7 - i32.gt_s - select - local.set $4 - local.get $4 - memory.grow - i32.const 0 - i32.lt_s + i32.eqz if - local.get $3 - memory.grow i32.const 0 - i32.lt_s - if - unreachable - end + i32.const 104 + i32.const 478 + i32.const 15 + call $~lib/builtins/abort + unreachable end end - local.get $5 - global.set $~lib/rt/stub/offset + local.get $3 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and local.get $2 - i32.const 16 - i32.sub - local.set $8 - local.get $8 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 480 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 local.get $1 - i32.store offset=8 - local.get $8 - local.get $0 i32.store offset=12 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $3 + local.get $2 + call $~lib/rt/tlsf/prepareBlock + local.get $3 + call $~lib/rt/rtrace/onalloc + local.get $3 + ) + (func $~lib/rt/tlsf/__alloc (; 19 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + global.get $~lib/rt/tlsf/ROOT + local.set $2 + local.get $2 + i32.eqz + if + call $~lib/rt/tlsf/initializeRoot + global.get $~lib/rt/tlsf/ROOT + local.set $2 + end local.get $2 + local.get $0 + call $~lib/rt/tlsf/allocateBlock + local.set $3 + local.get $3 + local.get $1 + i32.store offset=8 + local.get $3 + i32.const 16 + i32.add ) - (func $~lib/util/memory/memcpy (; 7 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/memory/memcpy (; 20 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1192,7 +2495,7 @@ i32.store8 end ) - (func $~lib/memory/memory.copy (; 8 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.copy (; 21 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1417,12 +2720,271 @@ end end ) - (func $~lib/encoding/Encoding.UTF16.encode (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/rt/tlsf/__free (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) + global.get $~lib/rt/tlsf/ROOT + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 567 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 0 + i32.ne + if (result i32) + local.get $0 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 568 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/rt/tlsf/ROOT + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/rt/pure/growRoots (; 23 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + global.get $~lib/rt/pure/ROOTS + local.set $0 + global.get $~lib/rt/pure/CUR + local.get $0 + i32.sub + local.set $1 + local.get $1 + i32.const 2 + i32.mul + local.tee $2 + i32.const 64 + i32.const 2 + i32.shl + local.tee $3 + local.get $2 + local.get $3 + i32.gt_u + select + local.set $4 + local.get $4 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.set $5 + local.get $5 + i32.const 16 + i32.sub + call $~lib/rt/rtrace/onfree + local.get $5 + local.get $0 + local.get $1 + call $~lib/memory/memory.copy + local.get $0 + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/rtrace/onalloc + local.get $0 + call $~lib/rt/tlsf/__free + end + local.get $5 + global.set $~lib/rt/pure/ROOTS + local.get $5 + local.get $1 + i32.add + global.set $~lib/rt/pure/CUR + local.get $5 + local.get $4 + i32.add + global.set $~lib/rt/pure/END + ) + (func $~lib/rt/pure/appendRoot (; 24 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + global.get $~lib/rt/pure/CUR + local.set $1 + local.get $1 + global.get $~lib/rt/pure/END + i32.ge_u + if + call $~lib/rt/pure/growRoots + global.get $~lib/rt/pure/CUR + local.set $1 + end + local.get $1 + local.get $0 + i32.store + local.get $1 + i32.const 4 + i32.add + global.set $~lib/rt/pure/CUR + ) + (func $~lib/rt/pure/decrement (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.and + local.set $2 + local.get $0 + call $~lib/rt/rtrace/ondecrement + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 115 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 1 + i32.eq + if + local.get $0 + i32.const 16 + i32.add + i32.const 1 + call $~lib/rt/__visit_members + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + if + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + else + local.get $0 + i32.const -2147483648 + i32.const 0 + i32.or + i32.const 0 + i32.or + i32.store offset=4 + end + else + local.get $2 + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 124 + i32.const 15 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=8 + call $~lib/rt/__typeinfo + i32.const 16 + i32.and + i32.eqz + if + local.get $0 + i32.const -2147483648 + i32.const 805306368 + i32.or + local.get $2 + i32.const 1 + i32.sub + i32.or + i32.store offset=4 + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + if + local.get $0 + call $~lib/rt/pure/appendRoot + end + else + local.get $0 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.const 1 + i32.sub + i32.or + i32.store offset=4 + end + end + ) + (func $~lib/rt/pure/__release (; 26 ;) (type $FUNCSIG$vi) (param $0 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $~lib/string/String.UTF16.byteLength (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + local.get $0 + call $~lib/rt/pure/__retain + drop + local.get $0 + call $~lib/string/String#get:length + i32.const 1 + i32.shl + local.set $1 + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + ) + (func $std/string-encoding/testUTF16Length (; 28 ;) (type $FUNCSIG$v) + global.get $std/string-encoding/str + call $~lib/string/String.UTF16.byteLength + i32.const 12 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 8 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/string/String.UTF16.encode (; 29 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) local.get $0 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain drop local.get $0 i32.const 16 @@ -1431,30 +2993,30 @@ local.set $1 local.get $1 i32.const 0 - call $~lib/rt/stub/__alloc + call $~lib/rt/tlsf/__alloc local.set $2 local.get $2 local.get $0 local.get $1 call $~lib/memory/memory.copy local.get $2 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain local.set $3 local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $3 ) - (func $~lib/arraybuffer/ArrayBuffer#get:byteLength (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#get:byteLength (; 30 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 16 i32.sub i32.load offset=12 ) - (func $std/encoding/testUTF16Encode (; 11 ;) (type $FUNCSIG$v) + (func $std/string-encoding/testUTF16Encode (; 31 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) - global.get $std/encoding/str - call $~lib/encoding/Encoding.UTF16.encode + global.get $std/string-encoding/str + call $~lib/string/String.UTF16.encode local.set $0 local.get $0 local.set $1 @@ -1465,7 +3027,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 15 i32.const 2 call $~lib/builtins/abort @@ -1478,7 +3040,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 16 i32.const 2 call $~lib/builtins/abort @@ -1491,7 +3053,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 17 i32.const 2 call $~lib/builtins/abort @@ -1504,7 +3066,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 18 i32.const 2 call $~lib/builtins/abort @@ -1517,7 +3079,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 19 i32.const 2 call $~lib/builtins/abort @@ -1530,7 +3092,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 20 i32.const 2 call $~lib/builtins/abort @@ -1543,7 +3105,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 21 i32.const 2 call $~lib/builtins/abort @@ -1556,7 +3118,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 22 i32.const 2 call $~lib/builtins/abort @@ -1569,7 +3131,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 23 i32.const 2 call $~lib/builtins/abort @@ -1582,7 +3144,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 24 i32.const 2 call $~lib/builtins/abort @@ -1595,7 +3157,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 25 i32.const 2 call $~lib/builtins/abort @@ -1608,7 +3170,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 26 i32.const 2 call $~lib/builtins/abort @@ -1621,16 +3183,16 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 27 i32.const 2 call $~lib/builtins/abort unreachable end local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release ) - (func $~lib/encoding/Encoding.UTF16.decodeUnsafe (; 12 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.UTF16.decodeUnsafe (; 32 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $1 i32.const 1 @@ -1639,39 +3201,39 @@ i32.and local.tee $1 i32.const 1 - call $~lib/rt/stub/__alloc + call $~lib/rt/tlsf/__alloc local.set $2 local.get $2 local.get $0 local.get $1 call $~lib/memory/memory.copy local.get $2 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain ) - (func $~lib/encoding/Encoding.UTF16.decode (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/string/String.UTF16.decode (; 33 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain drop local.get $0 local.get $0 call $~lib/arraybuffer/ArrayBuffer#get:byteLength - call $~lib/encoding/Encoding.UTF16.decodeUnsafe + call $~lib/string/String.UTF16.decodeUnsafe local.set $1 local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $1 ) - (func $~lib/util/string/compareImpl (; 14 ;) (type $FUNCSIG$iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/util/string/compareImpl (; 34 ;) (type $FUNCSIG$iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (local $6 i32) (local $7 i32) (local $8 i32) local.get $0 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain drop local.get $2 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain drop i32.const 0 local.set $5 @@ -1722,19 +3284,19 @@ local.get $5 local.set $8 local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $2 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $8 ) - (func $~lib/string/String.__eq (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 35 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) local.get $0 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain drop local.get $1 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain drop local.get $0 local.get $1 @@ -1743,9 +3305,9 @@ i32.const 1 local.set $2 local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $1 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $2 return end @@ -1763,9 +3325,9 @@ i32.const 0 local.set $2 local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $1 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $2 return end @@ -1780,9 +3342,9 @@ i32.const 0 local.set $2 local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $1 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $2 return end @@ -1795,37 +3357,37 @@ i32.eqz local.set $2 local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $1 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $2 ) - (func $std/encoding/testUTF16Decode (; 16 ;) (type $FUNCSIG$v) + (func $std/string-encoding/testUTF16Decode (; 36 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) - global.get $std/encoding/str - call $~lib/encoding/Encoding.UTF16.encode + global.get $std/string-encoding/str + call $~lib/string/String.UTF16.encode local.set $0 local.get $0 - call $~lib/encoding/Encoding.UTF16.decode + call $~lib/string/String.UTF16.decode local.tee $1 - global.get $std/encoding/str + global.get $std/string-encoding/str call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 33 i32.const 2 call $~lib/builtins/abort unreachable end local.get $1 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release ) - (func $std/encoding/testUTF16DecodeUnsafe (; 17 ;) (type $FUNCSIG$v) + (func $std/string-encoding/testUTF16DecodeUnsafe (; 37 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -1836,24 +3398,24 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $std/encoding/str - call $~lib/encoding/Encoding.UTF16.encode + global.get $std/string-encoding/str + call $~lib/string/String.UTF16.encode local.set $0 - global.get $std/encoding/str - call $~lib/encoding/Encoding.UTF16.byteLength + global.get $std/string-encoding/str + call $~lib/string/String.UTF16.byteLength local.set $1 local.get $0 local.set $2 local.get $2 i32.const 0 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe + call $~lib/string/String.UTF16.decodeUnsafe local.tee $3 - i32.const 104 + i32.const 368 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 42 i32.const 2 call $~lib/builtins/abort @@ -1861,14 +3423,14 @@ end local.get $2 local.get $1 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe + call $~lib/string/String.UTF16.decodeUnsafe local.tee $4 - global.get $std/encoding/str + global.get $std/string-encoding/str call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 43 i32.const 2 call $~lib/builtins/abort @@ -1876,14 +3438,14 @@ end local.get $2 i32.const 4 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe + call $~lib/string/String.UTF16.decodeUnsafe local.tee $5 - i32.const 120 + i32.const 384 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 44 i32.const 2 call $~lib/builtins/abort @@ -1893,14 +3455,14 @@ i32.const 4 i32.add i32.const 2 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe + call $~lib/string/String.UTF16.decodeUnsafe local.tee $6 - i32.const 144 + i32.const 408 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 45 i32.const 2 call $~lib/builtins/abort @@ -1910,14 +3472,14 @@ i32.const 4 i32.add i32.const 4 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe + call $~lib/string/String.UTF16.decodeUnsafe local.tee $7 - i32.const 168 + i32.const 432 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 46 i32.const 2 call $~lib/builtins/abort @@ -1927,14 +3489,14 @@ i32.const 8 i32.add i32.const 4 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe + call $~lib/string/String.UTF16.decodeUnsafe local.tee $8 - i32.const 192 + i32.const 456 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 47 i32.const 2 call $~lib/builtins/abort @@ -1944,43 +3506,43 @@ i32.const 12 i32.add i32.const 0 - call $~lib/encoding/Encoding.UTF16.decodeUnsafe + call $~lib/string/String.UTF16.decodeUnsafe local.tee $9 - i32.const 104 + i32.const 368 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 48 i32.const 2 call $~lib/builtins/abort unreachable end local.get $3 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $4 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $5 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $6 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $7 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $8 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $9 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release ) - (func $~lib/encoding/Encoding.UTF8.byteLength (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.UTF8.byteLength (; 38 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) local.get $0 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain drop local.get $0 local.set $2 @@ -2092,75 +3654,222 @@ unreachable end local.get $4 - local.set $5 + local.set $5 + local.get $0 + call $~lib/rt/pure/__release + local.get $5 + ) + (func $std/string-encoding/testUTF8Length (; 39 ;) (type $FUNCSIG$v) + global.get $std/string-encoding/str + i32.const 0 + call $~lib/string/String.UTF8.byteLength + i32.const 10 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 55 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + global.get $std/string-encoding/str + i32.const 1 + call $~lib/string/String.UTF8.byteLength + i32.const 11 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 304 + i32.const 56 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/tlsf/reallocateBlock (; 40 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + local.get $2 + call $~lib/rt/tlsf/prepareSize + local.set $3 + local.get $1 + i32.load + local.set $4 + local.get $4 + i32.const 1 + i32.and + i32.eqz + if (result i32) + local.get $1 + i32.load offset=4 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 495 + i32.const 4 + call $~lib/builtins/abort + unreachable + end + local.get $3 + local.get $4 + i32.const -4 + i32.and + i32.le_u + if + local.get $0 + local.get $1 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + local.get $1 + local.get $2 + i32.store offset=12 + local.get $1 + return + end + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $6 + local.get $6 + i32.load + local.set $7 + local.get $7 + i32.const 1 + i32.and + if + local.get $4 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $7 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $5 + local.get $5 + local.get $3 + i32.ge_u + if + local.get $0 + local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $4 + i32.const 3 + i32.and + local.get $5 + i32.or + i32.store + local.get $1 + local.get $2 + i32.store offset=12 + local.get $0 + local.get $1 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + local.get $1 + return + end + end + local.get $0 + local.get $2 + call $~lib/rt/tlsf/allocateBlock + local.set $8 + local.get $8 + local.get $1 + i32.load offset=8 + i32.store offset=8 + local.get $8 + i32.const 16 + i32.add + local.get $1 + i32.const 16 + i32.add + local.get $2 + call $~lib/memory/memory.copy + local.get $1 + local.get $4 + i32.const 1 + i32.or + i32.store local.get $0 - call $~lib/rt/stub/__release - local.get $5 + local.get $1 + call $~lib/rt/tlsf/insertBlock + local.get $1 + call $~lib/rt/rtrace/onfree + local.get $8 ) - (func $std/encoding/testUTF8Length (; 19 ;) (type $FUNCSIG$v) - global.get $std/encoding/str - i32.const 0 - call $~lib/encoding/Encoding.UTF8.byteLength - i32.const 10 - i32.eq + (func $~lib/rt/tlsf/__realloc (; 41 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + global.get $~lib/rt/tlsf/ROOT i32.eqz if i32.const 0 - i32.const 56 - i32.const 55 - i32.const 2 + i32.const 104 + i32.const 559 + i32.const 13 call $~lib/builtins/abort unreachable end - global.get $std/encoding/str - i32.const 1 - call $~lib/encoding/Encoding.UTF8.byteLength - i32.const 11 - i32.eq + local.get $0 + i32.const 0 + i32.ne + if (result i32) + local.get $0 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end i32.eqz if i32.const 0 - i32.const 56 - i32.const 56 + i32.const 104 + i32.const 560 i32.const 2 call $~lib/builtins/abort unreachable end - ) - (func $~lib/rt/stub/__realloc (; 20 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) + global.get $~lib/rt/tlsf/ROOT local.get $0 i32.const 16 i32.sub - local.set $2 - local.get $2 - i32.load offset=12 - local.set $3 local.get $1 - local.get $3 - i32.gt_u - if - local.get $1 - local.get $2 - i32.load offset=8 - call $~lib/rt/stub/__alloc - local.set $4 - local.get $4 - local.get $0 - local.get $3 - call $~lib/memory/memory.copy - local.get $4 - local.set $0 - else - local.get $2 - local.get $1 - i32.store offset=12 - end - local.get $0 + call $~lib/rt/tlsf/reallocateBlock + i32.const 16 + i32.add ) - (func $~lib/encoding/Encoding.UTF8.encode (; 21 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.UTF8.encode (; 42 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2168,7 +3877,7 @@ (local $6 i32) (local $7 i32) local.get $0 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain drop local.get $0 local.set $2 @@ -2181,9 +3890,9 @@ local.set $3 local.get $0 local.get $1 - call $~lib/encoding/Encoding.UTF8.byteLength + call $~lib/string/String.UTF8.byteLength i32.const 0 - call $~lib/rt/stub/__alloc + call $~lib/rt/tlsf/__alloc local.set $4 local.get $4 local.set $5 @@ -2374,8 +4083,8 @@ i32.eqz if i32.const 0 - i32.const 216 - i32.const 66 + i32.const 480 + i32.const 592 i32.const 8 call $~lib/builtins/abort unreachable @@ -2386,7 +4095,7 @@ i32.sub i32.const 1 i32.add - call $~lib/rt/stub/__realloc + call $~lib/rt/tlsf/__realloc local.set $4 local.get $5 i32.const 0 @@ -2398,26 +4107,26 @@ i32.eqz if i32.const 0 - i32.const 216 - i32.const 70 + i32.const 480 + i32.const 596 i32.const 8 call $~lib/builtins/abort unreachable end end local.get $4 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain local.set $6 local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $6 ) - (func $std/encoding/testUTF8Encode (; 22 ;) (type $FUNCSIG$v) + (func $std/string-encoding/testUTF8Encode (; 43 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) - global.get $std/encoding/str + global.get $std/string-encoding/str i32.const 0 - call $~lib/encoding/Encoding.UTF8.encode + call $~lib/string/String.UTF8.encode local.set $0 local.get $0 local.set $1 @@ -2428,7 +4137,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 63 i32.const 2 call $~lib/builtins/abort @@ -2441,7 +4150,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 64 i32.const 2 call $~lib/builtins/abort @@ -2454,7 +4163,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 65 i32.const 2 call $~lib/builtins/abort @@ -2467,7 +4176,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 66 i32.const 2 call $~lib/builtins/abort @@ -2480,7 +4189,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 67 i32.const 2 call $~lib/builtins/abort @@ -2493,7 +4202,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 68 i32.const 2 call $~lib/builtins/abort @@ -2506,7 +4215,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 69 i32.const 2 call $~lib/builtins/abort @@ -2519,7 +4228,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 70 i32.const 2 call $~lib/builtins/abort @@ -2532,7 +4241,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 71 i32.const 2 call $~lib/builtins/abort @@ -2545,7 +4254,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 72 i32.const 2 call $~lib/builtins/abort @@ -2558,21 +4267,21 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 73 i32.const 2 call $~lib/builtins/abort unreachable end local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release ) - (func $std/encoding/testUTF8EncodeNullTerminated (; 23 ;) (type $FUNCSIG$v) + (func $std/string-encoding/testUTF8EncodeNullTerminated (; 44 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) - global.get $std/encoding/str + global.get $std/string-encoding/str i32.const 1 - call $~lib/encoding/Encoding.UTF8.encode + call $~lib/string/String.UTF8.encode local.set $0 local.get $0 local.set $1 @@ -2583,7 +4292,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 80 i32.const 2 call $~lib/builtins/abort @@ -2596,7 +4305,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 81 i32.const 2 call $~lib/builtins/abort @@ -2609,7 +4318,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 82 i32.const 2 call $~lib/builtins/abort @@ -2622,7 +4331,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 83 i32.const 2 call $~lib/builtins/abort @@ -2635,7 +4344,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 84 i32.const 2 call $~lib/builtins/abort @@ -2648,7 +4357,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 85 i32.const 2 call $~lib/builtins/abort @@ -2661,7 +4370,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 86 i32.const 2 call $~lib/builtins/abort @@ -2674,7 +4383,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 87 i32.const 2 call $~lib/builtins/abort @@ -2687,7 +4396,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 88 i32.const 2 call $~lib/builtins/abort @@ -2700,7 +4409,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 89 i32.const 2 call $~lib/builtins/abort @@ -2713,7 +4422,7 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 90 i32.const 2 call $~lib/builtins/abort @@ -2726,16 +4435,16 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 91 i32.const 2 call $~lib/builtins/abort unreachable end local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release ) - (func $~lib/encoding/Encoding.UTF8.decodeUnsafe (; 24 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String.UTF8.decodeUnsafe (; 45 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2754,8 +4463,8 @@ i32.eqz if i32.const 0 - i32.const 216 - i32.const 84 + i32.const 480 + i32.const 610 i32.const 6 call $~lib/builtins/abort unreachable @@ -2764,7 +4473,7 @@ i32.const 1 i32.shl i32.const 1 - call $~lib/rt/stub/__alloc + call $~lib/rt/tlsf/__alloc local.set $5 local.get $5 local.set $6 @@ -2937,52 +4646,52 @@ local.get $6 local.get $5 i32.sub - call $~lib/rt/stub/__realloc - call $~lib/rt/stub/__retain + call $~lib/rt/tlsf/__realloc + call $~lib/rt/pure/__retain ) - (func $~lib/encoding/Encoding.UTF8.decode (; 25 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.UTF8.decode (; 46 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 - call $~lib/rt/stub/__retain + call $~lib/rt/pure/__retain drop local.get $0 local.get $0 call $~lib/arraybuffer/ArrayBuffer#get:byteLength local.get $1 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe + call $~lib/string/String.UTF8.decodeUnsafe local.set $2 local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $2 ) - (func $std/encoding/testUTF8Decode (; 26 ;) (type $FUNCSIG$v) + (func $std/string-encoding/testUTF8Decode (; 47 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) - global.get $std/encoding/str + global.get $std/string-encoding/str i32.const 0 - call $~lib/encoding/Encoding.UTF8.encode + call $~lib/string/String.UTF8.encode local.set $0 local.get $0 i32.const 0 - call $~lib/encoding/Encoding.UTF8.decode + call $~lib/string/String.UTF8.decode local.tee $1 - global.get $std/encoding/str + global.get $std/string-encoding/str call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 97 i32.const 2 call $~lib/builtins/abort unreachable end local.get $1 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release ) - (func $std/encoding/testUTF8DecodeNullTerminated (; 27 ;) (type $FUNCSIG$v) + (func $std/string-encoding/testUTF8DecodeNullTerminated (; 48 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -2991,37 +4700,37 @@ (local $5 i32) (local $6 i32) (local $7 i32) - global.get $std/encoding/str + global.get $std/string-encoding/str i32.const 1 - call $~lib/encoding/Encoding.UTF8.encode + call $~lib/string/String.UTF8.encode local.set $0 local.get $0 i32.const 1 - call $~lib/encoding/Encoding.UTF8.decode + call $~lib/string/String.UTF8.decode local.tee $1 - global.get $std/encoding/str + global.get $std/string-encoding/str call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 103 i32.const 2 call $~lib/builtins/abort unreachable end - i32.const 264 - call $~lib/rt/stub/__retain + i32.const 528 + call $~lib/rt/pure/__retain local.set $2 local.get $2 i32.const 1 - call $~lib/encoding/Encoding.UTF8.byteLength + call $~lib/string/String.UTF8.byteLength i32.const 4 i32.eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 105 i32.const 2 call $~lib/builtins/abort @@ -3029,7 +4738,7 @@ end local.get $2 i32.const 1 - call $~lib/encoding/Encoding.UTF8.encode + call $~lib/string/String.UTF8.encode local.set $3 local.get $3 call $~lib/arraybuffer/ArrayBuffer#get:byteLength @@ -3038,24 +4747,24 @@ i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 107 i32.const 2 call $~lib/builtins/abort unreachable end - i32.const 296 - call $~lib/rt/stub/__retain + i32.const 560 + call $~lib/rt/pure/__retain local.set $4 local.get $4 i32.const 1 - call $~lib/encoding/Encoding.UTF8.byteLength + call $~lib/string/String.UTF8.byteLength i32.const 4 i32.eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 109 i32.const 2 call $~lib/builtins/abort @@ -3063,14 +4772,14 @@ end local.get $3 i32.const 1 - call $~lib/encoding/Encoding.UTF8.decode + call $~lib/string/String.UTF8.decode local.tee $5 local.get $4 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 110 i32.const 2 call $~lib/builtins/abort @@ -3078,41 +4787,41 @@ end local.get $2 i32.const 0 - call $~lib/encoding/Encoding.UTF8.encode + call $~lib/string/String.UTF8.encode local.set $6 local.get $6 i32.const 1 - call $~lib/encoding/Encoding.UTF8.decode + call $~lib/string/String.UTF8.decode local.tee $7 local.get $4 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 112 i32.const 2 call $~lib/builtins/abort unreachable end local.get $1 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $5 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $7 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $2 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $3 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $4 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $6 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release ) - (func $std/encoding/testUTF8DecodeUnsafe (; 28 ;) (type $FUNCSIG$v) + (func $std/string-encoding/testUTF8DecodeUnsafe (; 49 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -3125,27 +4834,27 @@ (local $9 i32) (local $10 i32) (local $11 i32) - global.get $std/encoding/str + global.get $std/string-encoding/str i32.const 1 - call $~lib/encoding/Encoding.UTF8.encode + call $~lib/string/String.UTF8.encode local.set $0 - global.get $std/encoding/str + global.get $std/string-encoding/str i32.const 0 - call $~lib/encoding/Encoding.UTF8.byteLength + call $~lib/string/String.UTF8.byteLength local.set $1 local.get $0 local.set $2 local.get $2 i32.const 0 i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe + call $~lib/string/String.UTF8.decodeUnsafe local.tee $3 - i32.const 104 + i32.const 368 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 121 i32.const 2 call $~lib/builtins/abort @@ -3154,14 +4863,14 @@ local.get $2 local.get $1 i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe + call $~lib/string/String.UTF8.decodeUnsafe local.tee $4 - global.get $std/encoding/str + global.get $std/string-encoding/str call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 122 i32.const 2 call $~lib/builtins/abort @@ -3170,14 +4879,14 @@ local.get $2 i32.const 4 i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe + call $~lib/string/String.UTF8.decodeUnsafe local.tee $5 - i32.const 120 + i32.const 384 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 123 i32.const 2 call $~lib/builtins/abort @@ -3188,14 +4897,14 @@ i32.add i32.const 2 i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe + call $~lib/string/String.UTF8.decodeUnsafe local.tee $6 - i32.const 168 + i32.const 432 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 124 i32.const 2 call $~lib/builtins/abort @@ -3206,14 +4915,14 @@ i32.add i32.const 4 i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe + call $~lib/string/String.UTF8.decodeUnsafe local.tee $7 - i32.const 192 + i32.const 456 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 125 i32.const 2 call $~lib/builtins/abort @@ -3224,14 +4933,14 @@ i32.add i32.const 0 i32.const 0 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe + call $~lib/string/String.UTF8.decodeUnsafe local.tee $8 - i32.const 104 + i32.const 368 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 126 i32.const 2 call $~lib/builtins/abort @@ -3242,14 +4951,14 @@ i32.add i32.const 100 i32.const 1 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe + call $~lib/string/String.UTF8.decodeUnsafe local.tee $9 - i32.const 320 + i32.const 584 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 128 i32.const 2 call $~lib/builtins/abort @@ -3260,14 +4969,14 @@ i32.add i32.const 100 i32.const 1 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe + call $~lib/string/String.UTF8.decodeUnsafe local.tee $10 - i32.const 192 + i32.const 456 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 129 i32.const 2 call $~lib/builtins/abort @@ -3278,65 +4987,333 @@ i32.add i32.const 100 i32.const 1 - call $~lib/encoding/Encoding.UTF8.decodeUnsafe + call $~lib/string/String.UTF8.decodeUnsafe local.tee $11 - i32.const 104 + i32.const 368 call $~lib/string/String.__eq i32.eqz if i32.const 0 - i32.const 56 + i32.const 304 i32.const 130 i32.const 2 call $~lib/builtins/abort unreachable end local.get $3 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $4 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $5 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $6 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $7 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $8 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $9 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $10 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $11 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release local.get $0 - call $~lib/rt/stub/__release + call $~lib/rt/pure/__release ) - (func $start:std/encoding (; 29 ;) (type $FUNCSIG$v) - call $std/encoding/testUTF16Length - global.get $~lib/heap/__heap_base - i32.const 15 - i32.add - i32.const 15 + (func $start:std/string-encoding (; 50 ;) (type $FUNCSIG$v) + call $std/string-encoding/testUTF16Length + call $std/string-encoding/testUTF16Encode + call $std/string-encoding/testUTF16Decode + call $std/string-encoding/testUTF16DecodeUnsafe + call $std/string-encoding/testUTF8Length + call $std/string-encoding/testUTF8Encode + call $std/string-encoding/testUTF8EncodeNullTerminated + call $std/string-encoding/testUTF8Decode + call $std/string-encoding/testUTF8DecodeNullTerminated + call $std/string-encoding/testUTF8DecodeUnsafe + ) + (func $start (; 51 ;) (type $FUNCSIG$v) + call $start:std/string-encoding + ) + (func $~lib/rt/pure/markGray (; 52 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 1879048192 + i32.and + i32.const 268435456 + i32.ne + if + local.get $0 + local.get $1 + i32.const 1879048192 + i32.const -1 + i32.xor + i32.and + i32.const 268435456 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 2 + call $~lib/rt/__visit_members + end + ) + (func $~lib/rt/pure/scanBlack (; 53 ;) (type $FUNCSIG$vi) (param $0 i32) + local.get $0 + local.get $0 + i32.load offset=4 + i32.const 1879048192 i32.const -1 i32.xor i32.and - global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset - global.set $~lib/rt/stub/offset - call $std/encoding/testUTF16Encode - call $std/encoding/testUTF16Decode - call $std/encoding/testUTF16DecodeUnsafe - call $std/encoding/testUTF8Length - call $std/encoding/testUTF8Encode - call $std/encoding/testUTF8EncodeNullTerminated - call $std/encoding/testUTF8Decode - call $std/encoding/testUTF8DecodeNullTerminated - call $std/encoding/testUTF8DecodeUnsafe + i32.const 0 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 4 + call $~lib/rt/__visit_members + ) + (func $~lib/rt/pure/scan (; 54 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 1879048192 + i32.and + i32.const 268435456 + i32.eq + if + local.get $1 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + if + local.get $0 + call $~lib/rt/pure/scanBlack + else + local.get $0 + local.get $1 + i32.const 1879048192 + i32.const -1 + i32.xor + i32.and + i32.const 536870912 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 3 + call $~lib/rt/__visit_members + end + end + ) + (func $~lib/rt/pure/collectWhite (; 55 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 1879048192 + i32.and + i32.const 536870912 + i32.eq + if (result i32) + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + else + i32.const 0 + end + if + local.get $0 + local.get $1 + i32.const 1879048192 + i32.const -1 + i32.xor + i32.and + i32.const 0 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 5 + call $~lib/rt/__visit_members + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + end + ) + (func $~lib/rt/pure/__visit (; 56 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.lt_u + if + return + end + local.get $0 + i32.const 16 + i32.sub + local.set $2 + block $break|0 + block $case5|0 + block $case4|0 + block $case3|0 + block $case2|0 + block $case1|0 + block $case0|0 + local.get $1 + local.set $3 + local.get $3 + i32.const 1 + i32.eq + br_if $case0|0 + local.get $3 + i32.const 2 + i32.eq + br_if $case1|0 + local.get $3 + i32.const 3 + i32.eq + br_if $case2|0 + local.get $3 + i32.const 4 + i32.eq + br_if $case3|0 + local.get $3 + i32.const 5 + i32.eq + br_if $case4|0 + br $case5|0 + end + local.get $2 + call $~lib/rt/pure/decrement + br $break|0 + end + local.get $2 + i32.load offset=4 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 75 + i32.const 17 + call $~lib/builtins/abort + unreachable + end + local.get $2 + local.get $2 + i32.load offset=4 + i32.const 1 + i32.sub + i32.store offset=4 + local.get $2 + call $~lib/rt/pure/markGray + br $break|0 + end + local.get $2 + call $~lib/rt/pure/scan + br $break|0 + end + local.get $2 + i32.load offset=4 + local.set $3 + local.get $3 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $3 + i32.const 1 + i32.add + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 86 + i32.const 6 + call $~lib/builtins/abort + unreachable + end + local.get $2 + local.get $3 + i32.const 1 + i32.add + i32.store offset=4 + local.get $3 + i32.const 1879048192 + i32.and + i32.const 0 + i32.ne + if + local.get $2 + call $~lib/rt/pure/scanBlack + end + br $break|0 + end + local.get $2 + call $~lib/rt/pure/collectWhite + br $break|0 + end + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 97 + i32.const 24 + call $~lib/builtins/abort + unreachable + end + end ) - (func $start (; 30 ;) (type $FUNCSIG$v) - call $start:std/encoding + (func $~lib/rt/__visit_members (; 57 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + block $switch$1$default + block $switch$1$case$4 + block $switch$1$case$2 + local.get $0 + i32.const 8 + i32.sub + i32.load + br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default + end + return + end + local.get $0 + i32.load + local.tee $2 + if + local.get $2 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + unreachable ) - (func $null (; 31 ;) (type $FUNCSIG$v) + (func $null (; 58 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/compiler/std/string-utf8.json b/tests/compiler/std/string-utf8.json deleted file mode 100644 index b1da366ff4..0000000000 --- a/tests/compiler/std/string-utf8.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "asc_flags": [ - "--runtime none" - ] -} \ No newline at end of file diff --git a/tests/compiler/std/string-utf8.optimized.wat b/tests/compiler/std/string-utf8.optimized.wat deleted file mode 100644 index 9d3859ea99..0000000000 --- a/tests/compiler/std/string-utf8.optimized.wat +++ /dev/null @@ -1,1144 +0,0 @@ -(module - (type $FUNCSIG$ii (func (param i32) (result i32))) - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) - (type $FUNCSIG$viii (func (param i32 i32 i32))) - (type $FUNCSIG$v (func)) - (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 8) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00\01\d87\dch\00i\00R\d8b\df") - (data (i32.const 40) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00-\00u\00t\00f\008\00.\00t\00s") - (data (i32.const 100) "\01\00\00\00\01") - (data (i32.const 112) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") - (data (i32.const 160) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00\01\d87\dc") - (data (i32.const 184) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00h\00i") - (data (i32.const 208) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00R\d8b\df") - (data (i32.const 232) "\02\00\00\00\01\00\00\00\01\00\00\00\02") - (global $std/string-utf8/str i32 (i32.const 24)) - (global $std/string-utf8/len (mut i32) (i32.const 0)) - (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) - (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $std/string-utf8/ptr (mut i32) (i32.const 0)) - (export "memory" (memory $0)) - (start $start) - (func $~lib/string/String#get:length (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=12 - i32.const 1 - i32.shr_u - ) - (func $~lib/string/String#get:lengthUTF8 (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - i32.const 1 - local.set $1 - local.get $0 - call $~lib/string/String#get:length - local.set $3 - loop $continue|0 - local.get $2 - local.get $3 - i32.ge_u - i32.eqz - if - local.get $2 - i32.const 1 - i32.shl - local.get $0 - i32.add - i32.load16_u - local.tee $4 - i32.const 128 - i32.lt_u - if (result i32) - local.get $1 - i32.const 1 - i32.add - local.set $1 - local.get $2 - i32.const 1 - i32.add - else - local.get $4 - i32.const 2048 - i32.lt_u - if (result i32) - local.get $1 - i32.const 2 - i32.add - local.set $1 - local.get $2 - i32.const 1 - i32.add - else - local.get $2 - i32.const 1 - i32.add - local.get $3 - i32.lt_u - i32.const 0 - local.get $4 - i32.const 64512 - i32.and - i32.const 55296 - i32.eq - select - if (result i32) - local.get $2 - i32.const 1 - i32.add - i32.const 1 - i32.shl - local.get $0 - i32.add - i32.load16_u - i32.const 64512 - i32.and - i32.const 56320 - i32.eq - else - i32.const 0 - end - if (result i32) - local.get $1 - i32.const 4 - i32.add - local.set $1 - local.get $2 - i32.const 2 - i32.add - else - local.get $1 - i32.const 3 - i32.add - local.set $1 - local.get $2 - i32.const 1 - i32.add - end - end - end - local.set $2 - br $continue|0 - end - end - local.get $1 - ) - (func $~lib/rt/stub/__alloc (; 3 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $0 - i32.const 1073741808 - i32.gt_u - if - unreachable - end - global.get $~lib/rt/stub/offset - i32.const 16 - i32.add - local.tee $3 - local.get $0 - i32.const 1 - local.get $0 - i32.const 1 - i32.gt_u - select - i32.add - i32.const 15 - i32.add - i32.const -16 - i32.and - local.tee $2 - memory.size - local.tee $4 - i32.const 16 - i32.shl - i32.gt_u - if - local.get $4 - local.get $2 - local.get $3 - i32.sub - i32.const 65535 - i32.add - i32.const -65536 - i32.and - i32.const 16 - i32.shr_u - local.tee $5 - local.get $4 - local.get $5 - i32.gt_s - select - memory.grow - i32.const 0 - i32.lt_s - if - local.get $5 - memory.grow - i32.const 0 - i32.lt_s - if - unreachable - end - end - end - local.get $2 - global.set $~lib/rt/stub/offset - local.get $3 - i32.const 16 - i32.sub - local.tee $2 - local.get $1 - i32.store offset=8 - local.get $2 - local.get $0 - i32.store offset=12 - local.get $3 - ) - (func $~lib/string/String#toUTF8 (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - local.get $0 - call $~lib/string/String#get:lengthUTF8 - i32.const 0 - call $~lib/rt/stub/__alloc - local.set $5 - local.get $0 - call $~lib/string/String#get:length - local.set $6 - loop $continue|0 - local.get $3 - local.get $6 - i32.lt_u - if - local.get $3 - i32.const 1 - i32.shl - local.get $0 - i32.add - i32.load16_u - local.tee $1 - i32.const 128 - i32.lt_u - if - local.get $2 - local.get $5 - i32.add - local.get $1 - i32.store8 - local.get $2 - i32.const 1 - i32.add - local.set $2 - else - local.get $1 - i32.const 2048 - i32.lt_u - if - local.get $2 - local.get $5 - i32.add - local.tee $4 - local.get $1 - i32.const 6 - i32.shr_u - i32.const 192 - i32.or - i32.store8 - local.get $4 - local.get $1 - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=1 - local.get $2 - i32.const 2 - i32.add - local.set $2 - else - local.get $2 - local.get $5 - i32.add - local.set $4 - local.get $3 - i32.const 1 - i32.add - local.get $6 - i32.lt_u - i32.const 0 - local.get $1 - i32.const 64512 - i32.and - i32.const 55296 - i32.eq - select - if - local.get $3 - i32.const 1 - i32.add - i32.const 1 - i32.shl - local.get $0 - i32.add - i32.load16_u - local.tee $7 - i32.const 64512 - i32.and - i32.const 56320 - i32.eq - if - local.get $4 - local.get $1 - i32.const 1023 - i32.and - i32.const 10 - i32.shl - i32.const 65536 - i32.add - local.get $7 - i32.const 1023 - i32.and - i32.add - local.tee $1 - i32.const 18 - i32.shr_u - i32.const 240 - i32.or - i32.store8 - local.get $4 - local.get $1 - i32.const 12 - i32.shr_u - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=1 - local.get $4 - local.get $1 - i32.const 6 - i32.shr_u - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=2 - local.get $4 - local.get $1 - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=3 - local.get $2 - i32.const 4 - i32.add - local.set $2 - local.get $3 - i32.const 2 - i32.add - local.set $3 - br $continue|0 - end - end - local.get $4 - local.get $1 - i32.const 12 - i32.shr_u - i32.const 224 - i32.or - i32.store8 - local.get $4 - local.get $1 - i32.const 6 - i32.shr_u - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=1 - local.get $4 - local.get $1 - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=2 - local.get $2 - i32.const 3 - i32.add - local.set $2 - end - end - local.get $3 - i32.const 1 - i32.add - local.set $3 - br $continue|0 - end - end - local.get $2 - local.get $5 - i32.add - i32.const 0 - i32.store8 - local.get $5 - ) - (func $~lib/memory/memory.copy (; 5 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - block $~lib/util/memory/memmove|inlined.0 - local.get $2 - local.set $3 - local.get $0 - local.get $1 - i32.eq - br_if $~lib/util/memory/memmove|inlined.0 - local.get $0 - local.get $1 - i32.lt_u - if - local.get $1 - i32.const 7 - i32.and - local.get $0 - i32.const 7 - i32.and - i32.eq - if - loop $continue|0 - local.get $0 - i32.const 7 - i32.and - if - local.get $3 - i32.eqz - br_if $~lib/util/memory/memmove|inlined.0 - local.get $3 - i32.const 1 - i32.sub - local.set $3 - local.get $0 - local.tee $2 - i32.const 1 - i32.add - local.set $0 - local.get $1 - local.tee $4 - i32.const 1 - i32.add - local.set $1 - local.get $2 - local.get $4 - i32.load8_u - i32.store8 - br $continue|0 - end - end - loop $continue|1 - local.get $3 - i32.const 8 - i32.lt_u - i32.eqz - if - local.get $0 - local.get $1 - i64.load - i64.store - local.get $3 - i32.const 8 - i32.sub - local.set $3 - local.get $0 - i32.const 8 - i32.add - local.set $0 - local.get $1 - i32.const 8 - i32.add - local.set $1 - br $continue|1 - end - end - end - loop $continue|2 - local.get $3 - if - local.get $0 - local.tee $2 - i32.const 1 - i32.add - local.set $0 - local.get $1 - local.tee $4 - i32.const 1 - i32.add - local.set $1 - local.get $2 - local.get $4 - i32.load8_u - i32.store8 - local.get $3 - i32.const 1 - i32.sub - local.set $3 - br $continue|2 - end - end - else - local.get $1 - i32.const 7 - i32.and - local.get $0 - i32.const 7 - i32.and - i32.eq - if - loop $continue|3 - local.get $0 - local.get $3 - i32.add - i32.const 7 - i32.and - if - local.get $3 - i32.eqz - br_if $~lib/util/memory/memmove|inlined.0 - local.get $0 - local.get $3 - i32.const 1 - i32.sub - local.tee $3 - i32.add - local.get $1 - local.get $3 - i32.add - i32.load8_u - i32.store8 - br $continue|3 - end - end - loop $continue|4 - local.get $3 - i32.const 8 - i32.lt_u - i32.eqz - if - local.get $0 - local.get $3 - i32.const 8 - i32.sub - local.tee $3 - i32.add - local.get $1 - local.get $3 - i32.add - i64.load - i64.store - br $continue|4 - end - end - end - loop $continue|5 - local.get $3 - if - local.get $0 - local.get $3 - i32.const 1 - i32.sub - local.tee $3 - i32.add - local.get $1 - local.get $3 - i32.add - i32.load8_u - i32.store8 - br $continue|5 - end - end - end - end - ) - (func $~lib/string/String.fromUTF8 (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - local.get $1 - i32.const 1 - i32.lt_u - if - i32.const 112 - return - end - local.get $1 - i32.const 1 - i32.shl - i32.const 0 - call $~lib/rt/stub/__alloc - local.set $6 - loop $continue|0 - local.get $2 - local.get $1 - i32.lt_u - if - local.get $2 - local.tee $4 - i32.const 1 - i32.add - local.set $2 - local.get $0 - local.get $4 - i32.add - i32.load8_u - local.tee $3 - i32.const 128 - i32.lt_u - if - local.get $5 - local.get $6 - i32.add - local.get $3 - i32.store16 - else - local.get $3 - i32.const 224 - i32.lt_u - i32.const 0 - local.get $3 - i32.const 191 - i32.gt_u - select - if - local.get $2 - i32.const 1 - i32.add - local.get $1 - i32.gt_u - if - i32.const 0 - i32.const 128 - i32.const 551 - i32.const 8 - call $~lib/builtins/abort - unreachable - end - local.get $2 - local.tee $4 - i32.const 1 - i32.add - local.set $2 - local.get $5 - local.get $6 - i32.add - local.get $0 - local.get $4 - i32.add - i32.load8_u - i32.const 63 - i32.and - local.get $3 - i32.const 31 - i32.and - i32.const 6 - i32.shl - i32.or - i32.store16 - else - local.get $3 - i32.const 365 - i32.lt_u - i32.const 0 - local.get $3 - i32.const 239 - i32.gt_u - select - if - local.get $2 - i32.const 3 - i32.add - local.get $1 - i32.gt_u - if - i32.const 0 - i32.const 128 - i32.const 555 - i32.const 8 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 7 - i32.and - i32.const 18 - i32.shl - local.get $0 - local.get $2 - i32.add - i32.load8_u - i32.const 63 - i32.and - i32.const 12 - i32.shl - i32.or - local.get $2 - i32.const 1 - i32.add - local.tee $2 - local.get $0 - i32.add - i32.load8_u - i32.const 63 - i32.and - i32.const 6 - i32.shl - i32.or - local.set $4 - local.get $2 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $2 - local.get $5 - local.get $6 - i32.add - local.get $0 - local.get $3 - i32.add - i32.load8_u - i32.const 63 - i32.and - local.get $4 - i32.or - i32.const 65536 - i32.sub - local.tee $4 - i32.const 10 - i32.shr_u - i32.const 55296 - i32.add - i32.store16 - local.get $6 - local.get $5 - i32.const 2 - i32.add - local.tee $5 - i32.add - local.get $4 - i32.const 1023 - i32.and - i32.const 56320 - i32.add - i32.store16 - else - local.get $2 - i32.const 2 - i32.add - local.get $1 - i32.gt_u - if - i32.const 0 - i32.const 128 - i32.const 567 - i32.const 8 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 15 - i32.and - i32.const 12 - i32.shl - local.get $0 - local.get $2 - i32.add - i32.load8_u - i32.const 63 - i32.and - i32.const 6 - i32.shl - i32.or - local.set $4 - local.get $2 - i32.const 1 - i32.add - local.tee $3 - i32.const 1 - i32.add - local.set $2 - local.get $5 - local.get $6 - i32.add - local.get $0 - local.get $3 - i32.add - i32.load8_u - i32.const 63 - i32.and - local.get $4 - i32.or - i32.store16 - end - end - end - local.get $5 - i32.const 2 - i32.add - local.set $5 - br $continue|0 - end - end - local.get $1 - local.get $2 - i32.ne - if - i32.const 0 - i32.const 128 - i32.const 576 - i32.const 4 - call $~lib/builtins/abort - unreachable - end - local.get $5 - i32.const 1 - call $~lib/rt/stub/__alloc - local.tee $0 - local.get $6 - local.get $5 - call $~lib/memory/memory.copy - local.get $0 - ) - (func $~lib/util/string/compareImpl (; 7 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - loop $continue|0 - local.get $2 - if (result i32) - local.get $0 - i32.load16_u - local.get $1 - i32.load16_u - i32.sub - local.tee $3 - i32.eqz - else - i32.const 0 - end - if - local.get $2 - i32.const 1 - i32.sub - local.set $2 - local.get $0 - i32.const 2 - i32.add - local.set $0 - local.get $1 - i32.const 2 - i32.add - local.set $1 - br $continue|0 - end - end - local.get $3 - ) - (func $~lib/string/String.__eq (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - local.get $0 - local.get $1 - i32.eq - if - i32.const 1 - return - end - block $folding-inner0 - local.get $1 - i32.eqz - i32.const 1 - local.get $0 - select - br_if $folding-inner0 - local.get $0 - call $~lib/string/String#get:length - local.tee $2 - local.get $1 - call $~lib/string/String#get:length - i32.ne - br_if $folding-inner0 - local.get $0 - local.get $1 - local.get $2 - call $~lib/util/string/compareImpl - i32.eqz - return - end - i32.const 0 - ) - (func $start:std/string-utf8 (; 9 ;) (type $FUNCSIG$v) - global.get $std/string-utf8/str - call $~lib/string/String#get:lengthUTF8 - global.set $std/string-utf8/len - global.get $std/string-utf8/len - i32.const 11 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 7 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 256 - global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset - global.set $~lib/rt/stub/offset - global.get $std/string-utf8/str - call $~lib/string/String#toUTF8 - global.set $std/string-utf8/ptr - global.get $std/string-utf8/ptr - i32.load8_u - i32.const 240 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 11 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=1 - i32.const 144 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 12 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=2 - i32.const 144 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 13 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=3 - i32.const 183 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 14 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=4 - i32.const 104 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 15 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=5 - i32.const 105 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 16 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=6 - i32.const 240 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 17 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=7 - i32.const 164 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 18 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=8 - i32.const 173 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 19 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=9 - i32.const 162 - i32.ne - if - i32.const 0 - i32.const 56 - i32.const 20 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=10 - if - i32.const 0 - i32.const 56 - i32.const 21 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.const 0 - call $~lib/string/String.fromUTF8 - i32.const 112 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 23 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - global.get $std/string-utf8/len - i32.const 1 - i32.sub - call $~lib/string/String.fromUTF8 - global.get $std/string-utf8/str - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 24 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.const 4 - call $~lib/string/String.fromUTF8 - i32.const 176 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 25 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.const 4 - i32.add - i32.const 2 - call $~lib/string/String.fromUTF8 - i32.const 200 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 26 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.const 6 - i32.add - i32.const 4 - call $~lib/string/String.fromUTF8 - i32.const 224 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 27 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.const 10 - i32.add - i32.const 1 - call $~lib/string/String.fromUTF8 - i32.const 248 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 28 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - ) - (func $start (; 10 ;) (type $FUNCSIG$v) - call $start:std/string-utf8 - ) - (func $null (; 11 ;) (type $FUNCSIG$v) - nop - ) -) diff --git a/tests/compiler/std/string-utf8.ts b/tests/compiler/std/string-utf8.ts deleted file mode 100644 index cdaf7c90ee..0000000000 --- a/tests/compiler/std/string-utf8.ts +++ /dev/null @@ -1,30 +0,0 @@ -/// - -var str = "𐐷hi𤭢"; // -> f0 90 90 b7 68 69 f0 a4 ad a2 00 - -var len = str.lengthUTF8; - -assert(len == 11); - -var ptr = str.toUTF8(); // toUTF8 is zero-terminated - -assert(load(ptr, 0) == 0xf0); -assert(load(ptr, 1) == 0x90); -assert(load(ptr, 2) == 0x90); -assert(load(ptr, 3) == 0xb7); -assert(load(ptr, 4) == 0x68); -assert(load(ptr, 5) == 0x69); -assert(load(ptr, 6) == 0xf0); -assert(load(ptr, 7) == 0xa4); -assert(load(ptr, 8) == 0xad); -assert(load(ptr, 9) == 0xa2); -assert(load(ptr, 10) == 0); - -assert(String.fromUTF8(ptr, 0) == ""); // fromUTF8 is not zero-terminated -assert(String.fromUTF8(ptr, len - 1) == str); -assert(String.fromUTF8(ptr, 4) == "𐐷"); -assert(String.fromUTF8(ptr + 4, 2) == "hi"); -assert(String.fromUTF8(ptr + 6, 4) == "𤭢"); -assert(String.fromUTF8(ptr + 10, 1) == "\0"); - -__free(ptr); diff --git a/tests/compiler/std/string-utf8.untouched.wat b/tests/compiler/std/string-utf8.untouched.wat deleted file mode 100644 index a9f2900b77..0000000000 --- a/tests/compiler/std/string-utf8.untouched.wat +++ /dev/null @@ -1,2443 +0,0 @@ -(module - (type $FUNCSIG$ii (func (param i32) (result i32))) - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) - (type $FUNCSIG$viii (func (param i32 i32 i32))) - (type $FUNCSIG$vi (func (param i32))) - (type $FUNCSIG$iiiiii (func (param i32 i32 i32 i32 i32) (result i32))) - (type $FUNCSIG$v (func)) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 8) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00\01\d87\dch\00i\00R\d8b\df") - (data (i32.const 40) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00-\00u\00t\00f\008\00.\00t\00s\00") - (data (i32.const 96) "\00\00\00\00\01\00\00\00\01\00\00\00\00\00\00\00") - (data (i32.const 112) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 160) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00\01\d87\dc") - (data (i32.const 184) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00h\00i\00") - (data (i32.const 208) "\04\00\00\00\01\00\00\00\01\00\00\00\04\00\00\00R\d8b\df") - (data (i32.const 232) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00\00\00") - (table $0 1 funcref) - (elem (i32.const 0) $null) - (global $std/string-utf8/str (mut i32) (i32.const 24)) - (global $std/string-utf8/len (mut i32) (i32.const 0)) - (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) - (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $std/string-utf8/ptr (mut i32) (i32.const 0)) - (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/heap/__heap_base i32 (i32.const 252)) - (export "memory" (memory $0)) - (start $start) - (func $~lib/string/String#get:length (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=12 - i32.const 1 - i32.shr_u - ) - (func $~lib/string/String#get:lengthUTF8 (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - i32.const 1 - local.set $1 - i32.const 0 - local.set $2 - local.get $0 - call $~lib/string/String#get:length - local.set $3 - block $break|0 - loop $continue|0 - local.get $2 - local.get $3 - i32.lt_u - i32.eqz - br_if $break|0 - local.get $0 - local.get $2 - i32.const 1 - i32.shl - i32.add - i32.load16_u - local.set $4 - local.get $4 - i32.const 128 - i32.lt_u - if - local.get $1 - i32.const 1 - i32.add - local.set $1 - local.get $2 - i32.const 1 - i32.add - local.set $2 - else - local.get $4 - i32.const 2048 - i32.lt_u - if - local.get $1 - i32.const 2 - i32.add - local.set $1 - local.get $2 - i32.const 1 - i32.add - local.set $2 - else - local.get $4 - i32.const 64512 - i32.and - i32.const 55296 - i32.eq - if (result i32) - local.get $2 - i32.const 1 - i32.add - local.get $3 - i32.lt_u - else - i32.const 0 - end - if (result i32) - local.get $0 - local.get $2 - i32.const 1 - i32.add - i32.const 1 - i32.shl - i32.add - i32.load16_u - i32.const 64512 - i32.and - i32.const 56320 - i32.eq - else - i32.const 0 - end - if - local.get $1 - i32.const 4 - i32.add - local.set $1 - local.get $2 - i32.const 2 - i32.add - local.set $2 - else - local.get $1 - i32.const 3 - i32.add - local.set $1 - local.get $2 - i32.const 1 - i32.add - local.set $2 - end - end - end - br $continue|0 - end - unreachable - end - local.get $1 - ) - (func $~lib/rt/stub/__alloc (; 3 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - local.get $0 - i32.const 1073741808 - i32.gt_u - if - unreachable - end - global.get $~lib/rt/stub/offset - i32.const 16 - i32.add - local.set $2 - local.get $2 - local.get $0 - local.tee $3 - i32.const 1 - local.tee $4 - local.get $3 - local.get $4 - i32.gt_u - select - i32.add - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $5 - memory.size - local.set $6 - local.get $5 - local.get $6 - i32.const 16 - i32.shl - i32.gt_u - if - local.get $5 - local.get $2 - i32.sub - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $3 - local.get $6 - local.tee $4 - local.get $3 - local.tee $7 - local.get $4 - local.get $7 - i32.gt_s - select - local.set $4 - local.get $4 - memory.grow - i32.const 0 - i32.lt_s - if - local.get $3 - memory.grow - i32.const 0 - i32.lt_s - if - unreachable - end - end - end - local.get $5 - global.set $~lib/rt/stub/offset - local.get $2 - i32.const 16 - i32.sub - local.set $8 - local.get $8 - local.get $1 - i32.store offset=8 - local.get $8 - local.get $0 - i32.store offset=12 - local.get $2 - ) - (func $~lib/string/String#toUTF8 (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - local.get $0 - call $~lib/string/String#get:lengthUTF8 - i32.const 0 - call $~lib/rt/stub/__alloc - local.set $1 - i32.const 0 - local.set $2 - local.get $0 - call $~lib/string/String#get:length - local.set $3 - i32.const 0 - local.set $4 - block $break|0 - loop $continue|0 - local.get $2 - local.get $3 - i32.lt_u - i32.eqz - br_if $break|0 - local.get $0 - local.get $2 - i32.const 1 - i32.shl - i32.add - i32.load16_u - local.set $5 - local.get $5 - i32.const 128 - i32.lt_u - if - local.get $1 - local.get $4 - i32.add - local.get $5 - i32.store8 - local.get $4 - i32.const 1 - i32.add - local.set $4 - local.get $2 - i32.const 1 - i32.add - local.set $2 - else - local.get $5 - i32.const 2048 - i32.lt_u - if - local.get $1 - local.get $4 - i32.add - local.set $6 - local.get $6 - local.get $5 - i32.const 6 - i32.shr_u - i32.const 192 - i32.or - i32.store8 - local.get $6 - local.get $5 - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=1 - local.get $4 - i32.const 2 - i32.add - local.set $4 - local.get $2 - i32.const 1 - i32.add - local.set $2 - else - local.get $1 - local.get $4 - i32.add - local.set $6 - local.get $5 - i32.const 64512 - i32.and - i32.const 55296 - i32.eq - if (result i32) - local.get $2 - i32.const 1 - i32.add - local.get $3 - i32.lt_u - else - i32.const 0 - end - if - local.get $0 - local.get $2 - i32.const 1 - i32.add - i32.const 1 - i32.shl - i32.add - i32.load16_u - local.set $7 - local.get $7 - i32.const 64512 - i32.and - i32.const 56320 - i32.eq - if - i32.const 65536 - local.get $5 - i32.const 1023 - i32.and - i32.const 10 - i32.shl - i32.add - local.get $7 - i32.const 1023 - i32.and - i32.add - local.set $5 - local.get $6 - local.get $5 - i32.const 18 - i32.shr_u - i32.const 240 - i32.or - i32.store8 - local.get $6 - local.get $5 - i32.const 12 - i32.shr_u - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=1 - local.get $6 - local.get $5 - i32.const 6 - i32.shr_u - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=2 - local.get $6 - local.get $5 - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=3 - local.get $4 - i32.const 4 - i32.add - local.set $4 - local.get $2 - i32.const 2 - i32.add - local.set $2 - br $continue|0 - end - end - local.get $6 - local.get $5 - i32.const 12 - i32.shr_u - i32.const 224 - i32.or - i32.store8 - local.get $6 - local.get $5 - i32.const 6 - i32.shr_u - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=1 - local.get $6 - local.get $5 - i32.const 63 - i32.and - i32.const 128 - i32.or - i32.store8 offset=2 - local.get $4 - i32.const 3 - i32.add - local.set $4 - local.get $2 - i32.const 1 - i32.add - local.set $2 - end - end - br $continue|0 - end - unreachable - end - local.get $1 - local.get $4 - i32.add - i32.const 0 - i32.store8 - local.get $1 - ) - (func $~lib/rt/stub/__retain (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - ) - (func $~lib/util/memory/memcpy (; 6 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - block $break|0 - loop $continue|0 - local.get $2 - if (result i32) - local.get $1 - i32.const 3 - i32.and - else - i32.const 0 - end - i32.eqz - br_if $break|0 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - br $continue|0 - end - unreachable - end - local.get $0 - i32.const 3 - i32.and - i32.const 0 - i32.eq - if - block $break|1 - loop $continue|1 - local.get $2 - i32.const 16 - i32.ge_u - i32.eqz - br_if $break|1 - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 8 - i32.add - i32.load - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 12 - i32.add - i32.load - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|1 - end - unreachable - end - local.get $2 - i32.const 8 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $0 - i32.const 8 - i32.add - local.set $0 - local.get $1 - i32.const 8 - i32.add - local.set $1 - end - local.get $2 - i32.const 4 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.set $0 - local.get $1 - i32.const 4 - i32.add - local.set $1 - end - local.get $2 - i32.const 2 - i32.and - if - local.get $0 - local.get $1 - i32.load16_u - i32.store16 - local.get $0 - i32.const 2 - i32.add - local.set $0 - local.get $1 - i32.const 2 - i32.add - local.set $1 - end - local.get $2 - i32.const 1 - i32.and - if - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - end - return - end - local.get $2 - i32.const 32 - i32.ge_u - if - block $break|2 - block $case2|2 - block $case1|2 - block $case0|2 - local.get $0 - i32.const 3 - i32.and - local.set $5 - local.get $5 - i32.const 1 - i32.eq - br_if $case0|2 - local.get $5 - i32.const 2 - i32.eq - br_if $case1|2 - local.get $5 - i32.const 3 - i32.eq - br_if $case2|2 - br $break|2 - end - local.get $1 - i32.load - local.set $3 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $2 - i32.const 3 - i32.sub - local.set $2 - block $break|3 - loop $continue|3 - local.get $2 - i32.const 17 - i32.ge_u - i32.eqz - br_if $break|3 - local.get $1 - i32.const 1 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 24 - i32.shr_u - local.get $4 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 5 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 24 - i32.shr_u - local.get $3 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 9 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 24 - i32.shr_u - local.get $4 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 13 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 24 - i32.shr_u - local.get $3 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|3 - end - unreachable - end - br $break|2 - end - local.get $1 - i32.load - local.set $3 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $2 - i32.const 2 - i32.sub - local.set $2 - block $break|4 - loop $continue|4 - local.get $2 - i32.const 18 - i32.ge_u - i32.eqz - br_if $break|4 - local.get $1 - i32.const 2 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 16 - i32.shr_u - local.get $4 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 6 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 16 - i32.shr_u - local.get $3 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 10 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 16 - i32.shr_u - local.get $4 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 14 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 16 - i32.shr_u - local.get $3 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|4 - end - unreachable - end - br $break|2 - end - local.get $1 - i32.load - local.set $3 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - block $break|5 - loop $continue|5 - local.get $2 - i32.const 19 - i32.ge_u - i32.eqz - br_if $break|5 - local.get $1 - i32.const 3 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 8 - i32.shr_u - local.get $4 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 7 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 8 - i32.shr_u - local.get $3 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 11 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 8 - i32.shr_u - local.get $4 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 15 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 8 - i32.shr_u - local.get $3 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $continue|5 - end - unreachable - end - br $break|2 - end - end - local.get $2 - i32.const 16 - i32.and - if - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 8 - i32.and - if - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 4 - i32.and - if - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 2 - i32.and - if - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 1 - i32.and - if - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - end - ) - (func $~lib/memory/memory.copy (; 7 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - block $~lib/util/memory/memmove|inlined.0 - local.get $0 - local.set $5 - local.get $1 - local.set $4 - local.get $2 - local.set $3 - local.get $5 - local.get $4 - i32.eq - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $4 - local.get $3 - i32.add - local.get $5 - i32.le_u - if (result i32) - i32.const 1 - else - local.get $5 - local.get $3 - i32.add - local.get $4 - i32.le_u - end - if - local.get $5 - local.get $4 - local.get $3 - call $~lib/util/memory/memcpy - br $~lib/util/memory/memmove|inlined.0 - end - local.get $5 - local.get $4 - i32.lt_u - if - local.get $4 - i32.const 7 - i32.and - local.get $5 - i32.const 7 - i32.and - i32.eq - if - block $break|0 - loop $continue|0 - local.get $5 - i32.const 7 - i32.and - i32.eqz - br_if $break|0 - local.get $3 - i32.eqz - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $3 - i32.const 1 - i32.sub - local.set $3 - local.get $5 - local.tee $6 - i32.const 1 - i32.add - local.set $5 - local.get $6 - local.get $4 - local.tee $6 - i32.const 1 - i32.add - local.set $4 - local.get $6 - i32.load8_u - i32.store8 - br $continue|0 - end - unreachable - end - block $break|1 - loop $continue|1 - local.get $3 - i32.const 8 - i32.ge_u - i32.eqz - br_if $break|1 - local.get $5 - local.get $4 - i64.load - i64.store - local.get $3 - i32.const 8 - i32.sub - local.set $3 - local.get $5 - i32.const 8 - i32.add - local.set $5 - local.get $4 - i32.const 8 - i32.add - local.set $4 - br $continue|1 - end - unreachable - end - end - block $break|2 - loop $continue|2 - local.get $3 - i32.eqz - br_if $break|2 - local.get $5 - local.tee $6 - i32.const 1 - i32.add - local.set $5 - local.get $6 - local.get $4 - local.tee $6 - i32.const 1 - i32.add - local.set $4 - local.get $6 - i32.load8_u - i32.store8 - local.get $3 - i32.const 1 - i32.sub - local.set $3 - br $continue|2 - end - unreachable - end - else - local.get $4 - i32.const 7 - i32.and - local.get $5 - i32.const 7 - i32.and - i32.eq - if - block $break|3 - loop $continue|3 - local.get $5 - local.get $3 - i32.add - i32.const 7 - i32.and - i32.eqz - br_if $break|3 - local.get $3 - i32.eqz - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $5 - local.get $3 - i32.const 1 - i32.sub - local.tee $3 - i32.add - local.get $4 - local.get $3 - i32.add - i32.load8_u - i32.store8 - br $continue|3 - end - unreachable - end - block $break|4 - loop $continue|4 - local.get $3 - i32.const 8 - i32.ge_u - i32.eqz - br_if $break|4 - local.get $3 - i32.const 8 - i32.sub - local.set $3 - local.get $5 - local.get $3 - i32.add - local.get $4 - local.get $3 - i32.add - i64.load - i64.store - br $continue|4 - end - unreachable - end - end - block $break|5 - loop $continue|5 - local.get $3 - i32.eqz - br_if $break|5 - local.get $5 - local.get $3 - i32.const 1 - i32.sub - local.tee $3 - i32.add - local.get $4 - local.get $3 - i32.add - i32.load8_u - i32.store8 - br $continue|5 - end - unreachable - end - end - end - ) - (func $~lib/rt/stub/__free (; 8 ;) (type $FUNCSIG$vi) (param $0 i32) - nop - ) - (func $~lib/string/String.fromUTF8 (; 9 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - local.get $1 - i32.const 1 - i32.lt_u - if - i32.const 112 - call $~lib/rt/stub/__retain - return - end - i32.const 0 - local.set $2 - local.get $1 - i32.const 1 - i32.shl - i32.const 0 - call $~lib/rt/stub/__alloc - local.set $3 - i32.const 0 - local.set $4 - block $break|0 - loop $continue|0 - local.get $2 - local.get $1 - i32.lt_u - i32.eqz - br_if $break|0 - local.get $0 - local.get $2 - local.tee $5 - i32.const 1 - i32.add - local.set $2 - local.get $5 - i32.add - i32.load8_u - local.set $5 - local.get $5 - i32.const 128 - i32.lt_u - if - local.get $3 - local.get $4 - i32.add - local.get $5 - i32.store16 - local.get $4 - i32.const 2 - i32.add - local.set $4 - else - local.get $5 - i32.const 191 - i32.gt_u - if (result i32) - local.get $5 - i32.const 224 - i32.lt_u - else - i32.const 0 - end - if - local.get $2 - i32.const 1 - i32.add - local.get $1 - i32.le_u - i32.eqz - if - i32.const 0 - i32.const 128 - i32.const 551 - i32.const 8 - call $~lib/builtins/abort - unreachable - end - local.get $3 - local.get $4 - i32.add - local.get $5 - i32.const 31 - i32.and - i32.const 6 - i32.shl - local.get $0 - local.get $2 - local.tee $6 - i32.const 1 - i32.add - local.set $2 - local.get $6 - i32.add - i32.load8_u - i32.const 63 - i32.and - i32.or - i32.store16 - local.get $4 - i32.const 2 - i32.add - local.set $4 - else - local.get $5 - i32.const 239 - i32.gt_u - if (result i32) - local.get $5 - i32.const 365 - i32.lt_u - else - i32.const 0 - end - if - local.get $2 - i32.const 3 - i32.add - local.get $1 - i32.le_u - i32.eqz - if - i32.const 0 - i32.const 128 - i32.const 555 - i32.const 8 - call $~lib/builtins/abort - unreachable - end - local.get $5 - i32.const 7 - i32.and - i32.const 18 - i32.shl - local.get $0 - local.get $2 - local.tee $6 - i32.const 1 - i32.add - local.set $2 - local.get $6 - i32.add - i32.load8_u - i32.const 63 - i32.and - i32.const 12 - i32.shl - i32.or - local.get $0 - local.get $2 - local.tee $6 - i32.const 1 - i32.add - local.set $2 - local.get $6 - i32.add - i32.load8_u - i32.const 63 - i32.and - i32.const 6 - i32.shl - i32.or - local.get $0 - local.get $2 - local.tee $6 - i32.const 1 - i32.add - local.set $2 - local.get $6 - i32.add - i32.load8_u - i32.const 63 - i32.and - i32.or - i32.const 65536 - i32.sub - local.set $5 - local.get $3 - local.get $4 - i32.add - i32.const 55296 - local.get $5 - i32.const 10 - i32.shr_u - i32.add - i32.store16 - local.get $4 - i32.const 2 - i32.add - local.set $4 - local.get $3 - local.get $4 - i32.add - i32.const 56320 - local.get $5 - i32.const 1023 - i32.and - i32.add - i32.store16 - local.get $4 - i32.const 2 - i32.add - local.set $4 - else - local.get $2 - i32.const 2 - i32.add - local.get $1 - i32.le_u - i32.eqz - if - i32.const 0 - i32.const 128 - i32.const 567 - i32.const 8 - call $~lib/builtins/abort - unreachable - end - local.get $3 - local.get $4 - i32.add - local.get $5 - i32.const 15 - i32.and - i32.const 12 - i32.shl - local.get $0 - local.get $2 - local.tee $6 - i32.const 1 - i32.add - local.set $2 - local.get $6 - i32.add - i32.load8_u - i32.const 63 - i32.and - i32.const 6 - i32.shl - i32.or - local.get $0 - local.get $2 - local.tee $6 - i32.const 1 - i32.add - local.set $2 - local.get $6 - i32.add - i32.load8_u - i32.const 63 - i32.and - i32.or - i32.store16 - local.get $4 - i32.const 2 - i32.add - local.set $4 - end - end - end - br $continue|0 - end - unreachable - end - local.get $2 - local.get $1 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 128 - i32.const 576 - i32.const 4 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 1 - call $~lib/rt/stub/__alloc - local.set $7 - local.get $7 - local.get $3 - local.get $4 - call $~lib/memory/memory.copy - local.get $3 - call $~lib/rt/stub/__free - local.get $7 - call $~lib/rt/stub/__retain - ) - (func $~lib/rt/stub/__release (; 10 ;) (type $FUNCSIG$vi) (param $0 i32) - nop - ) - (func $~lib/util/string/compareImpl (; 11 ;) (type $FUNCSIG$iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - local.get $0 - call $~lib/rt/stub/__retain - drop - local.get $2 - call $~lib/rt/stub/__retain - drop - i32.const 0 - local.set $5 - local.get $0 - local.get $1 - i32.const 1 - i32.shl - i32.add - local.set $6 - local.get $2 - local.get $3 - i32.const 1 - i32.shl - i32.add - local.set $7 - block $break|0 - loop $continue|0 - local.get $4 - if (result i32) - local.get $6 - i32.load16_u - local.get $7 - i32.load16_u - i32.sub - local.tee $5 - i32.eqz - else - i32.const 0 - end - i32.eqz - br_if $break|0 - local.get $4 - i32.const 1 - i32.sub - local.set $4 - local.get $6 - i32.const 2 - i32.add - local.set $6 - local.get $7 - i32.const 2 - i32.add - local.set $7 - br $continue|0 - end - unreachable - end - local.get $5 - local.set $8 - local.get $0 - call $~lib/rt/stub/__release - local.get $2 - call $~lib/rt/stub/__release - local.get $8 - ) - (func $~lib/string/String.__eq (; 12 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - local.get $0 - call $~lib/rt/stub/__retain - drop - local.get $1 - call $~lib/rt/stub/__retain - drop - local.get $0 - local.get $1 - i32.eq - if - i32.const 1 - local.set $2 - local.get $0 - call $~lib/rt/stub/__release - local.get $1 - call $~lib/rt/stub/__release - local.get $2 - return - end - local.get $0 - i32.const 0 - i32.eq - if (result i32) - i32.const 1 - else - local.get $1 - i32.const 0 - i32.eq - end - if - i32.const 0 - local.set $2 - local.get $0 - call $~lib/rt/stub/__release - local.get $1 - call $~lib/rt/stub/__release - local.get $2 - return - end - local.get $0 - call $~lib/string/String#get:length - local.set $3 - local.get $3 - local.get $1 - call $~lib/string/String#get:length - i32.ne - if - i32.const 0 - local.set $2 - local.get $0 - call $~lib/rt/stub/__release - local.get $1 - call $~lib/rt/stub/__release - local.get $2 - return - end - local.get $0 - i32.const 0 - local.get $1 - i32.const 0 - local.get $3 - call $~lib/util/string/compareImpl - i32.eqz - local.set $2 - local.get $0 - call $~lib/rt/stub/__release - local.get $1 - call $~lib/rt/stub/__release - local.get $2 - ) - (func $start:std/string-utf8 (; 13 ;) (type $FUNCSIG$v) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - global.get $std/string-utf8/str - call $~lib/string/String#get:lengthUTF8 - global.set $std/string-utf8/len - global.get $std/string-utf8/len - i32.const 11 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 7 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $~lib/heap/__heap_base - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset - global.set $~lib/rt/stub/offset - global.get $std/string-utf8/str - call $~lib/string/String#toUTF8 - global.set $std/string-utf8/ptr - global.get $std/string-utf8/ptr - i32.load8_u - i32.const 240 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 11 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=1 - i32.const 144 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 12 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=2 - i32.const 144 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 13 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=3 - i32.const 183 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 14 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=4 - i32.const 104 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 15 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=5 - i32.const 105 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 16 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=6 - i32.const 240 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 17 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=7 - i32.const 164 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 18 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=8 - i32.const 173 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 19 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=9 - i32.const 162 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 20 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.load8_u offset=10 - i32.const 0 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 21 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.const 0 - call $~lib/string/String.fromUTF8 - local.tee $0 - i32.const 112 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 23 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - global.get $std/string-utf8/len - i32.const 1 - i32.sub - call $~lib/string/String.fromUTF8 - local.tee $1 - global.get $std/string-utf8/str - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 24 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.const 4 - call $~lib/string/String.fromUTF8 - local.tee $2 - i32.const 176 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 25 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.const 4 - i32.add - i32.const 2 - call $~lib/string/String.fromUTF8 - local.tee $3 - i32.const 200 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 26 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.const 6 - i32.add - i32.const 4 - call $~lib/string/String.fromUTF8 - local.tee $4 - i32.const 224 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 27 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - i32.const 10 - i32.add - i32.const 1 - call $~lib/string/String.fromUTF8 - local.tee $5 - i32.const 248 - call $~lib/string/String.__eq - i32.eqz - if - i32.const 0 - i32.const 56 - i32.const 28 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - global.get $std/string-utf8/ptr - call $~lib/rt/stub/__free - local.get $0 - call $~lib/rt/stub/__release - local.get $1 - call $~lib/rt/stub/__release - local.get $2 - call $~lib/rt/stub/__release - local.get $3 - call $~lib/rt/stub/__release - local.get $4 - call $~lib/rt/stub/__release - local.get $5 - call $~lib/rt/stub/__release - ) - (func $start (; 14 ;) (type $FUNCSIG$v) - call $start:std/string-utf8 - ) - (func $null (; 15 ;) (type $FUNCSIG$v) - ) -)