From 09e622824417e2c1928282558bc05fd64ccab633 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 14 Dec 2020 03:24:35 +0200 Subject: [PATCH 1/3] improve string hashing --- std/assembly/map.ts | 12 +- std/assembly/set.ts | 10 +- std/assembly/util/hash.ts | 57 +- tests/compiler/std/hash.optimized.wat | 172 +- tests/compiler/std/hash.ts | 38 +- tests/compiler/std/hash.untouched.wat | 983 ++++--- tests/compiler/std/map.optimized.wat | 406 +-- tests/compiler/std/map.untouched.wat | 3549 +++++++++-------------- tests/compiler/std/set.optimized.wat | 368 ++- tests/compiler/std/set.untouched.wat | 2265 ++++++--------- tests/compiler/std/symbol.optimized.wat | 186 +- tests/compiler/std/symbol.untouched.wat | 562 ++-- 12 files changed, 4028 insertions(+), 4580 deletions(-) diff --git a/std/assembly/map.ts b/std/assembly/map.ts index c888cbc27f..1bdcdf06ae 100644 --- a/std/assembly/map.ts +++ b/std/assembly/map.ts @@ -1,6 +1,6 @@ /// -import { HASH } from "./util/hash"; +import { hash } from "./util/hash"; import { E_KEYNOTFOUND } from "./util/error"; // A deterministic hash map based on CloseTable from https://github.com/jorendorff/dht @@ -96,19 +96,19 @@ export class Map { } has(key: K): bool { - return this.find(key, HASH(key)) !== null; + return this.find(key, hash(key)) !== null; } @operator("[]") get(key: K): V { - var entry = this.find(key, HASH(key)); + var entry = this.find(key, hash(key)); if (!entry) throw new Error(E_KEYNOTFOUND); // cannot represent `undefined` return entry.value; } @operator("[]=") set(key: K, value: V): this { - var hashCode = HASH(key); + var hashCode = hash(key); var entry = this.find(key, hashCode); // unmanaged! if (entry) { if (isManaged()) { @@ -149,7 +149,7 @@ export class Map { } delete(key: K): bool { - var entry = this.find(key, HASH(key)); + var entry = this.find(key, hash(key)); if (!entry) return false; if (isManaged()) __release(changetype(entry.key)); if (isManaged()) __release(changetype(entry.value)); @@ -181,7 +181,7 @@ export class Map { let oldEntryKey = oldEntry.key; newEntry.key = oldEntryKey; newEntry.value = oldEntry.value; - let newBucketIndex = HASH(oldEntryKey) & newBucketsMask; + let newBucketIndex = hash(oldEntryKey) & newBucketsMask; let newBucketPtrBase = changetype(newBuckets) + newBucketIndex * BUCKET_SIZE; newEntry.taggedNext = load(newBucketPtrBase); store(newBucketPtrBase, newPtr); diff --git a/std/assembly/set.ts b/std/assembly/set.ts index 2fe540a551..baa4482108 100644 --- a/std/assembly/set.ts +++ b/std/assembly/set.ts @@ -1,6 +1,6 @@ /// -import { HASH } from "./util/hash"; +import { hash } from "./util/hash"; // A deterministic hash set based on CloseTable from https://github.com/jorendorff/dht @@ -94,11 +94,11 @@ export class Set { @operator("[]") has(key: T): bool { - return this.find(key, HASH(key)) !== null; + return this.find(key, hash(key)) !== null; } add(key: T): this { - var hashCode = HASH(key); + var hashCode = hash(key); var entry = this.find(key, hashCode); // unmanaged! if (!entry) { // check if rehashing is necessary @@ -130,7 +130,7 @@ export class Set { } delete(key: T): bool { - var entry = this.find(key, HASH(key)); // unmanaged! + var entry = this.find(key, hash(key)); // unmanaged! if (!entry) return false; if (isManaged()) __release(changetype(entry.key)); // exact 'key' entry.taggedNext |= EMPTY; @@ -160,7 +160,7 @@ export class Set { let newEntry = changetype>(newPtr); // unmanaged! let oldEntryKey = oldEntry.key; newEntry.key = oldEntryKey; - let newBucketIndex = HASH(oldEntryKey) & newBucketsMask; + let newBucketIndex = hash(oldEntryKey) & newBucketsMask; let newBucketPtrBase = changetype(newBuckets) + newBucketIndex * BUCKET_SIZE; newEntry.taggedNext = load(newBucketPtrBase); store(newBucketPtrBase, newPtr); diff --git a/std/assembly/util/hash.ts b/std/assembly/util/hash.ts index c168fa4903..b45e6f83e6 100644 --- a/std/assembly/util/hash.ts +++ b/std/assembly/util/hash.ts @@ -1,6 +1,4 @@ -// @ts-ignore: decorator -@inline -export function HASH(key: T): u32 { +export function hash(key: T): u32 { if (isString()) { return hashStr(changetype(key)); } else if (isReference()) { @@ -26,19 +24,26 @@ export function HASH(key: T): u32 { // @ts-ignore: decorator @inline const FNV_PRIME: u32 = 16777619; -function hash8(key: u32): u32 { - return (FNV_OFFSET ^ key) * FNV_PRIME; + +// @ts-ignore: decorator +@inline +function hash8(key: u32, seed: u32 = FNV_OFFSET): u32 { + return (seed ^ key) * FNV_PRIME; } -function hash16(key: u32): u32 { - var v = FNV_OFFSET; +// @ts-ignore: decorator +@inline +function hash16(key: u32, seed: u32 = FNV_OFFSET): u32 { + var v = seed; v = (v ^ ( key & 0xff)) * FNV_PRIME; v = (v ^ ( key >> 8 )) * FNV_PRIME; return v; } -function hash32(key: u32): u32 { - var v = FNV_OFFSET; +// @ts-ignore: decorator +@inline +function hash32(key: u32, seed: u32 = FNV_OFFSET): u32 { + var v = seed; v = (v ^ ( key & 0xff)) * FNV_PRIME; v = (v ^ ((key >> 8) & 0xff)) * FNV_PRIME; v = (v ^ ((key >> 16) & 0xff)) * FNV_PRIME; @@ -46,10 +51,12 @@ function hash32(key: u32): u32 { return v; } -function hash64(key: u64): u32 { +// @ts-ignore: decorator +@inline +function hash64(key: u64, seed: u32 = FNV_OFFSET): u32 { var l = key; var h = (key >>> 32); - var v = FNV_OFFSET; + var v = seed; v = (v ^ ( l & 0xff)) * FNV_PRIME; v = (v ^ ((l >> 8) & 0xff)) * FNV_PRIME; v = (v ^ ((l >> 16) & 0xff)) * FNV_PRIME; @@ -61,11 +68,31 @@ function hash64(key: u64): u32 { return v; } -function hashStr(key: string): u32 { - var v = FNV_OFFSET; +// @ts-ignore: decorator +@inline +function hashStr(key: string, seed: u32 = FNV_OFFSET): u32 { + var v = seed; if (key !== null) { - for (let i: usize = 0, k: usize = key.length << 1; i < k; ++i) { - v = (v ^ load(changetype(key) + i)) * FNV_PRIME; + let len = key.length << 1; + if (ASC_SHRINK_LEVEL > 1) { + for (let i: usize = 0; i < len; ++i) { + v = (v ^ load(changetype(key) + i)) * FNV_PRIME; + } + } else { + let off: usize = 0; + while (len >= 8) { + v = hash64(load(changetype(key) + off), v); + off += 8; len -= 8; + } + if (len >= 4) { + v = hash32(load(changetype(key) + off), v); + off += 4; len -= 4; + } + if (len >= 2) { + v = hash16(load(changetype(key) + off), v); + off += 2; len -= 2; + } + // length always is even so don't need hash8 } } return v; diff --git a/tests/compiler/std/hash.optimized.wat b/tests/compiler/std/hash.optimized.wat index e0f7a02167..d6af58da37 100644 --- a/tests/compiler/std/hash.optimized.wat +++ b/tests/compiler/std/hash.optimized.wat @@ -6,12 +6,15 @@ (data (i32.const 1068) "\02\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00a") (data (i32.const 1100) "\04\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\04\00\00\00a\00b") (data (i32.const 1132) "\06\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\06\00\00\00a\00b\00c") + (data (i32.const 1164) "\08\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\08\00\00\00a\00b\00c\00d") + (data (i32.const 1196) "\n\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\n\00\00\00a\00b\00c\00d\00e") (export "memory" (memory $0)) (start $~start) - (func $~lib/util/hash/hashStr (param $0 i32) + (func $~lib/util/hash/hash<~lib/string/String|null> (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) + (local $4 i64) i32.const -2128831035 local.set $2 local.get $0 @@ -24,40 +27,179 @@ i32.shr_u i32.const 1 i32.shl - local.set $3 - loop $for-loop|0 + local.set $1 + loop $while-continue|0 local.get $1 - local.get $3 - i32.lt_u + i32.const 8 + i32.ge_s if local.get $2 local.get $0 - local.get $1 + local.get $3 i32.add - i32.load8_u + i64.load + local.tee $4 + i32.wrap_i64 + local.tee $2 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.get $4 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.tee $2 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 24 + i32.shr_u i32.xor i32.const 16777619 i32.mul local.set $2 - local.get $1 - i32.const 1 + local.get $3 + i32.const 8 i32.add + local.set $3 + local.get $1 + i32.const 8 + i32.sub local.set $1 - br $for-loop|0 + br $while-continue|0 end end + local.get $1 + i32.const 4 + i32.ge_s + if (result i32) + local.get $2 + local.get $0 + local.get $3 + i32.add + i32.load + local.tee $2 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $2 + local.get $3 + i32.const 4 + i32.add + local.set $3 + local.get $1 + i32.const 4 + i32.sub + else + local.get $1 + end + i32.const 2 + i32.ge_s + if (result i32) + local.get $2 + local.get $0 + local.get $3 + i32.add + i32.load16_u + local.tee $0 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $0 + i32.const 8 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + else + local.get $2 + end + drop end ) (func $~start i32.const 0 - call $~lib/util/hash/hashStr + call $~lib/util/hash/hash<~lib/string/String|null> i32.const 1056 - call $~lib/util/hash/hashStr + call $~lib/util/hash/hash<~lib/string/String|null> i32.const 1088 - call $~lib/util/hash/hashStr + call $~lib/util/hash/hash<~lib/string/String|null> i32.const 1120 - call $~lib/util/hash/hashStr + call $~lib/util/hash/hash<~lib/string/String|null> i32.const 1152 - call $~lib/util/hash/hashStr + call $~lib/util/hash/hash<~lib/string/String|null> + i32.const 1184 + call $~lib/util/hash/hash<~lib/string/String|null> + i32.const 1216 + call $~lib/util/hash/hash<~lib/string/String|null> ) ) diff --git a/tests/compiler/std/hash.ts b/tests/compiler/std/hash.ts index b46889ba88..e99ddda546 100644 --- a/tests/compiler/std/hash.ts +++ b/tests/compiler/std/hash.ts @@ -1,25 +1,27 @@ -import { HASH } from "util/hash"; +import { hash } from "util/hash"; function check(hash: u32): bool { return true; } -check(HASH(null)); -check(HASH("")); -check(HASH("a")); -check(HASH("ab")); -check(HASH("abc")); +check(hash(null)); +check(hash("")); +check(hash("a")); +check(hash("ab")); +check(hash("abc")); +check(hash("abcd")); +check(hash("abcde")); -check(HASH(0.0)); -check(HASH(1.0)); -check(HASH(1.1)); -check(HASH(-0)); -check(HASH(Infinity)); -check(HASH(NaN)); +check(hash(0.0)); +check(hash(1.0)); +check(hash(1.1)); +check(hash(-0)); +check(hash(Infinity)); +check(hash(NaN)); -check(HASH(0.0)); -check(HASH(1.0)); -check(HASH(1.1)); -check(HASH(-0)); -check(HASH(Infinity)); -check(HASH(NaN)); +check(hash(0.0)); +check(hash(1.0)); +check(hash(1.1)); +check(hash(-0)); +check(hash(Infinity)); +check(hash(NaN)); diff --git a/tests/compiler/std/hash.untouched.wat b/tests/compiler/std/hash.untouched.wat index c1e7d41192..f0a4236761 100644 --- a/tests/compiler/std/hash.untouched.wat +++ b/tests/compiler/std/hash.untouched.wat @@ -2,13 +2,17 @@ (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) - (type $i64_=>_i32 (func (param i64) (result i32))) + (type $f32_=>_i32 (func (param f32) (result i32))) + (type $f64_=>_i32 (func (param f64) (result i32))) (memory $0 1) (data (i32.const 12) "\00\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00") (data (i32.const 44) "\02\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00a\00") (data (i32.const 76) "\04\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\04\00\00\00a\00b\00") (data (i32.const 108) "\06\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\06\00\00\00a\00b\00c\00") + (data (i32.const 140) "\08\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\08\00\00\00a\00b\00c\00d\00") + (data (i32.const 172) "\n\00\00\00\01\00\00\00\00\00\00\00\01\00\00\00\n\00\00\00a\00b\00c\00d\00e\00") (table $0 1 funcref) + (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) (export "memory" (memory $0)) (start $~start) (func $~lib/rt/stub/__retain (param $0 i32) (result i32) @@ -25,74 +29,560 @@ (func $~lib/rt/stub/__release (param $0 i32) nop ) - (func $~lib/util/hash/hashStr (param $0 i32) (result i32) + (func $~lib/util/hash/hash<~lib/string/String|null> (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i64) + (local $9 i32) + (local $10 i32) + (local $11 i32) local.get $0 call $~lib/rt/stub/__retain local.set $0 - i32.const -2128831035 - local.set $1 + i32.const 1 + drop local.get $0 + call $~lib/rt/stub/__retain + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $1 i32.const 0 i32.ne if - i32.const 0 - local.set $2 - local.get $0 + local.get $1 call $~lib/string/String#get:length i32.const 1 i32.shl - local.set $3 - loop $for-loop|0 - local.get $2 - local.get $3 - i32.lt_u - local.set $4 + local.set $4 + i32.const 0 + i32.const 1 + i32.gt_s + drop + i32.const 0 + local.set $5 + loop $while-continue|0 local.get $4 + i32.const 8 + i32.ge_s + local.set $6 + local.get $6 if local.get $1 - local.get $0 - local.get $2 + local.get $5 i32.add - i32.load8_u + i64.load + local.set $8 + local.get $3 + local.set $7 + local.get $8 + i32.wrap_i64 + local.set $9 + local.get $8 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.set $10 + local.get $7 + local.set $11 + local.get $11 + local.get $9 + i32.const 255 + i32.and i32.xor i32.const 16777619 i32.mul - local.set $1 - local.get $2 - i32.const 1 + local.set $11 + local.get $11 + local.get $9 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $9 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $9 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.set $3 + local.get $5 + i32.const 8 i32.add - local.set $2 - br $for-loop|0 + local.set $5 + local.get $4 + i32.const 8 + i32.sub + local.set $4 + br $while-continue|0 end end + local.get $4 + i32.const 4 + i32.ge_s + if + local.get $1 + local.get $5 + i32.add + i32.load + local.set $9 + local.get $3 + local.set $7 + local.get $7 + local.set $6 + local.get $6 + local.get $9 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $9 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $9 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $9 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.set $3 + local.get $5 + i32.const 4 + i32.add + local.set $5 + local.get $4 + i32.const 4 + i32.sub + local.set $4 + end + local.get $4 + i32.const 2 + i32.ge_s + if + local.get $1 + local.get $5 + i32.add + i32.load16_u + local.set $11 + local.get $3 + local.set $10 + local.get $10 + local.set $6 + local.get $6 + local.get $11 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $11 + i32.const 8 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.set $3 + local.get $5 + i32.const 2 + i32.add + local.set $5 + local.get $4 + i32.const 2 + i32.sub + local.set $4 + end end + local.get $3 + local.set $4 local.get $1 + call $~lib/rt/stub/__release + local.get $4 local.set $3 local.get $0 call $~lib/rt/stub/__release local.get $3 + return ) (func $std/hash/check (param $0 i32) (result i32) i32.const 1 ) - (func $~lib/util/hash/hash32 (param $0 i32) (result i32) + (func $~lib/util/hash/hash<~lib/string/String> (param $0 i32) (result i32) (local $1 i32) - i32.const -2128831035 + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i64) + (local $9 i32) + (local $10 i32) + (local $11 i32) + local.get $0 + call $~lib/rt/stub/__retain + local.set $0 + i32.const 1 + drop + local.get $0 + call $~lib/rt/stub/__retain local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 local.get $1 + i32.const 0 + i32.ne + if + local.get $1 + call $~lib/string/String#get:length + i32.const 1 + i32.shl + local.set $4 + i32.const 0 + i32.const 1 + i32.gt_s + drop + i32.const 0 + local.set $5 + loop $while-continue|0 + local.get $4 + i32.const 8 + i32.ge_s + local.set $6 + local.get $6 + if + local.get $1 + local.get $5 + i32.add + i64.load + local.set $8 + local.get $3 + local.set $7 + local.get $8 + i32.wrap_i64 + local.set $9 + local.get $8 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.set $10 + local.get $7 + local.set $11 + local.get $11 + local.get $9 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $9 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $9 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $9 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.set $3 + local.get $5 + i32.const 8 + i32.add + local.set $5 + local.get $4 + i32.const 8 + i32.sub + local.set $4 + br $while-continue|0 + end + end + local.get $4 + i32.const 4 + i32.ge_s + if + local.get $1 + local.get $5 + i32.add + i32.load + local.set $9 + local.get $3 + local.set $7 + local.get $7 + local.set $6 + local.get $6 + local.get $9 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $9 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $9 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $9 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.set $3 + local.get $5 + i32.const 4 + i32.add + local.set $5 + local.get $4 + i32.const 4 + i32.sub + local.set $4 + end + local.get $4 + i32.const 2 + i32.ge_s + if + local.get $1 + local.get $5 + i32.add + i32.load16_u + local.set $11 + local.get $3 + local.set $10 + local.get $10 + local.set $6 + local.get $6 + local.get $11 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $11 + i32.const 8 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.set $3 + local.get $5 + i32.const 2 + i32.add + local.set $5 + local.get $4 + i32.const 2 + i32.sub + local.set $4 + end + end + local.get $3 + local.set $4 + local.get $1 + call $~lib/rt/stub/__release + local.get $4 + local.set $3 + local.get $0 + call $~lib/rt/stub/__release + local.get $3 + return + ) + (func $~lib/util/hash/hash (param $0 f32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 1 + drop + i32.const 4 + i32.const 4 + i32.eq + drop local.get $0 + i32.reinterpret_f32 + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 + local.get $1 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 8 i32.shr_u i32.const 255 @@ -100,9 +590,9 @@ i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 16 i32.shr_u i32.const 255 @@ -110,41 +600,63 @@ i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 24 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $1 - local.get $1 + local.set $3 + local.get $3 + return ) - (func $~lib/util/hash/hash64 (param $0 i64) (result i32) - (local $1 i32) + (func $~lib/util/hash/hash (param $0 f64) (result i32) + (local $1 i64) (local $2 i32) (local $3 i32) + (local $4 i32) + (local $5 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 1 + drop + i32.const 8 + i32.const 4 + i32.eq + drop + i32.const 8 + i32.const 8 + i32.eq + drop local.get $0 - i32.wrap_i64 + i64.reinterpret_f64 local.set $1 - local.get $0 + i32.const -2128831035 + local.set $2 + local.get $1 + i32.wrap_i64 + local.set $3 + local.get $1 i64.const 32 i64.shr_u i32.wrap_i64 - local.set $2 - i32.const -2128831035 - local.set $3 + local.set $4 + local.get $2 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $3 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 8 i32.shr_u i32.const 255 @@ -152,9 +664,9 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 16 i32.shr_u i32.const 255 @@ -162,25 +674,25 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 24 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 8 i32.shr_u i32.const 255 @@ -188,9 +700,9 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 16 i32.shr_u i32.const 255 @@ -198,360 +710,93 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 24 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 + local.set $5 + local.get $5 + return ) (func $start:std/hash - (local $0 i32) - (local $1 i32) - (local $2 f32) - (local $3 f64) - block $~lib/util/hash/HASH<~lib/string/String|null>|inlined.0 (result i32) - i32.const 0 - call $~lib/rt/stub/__retain - local.set $0 - i32.const 1 - drop - local.get $0 - call $~lib/util/hash/hashStr - local.set $1 - local.get $0 - call $~lib/rt/stub/__release - local.get $1 - br $~lib/util/hash/HASH<~lib/string/String|null>|inlined.0 - end + i32.const 0 + call $~lib/util/hash/hash<~lib/string/String|null> call $std/hash/check drop - block $~lib/util/hash/HASH<~lib/string/String>|inlined.0 (result i32) - i32.const 32 - local.set $1 - i32.const 1 - drop - local.get $1 - call $~lib/util/hash/hashStr - local.set $0 - local.get $1 - call $~lib/rt/stub/__release - local.get $0 - br $~lib/util/hash/HASH<~lib/string/String>|inlined.0 - end + i32.const 32 + call $~lib/util/hash/hash<~lib/string/String> call $std/hash/check drop - block $~lib/util/hash/HASH<~lib/string/String>|inlined.1 (result i32) - i32.const 64 - local.set $0 - i32.const 1 - drop - local.get $0 - call $~lib/util/hash/hashStr - local.set $1 - local.get $0 - call $~lib/rt/stub/__release - local.get $1 - br $~lib/util/hash/HASH<~lib/string/String>|inlined.1 - end + i32.const 64 + call $~lib/util/hash/hash<~lib/string/String> call $std/hash/check drop - block $~lib/util/hash/HASH<~lib/string/String>|inlined.2 (result i32) - i32.const 96 - local.set $1 - i32.const 1 - drop - local.get $1 - call $~lib/util/hash/hashStr - local.set $0 - local.get $1 - call $~lib/rt/stub/__release - local.get $0 - br $~lib/util/hash/HASH<~lib/string/String>|inlined.2 - end + i32.const 96 + call $~lib/util/hash/hash<~lib/string/String> call $std/hash/check drop - block $~lib/util/hash/HASH<~lib/string/String>|inlined.3 (result i32) - i32.const 128 - local.set $0 - i32.const 1 - drop - local.get $0 - call $~lib/util/hash/hashStr - local.set $1 - local.get $0 - call $~lib/rt/stub/__release - local.get $1 - br $~lib/util/hash/HASH<~lib/string/String>|inlined.3 - end + i32.const 128 + call $~lib/util/hash/hash<~lib/string/String> call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.0 (result i32) - f32.const 0 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 - end + i32.const 160 + call $~lib/util/hash/hash<~lib/string/String> call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.1 (result i32) - f32.const 1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 - end + i32.const 192 + call $~lib/util/hash/hash<~lib/string/String> call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.2 (result i32) - f32.const 1.100000023841858 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.2 - end + f32.const 0 + call $~lib/util/hash/hash call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.3 (result i32) - f32.const 0 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.3 - end + f32.const 1 + call $~lib/util/hash/hash call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.4 (result i32) - f32.const inf - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.4 - end + f32.const 1.100000023841858 + call $~lib/util/hash/hash call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.5 (result i32) - f32.const nan:0x400000 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.5 - end + f32.const 0 + call $~lib/util/hash/hash call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.0 (result i32) - f64.const 0 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.0 - end + f32.const inf + call $~lib/util/hash/hash call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.1 (result i32) - f64.const 1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.1 - end + f32.const nan:0x400000 + call $~lib/util/hash/hash call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.2 (result i32) - f64.const 1.1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.2 - end + f64.const 0 + call $~lib/util/hash/hash call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.3 (result i32) - f64.const 0 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.3 - end + f64.const 1 + call $~lib/util/hash/hash call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.4 (result i32) - f64.const inf - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.4 - end + f64.const 1.1 + call $~lib/util/hash/hash call $std/hash/check drop - block $~lib/util/hash/HASH|inlined.5 (result i32) - f64.const nan:0x8000000000000 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.5 - end + f64.const 0 + call $~lib/util/hash/hash + call $std/hash/check + drop + f64.const inf + call $~lib/util/hash/hash + call $std/hash/check + drop + f64.const nan:0x8000000000000 + call $~lib/util/hash/hash call $std/hash/check drop ) diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index d65655a3d4..f841cd8c0b 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -22,6 +22,8 @@ (type $i32_f32_f32_=>_i32 (func (param i32 f32 f32) (result i32))) (type $i32_f64_f64_=>_i32 (func (param i32 f64 f64) (result i32))) (type $i64_=>_i32 (func (param i64) (result i32))) + (type $f32_=>_i32 (func (param f32) (result i32))) + (type $f64_=>_i32 (func (param f64) (result i32))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) @@ -1290,6 +1292,17 @@ local.get $1 call $~lib/rt/pure/__retain ) + (func $~lib/util/hash/hash (param $0 i32) (result i32) + local.get $0 + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + i32.const -2128831035 + i32.xor + i32.const 16777619 + i32.mul + ) (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 i32.load @@ -1337,14 +1350,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -1408,12 +1414,9 @@ i32.store offset=4 local.get $2 local.get $5 - local.get $1 local.get $6 - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash + local.get $1 i32.and i32.const 2 i32.shl @@ -1487,20 +1490,11 @@ (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul - local.tee $3 - local.set $5 local.get $0 local.get $1 - local.get $3 + local.get $1 + call $~lib/util/hash/hash + local.tee $5 call $~lib/map/Map#find local.tee $3 if @@ -1591,14 +1585,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $0 i32.eqz @@ -2475,12 +2462,9 @@ i32.store8 offset=1 local.get $2 local.get $5 - local.get $1 local.get $6 - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash + local.get $1 i32.and i32.const 2 i32.shl @@ -2554,19 +2538,13 @@ (local $3 i32) (local $4 i32) (local $5 i32) - local.get $0 - i32.load local.get $1 local.tee $3 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul - local.tee $5 + call $~lib/util/hash/hash + local.set $5 + local.get $0 + i32.load + local.get $5 local.get $0 i32.load offset=4 i32.and @@ -2690,7 +2668,7 @@ local.get $0 call $~lib/rt/pure/__retain ) - (func $~lib/util/hash/hash32 (param $0 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) local.get $0 i32.const 255 i32.and @@ -2822,7 +2800,7 @@ local.get $2 local.get $5 local.get $6 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -2900,7 +2878,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.tee $5 call $~lib/map/Map#find local.tee $3 @@ -2993,14 +2971,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $1 i32.eqz @@ -3610,16 +3581,20 @@ local.get $0 call $~lib/rt/pure/__release ) - (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) local.get $0 - local.get $1 - local.get $1 i32.const 255 i32.and i32.const -2128831035 i32.xor i32.const 16777619 i32.mul + ) + (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) + local.get $0 + local.get $1 + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -3683,12 +3658,9 @@ i32.store offset=4 local.get $2 local.get $5 - local.get $1 local.get $6 - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash + local.get $1 i32.and i32.const 2 i32.shl @@ -3762,18 +3734,11 @@ (local $3 i32) (local $4 i32) (local $5 i32) - local.get $1 - i32.const 255 - i32.and - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul - local.tee $3 - local.set $5 local.get $0 local.get $1 - local.get $3 + local.get $1 + call $~lib/util/hash/hash + local.tee $5 call $~lib/map/Map#find local.tee $3 if @@ -3864,12 +3829,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 255 - i32.and - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $0 i32.eqz @@ -4056,12 +4016,9 @@ i32.store8 offset=1 local.get $2 local.get $5 - local.get $1 local.get $6 - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash + local.get $1 i32.and i32.const 2 i32.shl @@ -4135,17 +4092,13 @@ (local $3 i32) (local $4 i32) (local $5 i32) - local.get $0 - i32.load local.get $1 local.tee $3 - i32.const 255 - i32.and - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul - local.tee $5 + call $~lib/util/hash/hash + local.set $5 + local.get $0 + i32.load + local.get $5 local.get $0 i32.load offset=4 i32.and @@ -4274,12 +4227,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 255 - i32.and - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $1 i32.eqz @@ -4834,8 +4782,13 @@ local.get $0 call $~lib/rt/pure/__release ) - (func $~lib/util/hash/hash16 (param $0 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) local.get $0 + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s + local.tee $0 i32.const 255 i32.and i32.const -2128831035 @@ -4896,11 +4849,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -4965,7 +4914,7 @@ local.get $2 local.get $5 local.get $6 - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -5043,11 +4992,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.tee $5 call $~lib/map/Map#find local.tee $3 @@ -5139,11 +5084,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $0 i32.eqz @@ -5385,7 +5326,7 @@ local.get $2 local.get $5 local.get $6 - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -5462,11 +5403,7 @@ (local $5 i32) local.get $1 local.tee $3 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.set $5 local.get $0 i32.load @@ -5599,11 +5536,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $1 i32.eqz @@ -6182,13 +6115,29 @@ local.get $0 call $~lib/rt/pure/__release ) + (func $~lib/util/hash/hash (param $0 i32) (result i32) + local.get $0 + i32.const 65535 + i32.and + local.tee $0 + i32.const 255 + i32.and + i32.const -2128831035 + i32.xor + i32.const 16777619 + i32.mul + local.get $0 + i32.const 8 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 local.get $1 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -6253,7 +6202,7 @@ local.get $2 local.get $5 local.get $6 - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -6331,9 +6280,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.tee $5 call $~lib/map/Map#find local.tee $3 @@ -6425,9 +6372,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $0 i32.eqz @@ -6619,7 +6564,7 @@ local.get $2 local.get $5 local.get $6 - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -6696,9 +6641,7 @@ (local $5 i32) local.get $1 local.tee $3 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.set $5 local.get $0 i32.load @@ -6831,9 +6774,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $1 i32.eqz @@ -7394,7 +7335,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -7403,7 +7344,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $0 i32.eqz @@ -7423,7 +7364,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $1 i32.eqz @@ -8521,7 +8462,7 @@ local.get $0 call $~lib/rt/pure/__release ) - (func $~lib/util/hash/hash64 (param $0 i64) (result i32) + (func $~lib/util/hash/hash (param $0 i64) (result i32) (local $1 i32) local.get $0 i32.wrap_i64 @@ -8632,7 +8573,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -8698,7 +8639,7 @@ local.get $2 local.get $5 local.get $8 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -8776,7 +8717,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.tee $5 call $~lib/map/Map#find local.tee $3 @@ -8868,7 +8809,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $0 i32.eqz @@ -9184,7 +9125,7 @@ local.get $2 local.get $5 local.get $8 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -9260,7 +9201,7 @@ (local $4 i32) (local $5 i32) local.get $1 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.set $4 local.get $0 i32.load @@ -9392,7 +9333,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $2 i32.eqz @@ -10542,6 +10483,40 @@ local.get $1 call $~lib/rt/pure/__release ) + (func $~lib/util/hash/hash (param $0 f32) (result i32) + (local $1 i32) + local.get $0 + i32.reinterpret_f32 + local.tee $1 + i32.const 255 + i32.and + i32.const -2128831035 + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + ) (func $~lib/map/Map#find (param $0 i32) (param $1 f32) (param $2 i32) (result i32) local.get $0 i32.load @@ -10587,8 +10562,7 @@ local.get $0 local.get $1 local.get $1 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -10654,8 +10628,7 @@ local.get $2 local.get $5 local.get $8 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -10733,8 +10706,7 @@ local.get $0 local.get $1 local.get $1 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.tee $5 call $~lib/map/Map#find local.tee $3 @@ -10826,8 +10798,7 @@ local.get $0 local.get $1 local.get $1 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $0 i32.eqz @@ -11054,8 +11025,7 @@ local.get $2 local.get $5 local.get $8 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -11133,8 +11103,7 @@ local.get $0 local.get $1 local.get $1 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.tee $4 call $~lib/map/Map#find local.tee $3 @@ -11228,8 +11197,7 @@ local.get $0 local.get $1 local.get $1 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $2 i32.eqz @@ -11772,6 +11740,75 @@ local.get $1 call $~lib/rt/pure/__release ) + (func $~lib/util/hash/hash (param $0 f64) (result i32) + (local $1 i32) + (local $2 i64) + local.get $0 + i64.reinterpret_f64 + local.tee $2 + i32.wrap_i64 + local.tee $1 + i32.const 255 + i32.and + i32.const -2128831035 + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.tee $1 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + ) (func $~lib/map/Map#find (param $0 i32) (param $1 f64) (param $2 i32) (result i32) local.get $0 i32.load @@ -11817,8 +11854,7 @@ local.get $0 local.get $1 local.get $1 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -11884,8 +11920,7 @@ local.get $2 local.get $5 local.get $8 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -11963,8 +11998,7 @@ local.get $0 local.get $1 local.get $1 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.tee $5 call $~lib/map/Map#find local.tee $3 @@ -12056,8 +12090,7 @@ local.get $0 local.get $1 local.get $1 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $0 i32.eqz @@ -12284,8 +12317,7 @@ local.get $2 local.get $5 local.get $8 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -12361,8 +12393,7 @@ (local $4 i32) (local $5 i32) local.get $1 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.set $4 local.get $0 i32.load @@ -12494,8 +12525,7 @@ local.get $0 local.get $1 local.get $1 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $2 i32.eqz diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index 19ba13b674..ffca4ccf7a 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -17,12 +17,14 @@ (type $i32_i32_f32_=>_none (func (param i32 i32 f32))) (type $i32_i32_f64_=>_none (func (param i32 i32 f64))) (type $i32_i64_i64_=>_i32 (func (param i32 i64 i64) (result i32))) + (type $i64_=>_i32 (func (param i64) (result i32))) (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) (type $i32_i32_=>_f64 (func (param i32 i32) (result f64))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_f32_f32_=>_i32 (func (param i32 f32 f32) (result i32))) (type $i32_f64_f64_=>_i32 (func (param i32 f64 f64) (result i32))) - (type $i64_=>_i32 (func (param i64) (result i32))) + (type $f32_=>_i32 (func (param f32) (result i32))) + (type $f64_=>_i32 (func (param f64) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 12) "(\00\00\00\01\00\00\00\00\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") @@ -1803,12 +1805,33 @@ i32.store offset=20 local.get $0 ) - (func $~lib/util/hash/hash8 (param $0 i32) (result i32) - i32.const -2128831035 + (func $~lib/util/hash/hash (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 1 + i32.const 1 + i32.eq + drop local.get $0 + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.get $1 i32.xor i32.const 16777619 i32.mul + return ) (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -1865,30 +1888,10 @@ i32.const 0 ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -1968,23 +1971,8 @@ local.get $10 i32.load offset=4 i32.store offset=4 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -2067,38 +2055,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $3 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store offset=4 else @@ -2134,8 +2103,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -2147,11 +2116,11 @@ i32.const 12 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store8 - local.get $5 + local.get $4 local.get $2 i32.store offset=4 local.get $0 @@ -2162,7 +2131,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -2170,14 +2139,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=8 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -2185,33 +2154,13 @@ ) (func $~lib/map/Map#get (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - (local $3 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 384 @@ -2221,7 +2170,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=4 ) (func $~lib/map/Map#get:size (param $0 i32) (result i32) @@ -4457,23 +4406,8 @@ local.get $10 i32.load8_s offset=1 i32.store8 offset=1 - block $~lib/util/hash/HASH|inlined.5 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.5 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -4556,38 +4490,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.4 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $3 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.4 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store8 offset=1 else @@ -4623,8 +4538,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -4636,11 +4551,11 @@ i32.const 8 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store8 - local.get $5 + local.get $4 local.get $2 i32.store8 offset=1 local.get $0 @@ -4651,7 +4566,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -4659,33 +4574,57 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=4 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 call $~lib/rt/pure/__retain ) - (func $~lib/util/hash/hash32 (param $0 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) (local $1 i32) - i32.const -2128831035 + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 4 + i32.const 2 + i32.eq + drop + i32.const 4 + i32.const 4 + i32.eq + drop + local.get $0 local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 8 i32.shr_u i32.const 255 @@ -4693,9 +4632,9 @@ i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 16 i32.shr_u i32.const 255 @@ -4703,16 +4642,17 @@ i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 24 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $1 - local.get $1 + local.set $3 + local.get $3 + return ) (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -4839,31 +4779,8 @@ local.get $10 i32.load offset=4 i32.store offset=4 - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -4946,42 +4863,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop + local.get $1 + call $~lib/util/hash/hash + local.set $3 + local.get $0 + local.get $1 + local.get $3 + call $~lib/map/Map#find + local.set $4 + local.get $4 + if i32.const 0 drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $3 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 - end - local.set $4 - local.get $0 - local.get $1 - local.get $4 - call $~lib/map/Map#find - local.set $5 - local.get $5 - if - i32.const 0 - drop - local.get $5 + local.get $4 local.get $2 i32.store offset=4 else @@ -5017,8 +4911,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -5030,11 +4924,11 @@ i32.const 12 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store - local.get $5 + local.get $4 local.get $2 i32.store offset=4 local.get $0 @@ -5045,7 +4939,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -5053,14 +4947,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=8 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -5081,30 +4975,11 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.6 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.6 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -5114,8 +4989,8 @@ drop i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=8 i32.const 1 i32.or @@ -5130,16 +5005,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -5159,7 +5034,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/map/Map#rehash end i32.const 1 @@ -5757,6 +5632,32 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 1 + i32.const 1 + i32.eq + drop + local.get $0 + i32.const 255 + i32.and + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.get $1 + i32.xor + i32.const 16777619 + i32.mul + return + ) (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -5810,28 +5711,10 @@ i32.const 0 ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 255 - i32.and - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -5911,23 +5794,8 @@ local.get $10 i32.load offset=4 i32.store offset=4 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -6010,36 +5878,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $3 - i32.const 255 - i32.and - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store offset=4 else @@ -6075,8 +5926,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -6088,11 +5939,11 @@ i32.const 12 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store8 - local.get $5 + local.get $4 local.get $2 i32.store offset=4 local.get $0 @@ -6103,7 +5954,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -6111,14 +5962,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=8 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -6126,31 +5977,13 @@ ) (func $~lib/map/Map#get (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - (local $3 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 255 - i32.and - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 384 @@ -6160,7 +5993,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=4 ) (func $~lib/map/Map#get:size (param $0 i32) (result i32) @@ -6640,23 +6473,8 @@ local.get $10 i32.load8_u offset=1 i32.store8 offset=1 - block $~lib/util/hash/HASH|inlined.5 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.5 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -6739,36 +6557,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.4 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $3 - i32.const 255 - i32.and - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.4 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store8 offset=1 else @@ -6804,8 +6605,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -6817,11 +6618,11 @@ i32.const 8 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store8 - local.get $5 + local.get $4 local.get $2 i32.store8 offset=1 local.get $0 @@ -6832,7 +6633,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -6840,14 +6641,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=4 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -6864,30 +6665,13 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.6 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 255 - i32.and - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.6 - end - call $~lib/map/Map#find - local.set $3 - local.get $3 - i32.eqz - if + local.get $1 + call $~lib/util/hash/hash + call $~lib/map/Map#find + local.set $2 + local.get $2 + i32.eqz + if i32.const 0 return end @@ -6895,8 +6679,8 @@ drop i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=8 i32.const 1 i32.or @@ -6911,16 +6695,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -6940,7 +6724,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/map/Map#rehash end i32.const 1 @@ -7516,27 +7300,52 @@ i32.store offset=20 local.get $0 ) - (func $~lib/util/hash/hash16 (param $0 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) (local $1 i32) - i32.const -2128831035 + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 2 + i32.const 1 + i32.eq + drop + i32.const 2 + i32.const 2 + i32.eq + drop + local.get $0 + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 8 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $1 - local.get $1 + local.set $3 + local.get $3 + return ) (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -7593,34 +7402,10 @@ i32.const 0 ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -7700,27 +7485,8 @@ local.get $10 i32.load offset=4 i32.store offset=4 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -7803,42 +7569,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $3 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store offset=4 else @@ -7874,8 +7617,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -7887,11 +7630,11 @@ i32.const 12 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store16 - local.get $5 + local.get $4 local.get $2 i32.store offset=4 local.get $0 @@ -7902,7 +7645,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -7910,14 +7653,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=8 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -7925,37 +7668,13 @@ ) (func $~lib/map/Map#get (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - (local $3 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 384 @@ -7965,7 +7684,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=4 ) (func $~lib/map/Map#get:size (param $0 i32) (result i32) @@ -8447,27 +8166,8 @@ local.get $10 i32.load16_s offset=2 i32.store16 offset=2 - block $~lib/util/hash/HASH|inlined.5 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.5 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -8550,42 +8250,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.4 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $3 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.4 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store16 offset=2 else @@ -8621,8 +8298,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -8634,11 +8311,11 @@ i32.const 8 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store16 - local.get $5 + local.get $4 local.get $2 i32.store16 offset=2 local.get $0 @@ -8649,7 +8326,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -8657,14 +8334,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=4 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -8681,36 +8358,13 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.6 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.6 - end - call $~lib/map/Map#find - local.set $3 - local.get $3 - i32.eqz - if + local.get $1 + call $~lib/util/hash/hash + call $~lib/map/Map#find + local.set $2 + local.get $2 + i32.eqz + if i32.const 0 return end @@ -8718,8 +8372,8 @@ drop i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=8 i32.const 1 i32.or @@ -8734,16 +8388,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -8763,7 +8417,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/map/Map#rehash end i32.const 1 @@ -9361,6 +9015,51 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 2 + i32.const 1 + i32.eq + drop + i32.const 2 + i32.const 2 + i32.eq + drop + local.get $0 + i32.const 65535 + i32.and + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 + local.get $1 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 8 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + return + ) (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -9414,32 +9113,10 @@ i32.const 0 ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -9519,27 +9196,8 @@ local.get $10 i32.load offset=4 i32.store offset=4 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -9622,40 +9280,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $3 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store offset=4 else @@ -9691,8 +9328,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -9704,11 +9341,11 @@ i32.const 12 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store16 - local.get $5 + local.get $4 local.get $2 i32.store offset=4 local.get $0 @@ -9719,7 +9356,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -9727,14 +9364,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=8 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -9742,35 +9379,13 @@ ) (func $~lib/map/Map#get (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - (local $3 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 384 @@ -9780,7 +9395,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=4 ) (func $~lib/map/Map#get:size (param $0 i32) (result i32) @@ -10260,27 +9875,8 @@ local.get $10 i32.load16_u offset=2 i32.store16 offset=2 - block $~lib/util/hash/HASH|inlined.5 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.5 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -10363,40 +9959,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.4 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $3 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.4 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store16 offset=2 else @@ -10432,8 +10007,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -10445,11 +10020,11 @@ i32.const 8 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store16 - local.get $5 + local.get $4 local.get $2 i32.store16 offset=2 local.get $0 @@ -10460,7 +10035,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -10468,14 +10043,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=4 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -10492,34 +10067,13 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.6 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.6 - end - call $~lib/map/Map#find - local.set $3 - local.get $3 - i32.eqz - if + local.get $1 + call $~lib/util/hash/hash + call $~lib/map/Map#find + local.set $2 + local.get $2 + i32.eqz + if i32.const 0 return end @@ -10527,8 +10081,8 @@ drop i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=8 i32.const 1 i32.or @@ -10543,16 +10097,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -10572,7 +10126,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/map/Map#rehash end i32.const 1 @@ -11109,71 +10663,23 @@ call $~lib/rt/pure/__release ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne ) (func $~lib/map/Map#get (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - (local $3 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 384 @@ -11183,7 +10689,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=4 ) (func $~lib/map/Map#keys (param $0 i32) (result i32) @@ -11327,34 +10833,11 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.4 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.4 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -11364,8 +10847,8 @@ drop i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=8 i32.const 1 i32.or @@ -11380,16 +10863,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -11409,7 +10892,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/map/Map#rehash end i32.const 1 @@ -11961,6 +11444,73 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 4 + i32.const 2 + i32.eq + drop + i32.const 4 + i32.const 4 + i32.eq + drop + local.get $0 + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 + local.get $1 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + return + ) (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -12012,34 +11562,10 @@ i32.const 0 ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -12119,31 +11645,8 @@ local.get $10 i32.load offset=4 i32.store offset=4 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -12226,42 +11729,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $3 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store offset=4 else @@ -12297,9 +11777,9 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 - local.get $0 + local.set $5 + local.get $5 + local.get $0 local.get $0 i32.load offset=16 local.tee $6 @@ -12310,11 +11790,11 @@ i32.const 12 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store - local.get $5 + local.get $4 local.get $2 i32.store offset=4 local.get $0 @@ -12325,7 +11805,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -12333,14 +11813,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=8 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -12348,37 +11828,13 @@ ) (func $~lib/map/Map#get (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - (local $3 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 384 @@ -12388,7 +11844,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=4 ) (func $~lib/map/Map#get:size (param $0 i32) (result i32) @@ -12866,31 +12322,8 @@ local.get $10 i32.load offset=4 i32.store offset=4 - block $~lib/util/hash/HASH|inlined.5 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.5 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -12973,42 +12406,19 @@ (local $4 i32) (local $5 i32) (local $6 i32) - block $~lib/util/hash/HASH|inlined.4 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $3 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.4 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store offset=4 else @@ -13044,8 +12454,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -13057,11 +12467,11 @@ i32.const 12 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store - local.get $5 + local.get $4 local.get $2 i32.store offset=4 local.get $0 @@ -13072,7 +12482,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -13080,14 +12490,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=8 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -13104,34 +12514,11 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.6 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.6 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -13141,8 +12528,8 @@ drop i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=8 i32.const 1 i32.or @@ -13157,16 +12544,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -13186,7 +12573,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/map/Map#rehash end i32.const 1 @@ -13738,30 +13125,58 @@ i32.store offset=20 local.get $0 ) - (func $~lib/util/hash/hash64 (param $0 i64) (result i32) - (local $1 i32) + (func $~lib/util/hash/hash (param $0 i64) (result i32) + (local $1 i64) (local $2 i32) (local $3 i32) + (local $4 i32) + (local $5 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 8 + i32.const 1 + i32.eq + drop + i32.const 8 + i32.const 2 + i32.eq + drop + i32.const 8 + i32.const 4 + i32.eq + drop + i32.const 8 + i32.const 8 + i32.eq + drop local.get $0 - i32.wrap_i64 local.set $1 - local.get $0 + i32.const -2128831035 + local.set $2 + local.get $1 + i32.wrap_i64 + local.set $3 + local.get $1 i64.const 32 i64.shr_u i32.wrap_i64 - local.set $2 - i32.const -2128831035 - local.set $3 + local.set $4 + local.get $2 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $3 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 8 i32.shr_u i32.const 255 @@ -13769,9 +13184,9 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 16 i32.shr_u i32.const 255 @@ -13779,25 +13194,25 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 24 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 8 i32.shr_u i32.const 255 @@ -13805,9 +13220,9 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 16 i32.shr_u i32.const 255 @@ -13815,16 +13230,17 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 24 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 + local.set $5 + local.get $5 + return ) (func $~lib/map/Map#find (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) @@ -13877,38 +13293,10 @@ i32.const 0 ) (func $~lib/map/Map#has (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -13925,9 +13313,8 @@ (local $10 i32) (local $11 i32) (local $12 i64) - (local $13 i64) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -13989,49 +13376,22 @@ local.get $10 i32.load offset=8 i32.store offset=8 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=12 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -14049,28 +13409,28 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne @@ -14096,51 +13456,23 @@ call $~lib/rt/pure/__release ) (func $~lib/map/Map#set (param $0 i32) (param $1 i64) (param $2 i32) (result i32) - (local $3 i64) + (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store offset=8 else @@ -14176,24 +13508,24 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $6 - local.get $6 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 - local.tee $7 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $7 + local.get $6 i32.const 16 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i64.store - local.get $5 + local.get $4 local.get $2 i32.store offset=8 local.get $0 @@ -14204,64 +13536,36 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $7 - local.get $5 - local.get $7 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=12 - local.get $7 - local.get $5 - i32.store local.get $6 + local.get $4 + i32.store + local.get $5 call $~lib/rt/pure/__release end local.get $0 call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) - (local $3 i32) + (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 384 @@ -14271,7 +13575,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=8 ) (func $~lib/map/Map#get:size (param $0 i32) (result i32) @@ -14686,9 +13990,8 @@ (local $10 i32) (local $11 i32) (local $12 i64) - (local $13 i64) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -14750,49 +14053,22 @@ local.get $10 i64.load offset=8 i64.store offset=8 - block $~lib/util/hash/HASH|inlined.5 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.5 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=16 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -14810,28 +14086,28 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne @@ -14857,51 +14133,23 @@ call $~lib/rt/pure/__release ) (func $~lib/map/Map#set (param $0 i32) (param $1 i64) (param $2 i64) (result i32) - (local $3 i64) + (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - block $~lib/util/hash/HASH|inlined.4 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.4 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i64.store offset=8 else @@ -14937,24 +14185,24 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $6 - local.get $6 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 - local.tee $7 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $7 + local.get $6 i32.const 24 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i64.store - local.get $5 + local.get $4 local.get $2 i64.store offset=8 local.get $0 @@ -14965,22 +14213,22 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $7 - local.get $5 - local.get $7 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=16 - local.get $7 - local.get $5 - i32.store local.get $6 + local.get $4 + i32.store + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -14991,47 +14239,19 @@ i32.load offset=20 ) (func $~lib/map/Map#delete (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) + (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.6 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.6 - end - call $~lib/map/Map#find - local.set $3 - local.get $3 - i32.eqz - if + local.get $1 + call $~lib/util/hash/hash + call $~lib/map/Map#find + local.set $2 + local.get $2 + i32.eqz + if i32.const 0 return end @@ -15039,8 +14259,8 @@ drop i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=12 i32.const 1 i32.or @@ -15055,17 +14275,17 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $5 + local.tee $4 local.get $0 i32.load offset=20 - local.tee $6 + local.tee $5 + local.get $4 local.get $5 - local.get $6 i32.gt_u select i32.ge_u @@ -15084,7 +14304,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/map/Map#rehash end i32.const 1 @@ -15644,6 +14864,123 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 i64) (result i32) + (local $1 i64) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 8 + i32.const 1 + i32.eq + drop + i32.const 8 + i32.const 2 + i32.eq + drop + i32.const 8 + i32.const 4 + i32.eq + drop + i32.const 8 + i32.const 8 + i32.eq + drop + local.get $0 + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $1 + i32.wrap_i64 + local.set $3 + local.get $1 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.set $4 + local.get $2 + local.set $5 + local.get $5 + local.get $3 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + return + ) (func $~lib/map/Map#find (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -15695,38 +15032,10 @@ i32.const 0 ) (func $~lib/map/Map#has (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -15743,9 +15052,8 @@ (local $10 i32) (local $11 i32) (local $12 i64) - (local $13 i64) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -15807,49 +15115,22 @@ local.get $10 i32.load offset=8 i32.store offset=8 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=12 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -15867,28 +15148,28 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne @@ -15914,51 +15195,23 @@ call $~lib/rt/pure/__release ) (func $~lib/map/Map#set (param $0 i32) (param $1 i64) (param $2 i32) (result i32) - (local $3 i64) + (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store offset=8 else @@ -15994,24 +15247,24 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $6 - local.get $6 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 - local.tee $7 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $7 + local.get $6 i32.const 16 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i64.store - local.get $5 + local.get $4 local.get $2 i32.store offset=8 local.get $0 @@ -16022,64 +15275,36 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $7 - local.get $5 - local.get $7 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=12 - local.get $7 - local.get $5 - i32.store local.get $6 + local.get $4 + i32.store + local.get $5 call $~lib/rt/pure/__release end local.get $0 call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) - (local $3 i32) + (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 384 @@ -16089,7 +15314,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=8 ) (func $~lib/map/Map#get:size (param $0 i32) (result i32) @@ -16504,9 +15729,8 @@ (local $10 i32) (local $11 i32) (local $12 i64) - (local $13 i64) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -16568,49 +15792,22 @@ local.get $10 i64.load offset=8 i64.store offset=8 - block $~lib/util/hash/HASH|inlined.5 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.5 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=16 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -16628,98 +15825,70 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 - i32.ne - if - local.get $9 - call $~lib/rt/pure/__retain - local.set $9 - local.get $11 - call $~lib/rt/pure/__release - end - local.get $9 - i32.store offset=8 - local.get $0 - local.get $4 - i32.store offset=12 - local.get $0 - local.get $0 - i32.load offset=20 - i32.store offset=16 - local.get $3 - call $~lib/rt/pure/__release - local.get $5 - call $~lib/rt/pure/__release - ) - (func $~lib/map/Map#set (param $0 i32) (param $1 i64) (param $2 i64) (result i32) - (local $3 i64) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - block $~lib/util/hash/HASH|inlined.4 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.4 + i32.ne + if + local.get $9 + call $~lib/rt/pure/__retain + local.set $9 + local.get $11 + call $~lib/rt/pure/__release end - local.set $4 + local.get $9 + i32.store offset=8 local.get $0 - local.get $1 local.get $4 - call $~lib/map/Map#find - local.set $5 + i32.store offset=12 + local.get $0 + local.get $0 + i32.load offset=20 + i32.store offset=16 + local.get $3 + call $~lib/rt/pure/__release local.get $5 + call $~lib/rt/pure/__release + ) + (func $~lib/map/Map#set (param $0 i32) (param $1 i64) (param $2 i64) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + local.get $1 + call $~lib/util/hash/hash + local.set $3 + local.get $0 + local.get $1 + local.get $3 + call $~lib/map/Map#find + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i64.store offset=8 else @@ -16755,24 +15924,24 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $6 - local.get $6 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 - local.tee $7 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $7 + local.get $6 i32.const 24 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i64.store - local.get $5 + local.get $4 local.get $2 i64.store offset=8 local.get $0 @@ -16783,22 +15952,22 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $7 - local.get $5 - local.get $7 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=16 - local.get $7 - local.get $5 - i32.store local.get $6 + local.get $4 + i32.store + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -16809,45 +15978,17 @@ i32.load offset=20 ) (func $~lib/map/Map#delete (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) + (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.6 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.6 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -16857,8 +15998,8 @@ drop i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=12 i32.const 1 i32.or @@ -16873,17 +16014,17 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $5 + local.tee $4 local.get $0 i32.load offset=20 - local.tee $6 + local.tee $5 + local.get $4 local.get $5 - local.get $6 i32.gt_u select i32.ge_u @@ -16902,7 +16043,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/map/Map#rehash end i32.const 1 @@ -17462,6 +16603,66 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 f32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 1 + drop + i32.const 4 + i32.const 4 + i32.eq + drop + local.get $0 + i32.reinterpret_f32 + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 + local.get $1 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + return + ) (func $~lib/map/Map#find (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -17513,27 +16714,10 @@ i32.const 0 ) (func $~lib/map/Map#has (param $0 i32) (param $1 f32) (result i32) - (local $2 f32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -17550,9 +16734,8 @@ (local $10 i32) (local $11 i32) (local $12 f32) - (local $13 f32) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -17614,38 +16797,22 @@ local.get $10 i32.load offset=4 i32.store offset=4 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $13 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=8 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -17663,28 +16830,28 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne @@ -17710,40 +16877,23 @@ call $~lib/rt/pure/__release ) (func $~lib/map/Map#set (param $0 i32) (param $1 f32) (param $2 i32) (result i32) - (local $3 f32) + (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $3 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store offset=4 else @@ -17779,24 +16929,24 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $6 - local.get $6 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 - local.tee $7 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $7 + local.get $6 i32.const 12 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 f32.store - local.get $5 + local.get $4 local.get $2 i32.store offset=4 local.get $0 @@ -17807,53 +16957,36 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul - i32.add - local.set $7 - local.get $5 - local.get $7 + i32.add + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=8 - local.get $7 - local.get $5 - i32.store local.get $6 + local.get $4 + i32.store + local.get $5 call $~lib/rt/pure/__release end local.get $0 call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (param $0 i32) (param $1 f32) (result i32) - (local $2 f32) - (local $3 i32) + (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 384 @@ -17863,7 +16996,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=4 ) (func $~lib/map/Map#get:size (param $0 i32) (result i32) @@ -18278,9 +17411,8 @@ (local $10 i32) (local $11 i32) (local $12 f32) - (local $13 f32) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -18342,38 +17474,22 @@ local.get $10 f32.load offset=4 f32.store offset=4 - block $~lib/util/hash/HASH|inlined.5 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $13 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.5 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=8 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -18391,28 +17507,28 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne @@ -18438,40 +17554,23 @@ call $~lib/rt/pure/__release ) (func $~lib/map/Map#set (param $0 i32) (param $1 f32) (param $2 f32) (result i32) - (local $3 f32) + (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - block $~lib/util/hash/HASH|inlined.4 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $3 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.4 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 f32.store offset=4 else @@ -18507,24 +17606,24 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $6 - local.get $6 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 - local.tee $7 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $7 + local.get $6 i32.const 12 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 f32.store - local.get $5 + local.get $4 local.get $2 f32.store offset=4 local.get $0 @@ -18535,22 +17634,22 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $7 - local.get $5 - local.get $7 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=8 - local.get $7 - local.get $5 - i32.store local.get $6 + local.get $4 + i32.store + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -18561,34 +17660,17 @@ i32.load offset=20 ) (func $~lib/map/Map#delete (param $0 i32) (param $1 f32) (result i32) - (local $2 f32) + (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.6 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.6 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -18598,8 +17680,8 @@ drop i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=8 i32.const 1 i32.or @@ -18614,17 +17696,17 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $5 + local.tee $4 local.get $0 i32.load offset=20 - local.tee $6 + local.tee $5 + local.get $4 local.get $5 - local.get $6 i32.gt_u select i32.ge_u @@ -18643,7 +17725,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/map/Map#rehash end i32.const 1 @@ -19203,6 +18285,116 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 f64) (result i32) + (local $1 i64) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 1 + drop + i32.const 8 + i32.const 4 + i32.eq + drop + i32.const 8 + i32.const 8 + i32.eq + drop + local.get $0 + i64.reinterpret_f64 + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $1 + i32.wrap_i64 + local.set $3 + local.get $1 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.set $4 + local.get $2 + local.set $5 + local.get $5 + local.get $3 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + return + ) (func $~lib/map/Map#find (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -19254,31 +18446,10 @@ i32.const 0 ) (func $~lib/map/Map#has (param $0 i32) (param $1 f64) (result i32) - (local $2 f64) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -19295,9 +18466,8 @@ (local $10 i32) (local $11 i32) (local $12 f64) - (local $13 f64) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -19359,42 +18529,22 @@ local.get $10 i32.load offset=8 i32.store offset=8 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $13 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=12 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -19412,28 +18562,28 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne @@ -19459,44 +18609,23 @@ call $~lib/rt/pure/__release ) (func $~lib/map/Map#set (param $0 i32) (param $1 f64) (param $2 i32) (result i32) - (local $3 f64) + (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 i32.store offset=8 else @@ -19532,24 +18661,24 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $6 - local.get $6 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 - local.tee $7 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $7 + local.get $6 i32.const 16 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 f64.store - local.get $5 + local.get $4 local.get $2 i32.store offset=8 local.get $0 @@ -19560,57 +18689,36 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $7 - local.get $5 - local.get $7 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=12 - local.get $7 - local.get $5 - i32.store local.get $6 + local.get $4 + i32.store + local.get $5 call $~lib/rt/pure/__release end local.get $0 call $~lib/rt/pure/__retain ) (func $~lib/map/Map#get (param $0 i32) (param $1 f64) (result i32) - (local $2 f64) - (local $3 i32) + (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 384 @@ -19620,7 +18728,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=8 ) (func $~lib/map/Map#get:size (param $0 i32) (result i32) @@ -20035,9 +19143,8 @@ (local $10 i32) (local $11 i32) (local $12 f64) - (local $13 f64) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -20099,42 +19206,22 @@ local.get $10 f64.load offset=8 f64.store offset=8 - block $~lib/util/hash/HASH|inlined.5 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $13 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.5 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=16 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -20152,28 +19239,28 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne @@ -20199,44 +19286,23 @@ call $~lib/rt/pure/__release ) (func $~lib/map/Map#set (param $0 i32) (param $1 f64) (param $2 f64) (result i32) - (local $3 f64) + (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - (local $7 i32) - block $~lib/util/hash/HASH|inlined.4 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $3 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.4 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $5 + local.get $4 local.get $2 f64.store offset=8 else @@ -20272,24 +19338,24 @@ local.get $0 i32.load offset=8 call $~lib/rt/pure/__retain - local.set $6 - local.get $6 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 - local.tee $7 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $7 + local.get $6 i32.const 24 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 f64.store - local.get $5 + local.get $4 local.get $2 f64.store offset=8 local.get $0 @@ -20300,22 +19366,22 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $7 - local.get $5 - local.get $7 + local.set $6 + local.get $4 + local.get $6 i32.load i32.store offset=16 - local.get $7 - local.get $5 - i32.store local.get $6 + local.get $4 + i32.store + local.get $5 call $~lib/rt/pure/__release end local.get $0 @@ -20326,38 +19392,17 @@ i32.load offset=20 ) (func $~lib/map/Map#delete (param $0 i32) (param $1 f64) (result i32) - (local $2 f64) + (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.6 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.6 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -20367,8 +19412,8 @@ drop i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=12 i32.const 1 i32.or @@ -20383,17 +19428,17 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $5 + local.tee $4 local.get $0 i32.load offset=20 - local.tee $6 + local.tee $5 + local.get $4 local.get $5 - local.get $6 i32.gt_u select i32.ge_u @@ -20412,7 +19457,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/map/Map#rehash end i32.const 1 diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index c185d03e5f..0b75dd4a6b 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -1,7 +1,7 @@ (module (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $none_=>_none (func)) (type $none_=>_i32 (func (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) @@ -19,6 +19,8 @@ (type $i32_f32_i32_=>_i32 (func (param i32 f32 i32) (result i32))) (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) (type $i64_=>_i32 (func (param i64) (result i32))) + (type $f32_=>_i32 (func (param f32) (result i32))) + (type $f64_=>_i32 (func (param f64) (result i32))) (type $i32_i32_=>_i64 (func (param i32 i32) (result i64))) (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) (type $i32_i32_=>_f64 (func (param i32 i32) (result f64))) @@ -1315,6 +1317,17 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 i32) (result i32) + local.get $0 + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + i32.const -2128831035 + i32.xor + i32.const 16777619 + i32.mul + ) (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $0 i32.load @@ -1362,14 +1375,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -1389,60 +1395,58 @@ i32.const 2 i32.shl call $~lib/arraybuffer/ArrayBuffer#constructor - local.set $4 + local.set $5 local.get $3 i32.const 3 i32.shl i32.const 3 i32.div_s - local.tee $6 + local.tee $7 i32.const 3 i32.shl call $~lib/arraybuffer/ArrayBuffer#constructor local.set $3 local.get $0 i32.load offset=8 - local.tee $8 + local.tee $4 local.get $0 i32.load offset=16 i32.const 3 i32.shl i32.add - local.set $5 + local.set $8 local.get $3 local.set $2 loop $while-continue|0 - local.get $5 + local.get $4 local.get $8 i32.ne if - local.get $8 + local.get $4 + local.tee $6 i32.load offset=4 i32.const 1 i32.and i32.eqz if local.get $2 - local.get $8 + local.get $6 i32.load8_s - local.tee $7 + local.tee $4 i32.store8 local.get $2 + local.get $5 local.get $4 + call $~lib/util/hash/hash local.get $1 - local.get $7 - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul i32.and i32.const 2 i32.shl i32.add - local.tee $7 + local.tee $4 i32.load i32.store offset=4 - local.get $7 + local.get $4 local.get $2 i32.store local.get $2 @@ -1450,24 +1454,24 @@ i32.add local.set $2 end - local.get $8 + local.get $6 i32.const 8 i32.add - local.set $8 + local.set $4 br $while-continue|0 end end - local.get $4 + local.get $5 local.tee $2 local.get $0 i32.load - local.tee $8 + local.tee $4 i32.ne if local.get $2 call $~lib/rt/pure/__retain local.set $2 - local.get $8 + local.get $4 call $~lib/rt/pure/__release end local.get $0 @@ -1493,13 +1497,13 @@ local.get $1 i32.store offset=8 local.get $0 - local.get $6 + local.get $7 i32.store offset=12 local.get $0 local.get $0 i32.load offset=20 i32.store offset=16 - local.get $4 + local.get $5 call $~lib/rt/pure/__release local.get $3 call $~lib/rt/pure/__release @@ -1508,20 +1512,11 @@ (local $2 i32) (local $3 i32) (local $4 i32) - local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul - local.tee $2 - local.set $3 local.get $0 local.get $1 - local.get $2 + local.get $1 + call $~lib/util/hash/hash + local.tee $3 call $~lib/set/Set#find i32.eqz if @@ -2202,14 +2197,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash call $~lib/set/Set#find local.tee $1 i32.eqz @@ -2641,16 +2629,20 @@ i32.store offset=20 local.get $0 ) - (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) local.get $0 - local.get $1 - local.get $1 i32.const 255 i32.and i32.const -2128831035 i32.xor i32.const 16777619 i32.mul + ) + (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) + local.get $0 + local.get $1 + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -2670,60 +2662,58 @@ i32.const 2 i32.shl call $~lib/arraybuffer/ArrayBuffer#constructor - local.set $4 + local.set $5 local.get $3 i32.const 3 i32.shl i32.const 3 i32.div_s - local.tee $6 + local.tee $7 i32.const 3 i32.shl call $~lib/arraybuffer/ArrayBuffer#constructor local.set $3 local.get $0 i32.load offset=8 - local.tee $8 + local.tee $4 local.get $0 i32.load offset=16 i32.const 3 i32.shl i32.add - local.set $5 + local.set $8 local.get $3 local.set $2 loop $while-continue|0 - local.get $5 + local.get $4 local.get $8 i32.ne if - local.get $8 + local.get $4 + local.tee $6 i32.load offset=4 i32.const 1 i32.and i32.eqz if local.get $2 - local.get $8 + local.get $6 i32.load8_u - local.tee $7 + local.tee $4 i32.store8 local.get $2 + local.get $5 local.get $4 + call $~lib/util/hash/hash local.get $1 - local.get $7 - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul i32.and i32.const 2 i32.shl i32.add - local.tee $7 + local.tee $4 i32.load i32.store offset=4 - local.get $7 + local.get $4 local.get $2 i32.store local.get $2 @@ -2731,24 +2721,24 @@ i32.add local.set $2 end - local.get $8 + local.get $6 i32.const 8 i32.add - local.set $8 + local.set $4 br $while-continue|0 end end - local.get $4 + local.get $5 local.tee $2 local.get $0 i32.load - local.tee $8 + local.tee $4 i32.ne if local.get $2 call $~lib/rt/pure/__retain local.set $2 - local.get $8 + local.get $4 call $~lib/rt/pure/__release end local.get $0 @@ -2774,13 +2764,13 @@ local.get $1 i32.store offset=8 local.get $0 - local.get $6 + local.get $7 i32.store offset=12 local.get $0 local.get $0 i32.load offset=20 i32.store offset=16 - local.get $4 + local.get $5 call $~lib/rt/pure/__release local.get $3 call $~lib/rt/pure/__release @@ -2789,18 +2779,11 @@ (local $2 i32) (local $3 i32) (local $4 i32) - local.get $1 - i32.const 255 - i32.and - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul - local.tee $2 - local.set $3 local.get $0 local.get $1 - local.get $2 + local.get $1 + call $~lib/util/hash/hash + local.tee $3 call $~lib/set/Set#find i32.eqz if @@ -3012,12 +2995,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 255 - i32.and - i32.const -2128831035 - i32.xor - i32.const 16777619 - i32.mul + call $~lib/util/hash/hash call $~lib/set/Set#find local.tee $1 i32.eqz @@ -3408,8 +3386,13 @@ i32.store offset=20 local.get $0 ) - (func $~lib/util/hash/hash16 (param $0 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) local.get $0 + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s + local.tee $0 i32.const 255 i32.and i32.const -2128831035 @@ -3470,11 +3453,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -3536,7 +3515,7 @@ local.get $2 local.get $5 local.get $4 - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -3614,11 +3593,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.tee $3 call $~lib/set/Set#find i32.eqz @@ -3887,11 +3862,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash call $~lib/set/Set#find local.tee $1 i32.eqz @@ -4290,13 +4261,29 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 i32) (result i32) + local.get $0 + i32.const 65535 + i32.and + local.tee $0 + i32.const 255 + i32.and + i32.const -2128831035 + i32.xor + i32.const 16777619 + i32.mul + local.get $0 + i32.const 8 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) local.get $0 local.get $1 local.get $1 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -4358,7 +4345,7 @@ local.get $2 local.get $5 local.get $4 - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -4436,9 +4423,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash local.tee $3 call $~lib/set/Set#find i32.eqz @@ -4657,9 +4642,7 @@ local.get $0 local.get $1 local.get $1 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 + call $~lib/util/hash/hash call $~lib/set/Set#find local.tee $1 i32.eqz @@ -5050,7 +5033,7 @@ i32.store offset=20 local.get $0 ) - (func $~lib/util/hash/hash32 (param $0 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) local.get $0 i32.const 255 i32.and @@ -5126,7 +5109,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -5188,7 +5171,7 @@ local.get $2 local.get $5 local.get $4 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -5266,7 +5249,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.tee $3 call $~lib/set/Set#find i32.eqz @@ -5535,7 +5518,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/set/Set#find local.tee $1 i32.eqz @@ -6364,7 +6347,7 @@ i32.store offset=20 local.get $0 ) - (func $~lib/util/hash/hash64 (param $0 i64) (result i32) + (func $~lib/util/hash/hash (param $0 i64) (result i32) (local $1 i32) local.get $0 i32.wrap_i64 @@ -6475,7 +6458,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -6538,7 +6521,7 @@ local.get $2 local.get $5 local.get $9 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -6616,7 +6599,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.tee $3 call $~lib/set/Set#find i32.eqz @@ -6886,7 +6869,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash call $~lib/set/Set#find local.tee $2 i32.eqz @@ -7750,6 +7733,40 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 f32) (result i32) + (local $1 i32) + local.get $0 + i32.reinterpret_f32 + local.tee $1 + i32.const 255 + i32.and + i32.const -2128831035 + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + ) (func $~lib/set/Set#find (param $0 i32) (param $1 f32) (param $2 i32) (result i32) local.get $0 i32.load @@ -7795,8 +7812,7 @@ local.get $0 local.get $1 local.get $1 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -7859,8 +7875,7 @@ local.get $2 local.get $5 local.get $9 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -7938,8 +7953,7 @@ local.get $0 local.get $1 local.get $1 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.tee $3 call $~lib/set/Set#find i32.eqz @@ -8193,8 +8207,7 @@ local.get $0 local.get $1 local.get $1 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/set/Set#find local.tee $2 i32.eqz @@ -8578,6 +8591,75 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 f64) (result i32) + (local $1 i32) + (local $2 i64) + local.get $0 + i64.reinterpret_f64 + local.tee $2 + i32.wrap_i64 + local.tee $1 + i32.const 255 + i32.and + i32.const -2128831035 + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.tee $1 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $1 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + ) (func $~lib/set/Set#find (param $0 i32) (param $1 f64) (param $2 i32) (result i32) local.get $0 i32.load @@ -8623,8 +8705,7 @@ local.get $0 local.get $1 local.get $1 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -8687,8 +8768,7 @@ local.get $2 local.get $5 local.get $9 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -8766,8 +8846,7 @@ local.get $0 local.get $1 local.get $1 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash local.tee $3 call $~lib/set/Set#find i32.eqz @@ -9021,8 +9100,7 @@ local.get $0 local.get $1 local.get $1 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 + call $~lib/util/hash/hash call $~lib/set/Set#find local.tee $2 i32.eqz diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 271db743ff..2a9fb37d44 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -14,12 +14,14 @@ (type $i32_i32_f32_=>_none (func (param i32 i32 f32))) (type $i32_i32_f64_=>_none (func (param i32 i32 f64))) (type $i32_i64_i32_=>_i32 (func (param i32 i64 i32) (result i32))) + (type $i64_=>_i32 (func (param i64) (result i32))) (type $i32_i32_=>_f32 (func (param i32 i32) (result f32))) (type $i32_i32_=>_f64 (func (param i32 i32) (result f64))) (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) (type $i32_f32_i32_=>_i32 (func (param i32 f32 i32) (result i32))) (type $i32_f64_i32_=>_i32 (func (param i32 f64 i32) (result i32))) - (type $i64_=>_i32 (func (param i64) (result i32))) + (type $f32_=>_i32 (func (param f32) (result i32))) + (type $f64_=>_i32 (func (param f64) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 12) "(\00\00\00\01\00\00\00\00\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") @@ -1798,12 +1800,33 @@ i32.store offset=20 local.get $0 ) - (func $~lib/util/hash/hash8 (param $0 i32) (result i32) - i32.const -2128831035 + (func $~lib/util/hash/hash (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 1 + i32.const 1 + i32.eq + drop local.get $0 + i32.const 24 + i32.shl + i32.const 24 + i32.shr_s + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.get $1 i32.xor i32.const 16777619 i32.mul + return ) (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -1860,30 +1883,10 @@ i32.const 0 ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -1959,23 +1962,8 @@ local.get $11 local.get $12 i32.store8 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -2057,34 +2045,15 @@ (local $2 i32) (local $3 i32) (local $4 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $3 + local.get $1 + call $~lib/util/hash/hash + local.set $2 local.get $0 local.get $1 - local.get $3 + local.get $2 call $~lib/set/Set#find - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.eqz if local.get $0 @@ -2121,16 +2090,16 @@ local.get $0 local.get $0 i32.load offset=16 - local.tee $2 + local.tee $4 i32.const 1 i32.add i32.store offset=16 - local.get $2 + local.get $4 i32.const 8 i32.mul i32.add - local.set $4 - local.get $4 + local.set $3 + local.get $3 local.get $1 i32.store8 local.get $0 @@ -2141,20 +2110,20 @@ i32.store offset=20 local.get $0 i32.load - local.get $3 + local.get $2 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $2 + local.set $4 + local.get $3 local.get $4 - local.get $2 i32.load i32.store offset=4 - local.get $2 local.get $4 + local.get $3 i32.store end local.get $0 @@ -3954,30 +3923,11 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 24 - i32.shl - i32.const 24 - i32.shr_s - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -3985,8 +3935,8 @@ end i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=4 i32.const 1 i32.or @@ -4001,16 +3951,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -4030,7 +3980,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/set/Set#rehash end i32.const 1 @@ -4475,6 +4425,32 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 1 + i32.const 1 + i32.eq + drop + local.get $0 + i32.const 255 + i32.and + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.get $1 + i32.xor + i32.const 16777619 + i32.mul + return + ) (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -4528,28 +4504,10 @@ i32.const 0 ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 255 - i32.and - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -4625,23 +4583,8 @@ local.get $11 local.get $12 i32.store8 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -4723,32 +4666,15 @@ (local $2 i32) (local $3 i32) (local $4 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 255 - i32.and - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $3 + local.get $1 + call $~lib/util/hash/hash + local.set $2 local.get $0 local.get $1 - local.get $3 + local.get $2 call $~lib/set/Set#find - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.eqz if local.get $0 @@ -4785,16 +4711,16 @@ local.get $0 local.get $0 i32.load offset=16 - local.tee $2 + local.tee $4 i32.const 1 i32.add i32.store offset=16 - local.get $2 + local.get $4 i32.const 8 i32.mul i32.add - local.set $4 - local.get $4 + local.set $3 + local.get $3 local.get $1 i32.store8 local.get $0 @@ -4805,20 +4731,20 @@ i32.store offset=20 local.get $0 i32.load - local.get $3 + local.get $2 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $2 + local.set $4 + local.get $3 local.get $4 - local.get $2 i32.load i32.store offset=4 - local.get $2 local.get $4 + local.get $3 i32.store end local.get $0 @@ -5076,28 +5002,11 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - i32.const 1 - i32.eq - drop - local.get $2 - i32.const 255 - i32.and - call $~lib/util/hash/hash8 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -5105,8 +5014,8 @@ end i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=4 i32.const 1 i32.or @@ -5121,16 +5030,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -5150,7 +5059,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/set/Set#rehash end i32.const 1 @@ -5587,27 +5496,52 @@ i32.store offset=20 local.get $0 ) - (func $~lib/util/hash/hash16 (param $0 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) (local $1 i32) - i32.const -2128831035 - local.set $1 - local.get $1 - local.get $0 - i32.const 255 + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 2 + i32.const 1 + i32.eq + drop + i32.const 2 + i32.const 2 + i32.eq + drop + local.get $0 + i32.const 16 + i32.shl + i32.const 16 + i32.shr_s + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 + local.get $1 + i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 8 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $1 - local.get $1 + local.set $3 + local.get $3 + return ) (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -5664,34 +5598,10 @@ i32.const 0 ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -5767,27 +5677,8 @@ local.get $11 local.get $12 i32.store16 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -5869,38 +5760,15 @@ (local $2 i32) (local $3 i32) (local $4 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $3 + local.get $1 + call $~lib/util/hash/hash + local.set $2 local.get $0 local.get $1 - local.get $3 + local.get $2 call $~lib/set/Set#find - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.eqz if local.get $0 @@ -5937,16 +5805,16 @@ local.get $0 local.get $0 i32.load offset=16 - local.tee $2 + local.tee $4 i32.const 1 i32.add i32.store offset=16 - local.get $2 + local.get $4 i32.const 8 i32.mul i32.add - local.set $4 - local.get $4 + local.set $3 + local.get $3 local.get $1 i32.store16 local.get $0 @@ -5957,20 +5825,20 @@ i32.store offset=20 local.get $0 i32.load - local.get $3 + local.get $2 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $2 + local.set $4 + local.get $3 local.get $4 - local.get $2 i32.load i32.store offset=4 - local.get $2 local.get $4 + local.get $3 i32.store end local.get $0 @@ -6228,34 +6096,11 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.shr_s - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -6263,8 +6108,8 @@ end i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=4 i32.const 1 i32.or @@ -6279,16 +6124,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -6308,7 +6153,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/set/Set#rehash end i32.const 1 @@ -6753,6 +6598,51 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 2 + i32.const 1 + i32.eq + drop + i32.const 2 + i32.const 2 + i32.eq + drop + local.get $0 + i32.const 65535 + i32.and + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 + local.get $1 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 8 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + return + ) (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -6806,32 +6696,10 @@ i32.const 0 ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -6907,27 +6775,8 @@ local.get $11 local.get $12 i32.store16 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -7009,36 +6858,15 @@ (local $2 i32) (local $3 i32) (local $4 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $3 + local.get $1 + call $~lib/util/hash/hash + local.set $2 local.get $0 local.get $1 - local.get $3 + local.get $2 call $~lib/set/Set#find - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.eqz if local.get $0 @@ -7075,16 +6903,16 @@ local.get $0 local.get $0 i32.load offset=16 - local.tee $2 + local.tee $4 i32.const 1 i32.add i32.store offset=16 - local.get $2 + local.get $4 i32.const 8 i32.mul i32.add - local.set $4 - local.get $4 + local.set $3 + local.get $3 local.get $1 i32.store16 local.get $0 @@ -7095,20 +6923,20 @@ i32.store offset=20 local.get $0 i32.load - local.get $3 + local.get $2 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $2 + local.set $4 + local.get $3 local.get $4 - local.get $2 i32.load i32.store offset=4 - local.get $2 local.get $4 + local.get $3 i32.store end local.get $0 @@ -7366,32 +7194,11 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 2 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - local.get $2 - i32.const 65535 - i32.and - call $~lib/util/hash/hash16 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -7399,8 +7206,8 @@ end i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=4 i32.const 1 i32.or @@ -7415,16 +7222,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -7444,7 +7251,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/set/Set#rehash end i32.const 1 @@ -7881,20 +7688,44 @@ i32.store offset=20 local.get $0 ) - (func $~lib/util/hash/hash32 (param $0 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) (local $1 i32) - i32.const -2128831035 + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 4 + i32.const 2 + i32.eq + drop + i32.const 4 + i32.const 4 + i32.eq + drop + local.get $0 local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 8 i32.shr_u i32.const 255 @@ -7902,9 +7733,9 @@ i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 16 i32.shr_u i32.const 255 @@ -7912,16 +7743,17 @@ i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 24 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $1 - local.get $1 + local.set $3 + local.get $3 + return ) (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -7974,34 +7806,10 @@ i32.const 0 ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -8077,31 +7885,8 @@ local.get $11 local.get $12 i32.store - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -8183,38 +7968,15 @@ (local $2 i32) (local $3 i32) (local $4 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $3 + local.get $1 + call $~lib/util/hash/hash + local.set $2 local.get $0 local.get $1 - local.get $3 + local.get $2 call $~lib/set/Set#find - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.eqz if local.get $0 @@ -8251,16 +8013,16 @@ local.get $0 local.get $0 i32.load offset=16 - local.tee $2 + local.tee $4 i32.const 1 i32.add i32.store offset=16 - local.get $2 + local.get $4 i32.const 8 i32.mul i32.add - local.set $4 - local.get $4 + local.set $3 + local.get $3 local.get $1 i32.store local.get $0 @@ -8271,20 +8033,20 @@ i32.store offset=20 local.get $0 i32.load - local.get $3 + local.get $2 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $2 + local.set $4 + local.get $3 local.get $4 - local.get $2 i32.load i32.store offset=4 - local.get $2 local.get $4 + local.get $3 i32.store end local.get $0 @@ -8542,34 +8304,11 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -8577,8 +8316,8 @@ end i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=4 i32.const 1 i32.or @@ -8593,16 +8332,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -8622,7 +8361,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/set/Set#rehash end i32.const 1 @@ -9047,17 +8786,84 @@ i32.store offset=20 local.get $0 ) - (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) (local $3 i32) - (local $4 i32) - (local $5 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 4 + i32.const 2 + i32.eq + drop + i32.const 4 + i32.const 4 + i32.eq + drop local.get $0 - i32.load + local.set $1 + i32.const -2128831035 + local.set $2 local.get $2 - local.get $0 - i32.load offset=4 + local.set $3 + local.get $3 + local.get $1 + i32.const 255 i32.and - i32.const 4 + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + return + ) + (func $~lib/set/Set#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $0 + i32.load + local.get $2 + local.get $0 + i32.load offset=4 + i32.and + i32.const 4 i32.mul i32.add i32.load @@ -9098,34 +8904,10 @@ i32.const 0 ) (func $~lib/set/Set#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -9201,31 +8983,8 @@ local.get $11 local.get $12 i32.store - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -9307,38 +9066,15 @@ (local $2 i32) (local $3 i32) (local $4 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $3 + local.get $1 + call $~lib/util/hash/hash + local.set $2 local.get $0 local.get $1 - local.get $3 + local.get $2 call $~lib/set/Set#find - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.eqz if local.get $0 @@ -9375,16 +9111,16 @@ local.get $0 local.get $0 i32.load offset=16 - local.tee $2 + local.tee $4 i32.const 1 i32.add i32.store offset=16 - local.get $2 + local.get $4 i32.const 8 i32.mul i32.add - local.set $4 - local.get $4 + local.set $3 + local.get $3 local.get $1 i32.store local.get $0 @@ -9395,20 +9131,20 @@ i32.store offset=20 local.get $0 i32.load - local.get $3 + local.get $2 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $2 + local.set $4 + local.get $3 local.get $4 - local.get $2 i32.load i32.store offset=4 - local.get $2 local.get $4 + local.get $3 i32.store end local.get $0 @@ -9666,34 +9402,11 @@ (local $5 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -9701,8 +9414,8 @@ end i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=4 i32.const 1 i32.or @@ -9717,16 +9430,16 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $2 + local.tee $4 local.get $0 i32.load offset=20 local.tee $5 - local.get $2 + local.get $4 local.get $5 i32.gt_u select @@ -9746,7 +9459,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/set/Set#rehash end i32.const 1 @@ -10171,30 +9884,58 @@ i32.store offset=20 local.get $0 ) - (func $~lib/util/hash/hash64 (param $0 i64) (result i32) - (local $1 i32) + (func $~lib/util/hash/hash (param $0 i64) (result i32) + (local $1 i64) (local $2 i32) (local $3 i32) + (local $4 i32) + (local $5 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 8 + i32.const 1 + i32.eq + drop + i32.const 8 + i32.const 2 + i32.eq + drop + i32.const 8 + i32.const 4 + i32.eq + drop + i32.const 8 + i32.const 8 + i32.eq + drop local.get $0 - i32.wrap_i64 local.set $1 - local.get $0 + i32.const -2128831035 + local.set $2 + local.get $1 + i32.wrap_i64 + local.set $3 + local.get $1 i64.const 32 i64.shr_u i32.wrap_i64 - local.set $2 - i32.const -2128831035 - local.set $3 + local.set $4 + local.get $2 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $3 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 8 i32.shr_u i32.const 255 @@ -10202,9 +9943,9 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 16 i32.shr_u i32.const 255 @@ -10212,25 +9953,25 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 + local.set $5 + local.get $5 local.get $3 - local.get $1 i32.const 24 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 8 i32.shr_u i32.const 255 @@ -10238,9 +9979,9 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 16 i32.shr_u i32.const 255 @@ -10248,16 +9989,17 @@ i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 - local.get $2 + local.set $5 + local.get $5 + local.get $4 i32.const 24 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $3 - local.get $3 + local.set $5 + local.get $5 + return ) (func $~lib/set/Set#find (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) @@ -10310,38 +10052,10 @@ i32.const 0 ) (func $~lib/set/Set#has (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -10358,9 +10072,8 @@ (local $10 i32) (local $11 i32) (local $12 i64) - (local $13 i64) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -10418,49 +10131,22 @@ local.get $11 local.get $12 i64.store - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=8 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -10478,28 +10164,28 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne @@ -10525,46 +10211,18 @@ call $~lib/rt/pure/__release ) (func $~lib/set/Set#add (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) + (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $3 + local.get $1 + call $~lib/util/hash/hash + local.set $2 local.get $0 local.get $1 - local.get $3 + local.get $2 call $~lib/set/Set#find - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.eqz if local.get $0 @@ -10601,16 +10259,16 @@ local.get $0 local.get $0 i32.load offset=16 - local.tee $5 + local.tee $4 i32.const 1 i32.add i32.store offset=16 - local.get $5 + local.get $4 i32.const 16 i32.mul i32.add - local.set $4 - local.get $4 + local.set $3 + local.get $3 local.get $1 i64.store local.get $0 @@ -10621,20 +10279,20 @@ i32.store offset=20 local.get $0 i32.load - local.get $3 + local.get $2 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $5 + local.set $4 + local.get $3 local.get $4 - local.get $5 i32.load i32.store offset=8 - local.get $5 local.get $4 + local.get $3 i32.store end local.get $0 @@ -10886,45 +10544,17 @@ local.get $2 ) (func $~lib/set/Set#delete (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) + (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -10932,8 +10562,8 @@ end i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=8 i32.const 1 i32.or @@ -10948,17 +10578,17 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $5 + local.tee $4 local.get $0 i32.load offset=20 - local.tee $6 + local.tee $5 + local.get $4 local.get $5 - local.get $6 i32.gt_u select i32.ge_u @@ -10977,7 +10607,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/set/Set#rehash end i32.const 1 @@ -11403,6 +11033,123 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 i64) (result i32) + (local $1 i64) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 8 + i32.const 1 + i32.eq + drop + i32.const 8 + i32.const 2 + i32.eq + drop + i32.const 8 + i32.const 4 + i32.eq + drop + i32.const 8 + i32.const 8 + i32.eq + drop + local.get $0 + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $1 + i32.wrap_i64 + local.set $3 + local.get $1 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.set $4 + local.get $2 + local.set $5 + local.get $5 + local.get $3 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + return + ) (func $~lib/set/Set#find (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -11454,38 +11201,10 @@ i32.const 0 ) (func $~lib/set/Set#has (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -11502,9 +11221,8 @@ (local $10 i32) (local $11 i32) (local $12 i64) - (local $13 i64) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -11562,49 +11280,22 @@ local.get $11 local.get $12 i64.store - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=8 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -11622,93 +11313,65 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne - if - local.get $9 - call $~lib/rt/pure/__retain - local.set $9 - local.get $11 - call $~lib/rt/pure/__release - end - local.get $9 - i32.store offset=8 - local.get $0 - local.get $4 - i32.store offset=12 - local.get $0 - local.get $0 - i32.load offset=20 - i32.store offset=16 - local.get $3 - call $~lib/rt/pure/__release - local.get $5 - call $~lib/rt/pure/__release - ) - (func $~lib/set/Set#add (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) - (local $3 i32) - (local $4 i32) - (local $5 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.1 + if + local.get $9 + call $~lib/rt/pure/__retain + local.set $9 + local.get $11 + call $~lib/rt/pure/__release end - local.set $3 + local.get $9 + i32.store offset=8 local.get $0 - local.get $1 + local.get $4 + i32.store offset=12 + local.get $0 + local.get $0 + i32.load offset=20 + i32.store offset=16 local.get $3 + call $~lib/rt/pure/__release + local.get $5 + call $~lib/rt/pure/__release + ) + (func $~lib/set/Set#add (param $0 i32) (param $1 i64) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + local.get $1 + call $~lib/util/hash/hash + local.set $2 + local.get $0 + local.get $1 + local.get $2 call $~lib/set/Set#find - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.eqz if local.get $0 @@ -11745,16 +11408,16 @@ local.get $0 local.get $0 i32.load offset=16 - local.tee $5 + local.tee $4 i32.const 1 i32.add i32.store offset=16 - local.get $5 + local.get $4 i32.const 16 i32.mul i32.add - local.set $4 - local.get $4 + local.set $3 + local.get $3 local.get $1 i64.store local.get $0 @@ -11765,20 +11428,20 @@ i32.store offset=20 local.get $0 i32.load - local.get $3 + local.get $2 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $5 + local.set $4 + local.get $3 local.get $4 - local.get $5 i32.load i32.store offset=8 - local.get $5 local.get $4 + local.get $3 i32.store end local.get $0 @@ -12030,45 +11693,17 @@ local.get $2 ) (func $~lib/set/Set#delete (param $0 i32) (param $1 i64) (result i32) - (local $2 i64) + (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 8 - i32.const 1 - i32.eq - drop - i32.const 8 - i32.const 2 - i32.eq - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -12076,8 +11711,8 @@ end i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=8 i32.const 1 i32.or @@ -12092,17 +11727,17 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $5 + local.tee $4 local.get $0 i32.load offset=20 - local.tee $6 + local.tee $5 + local.get $4 local.get $5 - local.get $6 i32.gt_u select i32.ge_u @@ -12121,7 +11756,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/set/Set#rehash end i32.const 1 @@ -12547,6 +12182,66 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 f32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 1 + drop + i32.const 4 + i32.const 4 + i32.eq + drop + local.get $0 + i32.reinterpret_f32 + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 + local.get $1 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + local.get $1 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $3 + local.get $3 + return + ) (func $~lib/set/Set#find (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -12598,27 +12293,10 @@ i32.const 0 ) (func $~lib/set/Set#has (param $0 i32) (param $1 f32) (result i32) - (local $2 f32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -12635,9 +12313,8 @@ (local $10 i32) (local $11 i32) (local $12 f32) - (local $13 f32) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -12695,38 +12372,22 @@ local.get $11 local.get $12 f32.store - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $13 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=4 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -12744,28 +12405,28 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne @@ -12791,35 +12452,18 @@ call $~lib/rt/pure/__release ) (func $~lib/set/Set#add (param $0 i32) (param $1 f32) (result i32) - (local $2 f32) + (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $3 + local.get $1 + call $~lib/util/hash/hash + local.set $2 local.get $0 local.get $1 - local.get $3 + local.get $2 call $~lib/set/Set#find - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.eqz if local.get $0 @@ -12856,16 +12500,16 @@ local.get $0 local.get $0 i32.load offset=16 - local.tee $5 + local.tee $4 i32.const 1 i32.add i32.store offset=16 - local.get $5 + local.get $4 i32.const 8 i32.mul i32.add - local.set $4 - local.get $4 + local.set $3 + local.get $3 local.get $1 f32.store local.get $0 @@ -12876,20 +12520,20 @@ i32.store offset=20 local.get $0 i32.load - local.get $3 + local.get $2 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $5 + local.set $4 + local.get $3 local.get $4 - local.get $5 i32.load i32.store offset=4 - local.get $5 local.get $4 + local.get $3 i32.store end local.get $0 @@ -13141,34 +12785,17 @@ local.get $2 ) (func $~lib/set/Set#delete (param $0 i32) (param $1 f32) (result i32) - (local $2 f32) + (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - i32.reinterpret_f32 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -13176,8 +12803,8 @@ end i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=4 i32.const 1 i32.or @@ -13192,17 +12819,17 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $5 + local.tee $4 local.get $0 i32.load offset=20 - local.tee $6 + local.tee $5 + local.get $4 local.get $5 - local.get $6 i32.gt_u select i32.ge_u @@ -13221,7 +12848,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/set/Set#rehash end i32.const 1 @@ -13647,6 +13274,116 @@ i32.store offset=20 local.get $0 ) + (func $~lib/util/hash/hash (param $0 f64) (result i32) + (local $1 i64) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 1 + drop + i32.const 8 + i32.const 4 + i32.eq + drop + i32.const 8 + i32.const 8 + i32.eq + drop + local.get $0 + i64.reinterpret_f64 + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $1 + i32.wrap_i64 + local.set $3 + local.get $1 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.set $4 + local.get $2 + local.set $5 + local.get $5 + local.get $3 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $3 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + local.get $4 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $5 + local.get $5 + return + ) (func $~lib/set/Set#find (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) @@ -13698,31 +13435,10 @@ i32.const 0 ) (func $~lib/set/Set#has (param $0 i32) (param $1 f64) (result i32) - (local $2 f64) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find i32.const 0 i32.ne @@ -13739,9 +13455,8 @@ (local $10 i32) (local $11 i32) (local $12 f64) - (local $13 f64) + (local $13 i32) (local $14 i32) - (local $15 i32) local.get $1 i32.const 1 i32.add @@ -13799,42 +13514,22 @@ local.get $11 local.get $12 f64.store - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $13 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and - local.set $14 + local.set $13 local.get $3 - local.get $14 + local.get $13 i32.const 4 i32.mul i32.add - local.set $15 + local.set $14 local.get $11 - local.get $15 + local.get $14 i32.load i32.store offset=8 - local.get $15 + local.get $14 local.get $8 i32.store local.get $8 @@ -13852,28 +13547,28 @@ local.get $0 local.tee $11 local.get $3 - local.tee $14 + local.tee $13 local.get $11 i32.load local.tee $9 i32.ne if - local.get $14 + local.get $13 call $~lib/rt/pure/__retain - local.set $14 + local.set $13 local.get $9 call $~lib/rt/pure/__release end - local.get $14 + local.get $13 i32.store local.get $0 local.get $1 i32.store offset=4 local.get $0 - local.tee $15 + local.tee $14 local.get $5 local.tee $9 - local.get $15 + local.get $14 i32.load offset=8 local.tee $11 i32.ne @@ -13899,39 +13594,18 @@ call $~lib/rt/pure/__release ) (func $~lib/set/Set#add (param $0 i32) (param $1 f64) (result i32) - (local $2 f64) + (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.1 - end - local.set $3 + local.get $1 + call $~lib/util/hash/hash + local.set $2 local.get $0 local.get $1 - local.get $3 + local.get $2 call $~lib/set/Set#find - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.eqz if local.get $0 @@ -13968,16 +13642,16 @@ local.get $0 local.get $0 i32.load offset=16 - local.tee $5 + local.tee $4 i32.const 1 i32.add i32.store offset=16 - local.get $5 + local.get $4 i32.const 16 i32.mul i32.add - local.set $4 - local.get $4 + local.set $3 + local.get $3 local.get $1 f64.store local.get $0 @@ -13988,20 +13662,20 @@ i32.store offset=20 local.get $0 i32.load - local.get $3 + local.get $2 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $5 + local.set $4 + local.get $3 local.get $4 - local.get $5 i32.load i32.store offset=8 - local.get $5 local.get $4 + local.get $3 i32.store end local.get $0 @@ -14253,38 +13927,17 @@ local.get $2 ) (func $~lib/set/Set#delete (param $0 i32) (param $1 f64) (result i32) - (local $2 f64) + (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 1 - drop - i32.const 8 - i32.const 4 - i32.eq - drop - i32.const 8 - i32.const 8 - i32.eq - drop - local.get $2 - i64.reinterpret_f64 - call $~lib/util/hash/hash64 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/set/Set#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 0 @@ -14292,8 +13945,8 @@ end i32.const 0 drop - local.get $3 - local.get $3 + local.get $2 + local.get $2 i32.load offset=8 i32.const 1 i32.or @@ -14308,17 +13961,17 @@ i32.load offset=4 i32.const 1 i32.shr_u - local.set $4 - local.get $4 + local.set $3 + local.get $3 i32.const 1 i32.add i32.const 4 - local.tee $5 + local.tee $4 local.get $0 i32.load offset=20 - local.tee $6 + local.tee $5 + local.get $4 local.get $5 - local.get $6 i32.gt_u select i32.ge_u @@ -14337,7 +13990,7 @@ end if local.get $0 - local.get $4 + local.get $3 call $~lib/set/Set#rehash end i32.const 1 diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index 7b2fd6d543..068ad65e06 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -343,14 +343,15 @@ call $~lib/memory/memory.fill local.get $1 ) - (func $~lib/util/hash/hashStr (param $0 i32) (result i32) + (func $~lib/util/hash/hash<~lib/string/String> (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) + (local $4 i64) i32.const -2128831035 - local.set $1 + local.set $2 local.get $0 - if + if (result i32) local.get $0 i32.const 20 i32.sub @@ -359,30 +360,165 @@ i32.shr_u i32.const 1 i32.shl - local.set $3 - loop $for-loop|0 - local.get $2 - local.get $3 - i32.lt_u + local.set $1 + loop $while-continue|0 + local.get $1 + i32.const 8 + i32.ge_s if - local.get $1 - local.get $0 local.get $2 + local.get $0 + local.get $3 i32.add - i32.load8_u + i64.load + local.tee $4 + i32.wrap_i64 + local.tee $2 + i32.const 255 + i32.and i32.xor i32.const 16777619 i32.mul - local.set $1 local.get $2 - i32.const 1 - i32.add + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.get $4 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.tee $2 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul local.set $2 - br $for-loop|0 + local.get $3 + i32.const 8 + i32.add + local.set $3 + local.get $1 + i32.const 8 + i32.sub + local.set $1 + br $while-continue|0 end end + local.get $1 + i32.const 4 + i32.ge_s + if (result i32) + local.get $2 + local.get $0 + local.get $3 + i32.add + i32.load + local.tee $2 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $2 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $2 + local.get $3 + i32.const 4 + i32.add + local.set $3 + local.get $1 + i32.const 4 + i32.sub + else + local.get $1 + end + i32.const 2 + i32.ge_s + if (result i32) + local.get $2 + local.get $0 + local.get $3 + i32.add + i32.load16_u + local.tee $0 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.get $0 + i32.const 8 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + else + local.get $2 + end + else + i32.const -2128831035 end - local.get $1 ) (func $~lib/string/String.__eq (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -599,7 +735,7 @@ local.get $2 local.get $4 local.get $7 - call $~lib/util/hash/hashStr + call $~lib/util/hash/hash<~lib/string/String> local.get $1 i32.and i32.const 2 @@ -652,7 +788,7 @@ i32.load offset=20 i32.store offset=16 ) - (func $~lib/util/hash/hash32 (param $0 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) local.get $0 i32.const 255 i32.and @@ -784,7 +920,7 @@ local.get $2 local.get $4 local.get $7 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.get $1 i32.and i32.const 2 @@ -844,7 +980,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash local.tee $3 call $~lib/map/Map#find local.tee $2 @@ -941,12 +1077,12 @@ if global.get $~lib/symbol/stringToId i32.const 1056 - call $~lib/util/hash/hashStr + call $~lib/util/hash/hash<~lib/string/String> call $~lib/map/Map<~lib/string/String,usize>#find if global.get $~lib/symbol/stringToId i32.const 1056 - call $~lib/util/hash/hashStr + call $~lib/util/hash/hash<~lib/string/String> call $~lib/map/Map<~lib/string/String,usize>#find local.tee $0 i32.eqz @@ -1027,7 +1163,7 @@ global.get $~lib/symbol/stringToId local.tee $1 i32.const 1056 - call $~lib/util/hash/hashStr + call $~lib/util/hash/hash<~lib/string/String> local.tee $3 call $~lib/map/Map<~lib/string/String,usize>#find local.tee $2 @@ -1116,7 +1252,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne @@ -1125,7 +1261,7 @@ local.get $0 local.get $1 local.get $1 - call $~lib/util/hash/hash32 + call $~lib/util/hash/hash call $~lib/map/Map#find local.tee $0 i32.eqz diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 8e803a5f0f..5a23a3bcfb 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -554,56 +554,265 @@ i32.const 1 i32.shr_u ) - (func $~lib/util/hash/hashStr (param $0 i32) (result i32) + (func $~lib/util/hash/hash<~lib/string/String> (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i64) + (local $9 i32) + (local $10 i32) + (local $11 i32) local.get $0 call $~lib/rt/stub/__retain local.set $0 - i32.const -2128831035 - local.set $1 + i32.const 1 + drop local.get $0 + call $~lib/rt/stub/__retain + local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $1 i32.const 0 i32.ne if - i32.const 0 - local.set $2 - local.get $0 + local.get $1 call $~lib/string/String#get:length i32.const 1 i32.shl - local.set $3 - loop $for-loop|0 - local.get $2 - local.get $3 - i32.lt_u - local.set $4 + local.set $4 + i32.const 0 + i32.const 1 + i32.gt_s + drop + i32.const 0 + local.set $5 + loop $while-continue|0 local.get $4 + i32.const 8 + i32.ge_s + local.set $6 + local.get $6 if local.get $1 - local.get $0 - local.get $2 + local.get $5 i32.add - i32.load8_u + i64.load + local.set $8 + local.get $3 + local.set $7 + local.get $8 + i32.wrap_i64 + local.set $9 + local.get $8 + i64.const 32 + i64.shr_u + i32.wrap_i64 + local.set $10 + local.get $7 + local.set $11 + local.get $11 + local.get $9 + i32.const 255 + i32.and i32.xor i32.const 16777619 i32.mul - local.set $1 - local.get $2 - i32.const 1 + local.set $11 + local.get $11 + local.get $9 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $9 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $9 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.get $10 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $11 + local.get $11 + local.set $3 + local.get $5 + i32.const 8 i32.add - local.set $2 - br $for-loop|0 + local.set $5 + local.get $4 + i32.const 8 + i32.sub + local.set $4 + br $while-continue|0 end end + local.get $4 + i32.const 4 + i32.ge_s + if + local.get $1 + local.get $5 + i32.add + i32.load + local.set $9 + local.get $3 + local.set $7 + local.get $7 + local.set $6 + local.get $6 + local.get $9 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $9 + i32.const 8 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $9 + i32.const 16 + i32.shr_u + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $9 + i32.const 24 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.set $3 + local.get $5 + i32.const 4 + i32.add + local.set $5 + local.get $4 + i32.const 4 + i32.sub + local.set $4 + end + local.get $4 + i32.const 2 + i32.ge_s + if + local.get $1 + local.get $5 + i32.add + i32.load16_u + local.set $11 + local.get $3 + local.set $10 + local.get $10 + local.set $6 + local.get $6 + local.get $11 + i32.const 255 + i32.and + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.get $11 + i32.const 8 + i32.shr_u + i32.xor + i32.const 16777619 + i32.mul + local.set $6 + local.get $6 + local.set $3 + local.get $5 + i32.const 2 + i32.add + local.set $5 + local.get $4 + i32.const 2 + i32.sub + local.set $4 + end end + local.get $3 + local.set $4 local.get $1 + call $~lib/rt/stub/__release + local.get $4 local.set $3 local.get $0 call $~lib/rt/stub/__release local.get $3 + return ) (func $~lib/util/string/compareImpl (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) @@ -868,26 +1077,13 @@ ) (func $~lib/map/Map<~lib/string/String,usize>#has (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - (local $3 i32) local.get $1 call $~lib/rt/stub/__retain local.set $1 local.get $0 local.get $1 - block $~lib/util/hash/HASH<~lib/string/String>|inlined.0 (result i32) - local.get $1 - call $~lib/rt/stub/__retain - local.set $2 - i32.const 1 - drop - local.get $2 - call $~lib/util/hash/hashStr - local.set $3 - local.get $2 - call $~lib/rt/stub/__release - local.get $3 - br $~lib/util/hash/HASH<~lib/string/String>|inlined.0 - end + local.get $1 + call $~lib/util/hash/hash<~lib/string/String> call $~lib/map/Map<~lib/string/String,usize>#find i32.const 0 i32.ne @@ -899,29 +1095,16 @@ (func $~lib/map/Map<~lib/string/String,usize>#get (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) - (local $4 i32) local.get $1 call $~lib/rt/stub/__retain local.set $1 local.get $0 local.get $1 - block $~lib/util/hash/HASH<~lib/string/String>|inlined.1 (result i32) - local.get $1 - call $~lib/rt/stub/__retain - local.set $2 - i32.const 1 - drop - local.get $2 - call $~lib/util/hash/hashStr - local.set $3 - local.get $2 - call $~lib/rt/stub/__release - local.get $3 - br $~lib/util/hash/HASH<~lib/string/String>|inlined.1 - end + local.get $1 + call $~lib/util/hash/hash<~lib/string/String> call $~lib/map/Map<~lib/string/String,usize>#find - local.set $4 - local.get $4 + local.set $2 + local.get $2 i32.eqz if i32.const 224 @@ -931,12 +1114,12 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $2 i32.load offset=4 - local.set $2 + local.set $3 local.get $1 call $~lib/rt/stub/__release - local.get $2 + local.get $3 ) (func $~lib/map/Map<~lib/string/String,usize>#rehash (param $0 i32) (param $1 i32) (local $2 i32) @@ -1014,20 +1197,8 @@ local.get $10 i32.load offset=4 i32.store offset=4 - block $~lib/util/hash/HASH<~lib/string/String>|inlined.3 (result i32) - local.get $12 - call $~lib/rt/stub/__retain - local.set $13 - i32.const 1 - drop - local.get $13 - call $~lib/util/hash/hashStr - local.set $14 - local.get $13 - call $~lib/rt/stub/__release - local.get $14 - br $~lib/util/hash/HASH<~lib/string/String>|inlined.3 - end + local.get $12 + call $~lib/util/hash/hash<~lib/string/String> local.get $1 i32.and local.set $13 @@ -1115,31 +1286,19 @@ local.get $1 call $~lib/rt/stub/__retain local.set $1 - block $~lib/util/hash/HASH<~lib/string/String>|inlined.2 (result i32) - local.get $1 - call $~lib/rt/stub/__retain - local.set $3 - i32.const 1 - drop - local.get $3 - call $~lib/util/hash/hashStr - local.set $4 - local.get $3 - call $~lib/rt/stub/__release - local.get $4 - br $~lib/util/hash/HASH<~lib/string/String>|inlined.2 - end - local.set $5 + local.get $1 + call $~lib/util/hash/hash<~lib/string/String> + local.set $3 local.get $0 local.get $1 - local.get $5 + local.get $3 call $~lib/map/Map<~lib/string/String,usize>#find - local.set $6 - local.get $6 + local.set $4 + local.get $4 if i32.const 0 drop - local.get $6 + local.get $4 local.get $2 i32.store offset=4 else @@ -1175,25 +1334,25 @@ local.get $0 i32.load offset=8 call $~lib/rt/stub/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 - local.tee $4 + local.tee $6 i32.const 1 i32.add i32.store offset=16 - local.get $4 + local.get $6 i32.const 12 i32.mul i32.add - local.set $6 - local.get $6 + local.set $4 + local.get $4 local.get $1 call $~lib/rt/stub/__retain i32.store - local.get $6 + local.get $4 local.get $2 i32.store offset=4 local.get $0 @@ -1204,45 +1363,69 @@ i32.store offset=20 local.get $0 i32.load - local.get $5 + local.get $3 local.get $0 i32.load offset=4 i32.and i32.const 4 i32.mul i32.add - local.set $4 - local.get $6 + local.set $6 local.get $4 + local.get $6 i32.load i32.store offset=8 - local.get $4 local.get $6 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/stub/__release end local.get $0 call $~lib/rt/stub/__retain - local.set $4 + local.set $6 local.get $1 call $~lib/rt/stub/__release - local.get $4 + local.get $6 ) - (func $~lib/util/hash/hash32 (param $0 i32) (result i32) + (func $~lib/util/hash/hash (param $0 i32) (result i32) (local $1 i32) - i32.const -2128831035 + (local $2 i32) + (local $3 i32) + i32.const 0 + drop + i32.const 0 + drop + i32.const 0 + drop + i32.const 4 + i32.const 1 + i32.eq + drop + i32.const 4 + i32.const 2 + i32.eq + drop + i32.const 4 + i32.const 4 + i32.eq + drop + local.get $0 local.set $1 + i32.const -2128831035 + local.set $2 + local.get $2 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 255 i32.and i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 8 i32.shr_u i32.const 255 @@ -1250,9 +1433,9 @@ i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 16 i32.shr_u i32.const 255 @@ -1260,16 +1443,17 @@ i32.xor i32.const 16777619 i32.mul - local.set $1 + local.set $3 + local.get $3 local.get $1 - local.get $0 i32.const 24 i32.shr_u i32.xor i32.const 16777619 i32.mul - local.set $1 - local.get $1 + local.set $3 + local.get $3 + return ) (func $~lib/map/Map#find (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -1396,31 +1580,8 @@ local.get $10 i32.load offset=4 i32.store offset=4 - block $~lib/util/hash/HASH|inlined.1 (result i32) - local.get $12 - local.set $13 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $13 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.1 - end + local.get $12 + call $~lib/util/hash/hash local.get $1 i32.and local.set $13 @@ -1506,53 +1667,30 @@ local.get $2 call $~lib/rt/stub/__retain local.set $2 - block $~lib/util/hash/HASH|inlined.0 (result i32) - local.get $1 - local.set $3 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $3 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.0 - end - local.set $4 + local.get $1 + call $~lib/util/hash/hash + local.set $3 local.get $0 local.get $1 - local.get $4 + local.get $3 call $~lib/map/Map#find - local.set $5 - local.get $5 + local.set $4 + local.get $4 if i32.const 1 drop - local.get $5 + local.get $4 i32.load offset=4 - local.set $3 + local.set $5 local.get $2 - local.get $3 + local.get $5 i32.ne if - local.get $5 + local.get $4 local.get $2 call $~lib/rt/stub/__retain i32.store offset=4 - local.get $3 + local.get $5 call $~lib/rt/stub/__release end else @@ -1588,8 +1726,8 @@ local.get $0 i32.load offset=8 call $~lib/rt/stub/__retain - local.set $3 - local.get $3 + local.set $5 + local.get $5 local.get $0 local.get $0 i32.load offset=16 @@ -1601,11 +1739,11 @@ i32.const 12 i32.mul i32.add - local.set $5 - local.get $5 + local.set $4 + local.get $4 local.get $1 i32.store - local.get $5 + local.get $4 local.get $2 call $~lib/rt/stub/__retain i32.store offset=4 @@ -1617,7 +1755,7 @@ i32.store offset=20 local.get $0 i32.load - local.get $4 + local.get $3 local.get $0 i32.load offset=4 i32.and @@ -1625,14 +1763,14 @@ i32.mul i32.add local.set $6 - local.get $5 + local.get $4 local.get $6 i32.load i32.store offset=8 local.get $6 - local.get $5 + local.get $4 i32.store - local.get $3 + local.get $5 call $~lib/rt/stub/__release end local.get $0 @@ -1709,71 +1847,23 @@ local.get $1 ) (func $~lib/map/Map#has (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.2 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.2 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find i32.const 0 i32.ne ) (func $~lib/map/Map#get (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - (local $3 i32) local.get $0 local.get $1 - block $~lib/util/hash/HASH|inlined.3 (result i32) - local.get $1 - local.set $2 - i32.const 0 - drop - i32.const 0 - drop - i32.const 0 - drop - i32.const 4 - i32.const 1 - i32.eq - drop - i32.const 4 - i32.const 2 - i32.eq - drop - i32.const 4 - i32.const 4 - i32.eq - drop - local.get $2 - call $~lib/util/hash/hash32 - br $~lib/util/hash/HASH|inlined.3 - end + local.get $1 + call $~lib/util/hash/hash call $~lib/map/Map#find - local.set $3 - local.get $3 + local.set $2 + local.get $2 i32.eqz if i32.const 224 @@ -1783,7 +1873,7 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.load offset=4 call $~lib/rt/stub/__retain ) From 9b16011b81e747931785d08962900f43235816a6 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 14 Dec 2020 03:31:22 +0200 Subject: [PATCH 2/3] fix comment --- std/assembly/util/hash.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/std/assembly/util/hash.ts b/std/assembly/util/hash.ts index b45e6f83e6..bf76e95f93 100644 --- a/std/assembly/util/hash.ts +++ b/std/assembly/util/hash.ts @@ -92,7 +92,7 @@ function hashStr(key: string, seed: u32 = FNV_OFFSET): u32 { v = hash16(load(changetype(key) + off), v); off += 2; len -= 2; } - // length always is even so don't need hash8 + // "len" always even so don't need hash8 } } return v; From 4a47a7ef4a186d172ac413106d3e9116b7fda5aa Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Mon, 14 Dec 2020 03:34:31 +0200 Subject: [PATCH 3/3] remove unnecessary ops in last branch --- std/assembly/util/hash.ts | 1 - tests/compiler/std/hash.untouched.wat | 16 ---------------- tests/compiler/std/symbol.untouched.wat | 8 -------- 3 files changed, 25 deletions(-) diff --git a/std/assembly/util/hash.ts b/std/assembly/util/hash.ts index bf76e95f93..763c2a2254 100644 --- a/std/assembly/util/hash.ts +++ b/std/assembly/util/hash.ts @@ -90,7 +90,6 @@ function hashStr(key: string, seed: u32 = FNV_OFFSET): u32 { } if (len >= 2) { v = hash16(load(changetype(key) + off), v); - off += 2; len -= 2; } // "len" always even so don't need hash8 } diff --git a/tests/compiler/std/hash.untouched.wat b/tests/compiler/std/hash.untouched.wat index f0a4236761..4879e4fcd0 100644 --- a/tests/compiler/std/hash.untouched.wat +++ b/tests/compiler/std/hash.untouched.wat @@ -268,14 +268,6 @@ local.set $6 local.get $6 local.set $3 - local.get $5 - i32.const 2 - i32.add - local.set $5 - local.get $4 - i32.const 2 - i32.sub - local.set $4 end end local.get $3 @@ -531,14 +523,6 @@ local.set $6 local.get $6 local.set $3 - local.get $5 - i32.const 2 - i32.add - local.set $5 - local.get $4 - i32.const 2 - i32.sub - local.set $4 end end local.get $3 diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 5a23a3bcfb..a273be8046 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -793,14 +793,6 @@ local.set $6 local.get $6 local.set $3 - local.get $5 - i32.const 2 - i32.add - local.set $5 - local.get $4 - i32.const 2 - i32.sub - local.set $4 end end local.get $3