diff --git a/src/resolver.ts b/src/resolver.ts index 43f8ba37..f32b8155 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -629,6 +629,18 @@ export class Resolver extends DiagnosticEmitter { } break; } + case ElementKind.FUNCTION_PROTOTYPE: { // function Symbol() + type Symbol = _Symbol + let shadowType = target.shadowType; + if (shadowType) { + if (!shadowType.is(CommonFlags.RESOLVED)) { + let resolvedType = this.resolveType(shadowType.typeNode, shadowType.parent, null, reportMode); + if (resolvedType) shadowType.setType(resolvedType); + } + let classReference = shadowType.type.classReference; + if (classReference) target = classReference.prototype; + break; + } + } } // Look up the member within @@ -672,6 +684,7 @@ export class Resolver extends DiagnosticEmitter { break; } } + this.error( DiagnosticCode.Property_0_does_not_exist_on_type_1, propertyAccess.property.range, propertyName, target.internalName diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 2544d66a..a3786559 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -1023,7 +1023,7 @@ declare class ArrayBuffer { /** Returns true if value is one of the ArrayBuffer views, such as typed array or a DataView **/ static isView(value: T): bool; /** Constructs a new array buffer of the given length in bytes. */ - constructor(length: i32, unsafe?: bool); + constructor(length: i32); /** Returns a copy of this array buffer's bytes from begin, inclusive, up to end, exclusive. */ slice(begin?: i32, end?: i32): ArrayBuffer; /** Returns a string representation of ArrayBuffer. */ diff --git a/std/assembly/map.ts b/std/assembly/map.ts index 7f4e8c44..1402ecfc 100644 --- a/std/assembly/map.ts +++ b/std/assembly/map.ts @@ -72,7 +72,7 @@ export class Map { this.buckets = new ArrayBuffer(bucketsSize); this.bucketsMask = INITIAL_CAPACITY - 1; const entriesSize = INITIAL_CAPACITY * ENTRY_SIZE(); - this.entries = new ArrayBuffer(entriesSize, true); + this.entries = new ArrayBuffer(entriesSize); this.entriesCapacity = INITIAL_CAPACITY; this.entriesOffset = 0; this.entriesCount = 0; @@ -147,7 +147,7 @@ export class Map { var newBucketsCapacity = (newBucketsMask + 1); var newBuckets = new ArrayBuffer(newBucketsCapacity * BUCKET_SIZE); var newEntriesCapacity = (newBucketsCapacity * FILL_FACTOR); - var newEntries = new ArrayBuffer(newEntriesCapacity * ENTRY_SIZE(), true); + var newEntries = new ArrayBuffer(newEntriesCapacity * ENTRY_SIZE()); // copy old entries to new entries var oldPtr = changetype(this.entries); diff --git a/std/assembly/runtime.ts b/std/assembly/runtime.ts index 8c3ab15e..ddce4370 100644 --- a/std/assembly/runtime.ts +++ b/std/assembly/runtime.ts @@ -12,8 +12,8 @@ export namespace runtime { // @ts-ignore: decorator @lazy @inline static readonly SIZE: usize = gc.implemented - ? (offsetof
( ) + AL_MASK) & ~AL_MASK // full header if GC is present - : (offsetof
("gc1") + AL_MASK) & ~AL_MASK; // half header if GC is absent + ? (offsetof( ) + AL_MASK) & ~AL_MASK // full header if GC is present + : (offsetof("gc1") + AL_MASK) & ~AL_MASK; // half header if GC is absent /** Magic value used to validate runtime headers. */ // @ts-ignore: decorator diff --git a/std/assembly/symbol.ts b/std/assembly/symbol.ts index ed5eb766..05124231 100644 --- a/std/assembly/symbol.ts +++ b/std/assembly/symbol.ts @@ -1,12 +1,83 @@ import { Map } from "./map"; -@lazy var stringToId: Map; -@lazy var idToString: Map; -@lazy var nextId: usize = 12; // Symbol.unscopables + 1 +// @ts-ignore: decorator +@lazy +var stringToId: Map; + +// @ts-ignore: decorator +@lazy +var idToString: Map; + +// @ts-ignore: decorator +@lazy +var nextId: usize = 12; // Symbol.unscopables + 1 + +@unmanaged abstract class _Symbol { + + // @ts-ignore: decorator + @lazy + static readonly hasInstance: symbol = changetype(1); + + // @ts-ignore: decorator + @lazy + static readonly isConcatSpreadable: symbol = changetype(2); + + // @ts-ignore: decorator + @lazy + static readonly isRegExp: symbol = changetype(3); + + // @ts-ignore: decorator + @lazy + static readonly iterator: symbol = changetype(3); + + // @ts-ignore: decorator + @lazy + static readonly match: symbol = changetype(4); + + // @ts-ignore: decorator + @lazy + static readonly replace: symbol = changetype(5); + + // @ts-ignore: decorator + @lazy + static readonly search: symbol = changetype(6); + + // @ts-ignore: decorator + @lazy + static readonly species: symbol = changetype(7); + + // @ts-ignore: decorator + @lazy + static readonly split: symbol = changetype(8); + + // @ts-ignore: decorator + @lazy + static readonly toPrimitive: symbol = changetype(9); + + // @ts-ignore: decorator + @lazy + static readonly toStringTag: symbol = changetype(10); + + // @ts-ignore: decorator + @lazy + static readonly unscopables: symbol = changetype(11); + + static for(key: string): symbol { + if (!stringToId) { stringToId = new Map(); idToString = new Map(); } + else if (stringToId.has(key)) return changetype(stringToId.get(key)); + var id = nextId++; + if (!id) unreachable(); // out of ids + stringToId.set(key, id); + idToString.set(id, key); + return changetype(id); + } + + static keyFor(sym: symbol): string | null { + return idToString !== null && idToString.has(changetype(sym)) + ? idToString.get(changetype(sym)) + : null; + } -@unmanaged -// @ts-ignore: nolib -export class symbol { toString(): string { var id = changetype(this); var str = ""; @@ -37,40 +108,7 @@ export function Symbol(description: string | null = null): symbol { return changetype(id); } -export namespace Symbol { +export type Symbol = _Symbol; - // well-known symbols - @lazy export const hasInstance = changetype(1); - @lazy export const isConcatSpreadable = changetype(2); - @lazy export const isRegExp = changetype(3); - @lazy export const iterator = changetype(3); - @lazy export const match = changetype(4); - @lazy export const replace = changetype(5); - @lazy export const search = changetype(6); - @lazy export const species = changetype(7); - @lazy export const split = changetype(8); - @lazy export const toPrimitive = changetype(9); - @lazy export const toStringTag = changetype(10); - @lazy export const unscopables = changetype(11); - - // FIXME - - /* tslint:disable */// not valid TS - // @ts-ignore: identifier - export function for(key: string): symbol { - if (!stringToId) { stringToId = new Map(); idToString = new Map(); } - else if (stringToId.has(key)) return changetype(stringToId.get(key)); - var id = nextId++; - if (!id) unreachable(); // out of ids - stringToId.set(key, id); - idToString.set(id, key); - return changetype(id); - } - /* tslint:enable */ - - export function keyFor(sym: symbol): string | null { - return idToString !== null && idToString.has(changetype(sym)) - ? idToString.get(changetype(sym)) - : null; - } -} +// @ts-ignore: nolib +export type symbol = _Symbol; diff --git a/tests/compiler/std/runtime.optimized.wat b/tests/compiler/std/runtime.optimized.wat index 95f0f5e0..5c669541 100644 --- a/tests/compiler/std/runtime.optimized.wat +++ b/tests/compiler/std/runtime.optimized.wat @@ -42,7 +42,7 @@ if i32.const 0 i32.const 16 - i32.const 132 + i32.const 130 i32.const 4 call $~lib/env/abort unreachable @@ -62,7 +62,7 @@ if i32.const 0 i32.const 16 - i32.const 155 + i32.const 153 i32.const 4 call $~lib/env/abort unreachable @@ -73,7 +73,7 @@ if i32.const 0 i32.const 16 - i32.const 156 + i32.const 154 i32.const 4 call $~lib/env/abort unreachable @@ -99,7 +99,7 @@ if i32.const 0 i32.const 16 - i32.const 77 + i32.const 76 i32.const 4 call $~lib/env/abort unreachable @@ -117,7 +117,7 @@ if i32.const 0 i32.const 16 - i32.const 78 + i32.const 77 i32.const 11 call $~lib/env/abort unreachable @@ -130,7 +130,7 @@ if i32.const 0 i32.const 16 - i32.const 416 + i32.const 414 i32.const 2 call $~lib/env/abort unreachable @@ -147,7 +147,7 @@ if i32.const 0 i32.const 16 - i32.const 146 + i32.const 144 i32.const 4 call $~lib/env/abort unreachable @@ -158,7 +158,7 @@ if i32.const 0 i32.const 16 - i32.const 147 + i32.const 145 i32.const 4 call $~lib/env/abort unreachable @@ -181,7 +181,7 @@ if i32.const 0 i32.const 16 - i32.const 126 + i32.const 124 i32.const 4 call $~lib/env/abort unreachable @@ -207,7 +207,7 @@ if i32.const 0 i32.const 16 - i32.const 246 + i32.const 244 i32.const 4 call $~lib/env/abort unreachable @@ -230,7 +230,7 @@ if i32.const 0 i32.const 16 - i32.const 248 + i32.const 246 i32.const 4 call $~lib/env/abort unreachable @@ -331,7 +331,7 @@ if i32.const 0 i32.const 16 - i32.const 69 + i32.const 68 i32.const 4 call $~lib/env/abort unreachable @@ -345,7 +345,7 @@ if i32.const 0 i32.const 16 - i32.const 70 + i32.const 69 i32.const 11 call $~lib/env/abort unreachable @@ -361,7 +361,7 @@ if i32.const 0 i32.const 16 - i32.const 322 + i32.const 320 i32.const 4 call $~lib/env/abort unreachable @@ -373,7 +373,7 @@ if i32.const 0 i32.const 16 - i32.const 323 + i32.const 321 i32.const 4 call $~lib/env/abort unreachable @@ -386,7 +386,7 @@ if i32.const 0 i32.const 16 - i32.const 324 + i32.const 322 i32.const 4 call $~lib/env/abort unreachable @@ -408,7 +408,7 @@ if i32.const 0 i32.const 16 - i32.const 177 + i32.const 175 i32.const 4 call $~lib/env/abort unreachable @@ -422,7 +422,7 @@ if i32.const 0 i32.const 16 - i32.const 179 + i32.const 177 i32.const 4 call $~lib/env/abort unreachable @@ -446,7 +446,7 @@ if i32.const 0 i32.const 16 - i32.const 181 + i32.const 179 i32.const 4 call $~lib/env/abort unreachable @@ -458,7 +458,7 @@ if i32.const 0 i32.const 16 - i32.const 185 + i32.const 183 i32.const 23 call $~lib/env/abort unreachable @@ -500,7 +500,7 @@ if i32.const 0 i32.const 16 - i32.const 199 + i32.const 197 i32.const 24 call $~lib/env/abort unreachable @@ -514,7 +514,7 @@ if i32.const 0 i32.const 16 - i32.const 201 + i32.const 199 i32.const 6 call $~lib/env/abort unreachable @@ -563,7 +563,7 @@ if i32.const 0 i32.const 16 - i32.const 214 + i32.const 212 i32.const 4 call $~lib/env/abort unreachable @@ -642,7 +642,7 @@ if i32.const 0 i32.const 16 - i32.const 365 + i32.const 363 i32.const 4 call $~lib/env/abort unreachable @@ -653,7 +653,7 @@ if i32.const 0 i32.const 16 - i32.const 366 + i32.const 364 i32.const 4 call $~lib/env/abort unreachable @@ -664,7 +664,7 @@ if i32.const 0 i32.const 16 - i32.const 367 + i32.const 365 i32.const 4 call $~lib/env/abort unreachable @@ -681,7 +681,7 @@ if i32.const 0 i32.const 16 - i32.const 372 + i32.const 370 i32.const 6 call $~lib/env/abort unreachable @@ -709,7 +709,7 @@ if i32.const 0 i32.const 16 - i32.const 381 + i32.const 379 i32.const 6 call $~lib/env/abort unreachable @@ -762,7 +762,7 @@ if i32.const 0 i32.const 16 - i32.const 410 + i32.const 408 i32.const 2 call $~lib/env/abort unreachable @@ -787,7 +787,7 @@ if i32.const 0 i32.const 16 - i32.const 284 + i32.const 282 i32.const 4 call $~lib/env/abort unreachable @@ -867,7 +867,7 @@ if i32.const 0 i32.const 16 - i32.const 311 + i32.const 309 i32.const 16 call $~lib/env/abort unreachable @@ -895,7 +895,7 @@ if i32.const 0 i32.const 16 - i32.const 336 + i32.const 334 i32.const 4 call $~lib/env/abort unreachable @@ -915,7 +915,7 @@ if i32.const 0 i32.const 16 - i32.const 337 + i32.const 335 i32.const 4 call $~lib/env/abort unreachable @@ -926,7 +926,7 @@ if i32.const 0 i32.const 16 - i32.const 338 + i32.const 336 i32.const 4 call $~lib/env/abort unreachable @@ -978,7 +978,7 @@ if i32.const 0 i32.const 16 - i32.const 356 + i32.const 354 i32.const 25 call $~lib/env/abort unreachable @@ -1143,7 +1143,7 @@ else i32.const 0 i32.const 16 - i32.const 465 + i32.const 467 i32.const 12 call $~lib/env/abort unreachable @@ -1160,7 +1160,7 @@ if i32.const 0 i32.const 16 - i32.const 468 + i32.const 470 i32.const 2 call $~lib/env/abort unreachable @@ -1170,7 +1170,7 @@ local.get $0 call $~lib/allocator/tlsf/Root#use ) - (func $~lib/runtime/ALLOC_RAW (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/runtime/runtime.allocRaw (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) i32.const 1 i32.const 32 @@ -1421,10 +1421,10 @@ local.get $1 call $~lib/util/memory/memset ) - (func $~lib/runtime/ALLOC (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/runtime/runtime.alloc (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 - call $~lib/runtime/ALLOC_RAW + call $~lib/runtime/runtime.allocRaw local.tee $1 local.get $0 call $~lib/memory/memory.fill @@ -2545,7 +2545,7 @@ if i32.const 0 i32.const 16 - i32.const 479 + i32.const 483 i32.const 6 call $~lib/env/abort unreachable @@ -2563,7 +2563,7 @@ end end ) - (func $~lib/runtime/REALLOC (; 24 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/runtime/runtime.realloc (; 24 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2637,8 +2637,8 @@ if i32.const 0 i32.const 184 - i32.const 83 - i32.const 8 + i32.const 96 + i32.const 10 call $~lib/env/abort unreachable end @@ -2667,15 +2667,15 @@ i32.store offset=4 local.get $0 ) - (func $~lib/runtime/unref (; 25 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/runtime/runtime.unref (; 25 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 232 i32.lt_u if i32.const 0 i32.const 184 - i32.const 104 - i32.const 2 + i32.const 117 + i32.const 4 call $~lib/env/abort unreachable end @@ -2689,8 +2689,8 @@ if i32.const 0 i32.const 184 - i32.const 106 - i32.const 2 + i32.const 119 + i32.const 4 call $~lib/env/abort unreachable end @@ -2736,7 +2736,7 @@ else i32.const 0 i32.const 72 - i32.const 36 + i32.const 30 i32.const 2 call $~lib/env/abort unreachable @@ -2836,7 +2836,7 @@ f64.const 0 call $~lib/env/trace i32.const 1 - call $~lib/runtime/ALLOC + call $~lib/runtime/runtime.alloc global.set $std/runtime/ref1 global.get $std/runtime/ref1 i32.const 16 @@ -2849,7 +2849,7 @@ if i32.const 0 i32.const 72 - i32.const 51 + i32.const 45 i32.const 0 call $~lib/env/abort unreachable @@ -2861,7 +2861,7 @@ if i32.const 0 i32.const 72 - i32.const 52 + i32.const 46 i32.const 0 call $~lib/env/abort unreachable @@ -2870,12 +2870,12 @@ local.tee $0 local.get $0 global.get $std/runtime/barrier1 - call $~lib/runtime/REALLOC + call $~lib/runtime/runtime.realloc i32.ne if i32.const 0 i32.const 72 - i32.const 53 + i32.const 47 i32.const 0 call $~lib/env/abort unreachable @@ -2887,14 +2887,14 @@ if i32.const 0 i32.const 72 - i32.const 54 + i32.const 48 i32.const 0 call $~lib/env/abort unreachable end global.get $std/runtime/ref1 global.get $std/runtime/barrier2 - call $~lib/runtime/REALLOC + call $~lib/runtime/runtime.realloc global.set $std/runtime/ref2 global.get $std/runtime/ref1 global.get $std/runtime/ref2 @@ -2902,7 +2902,7 @@ if i32.const 0 i32.const 72 - i32.const 56 + i32.const 50 i32.const 0 call $~lib/env/abort unreachable @@ -2918,16 +2918,16 @@ if i32.const 0 i32.const 72 - i32.const 58 + i32.const 52 i32.const 0 call $~lib/env/abort unreachable end global.get $std/runtime/ref2 - call $~lib/runtime/unref + call $~lib/runtime/runtime.unref call $~lib/allocator/tlsf/__memory_free global.get $std/runtime/barrier2 - call $~lib/runtime/ALLOC + call $~lib/runtime/runtime.alloc global.set $std/runtime/ref3 global.get $std/runtime/ref1 global.get $std/runtime/ref3 @@ -2935,17 +2935,17 @@ if i32.const 0 i32.const 72 - i32.const 61 + i32.const 55 i32.const 0 call $~lib/env/abort unreachable end global.get $std/runtime/barrier1 - call $~lib/runtime/ALLOC + call $~lib/runtime/runtime.alloc global.set $std/runtime/ref4 global.get $std/runtime/ref4 local.tee $0 - call $~lib/runtime/unref + call $~lib/runtime/runtime.unref i32.const 2 i32.store local.get $0 @@ -2956,7 +2956,7 @@ if i32.const 0 i32.const 72 - i32.const 65 + i32.const 59 i32.const 0 call $~lib/env/abort unreachable @@ -2972,7 +2972,7 @@ if i32.const 0 i32.const 72 - i32.const 67 + i32.const 61 i32.const 0 call $~lib/env/abort unreachable @@ -2984,13 +2984,13 @@ if i32.const 0 i32.const 72 - i32.const 68 + i32.const 62 i32.const 0 call $~lib/env/abort unreachable end i32.const 10 - call $~lib/runtime/ALLOC + call $~lib/runtime/runtime.alloc global.set $std/runtime/ref5 global.get $std/runtime/ref5 i32.const 16 @@ -3001,7 +3001,7 @@ if i32.const 0 i32.const 72 - i32.const 71 + i32.const 65 i32.const 0 call $~lib/env/abort unreachable @@ -3017,7 +3017,7 @@ if i32.const 0 i32.const 72 - i32.const 72 + i32.const 66 i32.const 0 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/runtime.untouched.wat b/tests/compiler/std/runtime.untouched.wat index b8192381..b22c518a 100644 --- a/tests/compiler/std/runtime.untouched.wat +++ b/tests/compiler/std/runtime.untouched.wat @@ -37,6 +37,8 @@ (global $~lib/allocator/tlsf/Root.SIZE i32 (i32.const 2916)) (global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0)) (global $std/runtime/register_ref (mut i32) (i32.const 0)) + (global $std/runtime/link_ref (mut i32) (i32.const 0)) + (global $std/runtime/link_parentRef (mut i32) (i32.const 0)) (global $~lib/gc/gc.implemented i32 (i32.const 1)) (global $std/runtime/barrier1 (mut i32) (i32.const 0)) (global $std/runtime/barrier2 (mut i32) (i32.const 0)) @@ -63,13 +65,13 @@ if i32.const 0 i32.const 16 - i32.const 110 + i32.const 109 i32.const 0 call $~lib/env/abort unreachable end ) - (func $~lib/runtime/ADJUST (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/runtime/runtime.adjust (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) i32.const 1 i32.const 32 local.get $0 @@ -112,7 +114,7 @@ if i32.const 0 i32.const 16 - i32.const 132 + i32.const 130 i32.const 4 call $~lib/env/abort unreachable @@ -133,7 +135,7 @@ if i32.const 0 i32.const 16 - i32.const 155 + i32.const 153 i32.const 4 call $~lib/env/abort unreachable @@ -145,7 +147,7 @@ if i32.const 0 i32.const 16 - i32.const 156 + i32.const 154 i32.const 4 call $~lib/env/abort unreachable @@ -178,7 +180,7 @@ if i32.const 0 i32.const 16 - i32.const 77 + i32.const 76 i32.const 4 call $~lib/env/abort unreachable @@ -198,7 +200,7 @@ if (result i32) i32.const 0 i32.const 16 - i32.const 78 + i32.const 77 i32.const 11 call $~lib/env/abort unreachable @@ -214,7 +216,7 @@ if i32.const 0 i32.const 16 - i32.const 416 + i32.const 414 i32.const 2 call $~lib/env/abort unreachable @@ -232,7 +234,7 @@ if i32.const 0 i32.const 16 - i32.const 146 + i32.const 144 i32.const 4 call $~lib/env/abort unreachable @@ -244,7 +246,7 @@ if i32.const 0 i32.const 16 - i32.const 147 + i32.const 145 i32.const 4 call $~lib/env/abort unreachable @@ -268,7 +270,7 @@ if i32.const 0 i32.const 16 - i32.const 126 + i32.const 124 i32.const 4 call $~lib/env/abort unreachable @@ -298,7 +300,7 @@ if i32.const 0 i32.const 16 - i32.const 246 + i32.const 244 i32.const 4 call $~lib/env/abort unreachable @@ -324,7 +326,7 @@ if i32.const 0 i32.const 16 - i32.const 248 + i32.const 246 i32.const 4 call $~lib/env/abort unreachable @@ -435,7 +437,7 @@ if i32.const 0 i32.const 16 - i32.const 69 + i32.const 68 i32.const 4 call $~lib/env/abort unreachable @@ -449,7 +451,7 @@ if (result i32) i32.const 0 i32.const 16 - i32.const 70 + i32.const 69 i32.const 11 call $~lib/env/abort unreachable @@ -466,7 +468,7 @@ if i32.const 0 i32.const 16 - i32.const 322 + i32.const 320 i32.const 4 call $~lib/env/abort unreachable @@ -479,7 +481,7 @@ if i32.const 0 i32.const 16 - i32.const 323 + i32.const 321 i32.const 4 call $~lib/env/abort unreachable @@ -492,7 +494,7 @@ if i32.const 0 i32.const 16 - i32.const 324 + i32.const 322 i32.const 4 call $~lib/env/abort unreachable @@ -518,7 +520,7 @@ if i32.const 0 i32.const 16 - i32.const 177 + i32.const 175 i32.const 4 call $~lib/env/abort unreachable @@ -533,7 +535,7 @@ if i32.const 0 i32.const 16 - i32.const 179 + i32.const 177 i32.const 4 call $~lib/env/abort unreachable @@ -559,7 +561,7 @@ if i32.const 0 i32.const 16 - i32.const 181 + i32.const 179 i32.const 4 call $~lib/env/abort unreachable @@ -571,7 +573,7 @@ if (result i32) i32.const 0 i32.const 16 - i32.const 185 + i32.const 183 i32.const 23 call $~lib/env/abort unreachable @@ -619,7 +621,7 @@ if (result i32) i32.const 0 i32.const 16 - i32.const 199 + i32.const 197 i32.const 24 call $~lib/env/abort unreachable @@ -637,7 +639,7 @@ if i32.const 0 i32.const 16 - i32.const 201 + i32.const 199 i32.const 6 call $~lib/env/abort unreachable @@ -692,7 +694,7 @@ if i32.const 0 i32.const 16 - i32.const 214 + i32.const 212 i32.const 4 call $~lib/env/abort unreachable @@ -783,7 +785,7 @@ if i32.const 0 i32.const 16 - i32.const 365 + i32.const 363 i32.const 4 call $~lib/env/abort unreachable @@ -796,7 +798,7 @@ if i32.const 0 i32.const 16 - i32.const 366 + i32.const 364 i32.const 4 call $~lib/env/abort unreachable @@ -809,7 +811,7 @@ if i32.const 0 i32.const 16 - i32.const 367 + i32.const 365 i32.const 4 call $~lib/env/abort unreachable @@ -830,7 +832,7 @@ if i32.const 0 i32.const 16 - i32.const 372 + i32.const 370 i32.const 6 call $~lib/env/abort unreachable @@ -859,7 +861,7 @@ if i32.const 0 i32.const 16 - i32.const 381 + i32.const 379 i32.const 6 call $~lib/env/abort unreachable @@ -930,7 +932,7 @@ if i32.const 0 i32.const 16 - i32.const 410 + i32.const 408 i32.const 2 call $~lib/env/abort unreachable @@ -946,7 +948,7 @@ if i32.const 0 i32.const 16 - i32.const 410 + i32.const 408 i32.const 2 call $~lib/env/abort unreachable @@ -976,7 +978,7 @@ if i32.const 0 i32.const 16 - i32.const 284 + i32.const 282 i32.const 4 call $~lib/env/abort unreachable @@ -1072,7 +1074,7 @@ else i32.const 0 i32.const 16 - i32.const 311 + i32.const 309 i32.const 16 call $~lib/env/abort unreachable @@ -1109,7 +1111,7 @@ if i32.const 0 i32.const 16 - i32.const 336 + i32.const 334 i32.const 4 call $~lib/env/abort unreachable @@ -1129,7 +1131,7 @@ if i32.const 0 i32.const 16 - i32.const 337 + i32.const 335 i32.const 4 call $~lib/env/abort unreachable @@ -1142,7 +1144,7 @@ if i32.const 0 i32.const 16 - i32.const 338 + i32.const 336 i32.const 4 call $~lib/env/abort unreachable @@ -1202,7 +1204,7 @@ if (result i32) i32.const 0 i32.const 16 - i32.const 356 + i32.const 354 i32.const 25 call $~lib/env/abort unreachable @@ -1428,7 +1430,7 @@ if (result i32) i32.const 0 i32.const 16 - i32.const 465 + i32.const 467 i32.const 12 call $~lib/env/abort unreachable @@ -1449,7 +1451,7 @@ if i32.const 0 i32.const 16 - i32.const 468 + i32.const 470 i32.const 2 call $~lib/env/abort unreachable @@ -1464,10 +1466,10 @@ call $~lib/allocator/tlsf/__memory_allocate return ) - (func $~lib/runtime/ALLOC_RAW (; 24 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/runtime/runtime.allocRaw (; 24 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 - call $~lib/runtime/ADJUST + call $~lib/runtime/runtime.adjust call $~lib/memory/memory.allocate local.set $1 local.get $1 @@ -1746,10 +1748,10 @@ local.get $2 call $~lib/util/memory/memset ) - (func $~lib/runtime/ALLOC (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/runtime/runtime.alloc (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 - call $~lib/runtime/ALLOC_RAW + call $~lib/runtime/runtime.allocRaw local.set $1 local.get $1 i32.const 0 @@ -3216,7 +3218,7 @@ if i32.const 0 i32.const 16 - i32.const 479 + i32.const 483 i32.const 6 call $~lib/env/abort unreachable @@ -3246,7 +3248,7 @@ local.get $0 call $std/runtime/__gc_register ) - (func $~lib/runtime/REALLOC (; 35 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/runtime/runtime.realloc (; 35 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3264,10 +3266,10 @@ i32.lt_u if local.get $1 - call $~lib/runtime/ADJUST + call $~lib/runtime/runtime.adjust local.set $4 local.get $3 - call $~lib/runtime/ADJUST + call $~lib/runtime/runtime.adjust i32.const 0 local.get $0 global.get $~lib/memory/HEAP_BASE @@ -3316,8 +3318,8 @@ if i32.const 0 i32.const 184 - i32.const 83 - i32.const 8 + i32.const 96 + i32.const 10 call $~lib/env/abort unreachable end @@ -3349,7 +3351,7 @@ i32.store offset=4 local.get $0 ) - (func $~lib/runtime/unref (; 36 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/runtime/runtime.unref (; 36 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) local.get $0 global.get $~lib/memory/HEAP_BASE @@ -3360,8 +3362,8 @@ if i32.const 0 i32.const 184 - i32.const 104 - i32.const 2 + i32.const 117 + i32.const 4 call $~lib/env/abort unreachable end @@ -3377,16 +3379,16 @@ if i32.const 0 i32.const 184 - i32.const 106 - i32.const 2 + i32.const 119 + i32.const 4 call $~lib/env/abort unreachable end local.get $1 ) - (func $~lib/runtime/FREE (; 37 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/runtime/runtime.free (; 37 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - call $~lib/runtime/unref + call $~lib/runtime/runtime.unref call $~lib/memory/memory.free ) (func $~lib/arraybuffer/ArrayBuffer#get:byteLength (; 38 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) @@ -3413,20 +3415,20 @@ if i32.const 0 i32.const 72 - i32.const 28 + i32.const 22 i32.const 0 call $~lib/env/abort unreachable end i32.const 0 - call $~lib/runtime/ADJUST + call $~lib/runtime/runtime.adjust i32.const 0 i32.gt_u i32.eqz if i32.const 0 i32.const 72 - i32.const 34 + i32.const 28 i32.const 0 call $~lib/env/abort unreachable @@ -3441,13 +3443,13 @@ i32.eqz br_if $break|0 local.get $0 - call $~lib/runtime/ADJUST + call $~lib/runtime/runtime.adjust call $std/runtime/isPowerOf2 i32.eqz if i32.const 0 i32.const 72 - i32.const 36 + i32.const 30 i32.const 2 call $~lib/env/abort unreachable @@ -3462,7 +3464,7 @@ unreachable end i32.const 0 - call $~lib/runtime/ADJUST + call $~lib/runtime/runtime.adjust global.set $std/runtime/barrier1 global.get $std/runtime/barrier1 i32.const 1 @@ -3473,9 +3475,9 @@ global.get $std/runtime/barrier2 i32.const 1 i32.add - call $~lib/runtime/ADJUST + call $~lib/runtime/runtime.adjust global.get $std/runtime/barrier2 - call $~lib/runtime/ADJUST + call $~lib/runtime/runtime.adjust i32.eq if global.get $std/runtime/barrier2 @@ -3495,9 +3497,9 @@ global.get $std/runtime/barrier3 i32.const 1 i32.add - call $~lib/runtime/ADJUST + call $~lib/runtime/runtime.adjust global.get $std/runtime/barrier3 - call $~lib/runtime/ADJUST + call $~lib/runtime/runtime.adjust i32.eq if global.get $std/runtime/barrier3 @@ -3536,7 +3538,7 @@ f64.const 0 call $~lib/env/trace i32.const 1 - call $~lib/runtime/ALLOC + call $~lib/runtime/runtime.alloc global.set $std/runtime/ref1 global.get $std/runtime/ref1 i32.const 16 @@ -3550,7 +3552,7 @@ if i32.const 0 i32.const 72 - i32.const 51 + i32.const 45 i32.const 0 call $~lib/env/abort unreachable @@ -3563,7 +3565,7 @@ if i32.const 0 i32.const 72 - i32.const 52 + i32.const 46 i32.const 0 call $~lib/env/abort unreachable @@ -3571,13 +3573,13 @@ global.get $std/runtime/ref1 global.get $std/runtime/ref1 global.get $std/runtime/barrier1 - call $~lib/runtime/REALLOC + call $~lib/runtime/runtime.realloc i32.eq i32.eqz if i32.const 0 i32.const 72 - i32.const 53 + i32.const 47 i32.const 0 call $~lib/env/abort unreachable @@ -3590,14 +3592,14 @@ if i32.const 0 i32.const 72 - i32.const 54 + i32.const 48 i32.const 0 call $~lib/env/abort unreachable end global.get $std/runtime/ref1 global.get $std/runtime/barrier2 - call $~lib/runtime/REALLOC + call $~lib/runtime/runtime.realloc global.set $std/runtime/ref2 global.get $std/runtime/ref1 global.get $std/runtime/ref2 @@ -3606,7 +3608,7 @@ if i32.const 0 i32.const 72 - i32.const 56 + i32.const 50 i32.const 0 call $~lib/env/abort unreachable @@ -3623,15 +3625,15 @@ if i32.const 0 i32.const 72 - i32.const 58 + i32.const 52 i32.const 0 call $~lib/env/abort unreachable end global.get $std/runtime/ref2 - call $~lib/runtime/FREE + call $~lib/runtime/runtime.free global.get $std/runtime/barrier2 - call $~lib/runtime/ALLOC + call $~lib/runtime/runtime.alloc global.set $std/runtime/ref3 global.get $std/runtime/ref1 global.get $std/runtime/ref3 @@ -3640,19 +3642,19 @@ if i32.const 0 i32.const 72 - i32.const 61 + i32.const 55 i32.const 0 call $~lib/env/abort unreachable end global.get $std/runtime/barrier1 - call $~lib/runtime/ALLOC + call $~lib/runtime/runtime.alloc global.set $std/runtime/ref4 - block $~lib/runtime/REGISTER|inlined.0 (result i32) + block $~lib/runtime/runtime.register|inlined.0 (result i32) global.get $std/runtime/ref4 local.set $0 local.get $0 - call $~lib/runtime/unref + call $~lib/runtime/runtime.unref i32.const 2 i32.store local.get $0 @@ -3667,7 +3669,7 @@ if i32.const 0 i32.const 72 - i32.const 65 + i32.const 59 i32.const 0 call $~lib/env/abort unreachable @@ -3684,7 +3686,7 @@ if i32.const 0 i32.const 72 - i32.const 67 + i32.const 61 i32.const 0 call $~lib/env/abort unreachable @@ -3697,13 +3699,13 @@ if i32.const 0 i32.const 72 - i32.const 68 + i32.const 62 i32.const 0 call $~lib/env/abort unreachable end i32.const 10 - call $~lib/runtime/ALLOC + call $~lib/runtime/runtime.alloc global.set $std/runtime/ref5 global.get $std/runtime/ref5 call $~lib/arraybuffer/ArrayBuffer#get:byteLength @@ -3713,7 +3715,7 @@ if i32.const 0 i32.const 72 - i32.const 71 + i32.const 65 i32.const 0 call $~lib/env/abort unreachable @@ -3726,7 +3728,7 @@ if i32.const 0 i32.const 72 - i32.const 72 + i32.const 66 i32.const 0 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index 6f80b62d..b03c49fe 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -1,47 +1,47 @@ (module - (type $FUNCSIG$v (func)) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$vi (func (param i32))) - (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (type $FUNCSIG$viii (func (param i32 i32 i32))) (type $FUNCSIG$iii (func (param i32 i32) (result i32))) + (type $FUNCSIG$viii (func (param i32 i32 i32))) + (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$vii (func (param i32 i32))) + (type $FUNCSIG$v (func)) (type $FUNCSIG$i (func (result i32))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (memory $0 1) - (data (i32.const 8) "\03\00\00\001\002\003") - (data (i32.const 24) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s") - (data (i32.const 56) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") - (data (i32.const 104) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") - (data (i32.const 176) "\0b\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e") - (data (i32.const 208) "\12\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e") - (data (i32.const 248) "\08\00\00\00i\00s\00R\00e\00g\00E\00x\00p") - (data (i32.const 272) "\05\00\00\00m\00a\00t\00c\00h") - (data (i32.const 288) "\07\00\00\00r\00e\00p\00l\00a\00c\00e") - (data (i32.const 312) "\06\00\00\00s\00e\00a\00r\00c\00h") - (data (i32.const 328) "\07\00\00\00s\00p\00e\00c\00i\00e\00s") - (data (i32.const 352) "\05\00\00\00s\00p\00l\00i\00t") - (data (i32.const 368) "\0b\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e") - (data (i32.const 400) "\0b\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g") - (data (i32.const 432) "\0b\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s") - (data (i32.const 464) "\07\00\00\00S\00y\00m\00b\00o\00l\00(") - (data (i32.const 488) "\04\00\00\00n\00u\00l\00l") - (data (i32.const 504) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") - (data (i32.const 536) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") - (data (i32.const 592) "\01\00\00\00)") - (data (i32.const 600) "\08\00\00\00S\00y\00m\00b\00o\00l\00(\00)") - (data (i32.const 624) "\0b\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)") - (data (i32.const 656) "\13\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)") - (data (i32.const 704) "\1a\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)") + (data (i32.const 8) "\01\00\00\00\06\00\00\001\002\003") + (data (i32.const 24) "\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s") + (data (i32.const 64) "\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") + (data (i32.const 112) "\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s") + (data (i32.const 152) "\01") + (data (i32.const 160) "\01\00\00\00\16\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e") + (data (i32.const 192) "\01\00\00\00$\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e") + (data (i32.const 240) "\01\00\00\00\10\00\00\00i\00s\00R\00e\00g\00E\00x\00p") + (data (i32.const 264) "\01\00\00\00\n\00\00\00m\00a\00t\00c\00h") + (data (i32.const 288) "\01\00\00\00\0e\00\00\00r\00e\00p\00l\00a\00c\00e") + (data (i32.const 312) "\01\00\00\00\0c\00\00\00s\00e\00a\00r\00c\00h") + (data (i32.const 336) "\01\00\00\00\0e\00\00\00s\00p\00e\00c\00i\00e\00s") + (data (i32.const 360) "\01\00\00\00\n\00\00\00s\00p\00l\00i\00t") + (data (i32.const 384) "\01\00\00\00\16\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e") + (data (i32.const 416) "\01\00\00\00\16\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g") + (data (i32.const 448) "\01\00\00\00\16\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s") + (data (i32.const 480) "\01\00\00\00\0e\00\00\00S\00y\00m\00b\00o\00l\00(") + (data (i32.const 504) "\01\00\00\00\08\00\00\00n\00u\00l\00l") + (data (i32.const 520) "\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 560) "\01\00\00\00\02\00\00\00)") + (data (i32.const 576) "\01\00\00\00\10\00\00\00S\00y\00m\00b\00o\00l\00(\00)") + (data (i32.const 600) "\01\00\00\00\16\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)") + (data (i32.const 632) "\01\00\00\00&\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)") + (data (i32.const 680) "\01\00\00\004\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)") (table $0 1 funcref) (elem (i32.const 0) $null) - (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) - (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $~lib/symbol/nextId (mut i32) (i32.const 12)) (global $std/symbol/sym1 (mut i32) (i32.const 0)) (global $std/symbol/sym2 (mut i32) (i32.const 0)) (global $~lib/symbol/stringToId (mut i32) (i32.const 0)) + (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) + (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $~lib/symbol/idToString (mut i32) (i32.const 0)) (global $std/symbol/sym3 (mut i32) (i32.const 0)) (global $std/symbol/sym4 (mut i32) (i32.const 0)) @@ -116,19 +116,8 @@ global.set $~lib/allocator/arena/offset local.get $1 ) - (func $~lib/internal/arraybuffer/allocateUnsafe (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/runtime/runtime.allocRaw (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - local.get $0 - i32.const 1073741816 - i32.gt_u - if - i32.const 0 - i32.const 104 - i32.const 26 - i32.const 2 - call $~lib/env/abort - unreachable - end i32.const 1 i32.const 32 local.get $0 @@ -139,11 +128,16 @@ i32.shl call $~lib/allocator/arena/__memory_allocate local.tee $1 - local.get $0 + i32.const -1520547049 i32.store local.get $1 + local.get $0 + i32.store offset=4 + local.get $1 + i32.const 8 + i32.add ) - (func $~lib/internal/memory/memset (; 3 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/util/memory/memset (; 3 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) local.get $1 i32.eqz @@ -362,37 +356,63 @@ end end ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 4 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) + (func $~lib/runtime/runtime.unref (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 748 + i32.lt_u + if + i32.const 0 + i32.const 120 + i32.const 117 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 8 + i32.sub + local.tee $0 + i32.load + i32.const -1520547049 + i32.ne + if + i32.const 0 + i32.const 120 + i32.const 119 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) local.get $0 i32.const 1073741816 i32.gt_u if i32.const 0 - i32.const 56 - i32.const 47 - i32.const 40 + i32.const 72 + i32.const 24 + i32.const 59 call $~lib/env/abort unreachable end local.get $0 - call $~lib/internal/arraybuffer/allocateUnsafe - local.set $2 + call $~lib/runtime/runtime.allocRaw + local.tee $1 + local.get $0 + call $~lib/util/memory/memset local.get $1 - i32.eqz - if - local.get $2 - i32.const 8 - i32.add - local.get $0 - call $~lib/internal/memory/memset - end - local.get $2 + local.tee $0 + call $~lib/runtime/runtime.unref + i32.const 2 + i32.store + local.get $0 ) - (func $~lib/map/Map#clear (; 5 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/map/Map#clear (; 6 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 16 - i32.const 0 call $~lib/arraybuffer/ArrayBuffer#constructor i32.store local.get $0 @@ -400,7 +420,6 @@ i32.store offset=4 local.get $0 i32.const 48 - i32.const 1 call $~lib/arraybuffer/ArrayBuffer#constructor i32.store offset=8 local.get $0 @@ -413,7 +432,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/map/Map#constructor (; 6 ;) (type $FUNCSIG$i) (result i32) + (func $~lib/map/Map#constructor (; 7 ;) (type $FUNCSIG$i) (result i32) (local $0 i32) i32.const 24 call $~lib/allocator/arena/__memory_allocate @@ -439,50 +458,53 @@ call $~lib/map/Map#clear local.get $0 ) - (func $~lib/internal/hash/hashStr (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/hash/hashStr (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) i32.const -2128831035 - local.set $2 + local.set $1 local.get $0 - i32.load + i32.const 8 + i32.sub + i32.load offset=4 + i32.const 1 + i32.shr_u i32.const 1 i32.shl local.set $3 loop $repeat|0 - block $break|0 - local.get $1 - local.get $3 - i32.ge_u - br_if $break|0 + local.get $2 + local.get $3 + i32.lt_u + if local.get $0 - local.get $1 - i32.add - i32.load8_u offset=4 local.get $2 + i32.add + i32.load8_u + local.get $1 i32.xor i32.const 16777619 i32.mul - local.set $2 - local.get $1 + local.set $1 + local.get $2 i32.const 1 i32.add - local.set $1 + local.set $2 br $repeat|0 end end - local.get $2 + local.get $1 ) - (func $~lib/internal/string/compareUnsafe (; 8 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/string/compareImpl (; 9 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) loop $continue|0 local.get $2 if (result i32) local.get $0 - i32.load16_u offset=4 + i32.load16_u local.get $1 - i32.load16_u offset=4 + i32.load16_u i32.sub local.tee $3 i32.eqz @@ -507,7 +529,7 @@ end local.get $3 ) - (func $~lib/string/String.__eq (; 9 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.eq (; 10 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 local.get $1 @@ -519,22 +541,29 @@ local.get $0 i32.eqz local.tee $2 - i32.eqz - if + if (result i32) + local.get $2 + else local.get $1 i32.eqz - local.set $2 end - local.get $2 if i32.const 0 return end local.get $0 - i32.load + i32.const 8 + i32.sub + i32.load offset=4 + i32.const 1 + i32.shr_u local.tee $2 local.get $1 - i32.load + i32.const 8 + i32.sub + i32.load offset=4 + i32.const 1 + i32.shr_u i32.ne if i32.const 0 @@ -543,10 +572,10 @@ local.get $0 local.get $1 local.get $2 - call $~lib/internal/string/compareUnsafe + call $~lib/util/string/compareImpl i32.eqz ) - (func $~lib/map/Map#find (; 10 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#find (; 11 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.load local.get $0 @@ -556,7 +585,7 @@ i32.const 2 i32.shl i32.add - i32.load offset=8 + i32.load local.set $1 loop $continue|0 local.get $1 @@ -570,8 +599,8 @@ if (result i32) local.get $1 i32.load - i32.const 8 - call $~lib/string/String.__eq + i32.const 16 + call $~lib/string/String.eq else local.get $0 end @@ -589,7 +618,7 @@ end i32.const 0 ) - (func $~lib/map/Map#rehash (; 11 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 12 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -600,13 +629,12 @@ local.get $1 i32.const 1 i32.add - local.tee $2 + local.tee $4 i32.const 2 i32.shl - i32.const 0 call $~lib/arraybuffer/ArrayBuffer#constructor - local.set $4 - local.get $2 + local.set $5 + local.get $4 f64.convert_i32_s f64.const 2.6666666666666665 f64.mul @@ -614,13 +642,10 @@ local.tee $6 i32.const 12 i32.mul - i32.const 1 call $~lib/arraybuffer/ArrayBuffer#constructor - local.set $5 + local.set $4 local.get $0 i32.load offset=8 - i32.const 8 - i32.add local.tee $2 local.get $0 i32.load offset=16 @@ -628,9 +653,7 @@ i32.mul i32.add local.set $7 - local.get $5 - i32.const 8 - i32.add + local.get $4 local.set $3 loop $continue|0 local.get $2 @@ -654,19 +677,19 @@ local.get $3 local.get $2 i32.load - call $~lib/internal/hash/hashStr + call $~lib/util/hash/hashStr local.get $1 i32.and i32.const 2 i32.shl - local.get $4 + local.get $5 i32.add local.tee $8 - i32.load offset=8 + i32.load i32.store offset=8 local.get $8 local.get $3 - i32.store offset=8 + i32.store local.get $3 i32.const 12 i32.add @@ -680,13 +703,13 @@ end end local.get $0 - local.get $4 + local.get $5 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.get $5 + local.get $4 i32.store offset=8 local.get $0 local.get $6 @@ -696,13 +719,13 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/map/Map#set (; 12 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#set (; 13 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) local.get $0 - i32.const 8 - call $~lib/internal/hash/hashStr + i32.const 16 + call $~lib/util/hash/hashStr local.tee $4 call $~lib/map/Map#find local.tee $2 @@ -750,15 +773,13 @@ i32.const 1 i32.add i32.store offset=16 - local.get $2 - i32.const 8 - i32.add local.get $3 i32.const 12 i32.mul + local.get $2 i32.add local.tee $2 - i32.const 8 + i32.const 16 i32.store local.get $2 local.get $1 @@ -780,14 +801,14 @@ i32.shl i32.add local.tee $3 - i32.load offset=8 + i32.load i32.store offset=8 local.get $3 local.get $2 - i32.store offset=8 + i32.store end ) - (func $~lib/internal/hash/hash32 (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/hash/hash32 (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.const 255 i32.and @@ -818,7 +839,7 @@ i32.const 16777619 i32.mul ) - (func $~lib/map/Map#find (; 14 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 15 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 i32.load local.get $0 @@ -828,7 +849,7 @@ i32.const 2 i32.shl i32.add - i32.load offset=8 + i32.load local.set $2 loop $continue|0 local.get $2 @@ -861,7 +882,7 @@ end i32.const 0 ) - (func $~lib/map/Map#rehash (; 15 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 16 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -872,13 +893,12 @@ local.get $1 i32.const 1 i32.add - local.tee $2 + local.tee $4 i32.const 2 i32.shl - i32.const 0 call $~lib/arraybuffer/ArrayBuffer#constructor - local.set $4 - local.get $2 + local.set $5 + local.get $4 f64.convert_i32_s f64.const 2.6666666666666665 f64.mul @@ -886,13 +906,10 @@ local.tee $6 i32.const 12 i32.mul - i32.const 1 call $~lib/arraybuffer/ArrayBuffer#constructor - local.set $5 + local.set $4 local.get $0 i32.load offset=8 - i32.const 8 - i32.add local.tee $2 local.get $0 i32.load offset=16 @@ -900,9 +917,7 @@ i32.mul i32.add local.set $7 - local.get $5 - i32.const 8 - i32.add + local.get $4 local.set $3 loop $continue|0 local.get $2 @@ -926,19 +941,19 @@ local.get $3 local.get $2 i32.load - call $~lib/internal/hash/hash32 + call $~lib/util/hash/hash32 local.get $1 i32.and i32.const 2 i32.shl - local.get $4 + local.get $5 i32.add local.tee $8 - i32.load offset=8 + i32.load i32.store offset=8 local.get $8 local.get $3 - i32.store offset=8 + i32.store local.get $3 i32.const 12 i32.add @@ -952,13 +967,13 @@ end end local.get $0 - local.get $4 + local.get $5 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.get $5 + local.get $4 i32.store offset=8 local.get $0 local.get $6 @@ -968,20 +983,20 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/map/Map#set (; 16 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#set (; 17 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) local.get $0 local.get $1 local.get $1 - call $~lib/internal/hash/hash32 + call $~lib/util/hash/hash32 local.tee $4 call $~lib/map/Map#find local.tee $2 if local.get $2 - i32.const 8 + i32.const 16 i32.store offset=4 else local.get $0 @@ -1023,18 +1038,16 @@ i32.const 1 i32.add i32.store offset=16 - local.get $2 - i32.const 8 - i32.add local.get $3 i32.const 12 i32.mul + local.get $2 i32.add local.tee $2 local.get $1 i32.store local.get $2 - i32.const 8 + i32.const 16 i32.store offset=4 local.get $0 local.get $0 @@ -1053,25 +1066,25 @@ i32.shl i32.add local.tee $3 - i32.load offset=8 + i32.load i32.store offset=8 local.get $3 local.get $2 - i32.store offset=8 + i32.store end ) - (func $~lib/symbol/Symbol.for (; 17 ;) (type $FUNCSIG$i) (result i32) + (func $~lib/symbol/_Symbol.for (; 18 ;) (type $FUNCSIG$i) (result i32) (local $0 i32) global.get $~lib/symbol/stringToId if global.get $~lib/symbol/stringToId - i32.const 8 - call $~lib/internal/hash/hashStr + i32.const 16 + call $~lib/util/hash/hashStr call $~lib/map/Map#find if global.get $~lib/symbol/stringToId - i32.const 8 - call $~lib/internal/hash/hashStr + i32.const 16 + call $~lib/util/hash/hashStr call $~lib/map/Map#find local.tee $0 if (result i32) @@ -1106,20 +1119,20 @@ call $~lib/map/Map#set local.get $0 ) - (func $~lib/map/Map#has (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 19 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 local.get $1 - call $~lib/internal/hash/hash32 + call $~lib/util/hash/hash32 call $~lib/map/Map#find i32.const 0 i32.ne ) - (func $~lib/map/Map#get (; 19 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 20 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 local.get $1 - call $~lib/internal/hash/hash32 + call $~lib/util/hash/hash32 call $~lib/map/Map#find local.tee $0 if (result i32) @@ -1129,7 +1142,7 @@ unreachable end ) - (func $~lib/symbol/Symbol.keyFor (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/symbol/_Symbol.keyFor (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) global.get $~lib/symbol/idToString i32.const 0 @@ -1150,40 +1163,7 @@ i32.const 0 end ) - (func $~lib/internal/string/allocateUnsafe (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - local.get $0 - i32.const 0 - i32.gt_s - local.tee $1 - if - local.get $0 - i32.const 536870910 - i32.le_s - local.set $1 - end - local.get $1 - i32.eqz - if - i32.const 0 - i32.const 536 - i32.const 14 - i32.const 2 - call $~lib/env/abort - unreachable - end - local.get $0 - i32.const 1 - i32.shl - i32.const 4 - i32.add - call $~lib/allocator/arena/__memory_allocate - local.tee $1 - local.get $0 - i32.store - local.get $1 - ) - (func $~lib/internal/memory/memcpy (; 22 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/memory/memcpy (; 22 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2080,7 +2060,7 @@ i32.store8 end ) - (func $~lib/internal/memory/memmove (; 23 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/memory/memmove (; 23 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) local.get $0 @@ -2109,7 +2089,7 @@ local.get $0 local.get $1 local.get $2 - call $~lib/internal/memory/memcpy + call $~lib/util/memory/memcpy return end local.get $0 @@ -2278,21 +2258,11 @@ end end ) - (func $~lib/internal/string/copyUnsafe (; 24 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) - local.get $1 - i32.const 1 - i32.shl + (func $~lib/memory/memory.copy (; 24 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) local.get $0 - i32.add - i32.const 4 - i32.add + local.get $1 local.get $2 - i32.const 4 - i32.add - local.get $3 - i32.const 1 - i32.shl - call $~lib/internal/memory/memmove + call $~lib/util/memory/memmove ) (func $~lib/string/String#concat (; 25 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -2302,57 +2272,73 @@ i32.eqz if i32.const 0 - i32.const 504 - i32.const 110 + i32.const 528 + i32.const 67 i32.const 4 call $~lib/env/abort unreachable end - local.get $0 - i32.load - local.tee $3 local.get $1 - i32.const 488 + i32.const 512 local.get $1 select local.tee $1 - i32.load + i32.const 8 + i32.sub + i32.load offset=4 + i32.const 1 + i32.shr_u + i32.const 1 + i32.shl local.tee $4 + local.get $0 + i32.const 8 + i32.sub + i32.load offset=4 + i32.const 1 + i32.shr_u + i32.const 1 + i32.shl + local.tee $3 i32.add local.tee $2 i32.eqz if - i32.const 168 + i32.const 160 return end local.get $2 - call $~lib/internal/string/allocateUnsafe + call $~lib/runtime/runtime.allocRaw local.tee $2 - i32.const 0 local.get $0 local.get $3 - call $~lib/internal/string/copyUnsafe + call $~lib/memory/memory.copy local.get $2 local.get $3 + i32.add local.get $1 local.get $4 - call $~lib/internal/string/copyUnsafe + call $~lib/memory/memory.copy + local.get $2 + call $~lib/runtime/runtime.unref + i32.const 1 + i32.store local.get $2 ) - (func $~lib/string/String.__concat (; 26 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.concat (; 26 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 - i32.const 488 + i32.const 512 local.get $0 select local.get $1 call $~lib/string/String#concat ) - (func $~lib/symbol/symbol#toString (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/symbol/_Symbol#toString (; 27 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) - i32.const 168 + i32.const 160 local.set $2 - i32.const 464 + i32.const 488 block $break|0 (result i32) block $case11|0 block $case10|0 @@ -2375,10 +2361,10 @@ i32.sub br_table $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 $case6|0 $case7|0 $case8|0 $case9|0 $case10|0 $case11|0 end - i32.const 176 + i32.const 168 br $break|0 end - i32.const 208 + i32.const 200 br $break|0 end i32.const 248 @@ -2387,25 +2373,25 @@ i32.const 272 br $break|0 end - i32.const 288 + i32.const 296 br $break|0 end - i32.const 312 + i32.const 320 br $break|0 end - i32.const 328 + i32.const 344 br $break|0 end - i32.const 352 + i32.const 368 br $break|0 end - i32.const 368 + i32.const 392 br $break|0 end - i32.const 400 + i32.const 424 br $break|0 end - i32.const 432 + i32.const 456 br $break|0 end global.get $~lib/symbol/idToString @@ -2424,19 +2410,15 @@ local.get $1 call $~lib/map/Map#get else - i32.const 168 + i32.const 160 end end - call $~lib/string/String.__concat - i32.const 592 - call $~lib/string/String.__concat + call $~lib/string/String.concat + i32.const 568 + call $~lib/string/String.concat ) (func $start:std/symbol (; 28 ;) (type $FUNCSIG$v) (local $0 i32) - i32.const 760 - global.set $~lib/allocator/arena/startOffset - global.get $~lib/allocator/arena/startOffset - global.set $~lib/allocator/arena/offset global.get $~lib/symbol/nextId local.tee $0 i32.const 1 @@ -2466,37 +2448,41 @@ i32.eq if i32.const 0 - i32.const 24 + i32.const 32 i32.const 6 i32.const 0 call $~lib/env/abort unreachable end - call $~lib/symbol/Symbol.for + i32.const 744 + global.set $~lib/allocator/arena/startOffset + global.get $~lib/allocator/arena/startOffset + global.set $~lib/allocator/arena/offset + call $~lib/symbol/_Symbol.for global.set $std/symbol/sym3 - call $~lib/symbol/Symbol.for + call $~lib/symbol/_Symbol.for global.set $std/symbol/sym4 global.get $std/symbol/sym3 global.get $std/symbol/sym4 i32.ne if i32.const 0 - i32.const 24 + i32.const 32 i32.const 11 i32.const 0 call $~lib/env/abort unreachable end global.get $std/symbol/sym1 - call $~lib/symbol/Symbol.keyFor + call $~lib/symbol/_Symbol.keyFor global.set $std/symbol/key1 global.get $std/symbol/sym2 - call $~lib/symbol/Symbol.keyFor + call $~lib/symbol/_Symbol.keyFor global.set $std/symbol/key2 global.get $std/symbol/key1 if i32.const 0 - i32.const 24 + i32.const 32 i32.const 16 i32.const 0 call $~lib/env/abort @@ -2505,25 +2491,25 @@ global.get $std/symbol/key2 if i32.const 0 - i32.const 24 + i32.const 32 i32.const 17 i32.const 0 call $~lib/env/abort unreachable end global.get $std/symbol/sym3 - call $~lib/symbol/Symbol.keyFor + call $~lib/symbol/_Symbol.keyFor global.set $std/symbol/key3 global.get $std/symbol/sym4 - call $~lib/symbol/Symbol.keyFor + call $~lib/symbol/_Symbol.keyFor global.set $std/symbol/key4 global.get $std/symbol/key3 - i32.const 8 - call $~lib/string/String.__eq + i32.const 16 + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 22 i32.const 0 call $~lib/env/abort @@ -2531,11 +2517,11 @@ end global.get $std/symbol/key3 global.get $std/symbol/key4 - call $~lib/string/String.__eq + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 23 i32.const 0 call $~lib/env/abort @@ -2552,26 +2538,26 @@ unreachable end local.get $0 - call $~lib/symbol/symbol#toString - i32.const 600 - call $~lib/string/String.__eq + call $~lib/symbol/_Symbol#toString + i32.const 584 + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 25 i32.const 0 call $~lib/env/abort unreachable end global.get $std/symbol/sym3 - call $~lib/symbol/symbol#toString - i32.const 624 - call $~lib/string/String.__eq + call $~lib/symbol/_Symbol#toString + i32.const 608 + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 26 i32.const 0 call $~lib/env/abort @@ -2582,26 +2568,26 @@ i32.const 2 global.set $std/symbol/isConcatSpreadable global.get $std/symbol/hasInstance - call $~lib/symbol/symbol#toString - i32.const 656 - call $~lib/string/String.__eq + call $~lib/symbol/_Symbol#toString + i32.const 640 + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 30 i32.const 0 call $~lib/env/abort unreachable end global.get $std/symbol/isConcatSpreadable - call $~lib/symbol/symbol#toString - i32.const 704 - call $~lib/string/String.__eq + call $~lib/symbol/_Symbol#toString + i32.const 688 + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 31 i32.const 0 call $~lib/env/abort diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 46b0ba6f..2ba25bb0 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -1,49 +1,49 @@ (module - (type $FUNCSIG$v (func)) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$vi (func (param i32))) - (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (type $FUNCSIG$viii (func (param i32 i32 i32))) (type $FUNCSIG$iii (func (param i32 i32) (result i32))) + (type $FUNCSIG$viii (func (param i32 i32 i32))) + (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$iiiiii (func (param i32 i32 i32 i32 i32) (result i32))) (type $FUNCSIG$vii (func (param i32 i32))) - (type $FUNCSIG$viiiii (func (param i32 i32 i32 i32 i32))) + (type $FUNCSIG$v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (memory $0 1) - (data (i32.const 8) "\03\00\00\001\002\003\00") - (data (i32.const 24) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s\00") - (data (i32.const 56) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") - (data (i32.const 104) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") - (data (i32.const 168) "\00\00\00\00") - (data (i32.const 176) "\0b\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00") - (data (i32.const 208) "\12\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00") - (data (i32.const 248) "\08\00\00\00i\00s\00R\00e\00g\00E\00x\00p\00") - (data (i32.const 272) "\05\00\00\00m\00a\00t\00c\00h\00") - (data (i32.const 288) "\07\00\00\00r\00e\00p\00l\00a\00c\00e\00") - (data (i32.const 312) "\06\00\00\00s\00e\00a\00r\00c\00h\00") - (data (i32.const 328) "\07\00\00\00s\00p\00e\00c\00i\00e\00s\00") - (data (i32.const 352) "\05\00\00\00s\00p\00l\00i\00t\00") - (data (i32.const 368) "\0b\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e\00") - (data (i32.const 400) "\0b\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g\00") - (data (i32.const 432) "\0b\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s\00") - (data (i32.const 464) "\07\00\00\00S\00y\00m\00b\00o\00l\00(\00") - (data (i32.const 488) "\04\00\00\00n\00u\00l\00l\00") - (data (i32.const 504) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 536) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 592) "\01\00\00\00)\00") - (data (i32.const 600) "\08\00\00\00S\00y\00m\00b\00o\00l\00(\00)\00") - (data (i32.const 624) "\0b\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)\00") - (data (i32.const 656) "\13\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)\00") - (data (i32.const 704) "\1a\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)\00") + (data (i32.const 8) "\01\00\00\00\06\00\00\001\002\003\00") + (data (i32.const 24) "\01\00\00\00\1a\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s\00") + (data (i32.const 64) "\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") + (data (i32.const 112) "\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00") + (data (i32.const 152) "\01\00\00\00\00\00\00\00") + (data (i32.const 160) "\01\00\00\00\16\00\00\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00") + (data (i32.const 192) "\01\00\00\00$\00\00\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00") + (data (i32.const 240) "\01\00\00\00\10\00\00\00i\00s\00R\00e\00g\00E\00x\00p\00") + (data (i32.const 264) "\01\00\00\00\n\00\00\00m\00a\00t\00c\00h\00") + (data (i32.const 288) "\01\00\00\00\0e\00\00\00r\00e\00p\00l\00a\00c\00e\00") + (data (i32.const 312) "\01\00\00\00\0c\00\00\00s\00e\00a\00r\00c\00h\00") + (data (i32.const 336) "\01\00\00\00\0e\00\00\00s\00p\00e\00c\00i\00e\00s\00") + (data (i32.const 360) "\01\00\00\00\n\00\00\00s\00p\00l\00i\00t\00") + (data (i32.const 384) "\01\00\00\00\16\00\00\00t\00o\00P\00r\00i\00m\00i\00t\00i\00v\00e\00") + (data (i32.const 416) "\01\00\00\00\16\00\00\00t\00o\00S\00t\00r\00i\00n\00g\00T\00a\00g\00") + (data (i32.const 448) "\01\00\00\00\16\00\00\00u\00n\00s\00c\00o\00p\00a\00b\00l\00e\00s\00") + (data (i32.const 480) "\01\00\00\00\0e\00\00\00S\00y\00m\00b\00o\00l\00(\00") + (data (i32.const 504) "\01\00\00\00\08\00\00\00n\00u\00l\00l\00") + (data (i32.const 520) "\01\00\00\00\1c\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 560) "\01\00\00\00\02\00\00\00)\00") + (data (i32.const 576) "\01\00\00\00\10\00\00\00S\00y\00m\00b\00o\00l\00(\00)\00") + (data (i32.const 600) "\01\00\00\00\16\00\00\00S\00y\00m\00b\00o\00l\00(\001\002\003\00)\00") + (data (i32.const 632) "\01\00\00\00&\00\00\00S\00y\00m\00b\00o\00l\00(\00h\00a\00s\00I\00n\00s\00t\00a\00n\00c\00e\00)\00") + (data (i32.const 680) "\01\00\00\004\00\00\00S\00y\00m\00b\00o\00l\00(\00i\00s\00C\00o\00n\00c\00a\00t\00S\00p\00r\00e\00a\00d\00a\00b\00l\00e\00)\00") (table $0 1 funcref) (elem (i32.const 0) $null) - (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) - (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $~lib/symbol/nextId (mut i32) (i32.const 12)) (global $std/symbol/sym1 (mut i32) (i32.const 0)) (global $std/symbol/sym2 (mut i32) (i32.const 0)) (global $~lib/symbol/stringToId (mut i32) (i32.const 0)) + (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) + (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) + (global $~lib/gc/gc.implemented i32 (i32.const 0)) + (global $~lib/runtime/ArrayBufferView.MAX_BYTELENGTH i32 (i32.const 1073741816)) (global $~lib/symbol/idToString (mut i32) (i32.const 0)) (global $std/symbol/sym3 (mut i32) (i32.const 0)) (global $std/symbol/sym4 (mut i32) (i32.const 0)) @@ -51,27 +51,15 @@ (global $std/symbol/key2 (mut i32) (i32.const 0)) (global $std/symbol/key3 (mut i32) (i32.const 0)) (global $std/symbol/key4 (mut i32) (i32.const 0)) - (global $~lib/symbol/Symbol.hasInstance i32 (i32.const 1)) + (global $~lib/symbol/_Symbol.hasInstance i32 (i32.const 1)) (global $std/symbol/hasInstance (mut i32) (i32.const 0)) - (global $~lib/symbol/Symbol.isConcatSpreadable i32 (i32.const 2)) + (global $~lib/symbol/_Symbol.isConcatSpreadable i32 (i32.const 2)) (global $std/symbol/isConcatSpreadable (mut i32) (i32.const 0)) - (global $~lib/memory/HEAP_BASE i32 (i32.const 760)) + (global $~lib/memory/HEAP_BASE i32 (i32.const 740)) (export "memory" (memory $0)) (export "table" (table $0)) (start $start) - (func $start:~lib/allocator/arena (; 1 ;) (type $FUNCSIG$v) - global.get $~lib/memory/HEAP_BASE - i32.const 7 - i32.add - i32.const 7 - i32.const -1 - i32.xor - i32.and - global.set $~lib/allocator/arena/startOffset - global.get $~lib/allocator/arena/startOffset - global.set $~lib/allocator/arena/offset - ) - (func $~lib/symbol/Symbol (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) block (result i32) @@ -90,7 +78,7 @@ end local.get $2 ) - (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -169,12 +157,12 @@ global.set $~lib/allocator/arena/offset local.get $1 ) - (func $~lib/memory/memory.allocate (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 call $~lib/allocator/arena/__memory_allocate return ) - (func $~lib/internal/arraybuffer/computeSize (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/runtime/runtime.adjust (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) i32.const 1 i32.const 32 local.get $0 @@ -186,36 +174,23 @@ i32.sub i32.shl ) - (func $~lib/internal/arraybuffer/allocateUnsafe (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/runtime/runtime.allocRaw (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - (local $2 i32) local.get $0 - i32.const 1073741816 - i32.le_u - i32.eqz - if - i32.const 0 - i32.const 104 - i32.const 26 - i32.const 2 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.allocate|inlined.0 (result i32) - local.get $0 - call $~lib/internal/arraybuffer/computeSize - local.set $2 - local.get $2 - call $~lib/allocator/arena/__memory_allocate - br $~lib/memory/memory.allocate|inlined.0 - end + call $~lib/runtime/runtime.adjust + call $~lib/memory/memory.allocate local.set $1 local.get $1 - local.get $0 + i32.const -1520547049 i32.store local.get $1 + local.get $0 + i32.store offset=4 + local.get $1 + i32.const 8 + i32.add ) - (func $~lib/internal/memory/memset (; 7 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/memory/memset (; 6 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -469,50 +444,86 @@ end end ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 8 ;) (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) + (func $~lib/memory/memory.fill (; 7 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + local.get $0 local.get $1 - i32.const 1073741816 - i32.gt_u + local.get $2 + call $~lib/util/memory/memset + ) + (func $~lib/runtime/runtime.alloc (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + local.get $0 + call $~lib/runtime/runtime.allocRaw + local.set $1 + local.get $1 + i32.const 0 + local.get $0 + call $~lib/memory/memory.fill + local.get $1 + ) + (func $~lib/runtime/runtime.unref (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + local.get $0 + global.get $~lib/memory/HEAP_BASE + i32.const 8 + i32.add + i32.ge_u + i32.eqz if i32.const 0 - i32.const 56 - i32.const 47 - i32.const 40 + i32.const 120 + i32.const 117 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 8 + i32.sub + local.set $1 + local.get $1 + i32.load + i32.const -1520547049 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 120 + i32.const 119 + i32.const 4 call $~lib/env/abort unreachable end local.get $1 - call $~lib/internal/arraybuffer/allocateUnsafe - local.set $3 - local.get $2 - i32.const 0 - i32.ne - i32.eqz - if - local.get $3 - i32.const 8 - i32.add - local.set $4 - i32.const 0 - local.set $5 - local.get $1 - local.set $6 - local.get $4 - local.get $5 - local.get $6 - call $~lib/internal/memory/memset - end - local.get $3 ) - (func $~lib/map/Map#clear (; 9 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 10 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $1 + global.get $~lib/runtime/ArrayBufferView.MAX_BYTELENGTH + i32.gt_u + if + i32.const 0 + i32.const 72 + i32.const 24 + i32.const 59 + call $~lib/env/abort + unreachable + end + block $~lib/runtime/runtime.register|inlined.0 (result i32) + local.get $1 + call $~lib/runtime/runtime.alloc + local.set $2 + local.get $2 + call $~lib/runtime/runtime.unref + i32.const 2 + i32.store + local.get $2 + end + ) + (func $~lib/map/Map#clear (; 11 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 - i32.const 0 call $~lib/arraybuffer/ArrayBuffer#constructor i32.store local.get $0 @@ -523,7 +534,6 @@ local.get $0 i32.const 0 i32.const 48 - i32.const 1 call $~lib/arraybuffer/ArrayBuffer#constructor i32.store offset=8 local.get $0 @@ -536,7 +546,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/map/Map#constructor (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) block (result i32) local.get $0 i32.eqz @@ -568,11 +578,10 @@ call $~lib/map/Map#clear local.get $0 ) - (func $~lib/map/Map#clear (; 11 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $~lib/map/Map#clear (; 13 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 i32.const 0 i32.const 16 - i32.const 0 call $~lib/arraybuffer/ArrayBuffer#constructor i32.store local.get $0 @@ -583,7 +592,6 @@ local.get $0 i32.const 0 i32.const 48 - i32.const 1 call $~lib/arraybuffer/ArrayBuffer#constructor i32.store offset=8 local.get $0 @@ -596,7 +604,7 @@ i32.const 0 i32.store offset=20 ) - (func $~lib/map/Map#constructor (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) block (result i32) local.get $0 i32.eqz @@ -628,7 +636,15 @@ call $~lib/map/Map#clear local.get $0 ) - (func $~lib/internal/hash/hashStr (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/string/String#get:length (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 8 + i32.sub + i32.load offset=4 + i32.const 1 + i32.shr_u + ) + (func $~lib/util/hash/hashStr (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -639,7 +655,7 @@ i32.const 0 local.set $2 local.get $0 - i32.load + call $~lib/string/String#get:length i32.const 1 i32.shl local.set $3 @@ -654,7 +670,7 @@ local.get $0 local.get $2 i32.add - i32.load8_u offset=4 + i32.load8_u i32.xor i32.const 16777619 i32.mul @@ -670,7 +686,7 @@ end local.get $1 ) - (func $~lib/internal/string/compareUnsafe (; 14 ;) (type $FUNCSIG$iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/util/string/compareImpl (; 17 ;) (type $FUNCSIG$iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (local $6 i32) (local $7 i32) @@ -693,9 +709,9 @@ local.get $4 if (result i32) local.get $6 - i32.load16_u offset=4 + i32.load16_u local.get $7 - i32.load16_u offset=4 + i32.load16_u i32.sub local.tee $5 i32.eqz @@ -723,7 +739,7 @@ end local.get $5 ) - (func $~lib/string/String.__eq (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.eq (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) local.get $0 @@ -749,11 +765,11 @@ return end local.get $0 - i32.load + call $~lib/string/String#get:length local.set $3 local.get $3 local.get $1 - i32.load + call $~lib/string/String#get:length i32.ne if i32.const 0 @@ -764,10 +780,10 @@ local.get $1 i32.const 0 local.get $3 - call $~lib/internal/string/compareUnsafe + call $~lib/util/string/compareImpl i32.eqz ) - (func $~lib/map/Map#find (; 16 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 19 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -779,7 +795,7 @@ i32.const 4 i32.mul i32.add - i32.load offset=8 + i32.load local.set $3 block $break|0 loop $continue|0 @@ -796,7 +812,7 @@ local.get $3 i32.load local.get $1 - call $~lib/string/String.__eq + call $~lib/string/String.eq else local.get $4 end @@ -818,32 +834,32 @@ end i32.const 0 ) - (func $~lib/map/Map#has (; 17 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 20 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 local.get $1 - block $~lib/internal/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.0 (result i32) local.get $1 local.set $2 local.get $2 - call $~lib/internal/hash/hashStr - br $~lib/internal/hash/HASH|inlined.0 + call $~lib/util/hash/hashStr + br $~lib/util/hash/HASH|inlined.0 end call $~lib/map/Map#find i32.const 0 i32.ne ) - (func $~lib/map/Map#get (; 18 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 21 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) local.get $0 local.get $1 - block $~lib/internal/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.1 (result i32) local.get $1 local.set $2 local.get $2 - call $~lib/internal/hash/hashStr - br $~lib/internal/hash/HASH|inlined.1 + call $~lib/util/hash/hashStr + br $~lib/util/hash/HASH|inlined.1 end call $~lib/map/Map#find local.set $3 @@ -855,7 +871,7 @@ unreachable end ) - (func $~lib/map/Map#rehash (; 19 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 22 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -875,7 +891,6 @@ local.get $2 i32.const 4 i32.mul - i32.const 0 call $~lib/arraybuffer/ArrayBuffer#constructor local.set $3 local.get $2 @@ -890,13 +905,10 @@ i32.const 12 end i32.mul - i32.const 1 call $~lib/arraybuffer/ArrayBuffer#constructor local.set $5 local.get $0 i32.load offset=8 - i32.const 8 - i32.add local.set $6 local.get $6 local.get $0 @@ -908,8 +920,6 @@ i32.add local.set $7 local.get $5 - i32.const 8 - i32.add local.set $8 block $break|0 loop $continue|0 @@ -936,13 +946,13 @@ local.get $9 i32.load offset=4 i32.store offset=4 - block $~lib/internal/hash/HASH|inlined.3 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $9 i32.load local.set $11 local.get $11 - call $~lib/internal/hash/hashStr - br $~lib/internal/hash/HASH|inlined.3 + call $~lib/util/hash/hashStr + br $~lib/util/hash/HASH|inlined.3 end local.get $1 i32.and @@ -955,11 +965,11 @@ local.set $12 local.get $10 local.get $12 - i32.load offset=8 + i32.load i32.store offset=8 local.get $12 local.get $8 - i32.store offset=8 + i32.store local.get $8 block $~lib/map/ENTRY_SIZE|inlined.3 (result i32) i32.const 12 @@ -995,17 +1005,17 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/map/Map#set (; 20 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 23 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/internal/hash/HASH|inlined.2 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $1 local.set $3 local.get $3 - call $~lib/internal/hash/hashStr - br $~lib/internal/hash/HASH|inlined.2 + call $~lib/util/hash/hashStr + br $~lib/util/hash/HASH|inlined.2 end local.set $4 local.get $0 @@ -1052,8 +1062,6 @@ i32.load offset=8 local.set $3 local.get $3 - i32.const 8 - i32.add block (result i32) local.get $0 local.get $0 @@ -1094,14 +1102,14 @@ local.set $6 local.get $5 local.get $6 - i32.load offset=8 + i32.load i32.store offset=8 local.get $6 local.get $5 - i32.store offset=8 + i32.store end ) - (func $~lib/internal/hash/hash32 (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/util/hash/hash32 (; 24 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) i32.const -2128831035 local.set $1 @@ -1143,7 +1151,7 @@ local.set $1 local.get $1 ) - (func $~lib/map/Map#find (; 22 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 25 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) local.get $0 @@ -1155,7 +1163,7 @@ i32.const 4 i32.mul i32.add - i32.load offset=8 + i32.load local.set $3 block $break|0 loop $continue|0 @@ -1194,7 +1202,7 @@ end i32.const 0 ) - (func $~lib/map/Map#rehash (; 23 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 26 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1214,7 +1222,6 @@ local.get $2 i32.const 4 i32.mul - i32.const 0 call $~lib/arraybuffer/ArrayBuffer#constructor local.set $3 local.get $2 @@ -1229,13 +1236,10 @@ i32.const 12 end i32.mul - i32.const 1 call $~lib/arraybuffer/ArrayBuffer#constructor local.set $5 local.get $0 i32.load offset=8 - i32.const 8 - i32.add local.set $6 local.get $6 local.get $0 @@ -1247,8 +1251,6 @@ i32.add local.set $7 local.get $5 - i32.const 8 - i32.add local.set $8 block $break|0 loop $continue|0 @@ -1275,13 +1277,13 @@ local.get $9 i32.load offset=4 i32.store offset=4 - block $~lib/internal/hash/HASH|inlined.1 (result i32) + block $~lib/util/hash/HASH|inlined.1 (result i32) local.get $9 i32.load local.set $11 local.get $11 - call $~lib/internal/hash/hash32 - br $~lib/internal/hash/HASH|inlined.1 + call $~lib/util/hash/hash32 + br $~lib/util/hash/HASH|inlined.1 end local.get $1 i32.and @@ -1294,11 +1296,11 @@ local.set $12 local.get $10 local.get $12 - i32.load offset=8 + i32.load i32.store offset=8 local.get $12 local.get $8 - i32.store offset=8 + i32.store local.get $8 block $~lib/map/ENTRY_SIZE|inlined.3 (result i32) i32.const 12 @@ -1334,17 +1336,17 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/map/Map#set (; 24 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 27 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/internal/hash/HASH|inlined.0 (result i32) + block $~lib/util/hash/HASH|inlined.0 (result i32) local.get $1 local.set $3 local.get $3 - call $~lib/internal/hash/hash32 - br $~lib/internal/hash/HASH|inlined.0 + call $~lib/util/hash/hash32 + br $~lib/util/hash/HASH|inlined.0 end local.set $4 local.get $0 @@ -1391,8 +1393,6 @@ i32.load offset=8 local.set $3 local.get $3 - i32.const 8 - i32.add block (result i32) local.get $0 local.get $0 @@ -1433,14 +1433,14 @@ local.set $6 local.get $5 local.get $6 - i32.load offset=8 + i32.load i32.store offset=8 local.get $6 local.get $5 - i32.store offset=8 + i32.store end ) - (func $~lib/symbol/Symbol.for (; 25 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/symbol/_Symbol.for (; 28 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) global.get $~lib/symbol/stringToId @@ -1487,32 +1487,32 @@ call $~lib/map/Map#set local.get $2 ) - (func $~lib/map/Map#has (; 26 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 29 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) local.get $0 local.get $1 - block $~lib/internal/hash/HASH|inlined.2 (result i32) + block $~lib/util/hash/HASH|inlined.2 (result i32) local.get $1 local.set $2 local.get $2 - call $~lib/internal/hash/hash32 - br $~lib/internal/hash/HASH|inlined.2 + call $~lib/util/hash/hash32 + br $~lib/util/hash/HASH|inlined.2 end call $~lib/map/Map#find i32.const 0 i32.ne ) - (func $~lib/map/Map#get (; 27 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 30 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) local.get $0 local.get $1 - block $~lib/internal/hash/HASH|inlined.3 (result i32) + block $~lib/util/hash/HASH|inlined.3 (result i32) local.get $1 local.set $2 local.get $2 - call $~lib/internal/hash/hash32 - br $~lib/internal/hash/HASH|inlined.3 + call $~lib/util/hash/hash32 + br $~lib/util/hash/HASH|inlined.3 end call $~lib/map/Map#find local.set $3 @@ -1524,7 +1524,7 @@ unreachable end ) - (func $~lib/symbol/Symbol.keyFor (; 28 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/symbol/_Symbol.keyFor (; 31 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) global.get $~lib/symbol/idToString i32.const 0 @@ -1545,47 +1545,7 @@ i32.const 0 end ) - (func $~lib/internal/string/allocateUnsafe (; 29 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.const 0 - i32.gt_s - local.tee $1 - if (result i32) - local.get $0 - i32.const 536870910 - i32.le_s - else - local.get $1 - end - i32.eqz - if - i32.const 0 - i32.const 536 - i32.const 14 - i32.const 2 - call $~lib/env/abort - unreachable - end - block $~lib/memory/memory.allocate|inlined.1 (result i32) - i32.const 4 - local.get $0 - i32.const 1 - i32.shl - i32.add - local.set $1 - local.get $1 - call $~lib/allocator/arena/__memory_allocate - br $~lib/memory/memory.allocate|inlined.1 - end - local.set $2 - local.get $2 - local.get $0 - i32.store - local.get $2 - ) - (func $~lib/internal/memory/memcpy (; 30 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/memory/memcpy (; 32 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2786,7 +2746,7 @@ i32.store8 end ) - (func $~lib/internal/memory/memmove (; 31 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/util/memory/memmove (; 33 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) local.get $0 local.get $1 @@ -2813,7 +2773,7 @@ local.get $0 local.get $1 local.get $2 - call $~lib/internal/memory/memcpy + call $~lib/util/memory/memcpy return end local.get $0 @@ -3013,48 +2973,26 @@ end end ) - (func $~lib/internal/string/copyUnsafe (; 32 ;) (type $FUNCSIG$viiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) + (func $~lib/memory/memory.copy (; 34 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) local.get $0 local.get $1 - i32.const 1 - i32.shl - i32.add - i32.const 4 - i32.add - local.set $5 local.get $2 - local.get $3 - i32.const 1 - i32.shl - i32.add - i32.const 4 - i32.add - local.set $6 - local.get $4 - i32.const 1 - i32.shl - local.set $7 - local.get $5 - local.get $6 - local.get $7 - call $~lib/internal/memory/memmove + call $~lib/util/memory/memmove ) - (func $~lib/string/String#concat (; 33 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#concat (; 35 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) local.get $0 i32.const 0 i32.ne i32.eqz if i32.const 0 - i32.const 504 - i32.const 110 + i32.const 528 + i32.const 67 i32.const 4 call $~lib/env/abort unreachable @@ -3063,14 +3001,18 @@ i32.const 0 i32.eq if - i32.const 488 + i32.const 512 local.set $1 end local.get $0 - i32.load + call $~lib/string/String#get:length + i32.const 1 + i32.shl local.set $2 local.get $1 - i32.load + call $~lib/string/String#get:length + i32.const 1 + i32.shl local.set $3 local.get $2 local.get $3 @@ -3080,44 +3022,50 @@ i32.const 0 i32.eq if - i32.const 168 + i32.const 160 return end local.get $4 - call $~lib/internal/string/allocateUnsafe + call $~lib/runtime/runtime.allocRaw local.set $5 local.get $5 - i32.const 0 local.get $0 - i32.const 0 local.get $2 - call $~lib/internal/string/copyUnsafe + call $~lib/memory/memory.copy local.get $5 local.get $2 + i32.add local.get $1 - i32.const 0 local.get $3 - call $~lib/internal/string/copyUnsafe - local.get $5 + call $~lib/memory/memory.copy + block $~lib/runtime/runtime.register|inlined.0 (result i32) + local.get $5 + local.set $6 + local.get $6 + call $~lib/runtime/runtime.unref + i32.const 1 + i32.store + local.get $6 + end ) - (func $~lib/string/String.__concat (; 34 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.concat (; 36 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) local.get $0 i32.eqz if - i32.const 488 + i32.const 512 local.set $0 end local.get $0 local.get $1 call $~lib/string/String#concat ) - (func $~lib/symbol/symbol#toString (; 35 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $~lib/symbol/_Symbol#toString (; 37 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) local.get $0 local.set $1 - i32.const 168 + i32.const 160 local.set $2 block $break|0 block $case11|0 @@ -3181,7 +3129,7 @@ br $case11|0 end block - i32.const 176 + i32.const 168 local.set $2 br $break|0 unreachable @@ -3189,7 +3137,7 @@ unreachable end block - i32.const 208 + i32.const 200 local.set $2 br $break|0 unreachable @@ -3213,7 +3161,7 @@ unreachable end block - i32.const 288 + i32.const 296 local.set $2 br $break|0 unreachable @@ -3221,7 +3169,7 @@ unreachable end block - i32.const 312 + i32.const 320 local.set $2 br $break|0 unreachable @@ -3229,7 +3177,7 @@ unreachable end block - i32.const 328 + i32.const 344 local.set $2 br $break|0 unreachable @@ -3237,7 +3185,7 @@ unreachable end block - i32.const 352 + i32.const 368 local.set $2 br $break|0 unreachable @@ -3245,7 +3193,7 @@ unreachable end block - i32.const 368 + i32.const 392 local.set $2 br $break|0 unreachable @@ -3253,7 +3201,7 @@ unreachable end block - i32.const 400 + i32.const 424 local.set $2 br $break|0 unreachable @@ -3261,7 +3209,7 @@ unreachable end block - i32.const 432 + i32.const 456 local.set $2 br $break|0 unreachable @@ -3291,18 +3239,17 @@ end unreachable end - i32.const 464 + i32.const 488 local.get $2 - call $~lib/string/String.__concat - i32.const 592 - call $~lib/string/String.__concat + call $~lib/string/String.concat + i32.const 568 + call $~lib/string/String.concat ) - (func $start:std/symbol (; 36 ;) (type $FUNCSIG$v) - call $start:~lib/allocator/arena - i32.const 8 + (func $start:std/symbol (; 38 ;) (type $FUNCSIG$v) + i32.const 16 call $~lib/symbol/Symbol global.set $std/symbol/sym1 - i32.const 8 + i32.const 16 call $~lib/symbol/Symbol global.set $std/symbol/sym2 global.get $std/symbol/sym1 @@ -3311,17 +3258,27 @@ i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 6 i32.const 0 call $~lib/env/abort unreachable end - i32.const 8 - call $~lib/symbol/Symbol.for + global.get $~lib/memory/HEAP_BASE + i32.const 7 + i32.add + i32.const 7 + i32.const -1 + i32.xor + i32.and + global.set $~lib/allocator/arena/startOffset + global.get $~lib/allocator/arena/startOffset + global.set $~lib/allocator/arena/offset + i32.const 16 + call $~lib/symbol/_Symbol.for global.set $std/symbol/sym3 - i32.const 8 - call $~lib/symbol/Symbol.for + i32.const 16 + call $~lib/symbol/_Symbol.for global.set $std/symbol/sym4 global.get $std/symbol/sym3 global.get $std/symbol/sym4 @@ -3329,17 +3286,17 @@ i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 11 i32.const 0 call $~lib/env/abort unreachable end global.get $std/symbol/sym1 - call $~lib/symbol/Symbol.keyFor + call $~lib/symbol/_Symbol.keyFor global.set $std/symbol/key1 global.get $std/symbol/sym2 - call $~lib/symbol/Symbol.keyFor + call $~lib/symbol/_Symbol.keyFor global.set $std/symbol/key2 global.get $std/symbol/key1 i32.const 0 @@ -3347,7 +3304,7 @@ i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 16 i32.const 0 call $~lib/env/abort @@ -3359,25 +3316,25 @@ i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 17 i32.const 0 call $~lib/env/abort unreachable end global.get $std/symbol/sym3 - call $~lib/symbol/Symbol.keyFor + call $~lib/symbol/_Symbol.keyFor global.set $std/symbol/key3 global.get $std/symbol/sym4 - call $~lib/symbol/Symbol.keyFor + call $~lib/symbol/_Symbol.keyFor global.set $std/symbol/key4 global.get $std/symbol/key3 - i32.const 8 - call $~lib/string/String.__eq + i32.const 16 + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 22 i32.const 0 call $~lib/env/abort @@ -3385,11 +3342,11 @@ end global.get $std/symbol/key3 global.get $std/symbol/key4 - call $~lib/string/String.__eq + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 23 i32.const 0 call $~lib/env/abort @@ -3397,69 +3354,69 @@ end i32.const 0 call $~lib/symbol/Symbol - call $~lib/symbol/symbol#toString - i32.const 600 - call $~lib/string/String.__eq + call $~lib/symbol/_Symbol#toString + i32.const 584 + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 25 i32.const 0 call $~lib/env/abort unreachable end global.get $std/symbol/sym3 - call $~lib/symbol/symbol#toString - i32.const 624 - call $~lib/string/String.__eq + call $~lib/symbol/_Symbol#toString + i32.const 608 + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 26 i32.const 0 call $~lib/env/abort unreachable end - global.get $~lib/symbol/Symbol.hasInstance + global.get $~lib/symbol/_Symbol.hasInstance global.set $std/symbol/hasInstance - global.get $~lib/symbol/Symbol.isConcatSpreadable + global.get $~lib/symbol/_Symbol.isConcatSpreadable global.set $std/symbol/isConcatSpreadable global.get $std/symbol/hasInstance - call $~lib/symbol/symbol#toString - i32.const 656 - call $~lib/string/String.__eq + call $~lib/symbol/_Symbol#toString + i32.const 640 + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 30 i32.const 0 call $~lib/env/abort unreachable end global.get $std/symbol/isConcatSpreadable - call $~lib/symbol/symbol#toString - i32.const 704 - call $~lib/string/String.__eq + call $~lib/symbol/_Symbol#toString + i32.const 688 + call $~lib/string/String.eq i32.eqz if i32.const 0 - i32.const 24 + i32.const 32 i32.const 31 i32.const 0 call $~lib/env/abort unreachable end - global.get $~lib/symbol/Symbol.hasInstance + global.get $~lib/symbol/_Symbol.hasInstance drop - global.get $~lib/symbol/Symbol.isConcatSpreadable + global.get $~lib/symbol/_Symbol.isConcatSpreadable drop ) - (func $start (; 37 ;) (type $FUNCSIG$v) + (func $start (; 39 ;) (type $FUNCSIG$v) call $start:std/symbol ) - (func $null (; 38 ;) (type $FUNCSIG$v) + (func $null (; 40 ;) (type $FUNCSIG$v) ) )