From 9620f18249f1e9552c94b5d27b0ac41ea63d1592 Mon Sep 17 00:00:00 2001 From: dcode Date: Sat, 25 May 2019 00:38:50 +0200 Subject: [PATCH] more loader work --- lib/loader/README.md | 173 +- lib/loader/index.d.ts | 62 +- lib/loader/index.js | 142 +- lib/loader/tests/assembly/index.ts | 4 +- lib/loader/tests/build/untouched.wasm | Bin 8182 -> 8245 bytes lib/loader/tests/index.js | 69 +- src/builtins.ts | 2 + std/assembly/shared/typeinfo.ts | 26 +- tests/allocators/buddy/optimized.wat | 107 +- tests/allocators/buddy/untouched.wat | 1261 +++++++++++- tests/allocators/rt-full/assembly/index.ts | 1 + tests/allocators/rt-full/optimized.wat | 582 ++---- tests/allocators/rt-full/untouched.wat | 1819 +++++++++++++---- tests/allocators/rt-stub/assembly/index.ts | 2 +- tests/allocators/rt-stub/optimized.wat | 242 +-- tests/allocators/rt-stub/untouched.wat | 1404 +++++++++++-- .../retain-release-sanity.optimized.wat | 2 +- .../retain-release-sanity.untouched.wat | 2 +- tests/compiler/rt/flags.optimized.wat | 169 +- tests/compiler/rt/flags.ts | 47 +- tests/compiler/rt/flags.untouched.wat | 489 ++++- .../compiler/std/array-literal.optimized.wat | 2 +- .../compiler/std/array-literal.untouched.wat | 2 +- tests/compiler/std/array.optimized.wat | 2 +- tests/compiler/std/array.untouched.wat | 2 +- tests/compiler/std/map.optimized.wat | 2 +- tests/compiler/std/map.untouched.wat | 2 +- tests/compiler/std/set.optimized.wat | 2 +- tests/compiler/std/set.untouched.wat | 2 +- tests/compiler/std/string.optimized.wat | 2 +- tests/compiler/std/string.untouched.wat | 2 +- tests/compiler/std/typedarray.optimized.wat | 2 +- tests/compiler/std/typedarray.untouched.wat | 2 +- 33 files changed, 5101 insertions(+), 1528 deletions(-) diff --git a/lib/loader/README.md b/lib/loader/README.md index 87694830..c05025ae 100644 --- a/lib/loader/README.md +++ b/lib/loader/README.md @@ -7,7 +7,7 @@ Usage ----- ```js -const loader = require("@assemblyscript/loader"); +const loader = require("assemblyscript/lib/loader"); ... ``` @@ -26,54 +26,143 @@ API * **demangle**<`T`>(exports: `WasmExports`, baseModule?: `Object`): `T`
Demangles an AssemblyScript module's exports to a friendly object structure. You usually don't have to call this manually as instantiation does this implicitly. -**Note:** `T` above can either be omitted if the structure of the module is unknown, or can reference a `.d.ts` (i.e. `typeof MyModule`) as produced by the compiler with the `-d` option. +**Note** that `T` above can either be omitted if the structure of the module is unknown, or can reference a `.d.ts` (i.e. `typeof MyModule`) as produced by the compiler with the `-d` option. Instances are automatically populated with useful utility: * **I8**: `Int8Array`
An 8-bit signed integer view on the memory. + ```ts + var value = module.I8[ptr]; + ``` + * **U8**: `Uint8Array`
An 8-bit unsigned integer view on the memory. + ```ts + var value = module.U8[ptr]; + ``` + * **I16**: `Int16Array`
A 16-bit signed integer view on the memory. + ```ts + var value = module.I16[ptr >>> 1]; + ``` + * **U16**: `Uint16Array`
A 16-bit unsigned integer view on the memory. + ```ts + var value = module.U16[ptr >>> 1]; + ``` + * **I32**: `Int32Array`
A 32-bit signed integer view on the memory. + ```ts + var value = module.I32[ptr >>> 2]; + ``` + * **U32**: `Uint32Array`
A 32-bit unsigned integer view on the memory. + ```ts + var value = module.U32[ptr >>> 2]; + ``` + * **I64**: `BigInt64Array`
- A 64-bit signed integer view on the memory1. + A 64-bit signed integer view on the memory, if supported by the VM. + + ```ts + var value = module.I64[ptr >>> 3]; + ``` * **U64**: `BigUint64Array`
- A 64-bit unsigned integer view on the memory1. + A 64-bit unsigned integer view on the memory, if supported by the VM. + + ```ts + var value = module.U64[ptr >>> 3]; + ``` * **F32**: `Float32Array`
A 32-bit float view on the memory. + ```ts + var value = module.I32[ptr >>> 2]; + ``` + * **F64**: `Float64Array`
A 64-bit float view on the memory. -* **newString**(str: `string`): `number`
- Allocates a new string in the module's memory and returns its retained pointer. When done with the string, make sure to `Module#__release` it. + ```ts + var value = module.F64[ptr >>> 3]; + ``` -* **getString**(ptr: `number`): `string`
- Reads a string from the module's memory by its pointer. +* **__allocString**(str: `string`): `number`
+ Allocates a new string in the module's memory and returns a reference (pointer) to it. -* **newArray**(id: `number`, values: `number[]`): `number`
- Allocates a new array in the module's memory and returns its retained pointer. - The `id` is the unique runtime id of the respective array class. If you are using `Int32Array` for example, the best way to know the relevant value is an `export const INT32ARRAY_ID = idof()`. When done with the array, make sure to `Module#__release` it. + ```ts + var ref = module.__retain(module.__allocString("hello world")); + ... + module.__release(ref); + ``` -* **getArray**(ptr: `number`): `number[]`
- Gets the values of an array in the module's memory by its pointer. +* **__getString**(ref: `number`): `string`
+ Gets the value of a string from the module's memory. -1 This feature has not yet landed in any VM as of this writing. + ```ts + var str = module.__getString(ref); + ... + ``` + +* **__allocArray**(id: `number`, values: `number[]`): `number`
+ Allocates a new array in the module's memory and returns a reference (pointer) to it. + The `id` is the unique runtime id of the respective array class. If you are using `Int32Array` for example, the best way to know the id is an `export const INT32ARRAY_ID = idof()`. When done with the array, make sure to release it. + + ```ts + var ref = module.__retain(module.__allocArray(module.INT32ARRAY, [1, 2, 3])); + ... + module.__release(ref); + ``` + +* **__getArray**(ref: `number`): `number[]`
+ Gets the values of an array from the module's memory. + + ```ts + var arr = module.__getArray(ref); + ... + ``` + +* **__retain**(ref: `number`): `number`
+ Retains a reference externally, making sure that it doesn't become collected prematurely. Returns the reference. + +* **__release**(ref: `number`): `void`
+ Releases a previously retained reference to an object, allowing the runtime to collect it once its reference count reaches zero. + +* **__alloc**(size: `number`, id: `number`): `number`
+ Allocates an instance of the class represented by the specified id. If you are using `MyClass` for example, the best way to know the id and the necessary size is an `export const MYCLASS_ID = idof()` and an `export const MYCLASS_SIZE = offsetof()`. Afterwards, use the respective views to assign values to the class's memory while making sure to retain interior references to other managed objects once. When done with the class, make sure to release it, which will automatically release any interiour references once the class becomes collected. + + ```ts + var ref = module.__retain(module.__alloc(module.MYCLASS_SIZE, module.MYCLASS_ID)); + F32[ref + MYCLASS_BASICFIELD1_OFFSET >>> 2] = field1_value_f32; + U32[ref + MYCLASS_MANAGEDFIELD2_OFFSET >>> 2] = module.__retain(field2_value_ref); + ... + module.__release(ref); + ``` + +* **__instanceof**(ref: `number`, baseId: `number`): `boolean`
+ Tests whether an object is an instance of the class represented by the specified base id. + +* **__collect**(): `void`
+ Forces a cycle collection. Only relevant if objects potentially forming reference cycles are used. + +**Note** that the views like `I32` above will automatically be updated when the module's memory grows. Don't cache these if this can happen. + +**Note** that the allocation and ownership features above require the `full` (this is the default) or the `stub` runtime to be present in your module. Other runtime variations do not export this functionality without further ado (so the compiler can eliminate what's dead code). + +**Note** that references returned from exported functions have already been retained for you and the runtime expects that you release them once not needed anymore. Examples -------- @@ -88,62 +177,6 @@ const myModule = loader.instantiateBuffer(fs.readFileSync("myModule.wasm"), myIm const myModule = await loader.instantiateStreaming(fetch("myModule.wasm"), myImports); ``` -### Reading/writing basic values to/from memory - -```js -var ptrToInt8 = ...; -var value = myModule.I8[ptrToInt8]; // alignment of log2(1)=0 - -var ptrToInt16 = ...; -var value = myModule.I16[ptrToInt16 >>> 1]; // alignment of log2(2)=1 - -var ptrToInt32 = ...; -var value = myModule.I32[ptrToInt32 >>> 2]; // alignment of log2(4)=2 - -var ptrToInt64 = ...; -var value = myModule.I64[ptrToInt64 >>> 3]; // alignment of log2(8)=3 - -var ptrToFloat32 = ...; -var value = myModule.F32[ptrToFloat32 >>> 2]; // alignment of log2(4)=2 - -var ptrToFloat64 = ...; -var value = myModule.F64[ptrToFloat64 >>> 3]; // alignment of log2(8)=3 - -// Likewise, for writing -myModule.I8[ptrToInt8] = newValue; -myModule.I16[ptrToInt16 >>> 1] = newValue; -myModule.I32[ptrToInt32 >>> 2] = newValue; -myModule.I64[ptrToInt64 >>> 3] = newValue; -myModule.F32[ptrToFloat32 >>> 2] = newValue; -myModule.F64[ptrToFloat64 >>> 3] = newValue; -``` - -**Note:** Make sure to reference the views as shown above as these will automatically be updated when the module's memory grows. - -### Working with strings and arrays - -Strings and arrays cannot yet flow in and out of WebAssembly naturally, hence it is necessary to create them in the module's memory using the `newString` and `newArray` helpers. Afterwards, instead of passing the string or array directly, the resulting reference (pointer) is provided instead: - -```js -var str = "Hello world!"; -var ptr = module.newString(str); - -// do something with ptr, i.e. call a WebAssembly export -... - -// when done, allow the runtime to collect it -module.__release(ptr); -``` - -Similarly, when a string or array is returned from a WebAssembly function, a reference (pointer) is received on the JS side and the `getString` and `getArray` helpers can be used to obtain their values: - -```js -var ptrToString = ...; -var str = module.getString(ptrToString); - -// ... do something with str ... -``` - ### Usage with TypeScript definitions produced by the compiler ```ts diff --git a/lib/loader/index.d.ts b/lib/loader/index.d.ts index b4814d27..3e394b96 100644 --- a/lib/loader/index.d.ts +++ b/lib/loader/index.d.ts @@ -3,33 +3,14 @@ import "@types/webassembly-js-api"; /** WebAssembly imports with two levels of nesting. */ interface ImportsObject { [key: string]: {}, - env: { + env?: { memory?: WebAssembly.Memory, table?: WebAssembly.Table, - abort?: (msg: number, file: number, line: number, column: number) => void + abort?: (msg: number, file: number, line: number, column: number) => void, + trace?: (msg: number, numArgs?: number, ...args: any[]) => void } } -type TypedArray - = Int8Array - | Uint8Array - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | Float32Array - | Float64Array; - -type TypedArrayConstructor - = Int8ArrayConstructor - | Uint8ArrayConstructor - | Int16ArrayConstructor - | Uint16ArrayConstructor - | Int32ArrayConstructor - | Uint32ArrayConstructor - | Float32ArrayConstructor - | Float32ArrayConstructor; - /** Utility mixed in by the loader. */ interface ASUtil { /** An 8-bit signed integer view on the memory. */ @@ -52,25 +33,24 @@ interface ASUtil { readonly F32: Float32Array; /** A 64-bit float view on the memory. */ readonly F64: Float64Array; - /** Allocates a new string in the module's memory and returns its pointer. */ - newString(str: string): number; - /** Gets a string from the module's memory by its pointer. */ - getString(ptr: number): string; - /** Copies a typed array into the module's memory and returns its pointer. */ - newArray(view: TypedArray, length?: number): number; - /** Creates a typed array in the module's memory and returns its pointer. */ - newArray(ctor: TypedArrayConstructor, length: number, unsafe?: boolean): number; - /** Gets a view on a typed array in the module's memory by its pointer. */ - getArray(ctor: TypedArrayConstructor, ptr: number): T; - /** Frees a typed array in the module's memory. Must not be accessed anymore afterwards. */ - freeArray(ptr: number): void; - /** Gets a function by its pointer. */ - getFunction(ptr: number): (...args: any[]) => R; - /** - * Creates a new function in the module's table and returns its pointer. Note that only actual - * WebAssembly functions, i.e. as exported by the module, are supported. - */ - newFunction(fn: (...args: any[]) => any): number; + /** Allocates a new string in the module's memory and returns a reference (pointer) to it. */ + __allocString(str: string): number; + /** Gets the value of a string from the module's memory. */ + __getString(ref: number): string; + /** Allocates a new array in the module's memory and returns a reference (pointer) to it. */ + __allocArray(id: number, values: number[]): number; + /** Gets the values of an array from the module's memory. */ + __getArray(ref: number): number[]; + /** Retains a reference externally, making sure that it doesn't become collected prematurely. Returns the reference. */ + __retain(ref: number): number; + /** Releases a previously retained reference to an object, allowing the runtime to collect it once its reference count reaches zero. */ + __release(ref: number): void; + /** Allocates an instance of the class represented by the specified id. */ + __alloc(size: number, id: number): number; + /** Tests whether an object is an instance of the class represented by the specified base id. */ + __instanceof(ref: number, baseId: number): boolean; + /** Forces a cycle collection. Only relevant if objects potentially forming reference cycles are used. */ + __collect(): void; } /** Instantiates an AssemblyScript module using the specified imports. */ diff --git a/lib/loader/index.js b/lib/loader/index.js index 6b068902..726d5d94 100644 --- a/lib/loader/index.js +++ b/lib/loader/index.js @@ -14,11 +14,15 @@ const ARRAY = 1 << 0; const SET = 1 << 1; const MAP = 1 << 2; const VAL_ALIGN = 1 << 4; -const VAL_NULLABLE = 1 << 9; -const VAL_MANAGED = 1 << 10; -const KEY_ALIGN = 1 << 11; -const KEY_NULLABLE = 1 << 16; -const KEY_MANAGED = 1 << 17; +const VAL_SIGNED = 1 << 9; +const VAL_FLOAT = 1 << 10; +const VAL_NULLABLE = 1 << 11; +const VAL_MANAGED = 1 << 12; +const KEY_ALIGN = 1 << 13; +const KEY_SIGNED = 1 << 18; +const KEY_FLOAT = 1 << 19; +const KEY_NULLABLE = 1 << 20; +const KEY_MANAGED = 1 << 21; // ArrayBufferView layout const ABV_BUFFER_OFFSET = 0; @@ -28,41 +32,41 @@ const ABV_SIZE = 12; const BIGINT = typeof BigUint64Array !== "undefined"; const THIS = Symbol(); +const CHUNKSIZE = 1024; /** Gets a string from an U32 and an U16 view on a memory. */ -function getStringImpl(U32, U16, ptr) { - var length = U32[(ptr + SIZE_OFFSET) >>> 2] >>> 1; - var offset = ptr >>> 1; - var parts = []; - const chunkSize = 1024; - while (length > chunkSize) { - let last = U16[offset + chunkSize - 1]; - let size = last >= 0xD800 && last < 0xDC00 ? chunkSize - 1 : chunkSize; - let part = U16.subarray(offset, offset += size); - parts.push(String.fromCharCode.apply(String, part)); +function getStringImpl(U32, U16, ref) { + var length = U32[(ref + SIZE_OFFSET) >>> 2] >>> 1; + var offset = ref >>> 1; + if (length <= CHUNKSIZE) return String.fromCharCode.apply(String, U16.subarray(offset, offset + length)); + const parts = []; + do { + const last = U16[offset + CHUNKSIZE - 1]; + const size = last >= 0xD800 && last < 0xDC00 ? CHUNKSIZE - 1 : CHUNKSIZE; + parts.push(String.fromCharCode.apply(String, U16.subarray(offset, offset += size))); length -= size; - } + } while (length > CHUNKSIZE); return parts.join("") + String.fromCharCode.apply(String, U16.subarray(offset, offset + length)); } /** Prepares the base module prior to instantiation. */ function preInstantiate(imports) { - var baseModule = {}; + const baseModule = {}; - function getString(memory, ptr) { + function getString(memory, ref) { if (!memory) return ""; - var buffer = memory.buffer; - return getStringImpl(new Uint32Array(buffer), new Uint16Array(buffer), ptr); + const buffer = memory.buffer; + return getStringImpl(new Uint32Array(buffer), new Uint16Array(buffer), ref); } // add common imports used by stdlib for convenience - var env = (imports.env = imports.env || {}); + const env = (imports.env = imports.env || {}); env.abort = env.abort || function abort(mesg, file, line, colm) { - var memory = baseModule.memory || env.memory; // prefer exported, otherwise try imported + const memory = baseModule.memory || env.memory; // prefer exported, otherwise try imported throw Error("abort: " + getString(memory, mesg) + " at " + getString(memory, file) + ":" + line + ":" + colm); } env.trace = env.trace || function trace(mesg, n) { - var memory = baseModule.memory || env.memory; + const memory = baseModule.memory || env.memory; console.log("trace: " + getString(memory, mesg) + (n ? " " : "") + Array.prototype.slice.call(arguments, 2, 2 + n).join(", ")); } imports.Math = imports.Math || Math; @@ -73,12 +77,12 @@ function preInstantiate(imports) { /** Prepares the final module once instantiation is complete. */ function postInstantiate(baseModule, instance) { - var rawExports = instance.exports; - var memory = rawExports.memory; - var table = rawExports.table; - var alloc = rawExports["__alloc"]; - var retain = rawExports["__retain"]; - var rtti = rawExports["__rtti"] | 0; + const rawExports = instance.exports; + const memory = rawExports.memory; + const table = rawExports.table; + const alloc = rawExports["__alloc"]; + const retain = rawExports["__retain"]; + const rtti = rawExports["__rtti"] || ~0; // oob if not present // Provide views for all sorts of basic values var buffer, I8, U8, I16, U16, I32, U32, F32, F64, I64, U64; @@ -120,32 +124,50 @@ function postInstantiate(baseModule, instance) { /** Gets the runtime alignment of a collection's values or keys. */ function getAlign(which, info) { - return 31 - Math.clz32((info / which) & 31); + return 31 - Math.clz32((info / which) & 31); // -1 if none } /** Allocates a new string in the module's memory and returns its retained pointer. */ - function newString(str) { + function __allocString(str) { const length = str.length; - const ptr = alloc(length << 1, STRING_ID); + const ref = alloc(length << 1, STRING_ID); checkMem(); - for (let i = 0, j = ptr >>> 1; i < length; ++i) U16[j + i] = str.charCodeAt(i); - return retain(ptr); + for (let i = 0, j = ref >>> 1; i < length; ++i) U16[j + i] = str.charCodeAt(i); + return ref; } - baseModule.newString = newString; + baseModule.__allocString = __allocString; /** Reads a string from the module's memory by its pointer. */ - function getString(ptr) { + function __getString(ref) { checkMem(); - const id = U32[ptr + ID_OFFSET >>> 2]; - if (id !== STRING_ID) throw Error("not a string: " + ptr); - return getStringImpl(U32, U16, ptr); + const id = U32[ref + ID_OFFSET >>> 2]; + if (id !== STRING_ID) throw Error("not a string: " + ref); + return getStringImpl(U32, U16, ref); } - baseModule.getString = getString; + baseModule.__getString = __getString; + + /** Gets the view matching the specified alignment, signedness and floatness. */ + function getView(align, signed, float) { + if (float) { + switch (align) { + case 2: return F32; + case 3: return F64; + } + } else { + switch (align) { + case 0: return signed ? I8 : U8; + case 1: return signed ? I16 : U16; + case 2: return signed ? I32 : U32; + case 3: return signed ? I64 : U64; + } + } + throw Error("unsupported align: " + align); + } /** Allocates a new array in the module's memory and returns its retained pointer. */ - function newArray(id, values) { + function __allocArray(id, values) { const info = getInfo(id); if (!(info & ARRAY)) throw Error("not an array: " + id + " @ " + info); const align = getAlign(VAL_ALIGN, info); @@ -156,23 +178,16 @@ function postInstantiate(baseModule, instance) { U32[arr + ABV_BUFFER_OFFSET >>> 2] = retain(buf); U32[arr + ABV_DATASTART_OFFSET >>> 2] = buf; U32[arr + ABV_DATALENGTH_OFFSET >>> 2] = length << align; - var view; - switch (align) { - case 0: view = U8; break; - case 1: view = U16; break; - case 2: view = U32; break; - case 3: view = U64; break; - default: throw Error("unsupported align: " + align); - } + const view = getView(align, info & VAL_SIGNED, info & VAL_FLOAT); for (let i = 0; i < length; ++i) view[(buf >> align) + i] = values[i]; if (info & VAL_MANAGED) for (let i = 0; i < length; ++i) retain(values[i]); - return retain(arr); + return arr; } - baseModule.newArray = newArray; + baseModule.__allocArray = __allocArray; /** Gets the values of an array in the module's memory by its pointer. */ - function getArray(arr) { + function __getArray(arr) { checkMem(); const id = U32[arr + ID_OFFSET >>> 2]; const info = getInfo(id); @@ -180,19 +195,22 @@ function postInstantiate(baseModule, instance) { const align = getAlign(VAL_ALIGN, info); var buf = U32[arr + ABV_DATASTART_OFFSET >>> 2]; const length = U32[buf + SIZE_OFFSET >>> 2] >>> align; - var view; - switch (align) { - // TODO: signedness/floats - case 0: view = U8; break; - case 1: view = U16; break; - case 2: view = U32; break; - case 3: view = U64; break; - default: throw Error("unsupported align: " + align); - } + const view = getView(align, info & VAL_SIGNED, info & VAL_FLOAT); return Array.from(view.slice(buf >>>= align, buf + length)); } - baseModule.getArray = getArray; + baseModule.__getArray = __getArray; + + function __instanceof(ref, baseId) { + var id = U32[(ref + ID_OFFSET) >>> 2]; + if (id <= U32[rtti >>> 2]) { + do if (id == baseId) return true; + while (id = getBase(id)); + } + return false; + } + + baseModule.__instanceof = __instanceof; // Pull basic exports to baseModule so code in preInstantiate can use them baseModule.memory = baseModule.memory || memory; diff --git a/lib/loader/tests/assembly/index.ts b/lib/loader/tests/assembly/index.ts index 42552342..9e0471db 100644 --- a/lib/loader/tests/assembly/index.ts +++ b/lib/loader/tests/assembly/index.ts @@ -49,7 +49,7 @@ export function varadd(a: i32 = 1, b: i32 = 2): i32 { return a + b; } -export const varadd_ptr = varadd; +export const varadd_ref = varadd; export function calladd(fn: (a: i32, b: i32) => i32, a: i32, b: i32): i32 { return fn(a, b); @@ -60,3 +60,5 @@ export function dotrace(num: f64): void { } export const INT32ARRAY_ID = idof(); +export const UINT32ARRAY_ID = idof(); +export const FLOAT32ARRAY_ID = idof(); diff --git a/lib/loader/tests/build/untouched.wasm b/lib/loader/tests/build/untouched.wasm index 1de1f6e217a1fd0b56f45241373953397f466c57..090a2961635cd430c67ba449ea55f756902abf59 100644 GIT binary patch delta 253 zcmexnztv&FLZ%RbiHl8?85~)->lqwbx$7An89=ND%ph_OSd@*M{SdR_#1D3iyp#1A z6&d*_2Qr>yE=o3f8Sm-B%*F5KBrj85kHDCl|^_vhZ+oZ{K`Q_BSJw4g2KN@-p&F3=BZT Q;0eTFnhip80Qn#Q0N({R8vplqv$FoVb*77)q8%|4%5e&R1XM()X$jEaoBlcO0= zG8dE-O;%@8n_R#Y#<+3waVAz)MxM=Q*>hMJc_v%&xH58YZs2L;28uCBXfrW#P1chN zVq}@zDD?%%E|dNXlqiwmXOxa)WUOa$;AV1wKm`Uzj%*Dk20m5>hRF+LBU!k(xtDML aEBl*~Nr!dvFL@b$1_lNuAm#vK5C8ycFf1Pc diff --git a/lib/loader/tests/index.js b/lib/loader/tests/index.js index 9994af99..e542eeb7 100644 --- a/lib/loader/tests/index.js +++ b/lib/loader/tests/index.js @@ -24,43 +24,70 @@ assert(module.memory instanceof WebAssembly.Memory); assert(typeof module.memory.copy === "function"); // should be able to get an exported string -assert.strictEqual(module.getString(module.COLOR), "red"); +assert.strictEqual(module.__getString(module.COLOR), "red"); // should be able to allocate and work with a new string -var str = "Hello world!𤭢"; -var ptr = module.newString(str); -assert.strictEqual(module.getString(ptr), str); -assert.strictEqual(module.strlen(ptr), str.length); +{ + let str = "Hello world!𤭢"; + let ref = module.__retain(module.__allocString(str)); + assert.strictEqual(module.__getString(ref), str); + assert.strictEqual(module.strlen(ref), str.length); + module.__release(ref); +} -// should be able to allocate a typed array and sum up its values -var arr = [1, 2, 3, 4, 5, 0x7fffffff]; -ptr = module.newArray(module.INT32ARRAY_ID, arr); -assert.strictEqual(module.sum(ptr), arr.reduce((a, b) => a + b, 0) | 0); +// should be able to allocate a typed array +{ + var arr = [1, 2, 3, 4, 5, 0x80000000 | 0]; + let ref = module.__retain(module.__allocArray(module.INT32ARRAY_ID, arr)); + assert(module.__instanceof(ref, module.INT32ARRAY_ID)); -// should be able to get a view on an internal typed array -assert.deepEqual(Array.from(module.getArray(ptr)), arr); + // should be able to get a view on an internal typed array + assert.deepEqual(module.__getArray(ref), arr); -// should be able to release no longer needed references -module.__release(ptr); -try { - module.__release(ptr); - assert(false); -} catch (e) {}; + // should be able to sum up its values + assert.strictEqual(module.sum(ref), arr.reduce((a, b) => (a + b) | 0, 0) | 0); -// should be able to just call a function with variable arguments + // should be able to release no longer needed references + module.__release(ref); + try { module.__release(ref); assert(false); } catch (e) {}; +} + +// should be able to distinguish between signed and unsigned +{ + let arr = [1, -1 >>> 0, 0x80000000]; + let ref = module.__retain(module.__allocArray(module.UINT32ARRAY_ID, arr)); + assert(module.__instanceof(ref, module.UINT32ARRAY_ID)); + assert.deepEqual(module.__getArray(ref), arr); + module.__release(ref); + try { module.__release(ref); assert(false); } catch (e) {}; +} + +// should be able to distinguish between integer and float +{ + let arr = [0.0, 1.5, 2.5]; + let ref = module.__retain(module.__allocArray(module.FLOAT32ARRAY_ID, arr)); + assert(module.__instanceof(ref, module.FLOAT32ARRAY_ID)); + assert.deepEqual(module.__getArray(ref), arr); + module.__release(ref); + try { module.__release(ref); assert(false); } catch (e) {}; +} + +// should be able to correctly call a function with variable arguments assert.strictEqual(module.varadd(), 3); assert.strictEqual(module.varadd(2, 3), 5); assert.strictEqual(module.varadd(2), 4); +// TBD: table is no more exported by default to allow more optimizations + // should be able to get a function from the table and just call it with variable arguments -// var fn = module.getFunction(module.varadd_ptr); +// var fn = module.getFunction(module.varadd_ref); // assert.strictEqual(fn(), 3); // assert.strictEqual(fn(2, 3), 5); // assert.strictEqual(fn(2), 4); // should be able to create a new function and call it from WASM -// ptr = module.newFunction(module.varadd); -// assert.strictEqual(module.calladd(ptr, 2, 3), 5); +// ref = module.newFunction(module.varadd); +// assert.strictEqual(module.calladd(ref, 2, 3), 5); // should be able to use a class var car = new module.Car(5); diff --git a/src/builtins.ts b/src/builtins.ts index 348f6326..899f5e35 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -4145,6 +4145,8 @@ export function compileVisitMembers(compiler: Compiler): void { function typeToRuntimeFlags(type: Type): TypeinfoFlags { var flags = TypeinfoFlags.VALUE_ALIGN_0 * (1 << type.alignLog2); + if (type.is(TypeFlags.SIGNED)) flags |= TypeinfoFlags.VALUE_SIGNED; + if (type.is(TypeFlags.FLOAT)) flags |= TypeinfoFlags.VALUE_FLOAT; if (type.is(TypeFlags.NULLABLE)) flags |= TypeinfoFlags.VALUE_NULLABLE; if (type.isManaged) flags |= TypeinfoFlags.VALUE_MANAGED; return flags / TypeinfoFlags.VALUE_ALIGN_0; diff --git a/std/assembly/shared/typeinfo.ts b/std/assembly/shared/typeinfo.ts index 46b337b3..a55f61e0 100644 --- a/std/assembly/shared/typeinfo.ts +++ b/std/assembly/shared/typeinfo.ts @@ -43,22 +43,30 @@ export const enum TypeinfoFlags { VALUE_ALIGN_3 = 1 << 7, /** Value alignment of 16 bytes. */ VALUE_ALIGN_4 = 1 << 8, + /** Value is a signed type. */ + VALUE_SIGNED = 1 << 9, + /** Value is a float type. */ + VALUE_FLOAT = 1 << 10, /** Value type is nullable. */ - VALUE_NULLABLE = 1 << 9, + VALUE_NULLABLE = 1 << 11, /** Value type is managed. */ - VALUE_MANAGED = 1 << 10, + VALUE_MANAGED = 1 << 12, /** Key alignment of 1 byte. */ - KEY_ALIGN_0 = 1 << 11, + KEY_ALIGN_0 = 1 << 13, /** Key alignment of 2 bytes. */ - KEY_ALIGN_1 = 1 << 12, + KEY_ALIGN_1 = 1 << 14, /** Key alignment of 4 bytes. */ - KEY_ALIGN_2 = 1 << 13, + KEY_ALIGN_2 = 1 << 15, /** Key alignment of 8 bytes. */ - KEY_ALIGN_3 = 1 << 14, + KEY_ALIGN_3 = 1 << 16, /** Key alignment of 16 bytes. */ - KEY_ALIGN_4 = 1 << 15, + KEY_ALIGN_4 = 1 << 17, + /** Value is a signed type. */ + KEY_SIGNED = 1 << 18, + /** Value is a float type. */ + KEY_FLOAT = 1 << 19, /** Key type is nullable. */ - KEY_NULLABLE = 1 << 16, + KEY_NULLABLE = 1 << 20, /** Key type is managed. */ - KEY_MANAGED = 1 << 17 + KEY_MANAGED = 1 << 21 } diff --git a/tests/allocators/buddy/optimized.wat b/tests/allocators/buddy/optimized.wat index 4ee661b1..be3fc9f3 100644 --- a/tests/allocators/buddy/optimized.wat +++ b/tests/allocators/buddy/optimized.wat @@ -45,6 +45,7 @@ ) (func $~lib/memory/memory.copy (; 3 ;) (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 @@ -81,16 +82,14 @@ 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 - block (result i32) - local.get $1 - local.tee $2 - i32.const 1 - i32.add - local.set $1 - local.get $2 - i32.load8_u - end + local.get $4 + i32.load8_u i32.store8 br $continue|0 end @@ -128,16 +127,14 @@ 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 - block (result i32) - local.get $1 - local.tee $2 - i32.const 1 - i32.add - local.set $1 - local.get $2 - i32.load8_u - end + local.get $4 + i32.load8_u i32.store8 local.get $3 i32.const 1 @@ -303,9 +300,9 @@ i32.const 16 i32.shr_u local.tee $0 - current_memory + memory.size i32.sub - grow_memory + memory.grow i32.const 0 i32.lt_s if @@ -446,7 +443,6 @@ ) (func $assembly/buddy/flip_parent_is_split (; 16 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) - (local $2 i32) local.get $0 i32.const 1 i32.sub @@ -456,8 +452,6 @@ i32.const 8 i32.div_u local.tee $1 - local.set $2 - local.get $1 call $assembly/buddy/node_is_split$get i32.const 1 local.get $0 @@ -467,7 +461,7 @@ i32.xor local.set $0 global.get $assembly/buddy/NODE_IS_SPLIT_START - local.get $2 + local.get $1 i32.add local.get $0 i32.store8 @@ -489,13 +483,11 @@ if global.get $assembly/buddy/base_ptr call $assembly/buddy/list_remove - block (result i32) - global.get $assembly/buddy/bucket_limit - i32.const 1 - i32.sub - global.set $assembly/buddy/bucket_limit - global.get $assembly/buddy/bucket_limit - end + global.get $assembly/buddy/bucket_limit + i32.const 1 + i32.sub + global.set $assembly/buddy/bucket_limit + global.get $assembly/buddy/bucket_limit call $assembly/buddy/buckets$get call $assembly/buddy/list_init global.get $assembly/buddy/bucket_limit @@ -522,13 +514,11 @@ call $assembly/buddy/buckets$get local.get $2 call $assembly/buddy/list_push - block (result i32) - global.get $assembly/buddy/bucket_limit - i32.const 1 - i32.sub - global.set $assembly/buddy/bucket_limit - global.get $assembly/buddy/bucket_limit - end + global.get $assembly/buddy/bucket_limit + i32.const 1 + i32.sub + global.set $assembly/buddy/bucket_limit + global.get $assembly/buddy/bucket_limit call $assembly/buddy/buckets$get call $assembly/buddy/list_init local.get $1 @@ -580,7 +570,7 @@ i32.const -8 i32.and global.set $assembly/buddy/base_ptr - current_memory + memory.size i32.const 16 i32.shl global.set $assembly/buddy/max_ptr @@ -624,14 +614,14 @@ local.get $1 call $assembly/buddy/buckets$get call $assembly/buddy/list_pop - local.tee $2 + local.tee $3 i32.eqz if i32.const 1 local.get $1 i32.eqz - local.get $1 global.get $assembly/buddy/bucket_limit + local.get $1 i32.ne select if @@ -653,44 +643,44 @@ local.get $1 call $assembly/buddy/buckets$get call $assembly/buddy/list_pop - local.set $2 + local.set $3 end i32.const 1 i32.const 30 local.get $1 i32.sub i32.shl - local.set $3 + local.set $2 local.get $1 local.get $4 i32.lt_u - if (result i32) - local.get $3 + if + local.get $2 i32.const 2 i32.div_u i32.const 8 i32.add - else - local.get $3 + local.set $2 end local.get $2 + local.get $3 i32.add call $assembly/buddy/update_max_ptr i32.eqz if local.get $1 call $assembly/buddy/buckets$get - local.get $2 + local.get $3 call $assembly/buddy/list_push i32.const 0 return end - local.get $2 + local.get $3 local.get $1 call $assembly/buddy/node_for_ptr - local.tee $3 + local.tee $2 if - local.get $3 + local.get $2 call $assembly/buddy/flip_parent_is_split end loop $continue|1 @@ -698,19 +688,19 @@ local.get $4 i32.lt_u if - local.get $3 + local.get $2 i32.const 1 i32.shl i32.const 1 i32.add - local.tee $3 + local.tee $2 call $assembly/buddy/flip_parent_is_split local.get $1 i32.const 1 i32.add local.tee $1 call $assembly/buddy/buckets$get - local.get $3 + local.get $2 i32.const 1 i32.add local.get $1 @@ -719,10 +709,10 @@ br $continue|1 end end - local.get $2 + local.get $3 local.get $0 i32.store - local.get $2 + local.get $3 i32.const 8 i32.add return @@ -761,14 +751,15 @@ if (result i32) i32.const 1 else - local.get $0 global.get $assembly/buddy/bucket_limit + local.get $0 i32.eq end br_if $break|0 local.get $1 i32.const 1 i32.sub + local.tee $1 i32.const 1 i32.xor i32.const 1 @@ -777,8 +768,6 @@ call $assembly/buddy/ptr_for_node call $assembly/buddy/list_remove local.get $1 - i32.const 1 - i32.sub i32.const 2 i32.div_u local.set $1 diff --git a/tests/allocators/buddy/untouched.wat b/tests/allocators/buddy/untouched.wat index e8ab7fe8..c8c94697 100644 --- a/tests/allocators/buddy/untouched.wat +++ b/tests/allocators/buddy/untouched.wat @@ -29,6 +29,7 @@ (global $assembly/buddy/NODE_IS_SPLIT_END (mut i32) (i32.const 0)) (global $assembly/buddy/base_ptr (mut i32) (i32.const 0)) (global $assembly/buddy/max_ptr (mut i32) (i32.const 0)) + (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) (global $~lib/heap/HEAP_BASE i32 (i32.const 156)) (export "memory" (memory $0)) (export "memory.copy" (func $~lib/memory/memory.copy)) @@ -76,7 +77,1198 @@ call $~lib/builtins/abort unreachable ) - (func $~lib/memory/memory.copy (; 5 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/memory/memcpy (; 5 ;) (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 + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + br $continue|0 + end + end + 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 + 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.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 + end + 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 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + if + 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 + end + end + br $break|2 + unreachable + end + unreachable + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + if + 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 + end + end + br $break|2 + unreachable + end + unreachable + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + if + 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 + end + end + br $break|2 + unreachable + end + unreachable + end + end + local.get $2 + i32.const 16 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 8 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 4 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 2 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 1 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + ) + (func $~lib/memory/memory.copy (; 6 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -94,6 +1286,27 @@ 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 @@ -282,7 +1495,7 @@ end end ) - (func $~lib/memory/memory.repeat (; 6 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/memory/memory.repeat (; 7 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) i32.const 0 @@ -312,7 +1525,7 @@ end end ) - (func $~lib/memory/memory.compare (; 7 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.compare (; 8 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -373,14 +1586,14 @@ end end ) - (func $assembly/buddy/update_max_ptr (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/buddy/update_max_ptr (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) local.get $0 global.get $assembly/buddy/max_ptr i32.gt_u if - current_memory + memory.size local.set $1 local.get $0 i32.const 65535 @@ -407,7 +1620,7 @@ local.get $2 local.get $1 i32.sub - grow_memory + memory.grow i32.const 0 i32.lt_s if @@ -421,7 +1634,7 @@ end i32.const 1 ) - (func $assembly/buddy/buckets$get (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/buddy/buckets$get (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 global.get $assembly/buddy/BUCKET_COUNT i32.lt_u @@ -440,7 +1653,7 @@ i32.mul i32.add ) - (func $assembly/buddy/list_init (; 10 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/buddy/list_init (; 11 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 local.get $0 i32.store @@ -448,7 +1661,7 @@ local.get $0 i32.store offset=4 ) - (func $assembly/buddy/list_push (; 11 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $assembly/buddy/list_push (; 12 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) local.get $0 i32.load @@ -466,7 +1679,7 @@ local.get $1 i32.store ) - (func $assembly/buddy/bucket_for_request (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/buddy/bucket_for_request (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) global.get $assembly/buddy/BUCKET_COUNT @@ -495,7 +1708,7 @@ end local.get $1 ) - (func $assembly/buddy/node_for_ptr (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $assembly/buddy/node_for_ptr (; 14 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 global.get $assembly/buddy/base_ptr i32.sub @@ -510,7 +1723,7 @@ i32.const 1 i32.sub ) - (func $assembly/buddy/node_is_split$get (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/buddy/node_is_split$get (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 global.get $assembly/buddy/SPLIT_COUNT i32.lt_u @@ -528,7 +1741,7 @@ i32.add i32.load8_u ) - (func $assembly/buddy/parent_is_split (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/buddy/parent_is_split (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 1 i32.sub @@ -548,7 +1761,7 @@ i32.const 1 i32.eq ) - (func $assembly/buddy/list_remove (; 16 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/buddy/list_remove (; 17 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) (local $2 i32) local.get $0 @@ -564,7 +1777,7 @@ local.get $1 i32.store ) - (func $assembly/buddy/ptr_for_node (; 17 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $assembly/buddy/ptr_for_node (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) global.get $assembly/buddy/base_ptr local.get $0 i32.const 1 @@ -579,7 +1792,7 @@ i32.shl i32.add ) - (func $assembly/buddy/node_is_split$set (; 18 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $assembly/buddy/node_is_split$set (; 19 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) local.get $0 global.get $assembly/buddy/SPLIT_COUNT i32.lt_u @@ -598,7 +1811,7 @@ local.get $1 i32.store8 ) - (func $assembly/buddy/flip_parent_is_split (; 19 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/buddy/flip_parent_is_split (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.const 1 @@ -621,7 +1834,7 @@ i32.xor call $assembly/buddy/node_is_split$set ) - (func $assembly/buddy/lower_bucket_limit (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/buddy/lower_bucket_limit (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) block $break|0 @@ -702,7 +1915,7 @@ end i32.const 1 ) - (func $assembly/buddy/list_pop (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/buddy/list_pop (; 22 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 i32.load @@ -718,7 +1931,7 @@ call $assembly/buddy/list_remove local.get $1 ) - (func $assembly/buddy/__mem_allocate (; 22 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/buddy/__mem_allocate (; 23 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -743,7 +1956,7 @@ i32.xor i32.and global.set $assembly/buddy/base_ptr - current_memory + memory.size i32.const 16 i32.shl global.set $assembly/buddy/max_ptr @@ -917,7 +2130,7 @@ end i32.const 0 ) - (func $assembly/buddy/__mem_free (; 23 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/buddy/__mem_free (; 24 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) (local $2 i32) local.get $0 @@ -990,9 +2203,9 @@ call $assembly/buddy/ptr_for_node call $assembly/buddy/list_push ) - (func $start (; 24 ;) (type $FUNCSIG$v) + (func $start (; 25 ;) (type $FUNCSIG$v) call $start:assembly/index ) - (func $null (; 25 ;) (type $FUNCSIG$v) + (func $null (; 26 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/allocators/rt-full/assembly/index.ts b/tests/allocators/rt-full/assembly/index.ts index d6c82e6f..c9701ae3 100644 --- a/tests/allocators/rt-full/assembly/index.ts +++ b/tests/allocators/rt-full/assembly/index.ts @@ -1 +1,2 @@ export { memory } from "memory"; +export { __free }; diff --git a/tests/allocators/rt-full/optimized.wat b/tests/allocators/rt-full/optimized.wat index 0b0a6d27..21c7adc9 100644 --- a/tests/allocators/rt-full/optimized.wat +++ b/tests/allocators/rt-full/optimized.wat @@ -20,20 +20,19 @@ (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/rt/RTTI_BASE i32 (i32.const 304)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/tlsf/__alloc)) - (export "__realloc" (func $~lib/rt/tlsf/__realloc)) - (export "__free" (func $~lib/rt/tlsf/__free)) (export "__retain" (func $~lib/rt/pure/__retain)) (export "__release" (func $~lib/rt/pure/__release)) (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__instanceof" (func $~lib/rt/__instanceof)) - (export "__typeinfo" (func $~lib/rt/__typeinfo)) + (export "__rtti" (global $~lib/rt/RTTI_BASE)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) (export "memory.drop" (func $~lib/memory/memory.drop)) (export "memory.repeat" (func $~lib/memory/memory.repeat)) (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "__free" (func $~lib/rt/tlsf/__free)) (func $~lib/rt/tlsf/removeBlock (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) @@ -87,8 +86,6 @@ local.get $5 i32.store offset=16 end - local.get $1 - local.get $0 local.get $3 i32.const 4 i32.shl @@ -96,11 +93,12 @@ i32.add i32.const 2 i32.shl + local.get $0 i32.add i32.load offset=96 + local.get $1 i32.eq if - local.get $0 local.get $3 i32.const 4 i32.shl @@ -108,21 +106,22 @@ i32.add i32.const 2 i32.shl + local.get $0 i32.add local.get $2 i32.store offset=96 local.get $2 i32.eqz if - local.get $0 local.get $3 i32.const 2 i32.shl + local.get $0 i32.add - local.get $0 local.get $3 i32.const 2 i32.shl + local.get $0 i32.add i32.load offset=4 i32.const 1 @@ -159,7 +158,7 @@ (local $7 i32) local.get $1 i32.load - local.set $2 + local.set $3 local.get $1 i32.const 16 i32.add @@ -174,7 +173,7 @@ i32.const 1 i32.and if - local.get $2 + local.get $3 i32.const -4 i32.and i32.const 16 @@ -183,7 +182,7 @@ i32.const -4 i32.and i32.add - local.tee $3 + local.tee $2 i32.const 1073741808 i32.lt_u if @@ -191,12 +190,12 @@ local.get $4 call $~lib/rt/tlsf/removeBlock local.get $1 - local.get $2 + local.get $3 i32.const 3 i32.and - local.get $3 + local.get $2 i32.or - local.tee $2 + local.tee $3 i32.store local.get $1 i32.const 16 @@ -211,7 +210,7 @@ local.set $5 end end - local.get $2 + local.get $3 i32.const 2 i32.and if @@ -219,14 +218,14 @@ i32.const 4 i32.sub i32.load - local.tee $3 + local.tee $2 i32.load local.tee $6 i32.const -4 i32.and i32.const 16 i32.add - local.get $2 + local.get $3 i32.const -4 i32.and i32.add @@ -235,17 +234,17 @@ i32.lt_u if local.get $0 - local.get $3 + local.get $2 call $~lib/rt/tlsf/removeBlock - local.get $3 + local.get $2 local.get $6 i32.const 3 i32.and local.get $7 i32.or - local.tee $2 + local.tee $3 i32.store - local.get $3 + local.get $2 local.set $1 end end @@ -259,7 +258,7 @@ i32.sub local.get $1 i32.store - local.get $2 + local.get $3 i32.const -4 i32.and local.tee $2 @@ -269,7 +268,7 @@ local.get $2 i32.const 4 i32.shr_u - local.set $2 + local.set $4 i32.const 0 else local.get $2 @@ -277,49 +276,49 @@ local.get $2 i32.clz i32.sub - local.tee $3 + local.tee $2 i32.const 4 i32.sub i32.shr_u i32.const 16 i32.xor - local.set $2 - local.get $3 + local.set $4 + local.get $2 i32.const 7 i32.sub end local.set $3 - local.get $0 local.get $3 i32.const 4 i32.shl - local.get $2 + local.get $4 i32.add i32.const 2 i32.shl + local.get $0 i32.add i32.load offset=96 - local.set $4 + local.set $2 local.get $1 i32.const 0 i32.store offset=16 local.get $1 - local.get $4 + local.get $2 i32.store offset=20 - local.get $4 + local.get $2 if - local.get $4 + local.get $2 local.get $1 i32.store offset=16 end - local.get $0 local.get $3 i32.const 4 i32.shl - local.get $2 + local.get $4 i32.add i32.const 2 i32.shl + local.get $0 i32.add local.get $1 i32.store offset=96 @@ -331,19 +330,19 @@ i32.shl i32.or i32.store - local.get $0 local.get $3 i32.const 2 i32.shl + local.get $0 i32.add - local.get $0 local.get $3 i32.const 2 i32.shl + local.get $0 i32.add i32.load offset=4 i32.const 1 - local.get $2 + local.get $4 i32.shl i32.or i32.store offset=4 @@ -415,25 +414,15 @@ (func $~lib/rt/tlsf/initializeRoot (; 4 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) - (local $2 i32) - (local $3 i32) - i32.const 336 - local.tee $3 - i32.const 67107 - i32.add - i32.const -65536 - i32.and - i32.const 16 - i32.shr_u - local.tee $1 - current_memory + i32.const 1 + memory.size local.tee $0 i32.gt_s if (result i32) - local.get $1 + i32.const 1 local.get $0 i32.sub - grow_memory + memory.grow i32.const 0 i32.lt_s else @@ -442,23 +431,24 @@ if unreachable end - local.get $3 - local.tee $0 + i32.const 336 i32.const 0 i32.store - local.get $0 + i32.const 1904 i32.const 0 - i32.store offset=1568 + i32.store + i32.const 0 + local.set $0 loop $repeat|0 block $break|0 - local.get $2 + local.get $0 i32.const 23 i32.ge_u br_if $break|0 local.get $0 - local.get $2 i32.const 2 i32.shl + i32.const 336 i32.add i32.const 0 i32.store offset=4 @@ -471,13 +461,13 @@ i32.ge_u br_if $break|1 local.get $0 - local.get $2 i32.const 4 i32.shl local.get $1 i32.add i32.const 2 i32.shl + i32.const 336 i32.add i32.const 0 i32.store offset=96 @@ -488,35 +478,30 @@ br $repeat|1 end end - local.get $2 + local.get $0 i32.const 1 i32.add - local.set $2 + local.set $0 br $repeat|0 end end - local.get $0 - local.get $3 - i32.const 1587 - i32.add - i32.const -16 - i32.and - current_memory + i32.const 336 + i32.const 1920 + memory.size i32.const 16 i32.shl call $~lib/rt/tlsf/addMemory - local.get $0 + i32.const 336 global.set $~lib/rt/tlsf/ROOT ) (func $~lib/rt/tlsf/prepareSize (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) local.get $0 i32.const 1073741808 i32.ge_u if i32.const 24 i32.const 80 - i32.const 446 + i32.const 447 i32.const 29 call $~lib/builtins/abort unreachable @@ -528,15 +513,13 @@ i32.and local.tee $0 i32.const 16 - local.tee $1 local.get $0 - local.get $1 + i32.const 16 i32.gt_u select ) (func $~lib/rt/tlsf/searchBlock (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - local.get $0 local.get $1 i32.const 256 i32.lt_u @@ -547,28 +530,28 @@ local.set $1 i32.const 0 else - i32.const 31 - 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 - local.get $1 local.get $1 i32.const 536870904 i32.lt_u - select - local.tee $1 + 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.set $2 - local.get $1 - local.get $2 + local.tee $2 i32.const 4 i32.sub i32.shr_u @@ -582,6 +565,7 @@ local.tee $2 i32.const 2 i32.shl + local.get $0 i32.add i32.load offset=4 i32.const -1 @@ -590,7 +574,6 @@ i32.and local.tee $1 if (result i32) - local.get $0 local.get $1 i32.ctz local.get $2 @@ -599,6 +582,7 @@ i32.add i32.const 2 i32.shl + local.get $0 i32.add i32.load offset=96 else @@ -616,13 +600,13 @@ local.get $0 local.get $1 i32.ctz - local.tee $1 + local.tee $0 i32.const 2 i32.shl i32.add i32.load offset=4 i32.ctz - local.get $1 + local.get $0 i32.const 4 i32.shl i32.add @@ -637,11 +621,8 @@ ) (func $~lib/rt/tlsf/growMemory (; 7 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) - (local $3 i32) - (local $4 i32) - current_memory + memory.size local.tee $2 - local.tee $3 local.get $1 i32.const 65535 i32.add @@ -650,17 +631,16 @@ i32.const 16 i32.shr_u local.tee $1 - local.tee $4 - local.get $3 - local.get $4 + local.get $2 + local.get $1 i32.gt_s select - grow_memory + memory.grow i32.const 0 i32.lt_s if local.get $1 - grow_memory + memory.grow i32.const 0 i32.lt_s if @@ -671,7 +651,7 @@ local.get $2 i32.const 16 i32.shl - current_memory + memory.size i32.const 16 i32.shl call $~lib/rt/tlsf/addMemory @@ -691,10 +671,10 @@ i32.ge_u if local.get $1 - local.get $2 local.get $3 i32.const 2 i32.and + local.get $2 i32.or i32.store local.get $1 @@ -793,8 +773,58 @@ i32.const 16 i32.add ) - (func $~lib/memory/memory.copy (; 11 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/rt/pure/__retain (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + local.get $0 + i32.const 332 + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + local.tee $1 + local.get $1 + i32.load offset=4 + i32.const 1 + i32.add + i32.store offset=4 + end + local.get $0 + ) + (func $~lib/rt/tlsf/freeBlock (; 12 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + local.get $1 + local.get $1 + i32.load + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + ) + (func $~lib/rt/__typeinfo (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 304 + i32.load + i32.gt_u + if + i32.const 128 + i32.const 184 + i32.const 22 + i32.const 27 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 3 + i32.shl + i32.const 308 + i32.add + i32.load + ) + (func $~lib/memory/memory.copy (; 14 ;) (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 @@ -831,16 +861,14 @@ 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 - block (result i32) - local.get $1 - local.tee $2 - i32.const 1 - i32.add - local.set $1 - local.get $2 - i32.load8_u - end + local.get $4 + i32.load8_u i32.store8 br $continue|0 end @@ -878,16 +906,14 @@ 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 - block (result i32) - local.get $1 - local.tee $2 - i32.const 1 - i32.add - local.set $1 - local.get $2 - i32.load8_u - end + local.get $4 + i32.load8_u i32.store8 local.get $3 i32.const 1 @@ -969,216 +995,43 @@ end end ) - (func $~lib/rt/tlsf/reallocateBlock (; 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.get $2 - call $~lib/rt/tlsf/prepareSize - local.tee $3 - local.get $1 - i32.load - local.tee $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=4 - i32.store offset=4 - local.get $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 $3 - ) - (func $~lib/rt/tlsf/__realloc (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - 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/rt/tlsf/freeBlock (; 14 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) - local.get $1 - local.get $1 - i32.load - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $1 - call $~lib/rt/tlsf/insertBlock - ) - (func $~lib/rt/tlsf/__free (; 15 ;) (type $FUNCSIG$vi) (param $0 i32) - global.get $~lib/rt/tlsf/ROOT - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/tlsf/freeBlock - ) - (func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - local.get $0 - i32.const 332 - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - local.tee $1 - local.get $1 - i32.load offset=4 - i32.const 1 - i32.add - i32.store offset=4 - end - local.get $0 - ) - (func $~lib/rt/__typeinfo (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - local.get $0 - i32.const 304 - local.tee $1 - i32.load - i32.gt_u - if - i32.const 128 - i32.const 184 - 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 3 - i32.shl - i32.add - i32.load - ) - (func $~lib/rt/pure/growRoots (; 18 ;) (type $FUNCSIG$v) + (func $~lib/rt/pure/growRoots (; 15 ;) (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 $3 - i32.sub local.tee $2 + i32.sub + local.tee $1 i32.const 1 i32.shl local.tee $0 i32.const 256 - local.tee $1 local.get $0 - local.get $1 + i32.const 256 i32.gt_u select - local.tee $1 + local.tee $3 i32.const 0 call $~lib/rt/tlsf/__alloc local.tee $0 - local.get $3 local.get $2 + local.get $1 call $~lib/memory/memory.copy local.get $0 global.set $~lib/rt/pure/ROOTS local.get $0 - local.get $2 + local.get $1 i32.add global.set $~lib/rt/pure/CUR local.get $0 - local.get $1 + local.get $3 i32.add global.set $~lib/rt/pure/END ) - (func $~lib/rt/pure/appendRoot (; 19 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/appendRoot (; 16 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) global.get $~lib/rt/pure/CUR local.tee $1 @@ -1197,7 +1050,7 @@ i32.add global.set $~lib/rt/pure/CUR ) - (func $~lib/rt/pure/decrement (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/decrement (; 17 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) (local $2 i32) local.get $0 @@ -1261,7 +1114,7 @@ end end ) - (func $~lib/rt/pure/__release (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/__release (; 18 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 332 i32.gt_u @@ -1272,7 +1125,7 @@ call $~lib/rt/pure/decrement end ) - (func $~lib/rt/pure/markGray (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/markGray (; 19 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.load offset=4 @@ -1296,7 +1149,7 @@ call $~lib/rt/__visit_members end ) - (func $~lib/rt/pure/scanBlack (; 23 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/scanBlack (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 local.get $0 i32.load offset=4 @@ -1309,7 +1162,7 @@ i32.const 4 call $~lib/rt/__visit_members ) - (func $~lib/rt/pure/scan (; 24 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/scan (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.load offset=4 @@ -1343,21 +1196,23 @@ end end ) - (func $~lib/rt/pure/collectWhite (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/collectWhite (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.load offset=4 local.tee $1 - i32.const -2147483648 - i32.and - i32.eqz - i32.const 0 - local.get $1 i32.const 1879048192 i32.and i32.const 536870912 i32.eq - select + if (result i32) + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + else + i32.const 0 + end if local.get $0 i32.const 16 @@ -1369,7 +1224,7 @@ local.get $0 call $~lib/rt/tlsf/freeBlock ) - (func $~lib/rt/pure/__collect (; 26 ;) (type $FUNCSIG$v) + (func $~lib/rt/pure/__collect (; 23 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -1393,17 +1248,19 @@ local.tee $4 i32.load offset=4 local.tee $1 - i32.const 268435455 - i32.and - i32.const 0 - i32.gt_u - i32.const 0 - local.get $1 i32.const 1879048192 i32.and i32.const 805306368 i32.eq - select + if (result i32) + local.get $1 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + else + i32.const 0 + end if local.get $4 call $~lib/rt/pure/markGray @@ -1491,41 +1348,7 @@ local.get $5 global.set $~lib/rt/pure/CUR ) - (func $~lib/rt/__instanceof (; 27 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=8 - local.tee $0 - i32.const 304 - local.tee $2 - i32.load - i32.le_u - if - loop $continue|0 - local.get $0 - local.get $1 - i32.eq - if - i32.const 1 - return - end - local.get $2 - i32.const 4 - i32.add - local.get $0 - i32.const 3 - i32.shl - i32.add - i32.load offset=4 - local.tee $0 - br_if $continue|0 - end - end - i32.const 0 - ) - (func $~lib/memory/memory.init (; 28 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/memory/memory.init (; 24 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) i32.const 224 i32.const 272 i32.const 35 @@ -1533,7 +1356,7 @@ call $~lib/builtins/abort unreachable ) - (func $~lib/memory/memory.drop (; 29 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/memory/memory.drop (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 224 i32.const 272 i32.const 42 @@ -1541,7 +1364,7 @@ call $~lib/builtins/abort unreachable ) - (func $~lib/memory/memory.repeat (; 30 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/memory/memory.repeat (; 26 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) local.get $2 local.get $3 @@ -1566,7 +1389,7 @@ end end ) - (func $~lib/memory/memory.compare (; 31 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.compare (; 27 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.eq @@ -1612,7 +1435,14 @@ end end ) - (func $~lib/rt/pure/__visit (; 32 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/rt/tlsf/__free (; 28 ;) (type $FUNCSIG$vi) (param $0 i32) + global.get $~lib/rt/tlsf/ROOT + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/rt/pure/__visit (; 29 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) local.get $0 i32.const 332 i32.lt_u @@ -1628,11 +1458,21 @@ block $case3|0 block $case2|0 block $case1|0 - block $case0|0 + local.get $1 + i32.const 1 + i32.ne + if local.get $1 - i32.const 1 - i32.sub - br_table $case0|0 $case1|0 $case2|0 $case3|0 $case4|0 $break|0 + 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 $break|0 end local.get $0 call $~lib/rt/pure/decrement @@ -1672,7 +1512,7 @@ call $~lib/rt/pure/collectWhite end ) - (func $~lib/rt/__visit_members (; 33 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/rt/__visit_members (; 30 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) block $switch$1$default block $switch$1$case$4 block $switch$1$case$2 @@ -1696,7 +1536,7 @@ end unreachable ) - (func $null (; 34 ;) (type $FUNCSIG$v) + (func $null (; 31 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/allocators/rt-full/untouched.wat b/tests/allocators/rt-full/untouched.wat index e51d1ff4..2b88fc56 100644 --- a/tests/allocators/rt-full/untouched.wat +++ b/tests/allocators/rt-full/untouched.wat @@ -23,22 +23,21 @@ (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/rt/RTTI_BASE i32 (i32.const 352)) (global $~lib/heap/HEAP_BASE i32 (i32.const 380)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/tlsf/__alloc)) - (export "__realloc" (func $~lib/rt/tlsf/__realloc)) - (export "__free" (func $~lib/rt/tlsf/__free)) (export "__retain" (func $~lib/rt/pure/__retain)) (export "__release" (func $~lib/rt/pure/__release)) (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__instanceof" (func $~lib/rt/__instanceof)) - (export "__typeinfo" (func $~lib/rt/__typeinfo)) + (export "__rtti" (global $~lib/rt/RTTI_BASE)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) (export "memory.drop" (func $~lib/memory/memory.drop)) (export "memory.repeat" (func $~lib/memory/memory.repeat)) (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "__free" (func $~lib/rt/tlsf/__free)) (func $~lib/rt/tlsf/removeBlock (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) @@ -60,7 +59,7 @@ if i32.const 0 i32.const 24 - i32.const 275 + i32.const 276 i32.const 13 call $~lib/builtins/abort unreachable @@ -85,7 +84,7 @@ if i32.const 0 i32.const 24 - i32.const 277 + i32.const 278 i32.const 13 call $~lib/builtins/abort unreachable @@ -137,7 +136,7 @@ if i32.const 0 i32.const 24 - i32.const 290 + i32.const 291 i32.const 13 call $~lib/builtins/abort unreachable @@ -275,7 +274,7 @@ if i32.const 0 i32.const 24 - i32.const 203 + i32.const 204 i32.const 13 call $~lib/builtins/abort unreachable @@ -290,7 +289,7 @@ if i32.const 0 i32.const 24 - i32.const 205 + i32.const 206 i32.const 13 call $~lib/builtins/abort unreachable @@ -389,7 +388,7 @@ if i32.const 0 i32.const 24 - i32.const 226 + i32.const 227 i32.const 15 call $~lib/builtins/abort unreachable @@ -452,7 +451,7 @@ if i32.const 0 i32.const 24 - i32.const 241 + i32.const 242 i32.const 13 call $~lib/builtins/abort unreachable @@ -468,7 +467,7 @@ if i32.const 0 i32.const 24 - i32.const 242 + i32.const 243 i32.const 13 call $~lib/builtins/abort unreachable @@ -525,7 +524,7 @@ if i32.const 0 i32.const 24 - i32.const 258 + i32.const 259 i32.const 13 call $~lib/builtins/abort unreachable @@ -652,7 +651,7 @@ if i32.const 0 i32.const 24 - i32.const 384 + i32.const 385 i32.const 4 call $~lib/builtins/abort unreachable @@ -677,7 +676,7 @@ if i32.const 0 i32.const 24 - i32.const 394 + i32.const 395 i32.const 15 call $~lib/builtins/abort unreachable @@ -708,7 +707,7 @@ if i32.const 0 i32.const 24 - i32.const 406 + i32.const 407 i32.const 4 call $~lib/builtins/abort unreachable @@ -792,7 +791,7 @@ i32.xor i32.and local.set $0 - current_memory + memory.size local.set $1 local.get $0 i32.const 1572 @@ -813,7 +812,7 @@ local.get $2 local.get $1 i32.sub - grow_memory + memory.grow i32.const 0 i32.lt_s else @@ -918,7 +917,7 @@ i32.const -1 i32.xor i32.and - current_memory + memory.size i32.const 16 i32.shl call $~lib/rt/tlsf/addMemory @@ -935,7 +934,7 @@ if i32.const 72 i32.const 24 - i32.const 446 + i32.const 447 i32.const 29 call $~lib/builtins/abort unreachable @@ -1029,7 +1028,7 @@ if i32.const 0 i32.const 24 - i32.const 336 + i32.const 337 i32.const 13 call $~lib/builtins/abort unreachable @@ -1096,7 +1095,7 @@ if i32.const 0 i32.const 24 - i32.const 349 + i32.const 350 i32.const 17 call $~lib/builtins/abort unreachable @@ -1153,7 +1152,7 @@ (local $5 i32) (local $6 i32) (local $7 i32) - current_memory + memory.size local.set $2 local.get $1 i32.const 65535 @@ -1175,19 +1174,19 @@ select local.set $6 local.get $6 - grow_memory + memory.grow i32.const 0 i32.lt_s if local.get $3 - grow_memory + memory.grow i32.const 0 i32.lt_s if unreachable end end - current_memory + memory.size local.set $7 local.get $0 local.get $2 @@ -1214,7 +1213,7 @@ if i32.const 0 i32.const 24 - i32.const 363 + i32.const 364 i32.const 13 call $~lib/builtins/abort unreachable @@ -1323,7 +1322,7 @@ if i32.const 0 i32.const 24 - i32.const 476 + i32.const 477 i32.const 15 call $~lib/builtins/abort unreachable @@ -1341,7 +1340,7 @@ if i32.const 0 i32.const 24 - i32.const 478 + i32.const 479 i32.const 13 call $~lib/builtins/abort unreachable @@ -1384,7 +1383,1309 @@ i32.const 16 i32.add ) - (func $~lib/memory/memory.copy (; 11 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/rt/pure/increment (; 11 ;) (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 128 + 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 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 128 + i32.const 107 + i32.const 13 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/pure/__retain (; 12 ;) (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/rt/tlsf/freeBlock (; 13 ;) (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 24 + i32.const 531 + 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 + ) + (func $~lib/rt/__typeinfo (; 14 ;) (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 176 + i32.const 232 + 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/util/memory/memcpy (; 15 ;) (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 + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + br $continue|0 + end + end + 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 + 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.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 + end + 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 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + if + 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 + end + end + br $break|2 + unreachable + end + unreachable + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + if + 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 + end + end + br $break|2 + unreachable + end + unreachable + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + if + 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 + end + end + br $break|2 + unreachable + end + unreachable + end + end + local.get $2 + i32.const 16 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 8 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 4 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 2 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 1 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + ) + (func $~lib/memory/memory.copy (; 16 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1402,6 +2703,27 @@ 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 @@ -1590,328 +2912,7 @@ end end ) - (func $~lib/rt/tlsf/reallocateBlock (; 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.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 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 491 - i32.const 13 - 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 - block $~lib/rt/tlsf/GETRIGHT|inlined.4 (result i32) - 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 - end - 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=4 - i32.store offset=4 - 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 - local.get $1 - call $~lib/rt/tlsf/insertBlock - local.get $8 - ) - (func $~lib/rt/tlsf/__realloc (; 13 ;) (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 24 - i32.const 552 - 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 24 - i32.const 553 - 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/rt/tlsf/freeBlock (; 14 ;) (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 24 - i32.const 530 - 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 - ) - (func $~lib/rt/tlsf/__free (; 15 ;) (type $FUNCSIG$vi) (param $0 i32) - global.get $~lib/rt/tlsf/ROOT - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 560 - 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 24 - i32.const 561 - 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/increment (; 16 ;) (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 128 - i32.const 103 - 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 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 128 - i32.const 106 - i32.const 13 - call $~lib/builtins/abort - unreachable - end - ) - (func $~lib/rt/pure/__retain (; 17 ;) (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/rt/__typeinfo (; 18 ;) (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 176 - i32.const 232 - 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/pure/growRoots (; 19 ;) (type $FUNCSIG$v) + (func $~lib/rt/pure/growRoots (; 17 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -1956,7 +2957,7 @@ i32.add global.set $~lib/rt/pure/END ) - (func $~lib/rt/pure/appendRoot (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/appendRoot (; 18 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) global.get $~lib/rt/pure/CUR local.set $1 @@ -1976,7 +2977,7 @@ i32.add global.set $~lib/rt/pure/CUR ) - (func $~lib/rt/pure/decrement (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/decrement (; 19 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) (local $2 i32) local.get $0 @@ -1995,7 +2996,7 @@ if i32.const 0 i32.const 128 - i32.const 114 + i32.const 115 i32.const 13 call $~lib/builtins/abort unreachable @@ -2034,7 +3035,7 @@ if i32.const 0 i32.const 128 - i32.const 123 + i32.const 124 i32.const 15 call $~lib/builtins/abort unreachable @@ -2078,7 +3079,7 @@ end end ) - (func $~lib/rt/pure/__release (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/__release (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 global.get $~lib/heap/HEAP_BASE i32.gt_u @@ -2089,7 +3090,7 @@ call $~lib/rt/pure/decrement end ) - (func $~lib/rt/pure/markGray (; 23 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/markGray (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.load offset=4 @@ -2116,7 +3117,7 @@ call $~lib/rt/__visit_members end ) - (func $~lib/rt/pure/scanBlack (; 24 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/scanBlack (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 local.get $0 i32.load offset=4 @@ -2133,7 +3134,7 @@ i32.const 4 call $~lib/rt/__visit_members ) - (func $~lib/rt/pure/scan (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/scan (; 23 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.load offset=4 @@ -2170,7 +3171,7 @@ end end ) - (func $~lib/rt/pure/collectWhite (; 26 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/rt/pure/collectWhite (; 24 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) local.get $0 i32.load offset=4 @@ -2199,7 +3200,7 @@ local.get $0 call $~lib/rt/tlsf/freeBlock ) - (func $~lib/rt/pure/__collect (; 27 ;) (type $FUNCSIG$v) + (func $~lib/rt/pure/__collect (; 25 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -2347,44 +3348,7 @@ local.get $0 global.set $~lib/rt/pure/CUR ) - (func $~lib/rt/__instanceof (; 28 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=8 - local.set $2 - global.get $~lib/rt/RTTI_BASE - local.set $3 - local.get $2 - local.get $3 - i32.load - i32.le_u - if - loop $continue|0 - local.get $2 - local.get $1 - i32.eq - if - i32.const 1 - return - end - local.get $3 - i32.const 4 - i32.add - local.get $2 - i32.const 8 - i32.mul - i32.add - i32.load offset=4 - local.tee $2 - br_if $continue|0 - end - end - i32.const 0 - ) - (func $~lib/memory/memory.init (; 29 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/memory/memory.init (; 26 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) i32.const 272 i32.const 320 i32.const 35 @@ -2392,7 +3356,7 @@ call $~lib/builtins/abort unreachable ) - (func $~lib/memory/memory.drop (; 30 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/memory/memory.drop (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 272 i32.const 320 i32.const 42 @@ -2400,7 +3364,7 @@ call $~lib/builtins/abort unreachable ) - (func $~lib/memory/memory.repeat (; 31 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/memory/memory.repeat (; 28 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) i32.const 0 @@ -2430,7 +3394,7 @@ end end ) - (func $~lib/memory/memory.compare (; 32 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.compare (; 29 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2491,7 +3455,44 @@ end end ) - (func $~lib/rt/pure/__visit (; 33 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/rt/tlsf/__free (; 30 ;) (type $FUNCSIG$vi) (param $0 i32) + global.get $~lib/rt/tlsf/ROOT + i32.eqz + if + i32.const 0 + i32.const 24 + i32.const 561 + 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 24 + i32.const 562 + 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/__visit (; 31 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) local.get $0 @@ -2554,7 +3555,7 @@ if i32.const 0 i32.const 128 - i32.const 74 + i32.const 75 i32.const 17 call $~lib/builtins/abort unreachable @@ -2601,7 +3602,7 @@ if i32.const 0 i32.const 128 - i32.const 85 + i32.const 86 i32.const 6 call $~lib/builtins/abort unreachable @@ -2638,14 +3639,14 @@ if i32.const 0 i32.const 128 - i32.const 96 + i32.const 97 i32.const 24 call $~lib/builtins/abort unreachable end end ) - (func $~lib/rt/__visit_members (; 34 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/rt/__visit_members (; 32 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) block end @@ -2702,6 +3703,6 @@ unreachable end ) - (func $null (; 35 ;) (type $FUNCSIG$v) + (func $null (; 33 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/allocators/rt-stub/assembly/index.ts b/tests/allocators/rt-stub/assembly/index.ts index 27345be9..714330ba 100644 --- a/tests/allocators/rt-stub/assembly/index.ts +++ b/tests/allocators/rt-stub/assembly/index.ts @@ -1,2 +1,2 @@ export { memory } from "memory"; -export { __reset }; +export { __free, __reset }; diff --git a/tests/allocators/rt-stub/optimized.wat b/tests/allocators/rt-stub/optimized.wat index a6e1b8b3..6f8e128a 100644 --- a/tests/allocators/rt-stub/optimized.wat +++ b/tests/allocators/rt-stub/optimized.wat @@ -1,34 +1,31 @@ (module (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$ii (func (param i32) (result i32))) + (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) (type $FUNCSIG$viiii (func (param i32 i32 i32 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) "$\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 64) "\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 104) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00N\00o\00t\00 \00i\00m\00p\00l\00e\00m\00e\00n\00t\00e\00d") - (data (i32.const 152) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s") - (data (i32.const 200) "\03\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08") + (data (i32.const 8) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00N\00o\00t\00 \00i\00m\00p\00l\00e\00m\00e\00n\00t\00e\00d") + (data (i32.const 56) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s") + (data (i32.const 104) "\03\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08") (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) + (global $~lib/rt/RTTI_BASE i32 (i32.const 104)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/stub/__alloc)) - (export "__realloc" (func $~lib/rt/stub/__realloc)) - (export "__free" (func $~lib/rt/stub/__free)) (export "__retain" (func $~lib/rt/stub/__retain)) - (export "__release" (func $~lib/rt/stub/__free)) + (export "__release" (func $~lib/rt/stub/__release)) (export "__collect" (func $~lib/rt/stub/__collect)) - (export "__instanceof" (func $~lib/rt/__instanceof)) - (export "__typeinfo" (func $~lib/rt/__typeinfo)) + (export "__rtti" (global $~lib/rt/RTTI_BASE)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) (export "memory.drop" (func $~lib/memory/memory.drop)) (export "memory.repeat" (func $~lib/memory/memory.repeat)) (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "__free" (func $~lib/rt/stub/__release)) (export "__reset" (func $~lib/rt/stub/__reset)) (start $start) (func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -36,39 +33,37 @@ (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) local.get $0 i32.const 1073741808 i32.gt_u if unreachable end - local.get $0 - i32.const 1 - local.tee $2 - local.get $0 - local.get $2 - i32.gt_u - select global.get $~lib/rt/stub/offset i32.const 16 i32.add - local.tee $2 + 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 $3 - current_memory + local.tee $2 + memory.size local.tee $4 i32.const 16 i32.shl i32.gt_u if local.get $4 - local.get $3 local.get $2 + local.get $3 i32.sub i32.const 65535 i32.add @@ -77,17 +72,16 @@ i32.const 16 i32.shr_u local.tee $5 - local.tee $6 local.get $4 - local.get $6 + local.get $5 i32.gt_s select - grow_memory + memory.grow i32.const 0 i32.lt_s if local.get $5 - grow_memory + memory.grow i32.const 0 i32.lt_s if @@ -95,21 +89,47 @@ end end end - local.get $3 - global.set $~lib/rt/stub/offset local.get $2 + global.set $~lib/rt/stub/offset + local.get $3 i32.const 16 i32.sub - local.tee $3 + local.tee $2 local.get $1 i32.store offset=8 - local.get $3 + local.get $2 local.get $0 i32.store offset=12 - local.get $2 + local.get $3 ) - (func $~lib/memory/memory.copy (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/rt/stub/__retain (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + ) + (func $~lib/rt/stub/__release (; 3 ;) (type $FUNCSIG$vi) (param $0 i32) + nop + ) + (func $~lib/rt/stub/__collect (; 4 ;) (type $FUNCSIG$v) + nop + ) + (func $~lib/memory/memory.init (; 5 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + i32.const 24 + i32.const 72 + i32.const 35 + i32.const 4 + call $~lib/builtins/abort + unreachable + ) + (func $~lib/memory/memory.drop (; 6 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 24 + i32.const 72 + i32.const 42 + i32.const 4 + call $~lib/builtins/abort + unreachable + ) + (func $~lib/memory/memory.copy (; 7 ;) (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 @@ -146,16 +166,14 @@ 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 - block (result i32) - local.get $1 - local.tee $2 - i32.const 1 - i32.add - local.set $1 - local.get $2 - i32.load8_u - end + local.get $4 + i32.load8_u i32.store8 br $continue|0 end @@ -193,16 +211,14 @@ 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 - block (result i32) - local.get $1 - local.tee $2 - i32.const 1 - i32.add - local.set $1 - local.get $2 - i32.load8_u - end + local.get $4 + i32.load8_u i32.store8 local.get $3 i32.const 1 @@ -284,119 +300,7 @@ end end ) - (func $~lib/rt/stub/__realloc (; 3 ;) (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/rt/stub/__free (; 4 ;) (type $FUNCSIG$vi) (param $0 i32) - nop - ) - (func $~lib/rt/stub/__retain (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - ) - (func $~lib/rt/stub/__collect (; 6 ;) (type $FUNCSIG$v) - nop - ) - (func $~lib/rt/__instanceof (; 7 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=8 - local.tee $0 - i32.const 200 - local.tee $2 - i32.load - i32.le_u - if - loop $continue|0 - local.get $0 - local.get $1 - i32.eq - if - i32.const 1 - return - end - local.get $2 - i32.const 4 - i32.add - local.get $0 - i32.const 3 - i32.shl - i32.add - i32.load offset=4 - local.tee $0 - br_if $continue|0 - end - end - i32.const 0 - ) - (func $~lib/rt/__typeinfo (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - local.get $0 - i32.const 200 - local.tee $1 - i32.load - i32.gt_u - if - i32.const 24 - i32.const 80 - 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 3 - i32.shl - i32.add - i32.load - ) - (func $~lib/memory/memory.init (; 9 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) - i32.const 120 - i32.const 168 - i32.const 35 - i32.const 4 - call $~lib/builtins/abort - unreachable - ) - (func $~lib/memory/memory.drop (; 10 ;) (type $FUNCSIG$vi) (param $0 i32) - i32.const 120 - i32.const 168 - i32.const 42 - i32.const 4 - call $~lib/builtins/abort - unreachable - ) - (func $~lib/memory/memory.repeat (; 11 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/memory/memory.repeat (; 8 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) local.get $2 local.get $3 @@ -421,7 +325,7 @@ end end ) - (func $~lib/memory/memory.compare (; 12 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.compare (; 9 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 local.get $1 i32.eq @@ -467,12 +371,12 @@ end end ) - (func $~lib/rt/stub/__reset (; 13 ;) (type $FUNCSIG$v) + (func $~lib/rt/stub/__reset (; 10 ;) (type $FUNCSIG$v) global.get $~lib/rt/stub/startOffset global.set $~lib/rt/stub/offset ) - (func $start (; 14 ;) (type $FUNCSIG$v) - i32.const 240 + (func $start (; 11 ;) (type $FUNCSIG$v) + i32.const 144 global.set $~lib/rt/stub/startOffset global.get $~lib/rt/stub/startOffset global.set $~lib/rt/stub/offset diff --git a/tests/allocators/rt-stub/untouched.wat b/tests/allocators/rt-stub/untouched.wat index 664945c2..f1ae8fe6 100644 --- a/tests/allocators/rt-stub/untouched.wat +++ b/tests/allocators/rt-stub/untouched.wat @@ -1,38 +1,35 @@ (module (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$ii (func (param i32) (result i32))) + (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) (type $FUNCSIG$viiii (func (param i32 i32 i32 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) "$\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 64) "\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 104) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00N\00o\00t\00 \00i\00m\00p\00l\00e\00m\00e\00n\00t\00e\00d\00") - (data (i32.const 152) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s\00") - (data (i32.const 200) "\03\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00") + (data (i32.const 8) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00N\00o\00t\00 \00i\00m\00p\00l\00e\00m\00e\00n\00t\00e\00d\00") + (data (i32.const 56) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00m\00e\00m\00o\00r\00y\00.\00t\00s\00") + (data (i32.const 104) "\03\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00") (table $0 1 funcref) (elem (i32.const 0) $null) (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 200)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 228)) + (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) + (global $~lib/rt/RTTI_BASE i32 (i32.const 104)) + (global $~lib/heap/HEAP_BASE i32 (i32.const 132)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/stub/__alloc)) - (export "__realloc" (func $~lib/rt/stub/__realloc)) - (export "__free" (func $~lib/rt/stub/__free)) (export "__retain" (func $~lib/rt/stub/__retain)) (export "__release" (func $~lib/rt/stub/__release)) (export "__collect" (func $~lib/rt/stub/__collect)) - (export "__instanceof" (func $~lib/rt/__instanceof)) - (export "__typeinfo" (func $~lib/rt/__typeinfo)) + (export "__rtti" (global $~lib/rt/RTTI_BASE)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) (export "memory.drop" (func $~lib/memory/memory.drop)) (export "memory.repeat" (func $~lib/memory/memory.repeat)) (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "__free" (func $~lib/rt/stub/__free)) (export "__reset" (func $~lib/rt/stub/__reset)) (start $start) (func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -70,7 +67,7 @@ i32.xor i32.and local.set $5 - current_memory + memory.size local.set $6 local.get $5 local.get $6 @@ -100,12 +97,12 @@ select local.set $4 local.get $4 - grow_memory + memory.grow i32.const 0 i32.lt_s if local.get $3 - grow_memory + memory.grow i32.const 0 i32.lt_s if @@ -127,7 +124,1223 @@ i32.store offset=12 local.get $2 ) - (func $~lib/memory/memory.copy (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/rt/stub/__retain (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + ) + (func $~lib/rt/stub/__release (; 3 ;) (type $FUNCSIG$vi) (param $0 i32) + nop + ) + (func $~lib/rt/stub/__collect (; 4 ;) (type $FUNCSIG$v) + nop + ) + (func $~lib/memory/memory.init (; 5 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + i32.const 24 + i32.const 72 + i32.const 35 + i32.const 4 + call $~lib/builtins/abort + unreachable + ) + (func $~lib/memory/memory.drop (; 6 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 24 + i32.const 72 + i32.const 42 + i32.const 4 + call $~lib/builtins/abort + unreachable + ) + (func $~lib/util/memory/memcpy (; 7 ;) (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 + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + br $continue|0 + end + end + 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 + 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.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 + end + 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 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + if + 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 + end + end + br $break|2 + unreachable + end + unreachable + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + if + 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 + end + end + br $break|2 + unreachable + end + unreachable + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + 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 + if + 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 + end + end + br $break|2 + unreachable + end + unreachable + end + end + local.get $2 + i32.const 16 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 8 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 4 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 2 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 1 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + ) + (func $~lib/memory/memory.copy (; 8 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -145,6 +1358,27 @@ 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 @@ -333,130 +1567,7 @@ end end ) - (func $~lib/rt/stub/__realloc (; 3 ;) (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 - 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 - ) - (func $~lib/rt/stub/__free (; 4 ;) (type $FUNCSIG$vi) (param $0 i32) - nop - ) - (func $~lib/rt/stub/__retain (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - ) - (func $~lib/rt/stub/__release (; 6 ;) (type $FUNCSIG$vi) (param $0 i32) - nop - ) - (func $~lib/rt/stub/__collect (; 7 ;) (type $FUNCSIG$v) - nop - ) - (func $~lib/rt/__instanceof (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - local.get $0 - i32.const 16 - i32.sub - i32.load offset=8 - local.set $2 - global.get $~lib/rt/RTTI_BASE - local.set $3 - local.get $2 - local.get $3 - i32.load - i32.le_u - if - loop $continue|0 - local.get $2 - local.get $1 - i32.eq - if - i32.const 1 - return - end - local.get $3 - i32.const 4 - i32.add - local.get $2 - i32.const 8 - i32.mul - i32.add - i32.load offset=4 - local.tee $2 - br_if $continue|0 - end - end - i32.const 0 - ) - (func $~lib/rt/__typeinfo (; 9 ;) (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 24 - i32.const 80 - 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/memory/memory.init (; 10 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) - i32.const 120 - i32.const 168 - i32.const 35 - i32.const 4 - call $~lib/builtins/abort - unreachable - ) - (func $~lib/memory/memory.drop (; 11 ;) (type $FUNCSIG$vi) (param $0 i32) - i32.const 120 - i32.const 168 - i32.const 42 - i32.const 4 - call $~lib/builtins/abort - unreachable - ) - (func $~lib/memory/memory.repeat (; 12 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/memory/memory.repeat (; 9 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) i32.const 0 @@ -486,7 +1597,7 @@ end end ) - (func $~lib/memory/memory.compare (; 13 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.compare (; 10 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -547,11 +1658,14 @@ end end ) - (func $~lib/rt/stub/__reset (; 14 ;) (type $FUNCSIG$v) + (func $~lib/rt/stub/__free (; 11 ;) (type $FUNCSIG$vi) (param $0 i32) + nop + ) + (func $~lib/rt/stub/__reset (; 12 ;) (type $FUNCSIG$v) global.get $~lib/rt/stub/startOffset global.set $~lib/rt/stub/offset ) - (func $start (; 15 ;) (type $FUNCSIG$v) + (func $start (; 13 ;) (type $FUNCSIG$v) global.get $~lib/heap/HEAP_BASE i32.const 15 i32.add @@ -563,6 +1677,6 @@ global.get $~lib/rt/stub/startOffset global.set $~lib/rt/stub/offset ) - (func $null (; 16 ;) (type $FUNCSIG$v) + (func $null (; 14 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/compiler/retain-release-sanity.optimized.wat b/tests/compiler/retain-release-sanity.optimized.wat index 5f9b45f5..2243de44 100644 --- a/tests/compiler/retain-release-sanity.optimized.wat +++ b/tests/compiler/retain-release-sanity.optimized.wat @@ -28,7 +28,7 @@ (data (i32.const 608) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00b") (data (i32.const 632) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00n\00u\00l\00l") (data (i32.const 656) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00d") - (data (i32.const 680) "\05\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\00\00\00\02\00\00\00I\04\00\00\02") + (data (i32.const 680) "\05\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\02\00\00\02\00\00\00I\10\00\00\02") (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)) diff --git a/tests/compiler/retain-release-sanity.untouched.wat b/tests/compiler/retain-release-sanity.untouched.wat index b86cf02a..5e2c8412 100644 --- a/tests/compiler/retain-release-sanity.untouched.wat +++ b/tests/compiler/retain-release-sanity.untouched.wat @@ -28,7 +28,7 @@ (data (i32.const 608) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00b\00") (data (i32.const 632) "\08\00\00\00\01\00\00\00\01\00\00\00\08\00\00\00n\00u\00l\00l\00") (data (i32.const 656) "\02\00\00\00\01\00\00\00\01\00\00\00\02\00\00\00d\00") - (data (i32.const 680) "\05\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\00\00\00\02\00\00\00I\04\00\00\02\00\00\00") + (data (i32.const 680) "\05\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\02\00\00\02\00\00\00I\10\00\00\02\00\00\00") (table $0 1 funcref) (elem (i32.const 0) $null) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) diff --git a/tests/compiler/rt/flags.optimized.wat b/tests/compiler/rt/flags.optimized.wat index d8e725d0..cd420b81 100644 --- a/tests/compiler/rt/flags.optimized.wat +++ b/tests/compiler/rt/flags.optimized.wat @@ -7,11 +7,11 @@ (data (i32.const 8) "$\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 64) "\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 104) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00r\00t\00/\00f\00l\00a\00g\00s\00.\00t\00s") - (data (i32.const 144) "-\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\00\00\00\02\00\00\00)\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00\t\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\04\00\00\02\00\00\00I\06\00\00\02\00\00\00\1a\00\00\00\00\00\00\00*\00\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\00\00\00\00\00\00\00\n\01\00\00\00\00\00\00J\04\00\00\00\00\00\00J\06\00\00\00\00\00\00\1c\80\00\00\00\00\00\00,@\00\00\00\00\00\00L \00\00\00\00\00\00\8c\10\00\00\00\00\00\00\0c\t\00\00\00\00\00\00\1c \02\00\00\00\00\00\1c \03\00\00\00\00\00L\0c\00\00\00\00\00\00L\0e\00\00\00\00\00\00L&\03\00\00\00\00\00\08") - (data (i32.const 420) "A\04\00\00\02\00\00\00\08") - (data (i32.const 444) "B\04\00\00\00\00\00\00\08") - (data (i32.const 468) "D \02") - (data (i32.const 484) "D$\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08") + (data (i32.const 144) ":\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\02\00\00\02\00\00\00\19\00\00\00\02\00\00\00)\02\00\00\02\00\00\00)\00\00\00\02\00\00\00I\02\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\02\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\06\00\00\02\00\00\00\89\06\00\00\02\00\00\00\t\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00I\18\00\00\02\00\00\00\1a\02\00\00\00\00\00\00\1a\00\00\00\00\00\00\00*\02\00\00\00\00\00\00*\00\00\00\00\00\00\00J\02\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\02\00\00\00\00\00\00\8a\00\00\00\00\00\00\00J\06\00\00\00\00\00\00\8a\06\00\00\00\00\00\00\n\01\00\00\00\00\00\00J\10\00\00\00\00\00\00J\18\00\00\00\00\00\00\1c\02\02\00\00\00\00\00,\02\05\00\00\00\00\00L\82\04\00\00\00\00\00\8cB\04\00\00\00\00\00\0c!\04\00\00\00\00\00\1c\82 \00\00\00\00\00\1c\820\00\00\00\00\00L0\04\00\00\00\00\00L8\04\00\00\00\00\00L\980\00\00\00\00\00L\82\0c\00\00\00\00\00\08") + (data (i32.const 524) "A\10\00\00\02\00\00\00\08") + (data (i32.const 548) "B\10\00\00\00\00\00\00\08") + (data (i32.const 572) "D\82 ") + (data (i32.const 588) "D\90\04\00\00\00\00\00\08\00\00\00\00\00\00\00\08") (export "memory" (memory $0)) (start $start) (func $~lib/rt/__typeinfo (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) @@ -38,232 +38,323 @@ block $folding-inner0 i32.const 4 call $~lib/rt/__typeinfo - i32.const 25 + i32.const 537 i32.ne if br $folding-inner0 end i32.const 5 call $~lib/rt/__typeinfo - i32.const 41 + i32.const 25 i32.ne if br $folding-inner0 end i32.const 6 call $~lib/rt/__typeinfo - i32.const 73 + i32.const 553 i32.ne if br $folding-inner0 end i32.const 7 call $~lib/rt/__typeinfo - i32.const 137 + i32.const 41 i32.ne if br $folding-inner0 end i32.const 8 call $~lib/rt/__typeinfo - i32.const 265 + i32.const 585 + i32.ne + if + br $folding-inner0 + end + i32.const 9 + call $~lib/rt/__typeinfo + i32.const 73 i32.ne if br $folding-inner0 end i32.const 10 call $~lib/rt/__typeinfo - i32.const 1097 + i32.const 649 i32.ne if br $folding-inner0 end i32.const 11 call $~lib/rt/__typeinfo - i32.const 1609 + i32.const 137 i32.ne if br $folding-inner0 end i32.const 12 call $~lib/rt/__typeinfo - i32.const 26 + i32.const 1609 i32.ne if br $folding-inner0 end i32.const 13 call $~lib/rt/__typeinfo - i32.const 42 + i32.const 1673 i32.ne if br $folding-inner0 end i32.const 14 call $~lib/rt/__typeinfo - i32.const 74 - i32.ne - if - br $folding-inner0 - end - i32.const 15 - call $~lib/rt/__typeinfo - i32.const 138 + i32.const 265 i32.ne if br $folding-inner0 end i32.const 16 call $~lib/rt/__typeinfo - i32.const 266 + i32.const 4169 i32.ne if br $folding-inner0 end i32.const 17 call $~lib/rt/__typeinfo - i32.const 1098 + i32.const 6217 i32.ne if br $folding-inner0 end i32.const 18 call $~lib/rt/__typeinfo - i32.const 1610 + i32.const 538 i32.ne if br $folding-inner0 end i32.const 19 call $~lib/rt/__typeinfo - i32.const 32796 + i32.const 26 i32.ne if br $folding-inner0 end i32.const 20 call $~lib/rt/__typeinfo - i32.const 16428 + i32.const 554 i32.ne if br $folding-inner0 end i32.const 21 call $~lib/rt/__typeinfo - i32.const 8268 + i32.const 42 i32.ne if br $folding-inner0 end i32.const 22 call $~lib/rt/__typeinfo - i32.const 4236 + i32.const 586 i32.ne if br $folding-inner0 end i32.const 23 call $~lib/rt/__typeinfo - i32.const 2316 + i32.const 74 i32.ne if br $folding-inner0 end i32.const 24 call $~lib/rt/__typeinfo - i32.const 139292 + i32.const 650 i32.ne if br $folding-inner0 end i32.const 25 call $~lib/rt/__typeinfo - i32.const 204828 + i32.const 138 i32.ne if br $folding-inner0 end i32.const 26 call $~lib/rt/__typeinfo - i32.const 3148 + i32.const 1610 i32.ne if br $folding-inner0 end i32.const 27 call $~lib/rt/__typeinfo - i32.const 3660 + i32.const 1674 i32.ne if br $folding-inner0 end i32.const 28 call $~lib/rt/__typeinfo - i32.const 206412 + i32.const 266 i32.ne if br $folding-inner0 end i32.const 29 call $~lib/rt/__typeinfo - i32.const 8 + i32.const 4170 i32.ne if br $folding-inner0 end i32.const 30 call $~lib/rt/__typeinfo + i32.const 6218 + i32.ne if br $folding-inner0 end i32.const 31 call $~lib/rt/__typeinfo + i32.const 131612 + i32.ne + if + br $folding-inner0 + end + i32.const 32 + call $~lib/rt/__typeinfo + i32.const 328236 + i32.ne if br $folding-inner0 end i32.const 33 call $~lib/rt/__typeinfo + i32.const 295500 + i32.ne + if + br $folding-inner0 + end + i32.const 34 + call $~lib/rt/__typeinfo + i32.const 279180 + i32.ne if br $folding-inner0 end i32.const 35 call $~lib/rt/__typeinfo - i32.const 8 + i32.const 270604 i32.ne if br $folding-inner0 end i32.const 36 call $~lib/rt/__typeinfo + i32.const 2130460 + i32.ne + if + br $folding-inner0 + end + i32.const 37 + call $~lib/rt/__typeinfo + i32.const 3179036 + i32.ne if br $folding-inner0 end i32.const 38 call $~lib/rt/__typeinfo - i32.const 8 + i32.const 274508 i32.ne if br $folding-inner0 end i32.const 39 call $~lib/rt/__typeinfo + i32.const 276556 + i32.ne + if + br $folding-inner0 + end + i32.const 40 + call $~lib/rt/__typeinfo + i32.const 3184716 + i32.ne if br $folding-inner0 end i32.const 41 call $~lib/rt/__typeinfo + i32.const 819788 + i32.ne if br $folding-inner0 end - i32.const 43 + i32.const 42 call $~lib/rt/__typeinfo i32.const 8 i32.ne if br $folding-inner0 end + i32.const 43 + call $~lib/rt/__typeinfo + if + br $folding-inner0 + end i32.const 44 call $~lib/rt/__typeinfo + if + br $folding-inner0 + end + i32.const 46 + call $~lib/rt/__typeinfo + if + br $folding-inner0 + end + i32.const 48 + call $~lib/rt/__typeinfo + i32.const 8 + i32.ne + if + br $folding-inner0 + end + i32.const 49 + call $~lib/rt/__typeinfo + if + br $folding-inner0 + end + i32.const 51 + call $~lib/rt/__typeinfo + i32.const 8 + i32.ne + if + br $folding-inner0 + end + i32.const 52 + call $~lib/rt/__typeinfo + if + br $folding-inner0 + end + i32.const 54 + call $~lib/rt/__typeinfo + if + br $folding-inner0 + end + i32.const 56 + call $~lib/rt/__typeinfo + i32.const 8 + i32.ne + if + br $folding-inner0 + end + i32.const 57 + call $~lib/rt/__typeinfo i32.const 8 i32.ne if diff --git a/tests/compiler/rt/flags.ts b/tests/compiler/rt/flags.ts index b7c42eda..d42b0728 100644 --- a/tests/compiler/rt/flags.ts +++ b/tests/compiler/rt/flags.ts @@ -17,32 +17,45 @@ class Ref {} const VALUE_ALIGN_REF = sizeof() == 4 ? TypeinfoFlags.VALUE_ALIGN_2 : TypeinfoFlags.VALUE_ALIGN_3; const KEY_ALIGN_REF = sizeof() == 4 ? TypeinfoFlags.KEY_ALIGN_2 : TypeinfoFlags.KEY_ALIGN_3; -test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_0); -test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_1); -test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2); -test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3); +test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_0 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_0); +test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_1 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_1); +test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2); +test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3); +test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2 | TypeinfoFlags.VALUE_SIGNED | TypeinfoFlags.VALUE_FLOAT); +test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3 | TypeinfoFlags.VALUE_SIGNED | TypeinfoFlags.VALUE_FLOAT); test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_4); test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | VALUE_ALIGN_REF | TypeinfoFlags.VALUE_MANAGED); test>(TypeinfoFlags.ARRAY | TypeinfoFlags.ACYCLIC | VALUE_ALIGN_REF | TypeinfoFlags.VALUE_NULLABLE | TypeinfoFlags.VALUE_MANAGED); -test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_0); -test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_1); -test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2); -test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3); +test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_0 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_0); +test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_1 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_1); +test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2); +test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3); +test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_2 | TypeinfoFlags.VALUE_SIGNED | TypeinfoFlags.VALUE_FLOAT); +test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_3 | TypeinfoFlags.VALUE_SIGNED | TypeinfoFlags.VALUE_FLOAT); test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | TypeinfoFlags.VALUE_ALIGN_4); test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | VALUE_ALIGN_REF | TypeinfoFlags.VALUE_MANAGED); test>(TypeinfoFlags.SET | TypeinfoFlags.ACYCLIC | VALUE_ALIGN_REF | TypeinfoFlags.VALUE_NULLABLE | TypeinfoFlags.VALUE_MANAGED); -test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_4 | TypeinfoFlags.VALUE_ALIGN_0); -test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_3 | TypeinfoFlags.VALUE_ALIGN_1); -test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_2 | TypeinfoFlags.VALUE_ALIGN_2); -test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_1 | TypeinfoFlags.VALUE_ALIGN_3); -test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_0 | TypeinfoFlags.VALUE_ALIGN_4); -test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | KEY_ALIGN_REF | TypeinfoFlags.KEY_MANAGED | TypeinfoFlags.VALUE_ALIGN_0); -test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC |KEY_ALIGN_REF | TypeinfoFlags.KEY_NULLABLE | TypeinfoFlags.KEY_MANAGED | TypeinfoFlags.VALUE_ALIGN_0); -test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_0 | TypeinfoFlags.VALUE_MANAGED | VALUE_ALIGN_REF); -test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_0 | TypeinfoFlags.VALUE_NULLABLE | TypeinfoFlags.VALUE_MANAGED | VALUE_ALIGN_REF); +test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_4 | TypeinfoFlags.VALUE_ALIGN_0 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_3 | TypeinfoFlags.KEY_SIGNED | TypeinfoFlags.VALUE_ALIGN_1 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_2 | TypeinfoFlags.KEY_SIGNED | TypeinfoFlags.VALUE_ALIGN_2 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_1 | TypeinfoFlags.KEY_SIGNED | TypeinfoFlags.VALUE_ALIGN_3 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_0 | TypeinfoFlags.KEY_SIGNED | TypeinfoFlags.VALUE_ALIGN_4); +test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | KEY_ALIGN_REF | TypeinfoFlags.KEY_MANAGED | TypeinfoFlags.VALUE_ALIGN_0 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC |KEY_ALIGN_REF | TypeinfoFlags.KEY_NULLABLE | TypeinfoFlags.KEY_MANAGED | TypeinfoFlags.VALUE_ALIGN_0 | TypeinfoFlags.VALUE_SIGNED); +test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_0 | TypeinfoFlags.KEY_SIGNED | TypeinfoFlags.VALUE_MANAGED | VALUE_ALIGN_REF); +test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_0 | TypeinfoFlags.KEY_SIGNED | TypeinfoFlags.VALUE_NULLABLE | TypeinfoFlags.VALUE_MANAGED | VALUE_ALIGN_REF); test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_NULLABLE | TypeinfoFlags.KEY_MANAGED | KEY_ALIGN_REF | TypeinfoFlags.VALUE_NULLABLE | TypeinfoFlags.VALUE_MANAGED | VALUE_ALIGN_REF); +test>(TypeinfoFlags.MAP | TypeinfoFlags.ACYCLIC | TypeinfoFlags.KEY_ALIGN_2 | TypeinfoFlags.KEY_SIGNED | TypeinfoFlags.KEY_FLOAT | TypeinfoFlags.VALUE_ALIGN_2 | TypeinfoFlags.VALUE_SIGNED); // cycle detection diff --git a/tests/compiler/rt/flags.untouched.wat b/tests/compiler/rt/flags.untouched.wat index f923567d..0b944445 100644 --- a/tests/compiler/rt/flags.untouched.wat +++ b/tests/compiler/rt/flags.untouched.wat @@ -8,11 +8,11 @@ (data (i32.const 8) "$\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 64) "\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 104) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\00r\00t\00/\00f\00l\00a\00g\00s\00.\00t\00s\00") - (data (i32.const 144) "-\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\00\00\00\02\00\00\00)\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00\t\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\04\00\00\02\00\00\00I\06\00\00\02\00\00\00\1a\00\00\00\00\00\00\00*\00\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\00\00\00\00\00\00\00\n\01\00\00\00\00\00\00J\04\00\00\00\00\00\00J\06\00\00\00\00\00\00\1c\80\00\00\00\00\00\00,@\00\00\00\00\00\00L \00\00\00\00\00\00\8c\10\00\00\00\00\00\00\0c\t\00\00\00\00\00\00\1c \02\00\00\00\00\00\1c \03\00\00\00\00\00L\0c\00\00\00\00\00\00L\0e\00\00\00\00\00\00L&\03\00\00\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00A\04\00\00\02\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00B\04\00\00\00\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00D \02\00\00\00\00\00\00\00\00\00\00\00\00\00D$\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00") + (data (i32.const 144) ":\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\02\00\00\02\00\00\00\19\00\00\00\02\00\00\00)\02\00\00\02\00\00\00)\00\00\00\02\00\00\00I\02\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\02\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\06\00\00\02\00\00\00\89\06\00\00\02\00\00\00\t\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00I\18\00\00\02\00\00\00\1a\02\00\00\00\00\00\00\1a\00\00\00\00\00\00\00*\02\00\00\00\00\00\00*\00\00\00\00\00\00\00J\02\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\02\00\00\00\00\00\00\8a\00\00\00\00\00\00\00J\06\00\00\00\00\00\00\8a\06\00\00\00\00\00\00\n\01\00\00\00\00\00\00J\10\00\00\00\00\00\00J\18\00\00\00\00\00\00\1c\02\02\00\00\00\00\00,\02\05\00\00\00\00\00L\82\04\00\00\00\00\00\8cB\04\00\00\00\00\00\0c!\04\00\00\00\00\00\1c\82 \00\00\00\00\00\1c\820\00\00\00\00\00L0\04\00\00\00\00\00L8\04\00\00\00\00\00L\980\00\00\00\00\00L\82\0c\00\00\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00A\10\00\00\02\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00B\10\00\00\00\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00D\82 \00\00\00\00\00\00\00\00\00\00\00\00\00D\90\04\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00") (table $0 1 funcref) (elem (i32.const 0) $null) (global $rt/flags/VALUE_ALIGN_REF i32 (i32.const 64)) - (global $rt/flags/KEY_ALIGN_REF i32 (i32.const 8192)) + (global $rt/flags/KEY_ALIGN_REF i32 (i32.const 32768)) (global $~lib/rt/RTTI_BASE i32 (i32.const 144)) (export "memory" (memory $0)) (start $start) @@ -56,7 +56,7 @@ unreachable end ) - (func $rt/flags/test<~lib/array/Array> (; 3 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 3 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 5 call $~lib/rt/__typeinfo local.get $0 @@ -71,7 +71,7 @@ unreachable end ) - (func $rt/flags/test<~lib/array/Array> (; 4 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 4 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 6 call $~lib/rt/__typeinfo local.get $0 @@ -86,7 +86,7 @@ unreachable end ) - (func $rt/flags/test<~lib/array/Array> (; 5 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 5 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 7 call $~lib/rt/__typeinfo local.get $0 @@ -101,7 +101,7 @@ unreachable end ) - (func $rt/flags/test<~lib/array/Array> (; 6 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 6 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 8 call $~lib/rt/__typeinfo local.get $0 @@ -116,7 +116,22 @@ unreachable end ) - (func $rt/flags/test<~lib/array/Array> (; 7 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 7 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 9 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test<~lib/array/Array> (; 8 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 10 call $~lib/rt/__typeinfo local.get $0 @@ -131,7 +146,7 @@ unreachable end ) - (func $rt/flags/test<~lib/array/Array> (; 8 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 9 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 11 call $~lib/rt/__typeinfo local.get $0 @@ -146,7 +161,7 @@ unreachable end ) - (func $rt/flags/test<~lib/set/Set> (; 9 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 10 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 12 call $~lib/rt/__typeinfo local.get $0 @@ -161,7 +176,7 @@ unreachable end ) - (func $rt/flags/test<~lib/set/Set> (; 10 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 11 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 13 call $~lib/rt/__typeinfo local.get $0 @@ -176,7 +191,7 @@ unreachable end ) - (func $rt/flags/test<~lib/set/Set> (; 11 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 12 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 14 call $~lib/rt/__typeinfo local.get $0 @@ -191,22 +206,7 @@ unreachable end ) - (func $rt/flags/test<~lib/set/Set> (; 12 ;) (type $FUNCSIG$vi) (param $0 i32) - i32.const 15 - call $~lib/rt/__typeinfo - local.get $0 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 120 - i32.const 6 - i32.const 2 - call $~lib/builtins/abort - unreachable - end - ) - (func $rt/flags/test<~lib/set/Set> (; 13 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 13 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 16 call $~lib/rt/__typeinfo local.get $0 @@ -221,7 +221,7 @@ unreachable end ) - (func $rt/flags/test<~lib/set/Set> (; 14 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/array/Array> (; 14 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 17 call $~lib/rt/__typeinfo local.get $0 @@ -236,7 +236,7 @@ unreachable end ) - (func $rt/flags/test<~lib/set/Set> (; 15 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 15 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 18 call $~lib/rt/__typeinfo local.get $0 @@ -251,7 +251,7 @@ unreachable end ) - (func $rt/flags/test<~lib/map/Map> (; 16 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 16 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 19 call $~lib/rt/__typeinfo local.get $0 @@ -266,7 +266,7 @@ unreachable end ) - (func $rt/flags/test<~lib/map/Map> (; 17 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 17 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 20 call $~lib/rt/__typeinfo local.get $0 @@ -281,7 +281,7 @@ unreachable end ) - (func $rt/flags/test<~lib/map/Map> (; 18 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 18 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 21 call $~lib/rt/__typeinfo local.get $0 @@ -296,7 +296,7 @@ unreachable end ) - (func $rt/flags/test<~lib/map/Map> (; 19 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 19 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 22 call $~lib/rt/__typeinfo local.get $0 @@ -311,7 +311,7 @@ unreachable end ) - (func $rt/flags/test<~lib/map/Map> (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 23 call $~lib/rt/__typeinfo local.get $0 @@ -326,7 +326,7 @@ unreachable end ) - (func $rt/flags/test<~lib/map/Map> (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 24 call $~lib/rt/__typeinfo local.get $0 @@ -341,7 +341,7 @@ unreachable end ) - (func $rt/flags/test<~lib/map/Map> (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 25 call $~lib/rt/__typeinfo local.get $0 @@ -356,7 +356,7 @@ unreachable end ) - (func $rt/flags/test<~lib/map/Map> (; 23 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 23 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 26 call $~lib/rt/__typeinfo local.get $0 @@ -371,7 +371,7 @@ unreachable end ) - (func $rt/flags/test<~lib/map/Map> (; 24 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 24 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 27 call $~lib/rt/__typeinfo local.get $0 @@ -386,7 +386,7 @@ unreachable end ) - (func $rt/flags/test<~lib/map/Map> (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 28 call $~lib/rt/__typeinfo local.get $0 @@ -401,7 +401,7 @@ unreachable end ) - (func $rt/flags/test (; 26 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 26 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 29 call $~lib/rt/__typeinfo local.get $0 @@ -416,7 +416,7 @@ unreachable end ) - (func $rt/flags/test (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/set/Set> (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 30 call $~lib/rt/__typeinfo local.get $0 @@ -431,7 +431,7 @@ unreachable end ) - (func $rt/flags/test (; 28 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/map/Map> (; 28 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 31 call $~lib/rt/__typeinfo local.get $0 @@ -446,7 +446,22 @@ unreachable end ) - (func $rt/flags/test (; 29 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/map/Map> (; 29 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 32 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test<~lib/map/Map> (; 30 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 33 call $~lib/rt/__typeinfo local.get $0 @@ -461,7 +476,22 @@ unreachable end ) - (func $rt/flags/test (; 30 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/map/Map> (; 31 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 34 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test<~lib/map/Map> (; 32 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 35 call $~lib/rt/__typeinfo local.get $0 @@ -476,7 +506,7 @@ unreachable end ) - (func $rt/flags/test (; 31 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/map/Map> (; 33 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 36 call $~lib/rt/__typeinfo local.get $0 @@ -491,7 +521,22 @@ unreachable end ) - (func $rt/flags/test (; 32 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/map/Map> (; 34 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 37 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test<~lib/map/Map> (; 35 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 38 call $~lib/rt/__typeinfo local.get $0 @@ -506,7 +551,7 @@ unreachable end ) - (func $rt/flags/test (; 33 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/map/Map> (; 36 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 39 call $~lib/rt/__typeinfo local.get $0 @@ -521,7 +566,22 @@ unreachable end ) - (func $rt/flags/test (; 34 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test<~lib/map/Map> (; 37 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 40 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test<~lib/map/Map> (; 38 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 41 call $~lib/rt/__typeinfo local.get $0 @@ -536,7 +596,22 @@ unreachable end ) - (func $rt/flags/test (; 35 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test (; 39 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 42 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test (; 40 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 43 call $~lib/rt/__typeinfo local.get $0 @@ -551,7 +626,7 @@ unreachable end ) - (func $rt/flags/test (; 36 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $rt/flags/test (; 41 ;) (type $FUNCSIG$vi) (param $0 i32) i32.const 44 call $~lib/rt/__typeinfo local.get $0 @@ -566,34 +641,206 @@ unreachable end ) - (func $start:rt/flags (; 37 ;) (type $FUNCSIG$v) + (func $rt/flags/test (; 42 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 46 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test (; 43 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 48 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test (; 44 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 49 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test (; 45 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 51 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test (; 46 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 52 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test (; 47 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 54 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test (; 48 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 56 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $rt/flags/test (; 49 ;) (type $FUNCSIG$vi) (param $0 i32) + i32.const 57 + call $~lib/rt/__typeinfo + local.get $0 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 6 + i32.const 2 + call $~lib/builtins/abort + unreachable + end + ) + (func $start:rt/flags (; 50 ;) (type $FUNCSIG$v) i32.const 1 i32.const 8 i32.or i32.const 16 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/array/Array> i32.const 1 i32.const 8 i32.or + i32.const 16 + i32.or + call $rt/flags/test<~lib/array/Array> + i32.const 1 + i32.const 8 + i32.or i32.const 32 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/array/Array> i32.const 1 i32.const 8 i32.or + i32.const 32 + i32.or + call $rt/flags/test<~lib/array/Array> + i32.const 1 + i32.const 8 + i32.or i32.const 64 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/array/Array> i32.const 1 i32.const 8 i32.or + i32.const 64 + i32.or + call $rt/flags/test<~lib/array/Array> + i32.const 1 + i32.const 8 + i32.or i32.const 128 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/array/Array> i32.const 1 i32.const 8 i32.or + i32.const 128 + i32.or + call $rt/flags/test<~lib/array/Array> + i32.const 1 + i32.const 8 + i32.or + i32.const 64 + i32.or + i32.const 512 + i32.or + i32.const 1024 + i32.or + call $rt/flags/test<~lib/array/Array> + i32.const 1 + i32.const 8 + i32.or + i32.const 128 + i32.or + i32.const 512 + i32.or + i32.const 1024 + i32.or + call $rt/flags/test<~lib/array/Array> + i32.const 1 + i32.const 8 + i32.or i32.const 256 i32.or call $rt/flags/test<~lib/array/Array> @@ -602,7 +849,7 @@ i32.or global.get $rt/flags/VALUE_ALIGN_REF i32.or - i32.const 1024 + i32.const 4096 i32.or call $rt/flags/test<~lib/array/Array> i32.const 1 @@ -610,9 +857,9 @@ i32.or global.get $rt/flags/VALUE_ALIGN_REF i32.or - i32.const 512 + i32.const 2048 i32.or - i32.const 1024 + i32.const 4096 i32.or call $rt/flags/test<~lib/array/Array> i32.const 2 @@ -620,28 +867,80 @@ i32.or i32.const 16 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/set/Set> i32.const 2 i32.const 8 i32.or + i32.const 16 + i32.or + call $rt/flags/test<~lib/set/Set> + i32.const 2 + i32.const 8 + i32.or i32.const 32 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/set/Set> i32.const 2 i32.const 8 i32.or + i32.const 32 + i32.or + call $rt/flags/test<~lib/set/Set> + i32.const 2 + i32.const 8 + i32.or i32.const 64 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/set/Set> i32.const 2 i32.const 8 i32.or + i32.const 64 + i32.or + call $rt/flags/test<~lib/set/Set> + i32.const 2 + i32.const 8 + i32.or i32.const 128 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/set/Set> i32.const 2 i32.const 8 i32.or + i32.const 128 + i32.or + call $rt/flags/test<~lib/set/Set> + i32.const 2 + i32.const 8 + i32.or + i32.const 64 + i32.or + i32.const 512 + i32.or + i32.const 1024 + i32.or + call $rt/flags/test<~lib/set/Set> + i32.const 2 + i32.const 8 + i32.or + i32.const 128 + i32.or + i32.const 512 + i32.or + i32.const 1024 + i32.or + call $rt/flags/test<~lib/set/Set> + i32.const 2 + i32.const 8 + i32.or i32.const 256 i32.or call $rt/flags/test<~lib/set/Set> @@ -650,7 +949,7 @@ i32.or global.get $rt/flags/VALUE_ALIGN_REF i32.or - i32.const 1024 + i32.const 4096 i32.or call $rt/flags/test<~lib/set/Set> i32.const 2 @@ -658,47 +957,63 @@ i32.or global.get $rt/flags/VALUE_ALIGN_REF i32.or - i32.const 512 + i32.const 2048 i32.or - i32.const 1024 + i32.const 4096 i32.or call $rt/flags/test<~lib/set/Set> i32.const 4 i32.const 8 i32.or - i32.const 32768 + i32.const 131072 i32.or i32.const 16 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/map/Map> i32.const 4 i32.const 8 i32.or - i32.const 16384 + i32.const 65536 + i32.or + i32.const 262144 i32.or i32.const 32 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/map/Map> i32.const 4 i32.const 8 i32.or - i32.const 8192 + i32.const 32768 + i32.or + i32.const 262144 i32.or i32.const 64 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/map/Map> i32.const 4 i32.const 8 i32.or - i32.const 4096 + i32.const 16384 + i32.or + i32.const 262144 i32.or i32.const 128 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/map/Map> i32.const 4 i32.const 8 i32.or - i32.const 2048 + i32.const 8192 + i32.or + i32.const 262144 i32.or i32.const 256 i32.or @@ -708,29 +1023,35 @@ i32.or global.get $rt/flags/KEY_ALIGN_REF i32.or - i32.const 131072 + i32.const 2097152 i32.or i32.const 16 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/map/Map> i32.const 4 i32.const 8 i32.or global.get $rt/flags/KEY_ALIGN_REF i32.or - i32.const 65536 + i32.const 1048576 i32.or - i32.const 131072 + i32.const 2097152 i32.or i32.const 16 i32.or + i32.const 512 + i32.or call $rt/flags/test<~lib/map/Map> i32.const 4 i32.const 8 i32.or - i32.const 2048 + i32.const 8192 i32.or - i32.const 1024 + i32.const 262144 + i32.or + i32.const 4096 i32.or global.get $rt/flags/VALUE_ALIGN_REF i32.or @@ -738,11 +1059,13 @@ i32.const 4 i32.const 8 i32.or + i32.const 8192 + i32.or + i32.const 262144 + i32.or i32.const 2048 i32.or - i32.const 512 - i32.or - i32.const 1024 + i32.const 4096 i32.or global.get $rt/flags/VALUE_ALIGN_REF i32.or @@ -750,19 +1073,33 @@ i32.const 4 i32.const 8 i32.or - i32.const 65536 + i32.const 1048576 i32.or - i32.const 131072 + i32.const 2097152 i32.or global.get $rt/flags/KEY_ALIGN_REF i32.or - i32.const 512 + i32.const 2048 i32.or - i32.const 1024 + i32.const 4096 i32.or global.get $rt/flags/VALUE_ALIGN_REF i32.or call $rt/flags/test<~lib/map/Map> + i32.const 4 + i32.const 8 + i32.or + i32.const 32768 + i32.or + i32.const 262144 + i32.or + i32.const 524288 + i32.or + i32.const 64 + i32.or + i32.const 512 + i32.or + call $rt/flags/test<~lib/map/Map> i32.const 8 call $rt/flags/test i32.const 0 @@ -786,9 +1123,9 @@ i32.const 8 call $rt/flags/test ) - (func $start (; 38 ;) (type $FUNCSIG$v) + (func $start (; 51 ;) (type $FUNCSIG$v) call $start:rt/flags ) - (func $null (; 39 ;) (type $FUNCSIG$v) + (func $null (; 52 ;) (type $FUNCSIG$v) ) ) diff --git a/tests/compiler/std/array-literal.optimized.wat b/tests/compiler/std/array-literal.optimized.wat index e62301f4..1f2014f0 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -26,7 +26,7 @@ (data (i32.const 384) "(\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 440) "\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 488) "\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 528) "\t\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\04\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\04\00\00\02") + (data (i32.const 528) "\t\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\02\00\00\02\00\00\00I\02\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02") (global $std/array-literal/emptyArrayI32 i32 (i32.const 320)) (global $std/array-literal/i (mut i32) (i32.const 0)) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index d39430db..c02a4dcf 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -27,7 +27,7 @@ (data (i32.const 384) "(\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 440) "\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 488) "\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 528) "\t\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\04\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\04\00\00\02\00\00\00") + (data (i32.const 528) "\t\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\02\00\00\02\00\00\00I\02\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00") (table $0 1 funcref) (elem (i32.const 0) $null) (global $std/array-literal/staticArrayI8 i32 (i32.const 48)) diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 9d3391bb..478bdc0e 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -210,7 +210,7 @@ (data (i32.const 7176) "\02\00\00\00\01\00\00\00\00\00\00\00\02\00\00\00\01\02") (data (i32.const 7200) "\02\00\00\00\01\00\00\00\00\00\00\00\02\00\00\00\03\04") (data (i32.const 7224) "\04\00\00\00\01\00\00\00\00\00\00\00\04\00\00\00\01") - (data (i32.const 7248) "\1a\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\00\00\00\02\00\00\00\08\00\00\00\00\00\00\00\19\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00I\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\04\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\04\00\00\02\00\00\00I\06\00\00\02\00\00\00I\04\00\00\02\00\00\00\19\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00)\00\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\06\00\00\02\00\00\00\19\00\00\00\02\00\00\00)\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\04\00\00\02\00\00\00I\04\00\00\02\00\00\00I\04\00\00\02") + (data (i32.const 7248) "\1a\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\02\00\00\02\00\00\00\08\00\00\00\00\00\00\00\19\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00I\00\00\00\02\00\00\00I\06\00\00\02\00\00\00\89\06\00\00\02\00\00\00I\10\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00I\18\00\00\02\00\00\00I\10\00\00\02\00\00\00\19\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00)\02\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\18\00\00\02\00\00\00\19\02\00\00\02\00\00\00)\00\00\00\02\00\00\00\89\02\00\00\02\00\00\00I\10\00\00\02\00\00\00I\10\00\00\02\00\00\00I\10\00\00\02") (table $0 57 funcref) (elem (i32.const 0) $null $start:std/array~anonymous|0 $start:std/array~anonymous|1 $start:std/array~anonymous|2 $start:std/array~anonymous|3 $start:std/array~anonymous|2 $start:std/array~anonymous|5 $start:std/array~anonymous|6 $start:std/array~anonymous|7 $start:std/array~anonymous|8 $start:std/array~anonymous|9 $start:std/array~anonymous|10 $start:std/array~anonymous|11 $start:std/array~anonymous|12 $start:std/array~anonymous|13 $start:std/array~anonymous|14 $start:std/array~anonymous|15 $start:std/array~anonymous|16 $start:std/array~anonymous|17 $start:std/array~anonymous|16 $start:std/array~anonymous|19 $start:std/array~anonymous|20 $start:std/array~anonymous|21 $start:std/array~anonymous|22 $start:std/array~anonymous|23 $start:std/array~anonymous|24 $start:std/array~anonymous|25 $start:std/array~anonymous|26 $start:std/array~anonymous|27 $start:std/array~anonymous|28 $start:std/array~anonymous|29 $start:std/array~anonymous|29 $start:std/array~anonymous|31 $start:std/array~anonymous|32 $start:std/array~anonymous|33 $start:std/array~anonymous|29 $start:std/array~anonymous|35 $start:std/array~anonymous|29 $start:std/array~anonymous|29 $start:std/array~anonymous|31 $start:std/array~anonymous|32 $start:std/array~anonymous|33 $start:std/array~anonymous|29 $start:std/array~anonymous|35 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $start:std/array~anonymous|44 $~lib/util/sort/COMPARATOR~anonymous|0 $start:std/array~anonymous|44 $start:std/array~anonymous|47 $start:std/array~anonymous|48 $~lib/util/sort/COMPARATOR<~lib/string/String | null>~anonymous|0 $~lib/util/sort/COMPARATOR<~lib/string/String | null>~anonymous|0) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 81885009..01570d8d 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -207,7 +207,7 @@ (data (i32.const 7624) "\02\00\00\00\01\00\00\00\00\00\00\00\02\00\00\00\01\02") (data (i32.const 7648) "\02\00\00\00\01\00\00\00\00\00\00\00\02\00\00\00\03\04") (data (i32.const 7672) "\04\00\00\00\01\00\00\00\00\00\00\00\04\00\00\00\01\00\00\00") - (data (i32.const 7696) "\1a\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\00\00\00\02\00\00\00\08\00\00\00\00\00\00\00\19\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00I\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\04\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\04\00\00\02\00\00\00I\06\00\00\02\00\00\00I\04\00\00\02\00\00\00\19\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00)\00\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\06\00\00\02\00\00\00\19\00\00\00\02\00\00\00)\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\04\00\00\02\00\00\00I\04\00\00\02\00\00\00I\04\00\00\02\00\00\00") + (data (i32.const 7696) "\1a\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\02\00\00\02\00\00\00\08\00\00\00\00\00\00\00\19\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00I\00\00\00\02\00\00\00I\06\00\00\02\00\00\00\89\06\00\00\02\00\00\00I\10\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00I\18\00\00\02\00\00\00I\10\00\00\02\00\00\00\19\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00)\02\00\00\02\00\00\00\08\00\00\00\00\00\00\00I\18\00\00\02\00\00\00\19\02\00\00\02\00\00\00)\00\00\00\02\00\00\00\89\02\00\00\02\00\00\00I\10\00\00\02\00\00\00I\10\00\00\02\00\00\00I\10\00\00\02\00\00\00") (table $0 57 funcref) (elem (i32.const 0) $null $start:std/array~anonymous|0 $start:std/array~anonymous|1 $start:std/array~anonymous|2 $start:std/array~anonymous|3 $start:std/array~anonymous|4 $start:std/array~anonymous|5 $start:std/array~anonymous|6 $start:std/array~anonymous|7 $start:std/array~anonymous|8 $start:std/array~anonymous|9 $start:std/array~anonymous|10 $start:std/array~anonymous|11 $start:std/array~anonymous|12 $start:std/array~anonymous|13 $start:std/array~anonymous|14 $start:std/array~anonymous|15 $start:std/array~anonymous|16 $start:std/array~anonymous|17 $start:std/array~anonymous|18 $start:std/array~anonymous|19 $start:std/array~anonymous|20 $start:std/array~anonymous|21 $start:std/array~anonymous|22 $start:std/array~anonymous|23 $start:std/array~anonymous|24 $start:std/array~anonymous|25 $start:std/array~anonymous|26 $start:std/array~anonymous|27 $start:std/array~anonymous|28 $start:std/array~anonymous|29 $start:std/array~anonymous|30 $start:std/array~anonymous|31 $start:std/array~anonymous|32 $start:std/array~anonymous|33 $start:std/array~anonymous|34 $start:std/array~anonymous|35 $start:std/array~anonymous|36 $start:std/array~anonymous|37 $start:std/array~anonymous|38 $start:std/array~anonymous|39 $start:std/array~anonymous|40 $start:std/array~anonymous|41 $start:std/array~anonymous|42 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|0 $~lib/util/sort/COMPARATOR~anonymous|1 $start:std/array~anonymous|43 $start:std/array~anonymous|44 $start:std/array~anonymous|45 $start:std/array~anonymous|46 $start:std/array~anonymous|47 $start:std/array~anonymous|48 $~lib/util/sort/COMPARATOR<~lib/string/String | null>~anonymous|0 $~lib/util/sort/COMPARATOR<~lib/string/String>~anonymous|0) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index 2c3e1cd4..1e6198c8 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -35,7 +35,7 @@ (data (i32.const 264) "$\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 320) "\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 360) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00s\00t\00d\00/\00m\00a\00p\00.\00t\00s") - (data (i32.const 400) "\0d\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00L\08\00\00\00\00\00\00L\08\00\00\00\00\00\00L\10\00\00\00\00\00\00L\10\00\00\00\00\00\00L \00\00\00\00\00\00L \00\00\00\00\00\00L@\00\00\00\00\00\00L@\00\00\00\00\00\00L \00\00\00\00\00\00L@") + (data (i32.const 400) "\0d\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00L\"\04\00\00\00\00\00L\"\00\00\00\00\00\00LB\04\00\00\00\00\00LB\00\00\00\00\00\00L\82\04\00\00\00\00\00L\82\00\00\00\00\00\00L\02\05\00\00\00\00\00L\02\01\00\00\00\00\00L\82\0c\00\00\00\00\00L\02\0d") (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)) diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index 91746bbb..5c2b4222 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -31,7 +31,7 @@ (data (i32.const 264) "$\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 320) "\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 360) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00s\00t\00d\00/\00m\00a\00p\00.\00t\00s\00") - (data (i32.const 400) "\0d\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00L\08\00\00\00\00\00\00L\08\00\00\00\00\00\00L\10\00\00\00\00\00\00L\10\00\00\00\00\00\00L \00\00\00\00\00\00L \00\00\00\00\00\00L@\00\00\00\00\00\00L@\00\00\00\00\00\00L \00\00\00\00\00\00L@\00\00\00\00\00\00") + (data (i32.const 400) "\0d\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00L\"\04\00\00\00\00\00L\"\00\00\00\00\00\00LB\04\00\00\00\00\00LB\00\00\00\00\00\00L\82\04\00\00\00\00\00L\82\00\00\00\00\00\00L\02\05\00\00\00\00\00L\02\01\00\00\00\00\00L\82\0c\00\00\00\00\00L\02\0d\00\00\00\00\00") (table $0 1 funcref) (elem (i32.const 0) $null) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index 5c63c1f1..d364192a 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -32,7 +32,7 @@ (data (i32.const 264) "$\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 320) "\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 360) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00s\00t\00d\00/\00s\00e\00t\00.\00t\00s") - (data (i32.const 400) "\0d\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\1a\00\00\00\00\00\00\00\1a\00\00\00\00\00\00\00*\00\00\00\00\00\00\00*\00\00\00\00\00\00\00J\00\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\00\00\00\00\00\00\00\8a\00\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a") + (data (i32.const 400) "\0d\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\1a\02\00\00\00\00\00\00\1a\00\00\00\00\00\00\00*\02\00\00\00\00\00\00*\00\00\00\00\00\00\00J\02\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\02\00\00\00\00\00\00\8a\00\00\00\00\00\00\00J\06\00\00\00\00\00\00\8a\06") (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)) diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 1ad3716d..a6ab8704 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -31,7 +31,7 @@ (data (i32.const 264) "$\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 320) "\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 360) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00s\00t\00d\00/\00s\00e\00t\00.\00t\00s\00") - (data (i32.const 400) "\0d\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\1a\00\00\00\00\00\00\00\1a\00\00\00\00\00\00\00*\00\00\00\00\00\00\00*\00\00\00\00\00\00\00J\00\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\00\00\00\00\00\00\00\8a\00\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\00\00\00\00\00\00\00") + (data (i32.const 400) "\0d\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\1a\02\00\00\00\00\00\00\1a\00\00\00\00\00\00\00*\02\00\00\00\00\00\00*\00\00\00\00\00\00\00J\02\00\00\00\00\00\00J\00\00\00\00\00\00\00\8a\02\00\00\00\00\00\00\8a\00\00\00\00\00\00\00J\06\00\00\00\00\00\00\8a\06\00\00\00\00\00\00") (table $0 1 funcref) (elem (i32.const 0) $null) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index 5f0f4669..c8b5eb70 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -175,7 +175,7 @@ (data (i32.const 6392) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\001\00.\001\00e\00+\001\002\008") (data (i32.const 6424) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\001\00.\001\00e\00-\006\004") (data (i32.const 6456) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\000\00.\000\000\000\000\003\005\006\008\009") - (data (i32.const 6496) "\08\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\04\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00)\00\00\00\02\00\00\00I\00\00\00\02") + (data (i32.const 6496) "\08\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00I\02\00\00\02\00\00\00\89\00\00\00\02\00\00\00)\02\00\00\02\00\00\00I\00\00\00\02") (global $std/string/str (mut i32) (i32.const 24)) (global $std/string/nullStr i32 (i32.const 0)) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index fbd4a8b5..80f25e95 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -180,7 +180,7 @@ (data (i32.const 6840) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\001\00.\001\00e\00+\001\002\008\00") (data (i32.const 6872) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\001\00.\001\00e\00-\006\004\00") (data (i32.const 6904) "\16\00\00\00\01\00\00\00\01\00\00\00\16\00\00\000\00.\000\000\000\000\003\005\006\008\009\00") - (data (i32.const 6944) "\08\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\04\00\00\02\00\00\00I\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00)\00\00\00\02\00\00\00") + (data (i32.const 6944) "\08\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00I\10\00\00\02\00\00\00I\02\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00)\02\00\00\02\00\00\00") (table $0 1 funcref) (elem (i32.const 0) $null) (global $std/string/str (mut i32) (i32.const 24)) diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 699591f1..37b16c24 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -74,7 +74,7 @@ (data (i32.const 1464) "\10\00\00\00\01\00\00\00\0f\00\00\00\10\00\00\00\90\05\00\00\90\05\00\00$\00\00\00\t") (data (i32.const 1496) "B\00\00\00\01\00\00\00\01\00\00\00B\00\00\00T\00y\00p\00e\00d\00A\00r\00r\00a\00y\00 \00r\00e\00v\00e\00r\00s\00e\00 \00v\00a\00l\00u\00e\00 \00m\00i\00s\00m\00a\00t\00c\00h") (data (i32.const 1584) "V\00\00\00\01\00\00\00\01\00\00\00V\00\00\00T\00y\00p\00e\00d\00A\00r\00r\00a\00y\00 \00r\00e\00v\00e\00r\00s\00e\00 \00w\00i\00t\00h\00 \00b\00y\00t\00e\00O\00f\00f\00s\00e\00t\00 \00m\00i\00s\00m\00a\00t\00c\00h") - (data (i32.const 1688) "\10\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00)\00\00\00\02\00\00\00)\00\00\00\02\00\00\00I\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00I\00\00\00\02") + (data (i32.const 1688) "\10\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\02\00\00\02\00\00\00\19\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00)\02\00\00\02\00\00\00)\00\00\00\02\00\00\00I\02\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\02\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\06\00\00\02\00\00\00\89\06\00\00\02\00\00\00\19\02\00\00\02\00\00\00I\02\00\00\02") (table $0 112 funcref) (elem (i32.const 0) $null $~lib/util/sort/COMPARATOR~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float64Array,f64>~anonymous|0) (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index b290739e..2fb20fb2 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -76,7 +76,7 @@ (data (i32.const 1464) "\10\00\00\00\01\00\00\00\0f\00\00\00\10\00\00\00\90\05\00\00\90\05\00\00$\00\00\00\t\00\00\00") (data (i32.const 1496) "B\00\00\00\01\00\00\00\01\00\00\00B\00\00\00T\00y\00p\00e\00d\00A\00r\00r\00a\00y\00 \00r\00e\00v\00e\00r\00s\00e\00 \00v\00a\00l\00u\00e\00 \00m\00i\00s\00m\00a\00t\00c\00h\00") (data (i32.const 1584) "V\00\00\00\01\00\00\00\01\00\00\00V\00\00\00T\00y\00p\00e\00d\00A\00r\00r\00a\00y\00 \00r\00e\00v\00e\00r\00s\00e\00 \00w\00i\00t\00h\00 \00b\00y\00t\00e\00O\00f\00f\00s\00e\00t\00 \00m\00i\00s\00m\00a\00t\00c\00h\00") - (data (i32.const 1688) "\10\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00)\00\00\00\02\00\00\00)\00\00\00\02\00\00\00I\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00I\00\00\00\02\00\00\00") + (data (i32.const 1688) "\10\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\08\00\00\00\00\00\00\00\19\02\00\00\02\00\00\00\19\00\00\00\02\00\00\00\19\00\00\00\02\00\00\00)\02\00\00\02\00\00\00)\00\00\00\02\00\00\00I\02\00\00\02\00\00\00I\00\00\00\02\00\00\00\89\02\00\00\02\00\00\00\89\00\00\00\02\00\00\00I\06\00\00\02\00\00\00\89\06\00\00\02\00\00\00\19\02\00\00\02\00\00\00I\02\00\00\02\00\00\00") (table $0 112 funcref) (elem (i32.const 0) $null $~lib/util/sort/COMPARATOR~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Uint8ClampedArray,u8>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduce<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Uint8ClampedArray,u8>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testReduceRight<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Uint8ClampedArray,u8>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayMap<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint8ClampedArray,u8>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint8ClampedArray,u8>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint16Array,u16>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint32Array,u32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Uint64Array,u64>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArraySome<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint8ClampedArray,u8>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint8ClampedArray,u8>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint16Array,u16>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint32Array,u32>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Uint64Array,u64>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayFindIndex<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int8Array,i8>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8Array,u8>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8ClampedArray,u8>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint8ClampedArray,u8>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int16Array,i16>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint16Array,u16>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int32Array,i32>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint32Array,u32>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Int64Array,i64>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Uint64Array,u64>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float32Array,f32>~anonymous|1 $std/typedarray/testArrayEvery<~lib/typedarray/Float64Array,f64>~anonymous|0 $std/typedarray/testArrayEvery<~lib/typedarray/Float64Array,f64>~anonymous|1 $std/typedarray/testArrayForEach<~lib/typedarray/Int8Array,i8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint8Array,u8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint8ClampedArray,u8>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int16Array,i16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint16Array,u16>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int32Array,i32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint32Array,u32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Int64Array,i64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Uint64Array,u64>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float32Array,f32>~anonymous|0 $std/typedarray/testArrayForEach<~lib/typedarray/Float64Array,f64>~anonymous|0) (global $~lib/typedarray/Int8Array.BYTES_PER_ELEMENT i32 (i32.const 1))