From 8a6bb401563f5cafd2cf6c9c322f691e87c4c553 Mon Sep 17 00:00:00 2001 From: Tuyen Nguyen Date: Wed, 28 Feb 2024 13:49:18 +0700 Subject: [PATCH] fix: chain w computation to main loop in hashBlocks() --- packages/as-sha256/assembly/index.ts | 25 +- packages/as-sha256/build/optimized.wasm | Bin 2951 -> 2900 bytes packages/as-sha256/build/optimized.wat | 2759 ++++++++++--- packages/as-sha256/build/untouched.wasm | Bin 7280 -> 7180 bytes packages/as-sha256/build/untouched.wat | 4288 ++++++++++---------- packages/as-sha256/src/index.ts | 16 +- packages/as-sha256/src/wasmCode.ts | 2 +- packages/as-sha256/test/perf/index.test.ts | 15 +- 8 files changed, 4485 insertions(+), 2620 deletions(-) diff --git a/packages/as-sha256/assembly/index.ts b/packages/as-sha256/assembly/index.ts index bb9142e7..385dcd25 100644 --- a/packages/as-sha256/assembly/index.ts +++ b/packages/as-sha256/assembly/index.ts @@ -141,6 +141,7 @@ function SIG1(x: u32): u32 { return rotr(x, 17) ^ rotr(x, 19) ^ (x >>> 10); } +var tmpW: u32; /** * Expand message blocks (16 32bit blocks), into extended message blocks (64 32bit blocks), * Apply SHA256 compression function on extended message blocks @@ -158,25 +159,17 @@ function hashBlocks(wPtr: usize, mPtr: usize): void { g = H6; h = H7; - // Load message blocks into first 16 expanded message blocks - for (i = 0; i < 16; i++) { - store32(wPtr, i, - load32be(mPtr, i) - ); - } - // Expand message blocks 17-64 - for (i = 16; i < 64; i++) { - store32(wPtr, i, - SIG1(load32(wPtr, i - 2)) + - load32(wPtr, i - 7) + - SIG0(load32(wPtr, i - 15)) + - load32(wPtr, i - 16) - ); - } + // 16 first u32 of expanded message block are same as message block + // rest of the 48 u32 are computed from the first 16 u32 + // instead of computing expanded messsage blocks in a separate for loop, + // chain it to the below for loop to improve performance // Apply SHA256 compression function on expanded message blocks for (i = 0; i < 64; i++) { - t1 = h + EP1(e) + CH(e, f, g) + load32(kPtr, i) + load32(wPtr, i); + tmpW = i < 16 ? load32be(mPtr, i) : SIG1(load32(wPtr, i - 2)) + load32(wPtr, i - 7) + + SIG0(load32(wPtr, i - 15)) + load32(wPtr, i - 16); + store32(wPtr, i, tmpW); + t1 = h + EP1(e) + CH(e, f, g) + load32(kPtr, i) + tmpW; t2 = EP0(a) + MAJ(a, b, c); h = g; g = f; diff --git a/packages/as-sha256/build/optimized.wasm b/packages/as-sha256/build/optimized.wasm index f9ae82be5c4e82dc2f9463b8b32b3b2e1977a2b2..0f1f13a1123f913017681e6d89c74843bd8035b4 100644 GIT binary patch delta 207 zcmZn{zalmvfMX-0ay^4%1Ixt1-iZ&Y7$w8yT08=tEDj0` z%EFFJC0UajnXOdJm_R(nEEQoMMs99L0Tp3p2cW_none (func (param i32))) - (type $i32_i32_=>_none (func (param i32 i32))) - (type $none_=>_none (func)) - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $0 (func (param i32) (result i32))) + (type $1 (func (param i32 i32))) + (type $2 (func)) + (type $3 (func (param i32 i32) (result i32))) + (type $4 (func (param i32))) + (type $5 (func (param i32 i32 i32))) + (type $6 (func (param i32 i32 i32 i32))) + (type $7 (func (param i32 i32 i64) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 17) "\01\00\00\01\00\00\00\00\00\00\00\00\01\00\00\98/\8aB\91D7q\cf\fb\c0\b5\a5\db\b5\e9[\c2V9\f1\11\f1Y\a4\82?\92\d5^\1c\ab\98\aa\07\d8\01[\83\12\be\851$\c3}\0cUt]\ber\fe\b1\de\80\a7\06\dc\9bt\f1\9b\c1\c1i\9b\e4\86G\be\ef\c6\9d\c1\0f\cc\a1\0c$o,\e9-\aa\84tJ\dc\a9\b0\\\da\88\f9vRQ>\98m\c61\a8\c8\'\03\b0\c7\7fY\bf\f3\0b\e0\c6G\91\a7\d5Qc\ca\06g))\14\85\n\b7\'8!\1b.\fcm,M\13\0d8STs\ne\bb\njv.\c9\c2\81\85,r\92\a1\e8\bf\a2Kf\1a\a8p\8bK\c2\a3Ql\c7\19\e8\92\d1$\06\99\d6\855\0e\f4p\a0j\10\16\c1\a4\19\08l7\1eLwH\'\b5\bc\b04\b3\0c\1c9J\aa\d8NO\ca\9c[\f3o.h\ee\82\8ftoc\a5x\14x\c8\84\08\02\c7\8c\fa\ff\be\90\eblP\a4\f7\a3\f9\be\f2xq\c6") - (data (i32.const 288) "\10\00\00\00\01\00\00\00\03\00\00\00\10\00\00\00 \00\00\00 \00\00\00\00\01\00\00@") - (data (i32.const 321) "\01\00\00\01\00\00\00\00\00\00\00\00\01\00\00\98/\8a\c2\91D7q\cf\fb\c0\b5\a5\db\b5\e9[\c2V9\f1\11\f1Y\a4\82?\92\d5^\1c\ab\98\aa\07\d8\01[\83\12\be\851$\c3}\0cUt]\ber\fe\b1\de\80\a7\06\dc\9bt\f3\9b\c1\c1i\9bd\86G\fe\f0\c6\ed\e1\0fT\f2\0c$o4\e9O\be\84\c9l\1eA\b9a\fa\88\f9\16RQ\c6\f2mZ\8e\a8e\fc\19\b0\c7\9e\d9\b9\c31\12\9a\a0\ea\0e\e7+#\b1\fd\b0>5\c7\d5\bai0_m\97\cb\8f\11\0fZ\fd\ee\1e\dc\89\b65\n\04z\0b\de\9d\ca\f4X\16[]\e1\86>\7f\00\80\89\0872\ea\07\a57\95\abo\10a@\17\f1\d6\8c\0dm;\aa\cd7\be\bb\c0\da;a\83c\a3H\db1\e9\02\0b\a7\\\d1o\ca\fa\1aR1\8431\95\1a\d4n\90xCm\f2\91\9c\c3\bd\ab\cc\9e\e6\a0\c9\b5<\b6/S\c6A\c7\d2\a3~#\07hK\95\a4v\1d\19L") - (data (i32.const 592) "\10\00\00\00\01\00\00\00\03\00\00\00\10\00\00\00P\01\00\00P\01\00\00\00\01\00\00@") - (data (i32.const 624) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h") - (data (i32.const 672) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") + (global $assembly/index/DIGEST_LENGTH i32 (i32.const 32)) (global $assembly/index/INPUT_LENGTH i32 (i32.const 512)) + (global $assembly/index/K i32 (i32.const 320)) (global $assembly/index/kPtr (mut i32) (i32.const 0)) + (global $assembly/index/W64 i32 (i32.const 656)) (global $assembly/index/w64Ptr (mut i32) (i32.const 0)) (global $assembly/index/H0 (mut i32) (i32.const 0)) (global $assembly/index/H1 (mut i32) (i32.const 0)) @@ -35,8 +33,15 @@ (global $assembly/index/i (mut i32) (i32.const 0)) (global $assembly/index/t1 (mut i32) (i32.const 0)) (global $assembly/index/t2 (mut i32) (i32.const 0)) - (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) - (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) + (global $~lib/shared/runtime/Runtime.Stub i32 (i32.const 0)) + (global $~lib/shared/runtime/Runtime.Minimal i32 (i32.const 1)) + (global $~lib/shared/runtime/Runtime.Incremental i32 (i32.const 2)) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/native/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) + (global $~lib/rt/tcms/fromSpace (mut i32) (i32.const 0)) + (global $~lib/rt/tcms/white (mut i32) (i32.const 0)) + (global $~lib/rt/tcms/total (mut i32) (i32.const 0)) + (global $~lib/native/ASC_RUNTIME i32 (i32.const 1)) (global $assembly/index/M (mut i32) (i32.const 0)) (global $assembly/index/mPtr (mut i32) (i32.const 0)) (global $assembly/index/W (mut i32) (i32.const 0)) @@ -47,7 +52,21 @@ (global $assembly/index/outputPtr (mut i32) (i32.const 0)) (global $assembly/index/mLength (mut i32) (i32.const 0)) (global $assembly/index/bytesHashed (mut i32) (i32.const 0)) - (export "memory" (memory $0)) + (global $assembly/index/tmpW (mut i32) (i32.const 0)) + (global $~lib/memory/__heap_base i32 (i32.const 1012)) + (memory $0 1) + (data $0 (i32.const 12) "\1c\01\00\00\00\00\00\00\00\00\00\00\01\00\00\00\00\01\00\00\98/\8aB\91D7q\cf\fb\c0\b5\a5\db\b5\e9[\c2V9\f1\11\f1Y\a4\82?\92\d5^\1c\ab\98\aa\07\d8\01[\83\12\be\851$\c3}\0cUt]\ber\fe\b1\de\80\a7\06\dc\9bt\f1\9b\c1\c1i\9b\e4\86G\be\ef\c6\9d\c1\0f\cc\a1\0c$o,\e9-\aa\84tJ\dc\a9\b0\\\da\88\f9vRQ>\98m\c61\a8\c8\'\03\b0\c7\7fY\bf\f3\0b\e0\c6G\91\a7\d5Qc\ca\06g))\14\85\n\b7\'8!\1b.\fcm,M\13\r8STs\ne\bb\njv.\c9\c2\81\85,r\92\a1\e8\bf\a2Kf\1a\a8p\8bK\c2\a3Ql\c7\19\e8\92\d1$\06\99\d6\855\0e\f4p\a0j\10\16\c1\a4\19\08l7\1eLwH\'\b5\bc\b04\b3\0c\1c9J\aa\d8NO\ca\9c[\f3o.h\ee\82\8ftoc\a5x\14x\c8\84\08\02\c7\8c\fa\ff\be\90\eblP\a4\f7\a3\f9\be\f2xq\c6\00\00\00\00\00\00\00\00\00\00\00\00") + (data $1 (i32.const 300) ",\00\00\00\00\00\00\00\00\00\00\00\04\00\00\00\10\00\00\00 \00\00\00 \00\00\00\00\01\00\00@\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data $2 (i32.const 348) "\1c\01\00\00\00\00\00\00\00\00\00\00\01\00\00\00\00\01\00\00\98/\8a\c2\91D7q\cf\fb\c0\b5\a5\db\b5\e9[\c2V9\f1\11\f1Y\a4\82?\92\d5^\1c\ab\98\aa\07\d8\01[\83\12\be\851$\c3}\0cUt]\ber\fe\b1\de\80\a7\06\dc\9bt\f3\9b\c1\c1i\9bd\86G\fe\f0\c6\ed\e1\0fT\f2\0c$o4\e9O\be\84\c9l\1eA\b9a\fa\88\f9\16RQ\c6\f2mZ\8e\a8e\fc\19\b0\c7\9e\d9\b9\c31\12\9a\a0\ea\0e\e7+#\b1\fd\b0>5\c7\d5\bai0_m\97\cb\8f\11\0fZ\fd\ee\1e\dc\89\b65\n\04z\0b\de\9d\ca\f4X\16[]\e1\86>\7f\00\80\89\0872\ea\07\a57\95\abo\10a@\17\f1\d6\8c\rm;\aa\cd7\be\bb\c0\da;a\83c\a3H\db1\e9\02\0b\a7\\\d1o\ca\fa\1aR1\8431\95\1a\d4n\90xCm\f2\91\9c\c3\bd\ab\cc\9e\e6\a0\c9\b5<\b6/S\c6A\c7\d2\a3~#\07hK\95\a4v\1d\19L\00\00\00\00\00\00\00\00\00\00\00\00") + (data $3 (i32.const 636) ",\00\00\00\00\00\00\00\00\00\00\00\04\00\00\00\10\00\00\00p\01\00\00p\01\00\00\00\01\00\00@\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data $4 (i32.const 684) ",\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00") + (data $5 (i32.const 732) "<\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00\00\00\00\00\00\00") + (data $6 (i32.const 796) "<\00\00\00\00\00\00\00\00\00\00\00\02\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\00\00\00\00") + (data $7 (i32.const 860) "<\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00c\00m\00s\00.\00t\00s\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data $8 (i32.const 924) "<\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data $9 (i32.const 992) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (table $0 1 1 funcref) + (elem $0 (i32.const 1)) (export "INPUT_LENGTH" (global $assembly/index/INPUT_LENGTH)) (export "input" (global $assembly/index/input)) (export "output" (global $assembly/index/output)) @@ -56,168 +75,1537 @@ (export "final" (func $assembly/index/final)) (export "digest" (func $assembly/index/digest)) (export "digest64" (func $assembly/index/digest64)) + (export "memory" (memory $0)) (start $~start) - (func $~lib/rt/stub/maybeGrowMemory (; 1 ;) (param $0 i32) - (local $1 i32) - (local $2 i32) + (func $~lib/array/Array#get:dataStart (param $0 i32) (result i32) local.get $0 - memory.size - local.tee $2 - i32.const 16 - i32.shl - local.tee $1 - i32.gt_u + i32.load offset=4 + ) + (func $~lib/rt/tlsf/Root#set:flMap (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store + ) + (func $~lib/rt/common/BLOCK#get:mmInfo (param $0 i32) (result i32) + local.get $0 + i32.load + ) + (func $~lib/rt/common/BLOCK#set:mmInfo (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store + ) + (func $~lib/rt/tlsf/Block#set:prev (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/Block#set:next (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=8 + ) + (func $~lib/rt/tlsf/Block#get:prev (param $0 i32) (result i32) + local.get $0 + i32.load offset=4 + ) + (func $~lib/rt/tlsf/Block#get:next (param $0 i32) (result i32) + local.get $0 + i32.load offset=8 + ) + (func $~lib/rt/tlsf/Root#get:flMap (param $0 i32) (result i32) + local.get $0 + i32.load + ) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) + local.get $1 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + drop + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 12 + i32.ge_u + drop + local.get $3 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $4 + local.get $3 + i32.const 4 + i32.shr_u + local.set $5 + else + local.get $3 + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u + select + local.set $8 + i32.const 31 + local.get $8 + i32.clz + i32.sub + local.set $4 + local.get $8 + local.get $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $5 + local.get $4 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $4 + end + i32.const 1 + drop + local.get $4 + i32.const 23 + i32.lt_u + if (result i32) + local.get $5 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + drop + local.get $1 + call $~lib/rt/tlsf/Block#get:prev + local.set $9 + local.get $1 + call $~lib/rt/tlsf/Block#get:next + local.set $10 + local.get $9 + if + local.get $9 + local.get $10 + call $~lib/rt/tlsf/Block#set:next + end + local.get $10 + if + local.get $10 + local.get $9 + call $~lib/rt/tlsf/Block#set:prev + end + local.get $1 + block $~lib/rt/tlsf/GETHEAD|inlined.0 (result i32) + local.get $0 + local.set $11 + local.get $4 + local.set $12 + local.get $5 + local.set $13 + local.get $11 + local.get $12 + i32.const 4 + i32.shl + local.get $13 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + br $~lib/rt/tlsf/GETHEAD|inlined.0 + end + i32.eq if - local.get $2 local.get $0 + local.set $14 + local.get $4 + local.set $15 + local.get $5 + local.set $16 + local.get $10 + local.set $17 + local.get $14 + local.get $15 + i32.const 4 + i32.shl + local.get $16 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $17 + i32.store offset=96 + local.get $10 + i32.eqz + if + block $~lib/rt/tlsf/GETSL|inlined.0 (result i32) + local.get $0 + local.set $18 + local.get $4 + local.set $19 + local.get $18 + local.get $19 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + br $~lib/rt/tlsf/GETSL|inlined.0 + end + local.set $20 + local.get $0 + local.set $21 + local.get $4 + local.set $22 + local.get $20 + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $20 + local.set $23 + local.get $21 + local.get $22 + i32.const 2 + i32.shl + i32.add + local.get $23 + i32.store offset=4 + local.get $20 + i32.eqz + if + local.get $0 + local.get $0 + call $~lib/rt/tlsf/Root#get:flMap + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + call $~lib/rt/tlsf/Root#set:flMap + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) + (local $24 i32) + (local $25 i32) + (local $26 i32) + (local $27 i32) + (local $28 i32) + i32.const 1 + drop + local.get $1 + drop + local.get $1 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + drop + block $~lib/rt/tlsf/GETRIGHT|inlined.0 (result i32) local.get $1 - i32.sub - i32.const 65535 + local.set $3 + local.get $3 + i32.const 4 i32.add - i32.const -65536 + local.get $3 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 + i32.xor i32.and - i32.const 16 - i32.shr_u - local.tee $1 + i32.add + br $~lib/rt/tlsf/GETRIGHT|inlined.0 + end + local.set $4 + local.get $4 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $5 + local.get $5 + i32.const 1 + i32.and + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 local.get $2 + i32.const 4 + i32.add + local.get $5 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + block $~lib/rt/tlsf/GETRIGHT|inlined.1 (result i32) + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.add + local.get $6 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + br $~lib/rt/tlsf/GETRIGHT|inlined.1 + end + local.set $4 + local.get $4 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $5 + end + local.get $2 + i32.const 2 + i32.and + if + block $~lib/rt/tlsf/GETFREELEFT|inlined.0 (result i32) + local.get $1 + local.set $7 + local.get $7 + i32.const 4 + i32.sub + i32.load + br $~lib/rt/tlsf/GETFREELEFT|inlined.0 + end + local.set $8 + local.get $8 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $9 + i32.const 1 + drop + local.get $9 + i32.const 1 + i32.and + drop + local.get $0 + local.get $8 + call $~lib/rt/tlsf/removeBlock + local.get $8 + local.set $1 local.get $1 - i32.gt_s + local.get $9 + i32.const 4 + i32.add + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $10 + i32.const 1 + drop + local.get $10 + i32.const 12 + i32.ge_u + drop + i32.const 1 + drop + local.get $1 + i32.const 4 + i32.add + local.get $10 + i32.add + local.get $4 + i32.eq + drop + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $10 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $11 + local.get $10 + i32.const 4 + i32.shr_u + local.set $12 + else + local.get $10 + local.tee $13 + i32.const 1073741820 + local.tee $14 + local.get $13 + local.get $14 + i32.lt_u select - memory.grow + local.set $15 + i32.const 31 + local.get $15 + i32.clz + i32.sub + local.set $11 + local.get $15 + local.get $11 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $12 + local.get $11 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $11 + end + i32.const 1 + drop + local.get $11 + i32.const 23 + i32.lt_u + if (result i32) + local.get $12 + i32.const 16 + i32.lt_u + else i32.const 0 - i32.lt_s + end + drop + block $~lib/rt/tlsf/GETHEAD|inlined.1 (result i32) + local.get $0 + local.set $16 + local.get $11 + local.set $17 + local.get $12 + local.set $18 + local.get $16 + local.get $17 + i32.const 4 + i32.shl + local.get $18 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + br $~lib/rt/tlsf/GETHEAD|inlined.1 + end + local.set $19 + local.get $1 + i32.const 0 + call $~lib/rt/tlsf/Block#set:prev + local.get $1 + local.get $19 + call $~lib/rt/tlsf/Block#set:next + local.get $19 + if + local.get $19 + local.get $1 + call $~lib/rt/tlsf/Block#set:prev + end + local.get $0 + local.set $20 + local.get $11 + local.set $21 + local.get $12 + local.set $22 + local.get $1 + local.set $23 + local.get $20 + local.get $21 + i32.const 4 + i32.shl + local.get $22 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $23 + i32.store offset=96 + local.get $0 + local.get $0 + call $~lib/rt/tlsf/Root#get:flMap + i32.const 1 + local.get $11 + i32.shl + i32.or + call $~lib/rt/tlsf/Root#set:flMap + local.get $0 + local.set $26 + local.get $11 + local.set $27 + block $~lib/rt/tlsf/GETSL|inlined.1 (result i32) + local.get $0 + local.set $24 + local.get $11 + local.set $25 + local.get $24 + local.get $25 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + br $~lib/rt/tlsf/GETSL|inlined.1 + end + i32.const 1 + local.get $12 + i32.shl + i32.or + local.set $28 + local.get $26 + local.get $27 + i32.const 2 + i32.shl + i32.add + local.get $28 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + local.get $2 + i32.wrap_i64 + local.set $3 + i32.const 1 + drop + local.get $1 + i64.extend_i32_u + local.get $2 + i64.le_u + drop + local.get $1 + i32.const 4 + i32.add + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + i32.const 4 + i32.sub + local.set $1 + local.get $3 + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $3 + block $~lib/rt/tlsf/GETTAIL|inlined.0 (result i32) + local.get $0 + local.set $4 + local.get $4 + i32.load offset=1568 + br $~lib/rt/tlsf/GETTAIL|inlined.0 + end + local.set $5 + i32.const 0 + local.set $6 + local.get $5 + if + i32.const 1 + drop + local.get $1 + local.get $5 + i32.const 4 + i32.add + i32.ge_u + drop + local.get $1 + i32.const 16 + i32.sub + local.get $5 + i32.eq if local.get $1 - memory.grow - i32.const 0 - i32.lt_s - if - unreachable + i32.const 16 + i32.sub + local.set $1 + local.get $5 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $6 + else + end + else + i32.const 1 + drop + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.ge_u + drop + end + local.get $3 + local.get $1 + i32.sub + local.set $7 + local.get $7 + i32.const 4 + i32.const 12 + i32.add + i32.const 4 + i32.add + i32.lt_u + if + i32.const 0 + return + end + local.get $7 + i32.const 2 + i32.const 4 + i32.mul + i32.sub + local.set $8 + local.get $1 + local.set $9 + local.get $9 + local.get $8 + i32.const 1 + i32.or + local.get $6 + i32.const 2 + i32.and + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $9 + i32.const 0 + call $~lib/rt/tlsf/Block#set:prev + local.get $9 + i32.const 0 + call $~lib/rt/tlsf/Block#set:next + local.get $1 + i32.const 4 + i32.add + local.get $8 + i32.add + local.set $5 + local.get $5 + i32.const 0 + i32.const 2 + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $0 + local.set $10 + local.get $5 + local.set $11 + local.get $10 + local.get $11 + i32.store offset=1568 + local.get $0 + local.get $9 + call $~lib/rt/tlsf/insertBlock + i32.const 1 + return + ) + (func $~lib/rt/tlsf/initialize + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + i32.const 0 + drop + global.get $~lib/memory/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $0 + memory.size + local.set $1 + local.get $0 + i32.const 1572 + i32.add + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $2 + local.get $2 + local.get $1 + i32.gt_s + if (result i32) + local.get $2 + local.get $1 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + local.get $0 + local.set $3 + local.get $3 + i32.const 0 + call $~lib/rt/tlsf/Root#set:flMap + local.get $3 + local.set $4 + i32.const 0 + local.set $5 + local.get $4 + local.get $5 + i32.store offset=1568 + i32.const 0 + local.set $6 + loop $for-loop|0 + local.get $6 + i32.const 23 + i32.lt_u + if + local.get $3 + local.set $7 + local.get $6 + local.set $8 + i32.const 0 + local.set $9 + local.get $7 + local.get $8 + i32.const 2 + i32.shl + i32.add + local.get $9 + i32.store offset=4 + i32.const 0 + local.set $10 + loop $for-loop|1 + local.get $10 + i32.const 16 + i32.lt_u + if + local.get $3 + local.set $11 + local.get $6 + local.set $12 + local.get $10 + local.set $13 + i32.const 0 + local.set $14 + local.get $11 + local.get $12 + i32.const 4 + i32.shl + local.get $13 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $14 + i32.store offset=96 + local.get $10 + i32.const 1 + i32.add + local.set $10 + br $for-loop|1 + end + end + local.get $6 + i32.const 1 + i32.add + local.set $6 + br $for-loop|0 + end + end + local.get $0 + i32.const 1572 + i32.add + local.set $15 + i32.const 0 + drop + local.get $3 + local.get $15 + memory.size + i64.extend_i32_s + i64.const 16 + i64.shl + call $~lib/rt/tlsf/addMemory + drop + local.get $3 + global.set $~lib/rt/tlsf/ROOT + ) + (func $~lib/rt/tlsf/computeSize (param $0 i32) (result i32) + local.get $0 + i32.const 12 + i32.le_u + if (result i32) + i32.const 12 + else + local.get $0 + i32.const 4 + i32.add + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + i32.const 4 + i32.sub + end + return + ) + (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) + local.get $0 + i32.const 1073741820 + i32.gt_u + if + i32.const 816 + i32.const 944 + i32.const 461 + i32.const 29 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/tlsf/computeSize + return + ) + (func $~lib/rt/tlsf/roundSize (param $0 i32) (result i32) + local.get $0 + i32.const 536870910 + i32.lt_u + if (result i32) + local.get $0 + i32.const 1 + i32.const 27 + local.get $0 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $0 + end + return + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $2 + local.get $1 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $1 + call $~lib/rt/tlsf/roundSize + local.set $4 + i32.const 4 + i32.const 8 + i32.mul + i32.const 1 + i32.sub + local.get $4 + i32.clz + i32.sub + local.set $2 + local.get $4 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $3 + local.get $2 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $2 + end + i32.const 1 + drop + local.get $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $3 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + drop + block $~lib/rt/tlsf/GETSL|inlined.2 (result i32) + local.get $0 + local.set $5 + local.get $2 + local.set $6 + local.get $5 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + br $~lib/rt/tlsf/GETSL|inlined.2 + end + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.shl + i32.and + local.set $7 + i32.const 0 + local.set $8 + local.get $7 + i32.eqz + if + local.get $0 + call $~lib/rt/tlsf/Root#get:flMap + i32.const 0 + i32.const -1 + i32.xor + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.set $9 + local.get $9 + i32.eqz + if + i32.const 0 + local.set $8 + else + local.get $9 + i32.ctz + local.set $2 + block $~lib/rt/tlsf/GETSL|inlined.3 (result i32) + local.get $0 + local.set $10 + local.get $2 + local.set $11 + local.get $10 + local.get $11 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + br $~lib/rt/tlsf/GETSL|inlined.3 + end + local.set $7 + i32.const 1 + drop + local.get $7 + drop + block $~lib/rt/tlsf/GETHEAD|inlined.2 (result i32) + local.get $0 + local.set $12 + local.get $2 + local.set $13 + local.get $7 + i32.ctz + local.set $14 + local.get $12 + local.get $13 + i32.const 4 + i32.shl + local.get $14 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + br $~lib/rt/tlsf/GETHEAD|inlined.2 end + local.set $8 + end + else + block $~lib/rt/tlsf/GETHEAD|inlined.3 (result i32) + local.get $0 + local.set $15 + local.get $2 + local.set $16 + local.get $7 + i32.ctz + local.set $17 + local.get $15 + local.get $16 + i32.const 4 + i32.shl + local.get $17 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + br $~lib/rt/tlsf/GETHEAD|inlined.3 + end + local.set $8 + end + local.get $8 + return + ) + (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + i32.const 0 + drop + local.get $1 + i32.const 256 + i32.ge_u + if + local.get $1 + call $~lib/rt/tlsf/roundSize + local.set $1 + end + memory.size + local.set $2 + local.get $1 + i32.const 4 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + block $~lib/rt/tlsf/GETTAIL|inlined.1 (result i32) + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + br $~lib/rt/tlsf/GETTAIL|inlined.1 + end + i32.ne + i32.shl + i32.add + local.set $1 + local.get $1 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $4 + local.get $2 + local.tee $5 + local.get $4 + local.tee $6 + local.get $5 + local.get $6 + i32.gt_s + select + local.set $7 + local.get $7 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $4 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable end end + memory.size + local.set $8 + local.get $0 + local.get $2 + i32.const 16 + i32.shl + local.get $8 + i64.extend_i32_s + i64.const 16 + i64.shl + call $~lib/rt/tlsf/addMemory + drop + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + local.get $1 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $3 + i32.const 1 + drop + local.get $2 + i32.const 4 + i32.add + i32.const 15 + i32.and + i32.eqz + drop + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.sub + local.set $4 + local.get $4 + i32.const 4 + i32.const 12 + i32.add + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + i32.const 4 + i32.add + local.get $2 + i32.add + local.set $5 + local.get $5 + local.get $4 + i32.const 4 + i32.sub + i32.const 1 + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $0 + local.get $5 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const 1 + i32.const -1 + i32.xor + i32.and + call $~lib/rt/common/BLOCK#set:mmInfo + block $~lib/rt/tlsf/GETRIGHT|inlined.3 (result i32) + local.get $1 + local.set $7 + local.get $7 + i32.const 4 + i32.add + local.get $7 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + br $~lib/rt/tlsf/GETRIGHT|inlined.3 + end + block $~lib/rt/tlsf/GETRIGHT|inlined.2 (result i32) + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.add + local.get $6 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + br $~lib/rt/tlsf/GETRIGHT|inlined.2 + end + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 2 + i32.const -1 + i32.xor + i32.and + call $~lib/rt/common/BLOCK#set:mmInfo + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.set $2 + local.get $0 + local.get $2 + call $~lib/rt/tlsf/searchBlock + local.set $3 + local.get $3 + i32.eqz + if + local.get $0 + local.get $2 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $2 + call $~lib/rt/tlsf/searchBlock + local.set $3 + i32.const 1 + drop + local.get $3 + drop + end + i32.const 1 + drop + local.get $3 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.ge_u + drop + local.get $0 + local.get $3 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $3 + local.get $2 + call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop + local.get $3 + return + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (result i32) + global.get $~lib/rt/tlsf/ROOT + i32.eqz + if + call $~lib/rt/tlsf/initialize + end + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/allocateBlock + i32.const 4 + i32.add + return + ) + (func $~lib/rt/tcms/Object#set:rtId (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=12 + ) + (func $~lib/rt/tcms/Object#set:rtSize (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=16 + ) + (func $~lib/rt/tcms/Object#set:nextWithColor (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=4 + ) + (func $~lib/rt/tcms/Object#set:prev (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=8 + ) + (func $~lib/rt/tcms/initLazy (param $0 i32) (result i32) + local.get $0 + local.get $0 + call $~lib/rt/tcms/Object#set:nextWithColor + local.get $0 + local.get $0 + call $~lib/rt/tcms/Object#set:prev + local.get $0 + return + ) + (func $~lib/rt/tcms/Object#get:prev (param $0 i32) (result i32) + local.get $0 + i32.load offset=8 + ) + (func $~lib/rt/tcms/Object#get:nextWithColor (param $0 i32) (result i32) + local.get $0 + i32.load offset=4 + ) + (func $~lib/rt/tcms/Object#set:next (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + local.get $0 + call $~lib/rt/tcms/Object#get:nextWithColor + i32.const 3 + i32.and + i32.or + call $~lib/rt/tcms/Object#set:nextWithColor + ) + (func $~lib/rt/tcms/Object#linkTo (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + local.get $1 + call $~lib/rt/tcms/Object#get:prev + local.set $3 local.get $0 - global.set $~lib/rt/stub/offset + local.get $1 + local.get $2 + i32.or + call $~lib/rt/tcms/Object#set:nextWithColor + local.get $0 + local.get $3 + call $~lib/rt/tcms/Object#set:prev + local.get $3 + local.get $0 + call $~lib/rt/tcms/Object#set:next + local.get $1 + local.get $0 + call $~lib/rt/tcms/Object#set:prev ) - (func $~lib/rt/stub/__alloc (; 2 ;) (param $0 i32) (result i32) - (local $1 i32) + (func $~lib/rt/tcms/Object#get:size (param $0 i32) (result i32) + i32.const 4 + local.get $0 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + return + ) + (func $~lib/rt/tcms/__new (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - (local $3 i32) local.get $0 - i32.const 1073741808 + i32.const 1073741804 i32.gt_u if + i32.const 816 + i32.const 880 + i32.const 125 + i32.const 30 + call $~lib/builtins/abort unreachable end - global.get $~lib/rt/stub/offset i32.const 16 - i32.add - local.tee $2 local.get $0 - i32.const 15 - i32.add - i32.const -16 - i32.and - local.tee $1 - i32.const 16 - local.get $1 - i32.const 16 - i32.gt_u - select - local.tee $3 i32.add - call $~lib/rt/stub/maybeGrowMemory - local.get $2 - i32.const 16 + call $~lib/rt/tlsf/__alloc + i32.const 4 i32.sub - local.tee $1 - local.get $3 - i32.store - local.get $1 - i32.const 1 - i32.store offset=4 - local.get $1 - i32.const 0 - i32.store offset=8 + local.set $2 + local.get $2 local.get $1 + call $~lib/rt/tcms/Object#set:rtId + local.get $2 local.get $0 - i32.store offset=12 + call $~lib/rt/tcms/Object#set:rtSize + local.get $2 + global.get $~lib/rt/tcms/fromSpace + global.get $~lib/rt/tcms/white + call $~lib/rt/tcms/Object#linkTo + global.get $~lib/rt/tcms/total + local.get $2 + call $~lib/rt/tcms/Object#get:size + i32.add + global.set $~lib/rt/tcms/total local.get $2 + i32.const 20 + i32.add + return ) - (func $~lib/memory/memory.fill (; 3 ;) (param $0 i32) (param $1 i32) + (func $~lib/arraybuffer/ArrayBuffer#constructor (param $0 i32) (param $1 i32) (result i32) (local $2 i32) - loop $while-continue|0 - local.get $1 - if - local.get $0 - local.tee $2 - i32.const 1 - i32.add - local.set $0 - local.get $2 - i32.const 0 - i32.store8 - local.get $1 - i32.const 1 - i32.sub - local.set $1 - br $while-continue|0 - end - end - ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 4 ;) (param $0 i32) (result i32) - (local $1 i32) - local.get $0 - i32.const 1073741808 + local.get $1 + i32.const 1073741820 i32.gt_u if - i32.const 640 - i32.const 688 - i32.const 54 - i32.const 42 + i32.const 704 + i32.const 752 + i32.const 52 + i32.const 43 call $~lib/builtins/abort unreachable end - local.get $0 - call $~lib/rt/stub/__alloc - local.tee $1 - local.get $0 - call $~lib/memory/memory.fill local.get $1 + i32.const 1 + call $~lib/rt/tcms/__new + local.set $2 + i32.const 1 + global.get $~lib/shared/runtime/Runtime.Incremental + i32.ne + drop + local.get $2 + i32.const 0 + local.get $1 + memory.fill + local.get $2 + return ) - (func $start:assembly/index (; 5 ;) - i32.const 308 - i32.load + (func $start:assembly/index + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + global.get $assembly/index/K + call $~lib/array/Array#get:dataStart global.set $assembly/index/kPtr - i32.const 612 - i32.load + global.get $assembly/index/W64 + call $~lib/array/Array#get:dataStart global.set $assembly/index/w64Ptr - i32.const 736 - global.set $~lib/rt/stub/startOffset - i32.const 736 - global.set $~lib/rt/stub/offset + i32.const 992 + call $~lib/rt/tcms/initLazy + global.set $~lib/rt/tcms/fromSpace + i32.const 0 i32.const 64 call $~lib/arraybuffer/ArrayBuffer#constructor global.set $assembly/index/M global.get $assembly/index/M global.set $assembly/index/mPtr + i32.const 0 i32.const 256 call $~lib/arraybuffer/ArrayBuffer#constructor global.set $assembly/index/W global.get $assembly/index/W global.set $assembly/index/wPtr - i32.const 512 + i32.const 0 + global.get $assembly/index/INPUT_LENGTH call $~lib/arraybuffer/ArrayBuffer#constructor global.set $assembly/index/input global.get $assembly/index/input global.set $assembly/index/inputPtr - i32.const 32 + i32.const 0 + global.get $assembly/index/DIGEST_LENGTH call $~lib/arraybuffer/ArrayBuffer#constructor global.set $assembly/index/output global.get $assembly/index/output global.set $assembly/index/outputPtr ) - (func $assembly/index/init (; 6 ;) + (func $assembly/index/init i32.const 1779033703 global.set $assembly/index/H0 i32.const -1150833019 @@ -239,67 +1627,41 @@ i32.const 0 global.set $assembly/index/bytesHashed ) - (func $~lib/memory/memory.copy (; 7 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $assembly/index/hashBlocks (param $0 i32) (param $1 i32) + (local $2 i32) (local $3 i32) (local $4 i32) - block $~lib/util/memory/memmove|inlined.0 - local.get $2 - local.set $3 - local.get $0 - local.get $1 - i32.eq - br_if $~lib/util/memory/memmove|inlined.0 - local.get $0 - local.get $1 - i32.lt_u - if - loop $while-continue|0 - local.get $3 - if - local.get $0 - local.tee $2 - i32.const 1 - i32.add - local.set $0 - local.get $1 - local.tee $4 - i32.const 1 - i32.add - local.set $1 - local.get $2 - local.get $4 - i32.load8_u - i32.store8 - local.get $3 - i32.const 1 - i32.sub - local.set $3 - br $while-continue|0 - end - end - else - loop $while-continue|1 - local.get $3 - if - local.get $3 - i32.const 1 - i32.sub - local.tee $3 - local.get $0 - i32.add - local.get $1 - local.get $3 - i32.add - i32.load8_u - i32.store8 - br $while-continue|1 - end - end - end - end - ) - (func $assembly/index/hashBlocks (; 8 ;) (param $0 i32) (param $1 i32) - (local $2 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) + (local $24 i32) + (local $25 i32) + (local $26 i32) + (local $27 i32) + (local $28 i32) + (local $29 i32) + (local $30 i32) + (local $31 i32) + (local $32 i32) + (local $33 i32) + (local $34 i32) + (local $35 i32) global.get $assembly/index/H0 global.set $assembly/index/a global.get $assembly/index/H1 @@ -319,207 +1681,295 @@ i32.const 0 global.set $assembly/index/i loop $for-loop|0 - global.get $assembly/index/i - i32.const 16 - i32.lt_u - if - local.get $0 - global.get $assembly/index/i - i32.const 2 - i32.shl - i32.add - local.get $1 - global.get $assembly/index/i - i32.const 2 - i32.shl - local.tee $2 - i32.add - i32.load8_u - i32.const 24 - i32.shl - local.get $1 - local.get $2 - i32.const 1 - i32.add - i32.add - i32.load8_u - i32.const 16 - i32.shl - i32.or - local.get $1 - local.get $2 - i32.const 2 - i32.add - i32.add - i32.load8_u - i32.const 8 - i32.shl - i32.or - local.get $1 - local.get $2 - i32.const 3 - i32.add - i32.add - i32.load8_u - i32.or - i32.store - global.get $assembly/index/i - i32.const 1 - i32.add - global.set $assembly/index/i - br $for-loop|0 - end - end - i32.const 16 - global.set $assembly/index/i - loop $for-loop|1 global.get $assembly/index/i i32.const 64 i32.lt_u if - local.get $0 - global.get $assembly/index/i - i32.const 2 - i32.shl - i32.add - local.get $0 global.get $assembly/index/i i32.const 16 - i32.sub - i32.const 2 - i32.shl - i32.add - i32.load - local.get $0 - global.get $assembly/index/i - i32.const 7 - i32.sub - i32.const 2 - i32.shl - i32.add - i32.load - local.get $0 - global.get $assembly/index/i - i32.const 2 - i32.sub - i32.const 2 - i32.shl - i32.add - i32.load - local.tee $1 - i32.const 17 - i32.rotr - local.get $1 - i32.const 19 - i32.rotr - i32.xor - local.get $1 - i32.const 10 - i32.shr_u - i32.xor - i32.add - local.get $0 - global.get $assembly/index/i - i32.const 15 - i32.sub - i32.const 2 - i32.shl - i32.add - i32.load - local.tee $1 - i32.const 7 - i32.rotr - local.get $1 - i32.const 18 - i32.rotr - i32.xor - local.get $1 - i32.const 3 - i32.shr_u - i32.xor - i32.add - i32.add - i32.store - global.get $assembly/index/i - i32.const 1 - i32.add - global.set $assembly/index/i - br $for-loop|1 - end - end - i32.const 0 - global.set $assembly/index/i - loop $for-loop|2 - global.get $assembly/index/i - i32.const 64 - i32.lt_u - if + i32.lt_u + if (result i32) + block $assembly/index/load32be|inlined.0 (result i32) + local.get $1 + local.set $2 + global.get $assembly/index/i + local.set $3 + local.get $3 + i32.const 2 + i32.shl + local.set $4 + block $assembly/index/load8|inlined.0 (result i32) + local.get $2 + local.set $5 + local.get $4 + i32.const 0 + i32.add + local.set $6 + local.get $5 + local.get $6 + i32.add + i32.load8_u + br $assembly/index/load8|inlined.0 + end + i32.const 255 + i32.and + i32.const 24 + i32.shl + block $assembly/index/load8|inlined.1 (result i32) + local.get $2 + local.set $7 + local.get $4 + i32.const 1 + i32.add + local.set $8 + local.get $7 + local.get $8 + i32.add + i32.load8_u + br $assembly/index/load8|inlined.1 + end + i32.const 255 + i32.and + i32.const 16 + i32.shl + i32.or + block $assembly/index/load8|inlined.2 (result i32) + local.get $2 + local.set $9 + local.get $4 + i32.const 2 + i32.add + local.set $10 + local.get $9 + local.get $10 + i32.add + i32.load8_u + br $assembly/index/load8|inlined.2 + end + i32.const 255 + i32.and + i32.const 8 + i32.shl + i32.or + block $assembly/index/load8|inlined.3 (result i32) + local.get $2 + local.set $11 + local.get $4 + i32.const 3 + i32.add + local.set $12 + local.get $11 + local.get $12 + i32.add + i32.load8_u + br $assembly/index/load8|inlined.3 + end + i32.const 255 + i32.and + i32.const 0 + i32.shl + i32.or + br $assembly/index/load32be|inlined.0 + end + else + block $assembly/index/SIG1|inlined.0 (result i32) + block $assembly/index/load32|inlined.0 (result i32) + local.get $0 + local.set $13 + global.get $assembly/index/i + i32.const 2 + i32.sub + local.set $14 + local.get $13 + local.get $14 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.0 + end + local.set $15 + local.get $15 + i32.const 17 + i32.rotr + local.get $15 + i32.const 19 + i32.rotr + i32.xor + local.get $15 + i32.const 10 + i32.shr_u + i32.xor + br $assembly/index/SIG1|inlined.0 + end + block $assembly/index/load32|inlined.1 (result i32) + local.get $0 + local.set $16 + global.get $assembly/index/i + i32.const 7 + i32.sub + local.set $17 + local.get $16 + local.get $17 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.1 + end + i32.add + block $assembly/index/SIG0|inlined.0 (result i32) + block $assembly/index/load32|inlined.2 (result i32) + local.get $0 + local.set $18 + global.get $assembly/index/i + i32.const 15 + i32.sub + local.set $19 + local.get $18 + local.get $19 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.2 + end + local.set $20 + local.get $20 + i32.const 7 + i32.rotr + local.get $20 + i32.const 18 + i32.rotr + i32.xor + local.get $20 + i32.const 3 + i32.shr_u + i32.xor + br $assembly/index/SIG0|inlined.0 + end + i32.add + block $assembly/index/load32|inlined.3 (result i32) + local.get $0 + local.set $21 + global.get $assembly/index/i + i32.const 16 + i32.sub + local.set $22 + local.get $21 + local.get $22 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.3 + end + i32.add + end + global.set $assembly/index/tmpW local.get $0 + local.set $23 global.get $assembly/index/i + local.set $24 + global.get $assembly/index/tmpW + local.set $25 + local.get $23 + local.get $24 i32.const 2 i32.shl i32.add - i32.load - global.get $assembly/index/kPtr - global.get $assembly/index/i - i32.const 2 - i32.shl - i32.add - i32.load - global.get $assembly/index/h - global.get $assembly/index/e - local.tee $1 - i32.const 6 - i32.rotr - local.get $1 - i32.const 11 - i32.rotr - i32.xor - local.get $1 - i32.const 25 - i32.rotr - i32.xor + local.get $25 + i32.store + global.get $assembly/index/h + block $assembly/index/EP1|inlined.0 (result i32) + global.get $assembly/index/e + local.set $26 + local.get $26 + i32.const 6 + i32.rotr + local.get $26 + i32.const 11 + i32.rotr + i32.xor + local.get $26 + i32.const 25 + i32.rotr + i32.xor + br $assembly/index/EP1|inlined.0 + end i32.add - global.get $assembly/index/e - local.tee $1 - global.get $assembly/index/f - i32.and - global.get $assembly/index/g - local.get $1 - i32.const -1 - i32.xor - i32.and - i32.xor + block $assembly/index/CH|inlined.0 (result i32) + global.get $assembly/index/e + local.set $27 + global.get $assembly/index/f + local.set $28 + global.get $assembly/index/g + local.set $29 + local.get $27 + local.get $28 + i32.and + local.get $27 + i32.const -1 + i32.xor + local.get $29 + i32.and + i32.xor + br $assembly/index/CH|inlined.0 + end i32.add + block $assembly/index/load32|inlined.4 (result i32) + global.get $assembly/index/kPtr + local.set $30 + global.get $assembly/index/i + local.set $31 + local.get $30 + local.get $31 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.4 + end i32.add + global.get $assembly/index/tmpW i32.add global.set $assembly/index/t1 - global.get $assembly/index/a - local.tee $1 - i32.const 2 - i32.rotr - local.get $1 - i32.const 13 - i32.rotr - i32.xor - local.get $1 - i32.const 22 - i32.rotr - i32.xor - global.get $assembly/index/a - local.tee $1 - global.get $assembly/index/b - local.tee $2 - i32.and - local.get $1 - global.get $assembly/index/c - local.tee $1 - i32.and - i32.xor - local.get $1 - local.get $2 - i32.and - i32.xor + block $assembly/index/EP0|inlined.0 (result i32) + global.get $assembly/index/a + local.set $32 + local.get $32 + i32.const 2 + i32.rotr + local.get $32 + i32.const 13 + i32.rotr + i32.xor + local.get $32 + i32.const 22 + i32.rotr + i32.xor + br $assembly/index/EP0|inlined.0 + end + block $assembly/index/MAJ|inlined.0 (result i32) + global.get $assembly/index/a + local.set $33 + global.get $assembly/index/b + local.set $34 + global.get $assembly/index/c + local.set $35 + local.get $33 + local.get $34 + i32.and + local.get $33 + local.get $35 + i32.and + i32.xor + local.get $34 + local.get $35 + i32.and + i32.xor + br $assembly/index/MAJ|inlined.0 + end i32.add global.set $assembly/index/t2 global.get $assembly/index/g @@ -546,7 +1996,7 @@ i32.const 1 i32.add global.set $assembly/index/i - br $for-loop|2 + br $for-loop|0 end end global.get $assembly/index/H0 @@ -582,11 +2032,13 @@ i32.add global.set $assembly/index/H7 ) - (func $assembly/index/update (; 9 ;) (param $0 i32) (param $1 i32) + (func $assembly/index/update (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) - local.get $1 + i32.const 0 + local.set $2 global.get $assembly/index/bytesHashed + local.get $1 i32.add global.set $assembly/index/bytesHashed global.get $assembly/index/mLength @@ -604,16 +2056,18 @@ i32.const 64 global.get $assembly/index/mLength i32.sub - call $~lib/memory/memory.copy + memory.copy global.get $assembly/index/mLength i32.const 64 global.get $assembly/index/mLength i32.sub i32.add global.set $assembly/index/mLength + local.get $2 i32.const 64 global.get $assembly/index/mLength i32.sub + i32.add local.set $2 local.get $1 i32.const 64 @@ -632,14 +2086,24 @@ i32.add local.get $0 local.get $1 - call $~lib/memory/memory.copy - local.get $1 + memory.copy global.get $assembly/index/mLength + local.get $1 i32.add global.set $assembly/index/mLength + local.get $2 + local.get $1 + i32.add + local.set $2 + local.get $1 + local.get $1 + i32.sub + local.set $1 return end end + i32.const 0 + local.set $3 loop $for-loop|0 local.get $3 local.get $1 @@ -657,8 +2121,8 @@ i32.add local.set $3 local.get $2 - i32.const -64 - i32.sub + i32.const 64 + i32.add local.set $2 br $for-loop|0 end @@ -676,15 +2140,58 @@ local.get $1 i32.const 63 i32.and - local.tee $0 - call $~lib/memory/memory.copy - local.get $0 + memory.copy global.get $assembly/index/mLength + local.get $1 + i32.const 63 + i32.and i32.add global.set $assembly/index/mLength end ) - (func $~lib/polyfills/bswap (; 10 ;) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (param $0 i32) (result i32) + i32.const 1 + 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.const -16711936 + i32.and + i32.const 8 + i32.rotl + local.get $0 + i32.const 16711935 + i32.and + i32.const 8 + i32.rotr + i32.or + return + ) + (func $~lib/polyfills/bswap (param $0 i32) (result i32) + i32.const 1 + 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.const -16711936 i32.and @@ -696,10 +2203,47 @@ i32.const 8 i32.rotr i32.or + return ) - (func $assembly/index/final (; 11 ;) (param $0 i32) + (func $assembly/index/final (param $0 i32) (local $1 i32) (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) + (local $24 i32) + (local $25 i32) + (local $26 i32) + (local $27 i32) + (local $28 i32) + (local $29 i32) + (local $30 i32) + (local $31 i32) + (local $32 i32) + (local $33 i32) + (local $34 i32) + (local $35 i32) + (local $36 i32) + (local $37 i32) + (local $38 i32) global.get $assembly/index/bytesHashed i32.const 63 i32.and @@ -707,9 +2251,15 @@ i32.lt_s if global.get $assembly/index/mPtr + local.set $1 global.get $assembly/index/mLength - i32.add + local.set $2 i32.const 128 + local.set $3 + local.get $1 + local.get $2 + i32.add + local.get $3 i32.store8 global.get $assembly/index/mLength i32.const 1 @@ -725,24 +2275,29 @@ global.get $assembly/index/mPtr global.get $assembly/index/mLength i32.add - local.tee $1 + local.set $4 + i32.const 0 + local.set $5 i32.const 64 global.get $assembly/index/mLength i32.sub + local.set $6 + local.get $4 + local.get $6 i32.add - local.set $2 + local.set $7 loop $while-continue|0 - local.get $1 - local.get $2 + local.get $4 + local.get $7 i32.lt_u if - local.get $1 - i32.const 0 + local.get $4 + local.get $5 i32.store8 - local.get $1 + local.get $4 i32.const 1 i32.add - local.set $1 + local.set $4 br $while-continue|0 end end @@ -759,9 +2314,15 @@ i32.ge_s if global.get $assembly/index/mPtr + local.set $8 global.get $assembly/index/mLength - i32.add + local.set $9 i32.const 128 + local.set $10 + local.get $8 + local.get $9 + i32.add + local.get $10 i32.store8 global.get $assembly/index/mLength i32.const 1 @@ -771,38 +2332,49 @@ global.get $assembly/index/mPtr global.get $assembly/index/mLength i32.add - local.tee $1 - i32.const 56 + local.set $11 + i32.const 0 + local.set $12 + i32.const 64 global.get $assembly/index/mLength i32.sub + i32.const 8 + i32.sub + local.set $13 + local.get $11 + local.get $13 i32.add - local.set $2 + local.set $14 loop $while-continue|1 - local.get $1 - local.get $2 + local.get $11 + local.get $14 i32.lt_u if - local.get $1 - i32.const 0 + local.get $11 + local.get $12 i32.store8 - local.get $1 + local.get $11 i32.const 1 i32.add - local.set $1 + local.set $11 br $while-continue|1 end end global.get $assembly/index/mPtr - i32.const 56 + i32.const 64 i32.add + i32.const 8 + i32.sub global.get $assembly/index/bytesHashed i32.const 536870912 i32.div_s call $~lib/polyfills/bswap i32.store global.get $assembly/index/mPtr - i32.const 60 + i32.const 64 i32.add + i32.const 4 + i32.sub global.get $assembly/index/bytesHashed i32.const 3 i32.shl @@ -812,53 +2384,119 @@ global.get $assembly/index/mPtr call $assembly/index/hashBlocks local.get $0 + local.set $15 + i32.const 0 + local.set $16 global.get $assembly/index/H0 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $17 + local.get $15 + local.get $16 + i32.const 2 + i32.shl + i32.add + local.get $17 i32.store local.get $0 - i32.const 4 - i32.add + local.set $18 + i32.const 1 + local.set $19 global.get $assembly/index/H1 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $20 + local.get $18 + local.get $19 + i32.const 2 + i32.shl + i32.add + local.get $20 i32.store local.get $0 - i32.const 8 - i32.add + local.set $21 + i32.const 2 + local.set $22 global.get $assembly/index/H2 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $23 + local.get $21 + local.get $22 + i32.const 2 + i32.shl + i32.add + local.get $23 i32.store local.get $0 - i32.const 12 - i32.add + local.set $24 + i32.const 3 + local.set $25 global.get $assembly/index/H3 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $26 + local.get $24 + local.get $25 + i32.const 2 + i32.shl + i32.add + local.get $26 i32.store local.get $0 - i32.const 16 - i32.add + local.set $27 + i32.const 4 + local.set $28 global.get $assembly/index/H4 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $29 + local.get $27 + local.get $28 + i32.const 2 + i32.shl + i32.add + local.get $29 i32.store local.get $0 - i32.const 20 - i32.add + local.set $30 + i32.const 5 + local.set $31 global.get $assembly/index/H5 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $32 + local.get $30 + local.get $31 + i32.const 2 + i32.shl + i32.add + local.get $32 i32.store local.get $0 - i32.const 24 - i32.add + local.set $33 + i32.const 6 + local.set $34 global.get $assembly/index/H6 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $35 + local.get $33 + local.get $34 + i32.const 2 + i32.shl + i32.add + local.get $35 i32.store local.get $0 - i32.const 28 - i32.add + local.set $36 + i32.const 7 + local.set $37 global.get $assembly/index/H7 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $38 + local.get $36 + local.get $37 + i32.const 2 + i32.shl + i32.add + local.get $38 i32.store ) - (func $assembly/index/digest (; 12 ;) (param $0 i32) + (func $assembly/index/digest (param $0 i32) call $assembly/index/init global.get $assembly/index/inputPtr local.get $0 @@ -866,9 +2504,17 @@ global.get $assembly/index/outputPtr call $assembly/index/final ) - (func $assembly/index/hashPreCompW (; 13 ;) (param $0 i32) + (func $assembly/index/hashPreCompW (param $0 i32) (local $1 i32) (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) global.get $assembly/index/H0 global.set $assembly/index/a global.get $assembly/index/H1 @@ -892,65 +2538,94 @@ i32.const 64 i32.lt_u if - local.get $0 - global.get $assembly/index/i - i32.const 2 - i32.shl - i32.add - i32.load global.get $assembly/index/h - global.get $assembly/index/e - local.tee $1 - i32.const 6 - i32.rotr - local.get $1 - i32.const 11 - i32.rotr - i32.xor - local.get $1 - i32.const 25 - i32.rotr - i32.xor + block $assembly/index/EP1|inlined.1 (result i32) + global.get $assembly/index/e + local.set $1 + local.get $1 + i32.const 6 + i32.rotr + local.get $1 + i32.const 11 + i32.rotr + i32.xor + local.get $1 + i32.const 25 + i32.rotr + i32.xor + br $assembly/index/EP1|inlined.1 + end i32.add - global.get $assembly/index/e - local.tee $1 - global.get $assembly/index/f - i32.and - global.get $assembly/index/g - local.get $1 - i32.const -1 - i32.xor - i32.and - i32.xor + block $assembly/index/CH|inlined.1 (result i32) + global.get $assembly/index/e + local.set $2 + global.get $assembly/index/f + local.set $3 + global.get $assembly/index/g + local.set $4 + local.get $2 + local.get $3 + i32.and + local.get $2 + i32.const -1 + i32.xor + local.get $4 + i32.and + i32.xor + br $assembly/index/CH|inlined.1 + end i32.add + block $assembly/index/load32|inlined.5 (result i32) + local.get $0 + local.set $5 + global.get $assembly/index/i + local.set $6 + local.get $5 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.5 + end i32.add global.set $assembly/index/t1 - global.get $assembly/index/a - local.tee $1 - i32.const 2 - i32.rotr - local.get $1 - i32.const 13 - i32.rotr - i32.xor - local.get $1 - i32.const 22 - i32.rotr - i32.xor - global.get $assembly/index/a - local.tee $1 - global.get $assembly/index/b - local.tee $2 - i32.and - local.get $1 - global.get $assembly/index/c - local.tee $1 - i32.and - i32.xor - local.get $1 - local.get $2 - i32.and - i32.xor + block $assembly/index/EP0|inlined.1 (result i32) + global.get $assembly/index/a + local.set $7 + local.get $7 + i32.const 2 + i32.rotr + local.get $7 + i32.const 13 + i32.rotr + i32.xor + local.get $7 + i32.const 22 + i32.rotr + i32.xor + br $assembly/index/EP0|inlined.1 + end + block $assembly/index/MAJ|inlined.1 (result i32) + global.get $assembly/index/a + local.set $8 + global.get $assembly/index/b + local.set $9 + global.get $assembly/index/c + local.set $10 + local.get $8 + local.get $9 + i32.and + local.get $8 + local.get $10 + i32.and + i32.xor + local.get $9 + local.get $10 + i32.and + i32.xor + br $assembly/index/MAJ|inlined.1 + end i32.add global.set $assembly/index/t2 global.get $assembly/index/g @@ -1013,7 +2688,31 @@ i32.add global.set $assembly/index/H7 ) - (func $assembly/index/digest64 (; 14 ;) (param $0 i32) (param $1 i32) + (func $assembly/index/digest64 (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) + (local $24 i32) + (local $25 i32) call $assembly/index/init global.get $assembly/index/wPtr local.get $0 @@ -1021,53 +2720,119 @@ global.get $assembly/index/w64Ptr call $assembly/index/hashPreCompW local.get $1 + local.set $2 + i32.const 0 + local.set $3 global.get $assembly/index/H0 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $4 + local.get $2 + local.get $3 + i32.const 2 + i32.shl + i32.add + local.get $4 i32.store local.get $1 - i32.const 4 - i32.add + local.set $5 + i32.const 1 + local.set $6 global.get $assembly/index/H1 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $7 + local.get $5 + local.get $6 + i32.const 2 + i32.shl + i32.add + local.get $7 i32.store local.get $1 - i32.const 8 - i32.add + local.set $8 + i32.const 2 + local.set $9 global.get $assembly/index/H2 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $10 + local.get $8 + local.get $9 + i32.const 2 + i32.shl + i32.add + local.get $10 i32.store local.get $1 - i32.const 12 - i32.add + local.set $11 + i32.const 3 + local.set $12 global.get $assembly/index/H3 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $13 + local.get $11 + local.get $12 + i32.const 2 + i32.shl + i32.add + local.get $13 i32.store local.get $1 - i32.const 16 - i32.add + local.set $14 + i32.const 4 + local.set $15 global.get $assembly/index/H4 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $16 + local.get $14 + local.get $15 + i32.const 2 + i32.shl + i32.add + local.get $16 i32.store local.get $1 - i32.const 20 - i32.add + local.set $17 + i32.const 5 + local.set $18 global.get $assembly/index/H5 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $19 + local.get $17 + local.get $18 + i32.const 2 + i32.shl + i32.add + local.get $19 i32.store local.get $1 - i32.const 24 - i32.add + local.set $20 + i32.const 6 + local.set $21 global.get $assembly/index/H6 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $22 + local.get $20 + local.get $21 + i32.const 2 + i32.shl + i32.add + local.get $22 i32.store local.get $1 - i32.const 28 - i32.add + local.set $23 + i32.const 7 + local.set $24 global.get $assembly/index/H7 - call $~lib/polyfills/bswap + call $~lib/polyfills/bswap + local.set $25 + local.get $23 + local.get $24 + i32.const 2 + i32.shl + i32.add + local.get $25 i32.store ) - (func $~start (; 15 ;) + (func $~start call $start:assembly/index ) ) diff --git a/packages/as-sha256/build/untouched.wasm b/packages/as-sha256/build/untouched.wasm index 72afc8bd98d77afb9060890172c4487cfbd62c45..da7593528ef4978326088a0f757adb9a110adf4d 100644 GIT binary patch delta 364 zcmZvXy-LJD9K@6TlmyMkc@eR2mksei1gqn?$}N2c3&HMkg~W)Yi=B<2$CkdsHF*KC zxAi%$v3C*?L~N$m|IBY@H?zmt^Cf-vC#$Qs)hl@s80niTcSiUtw_ z%ItnKKyi>}q=nhly#GvvWLqolE|P<}Daw2g;T_z#B@JX7VQw>ohj(fs_s#H delta 466 zcmZXQJx;?w6okD$-nDlDI|(sDG;igIA1Nh5DYGRKXCM+Cb`=F7cdif(MUatbI76CT z08w!QO3siYFqou>&`MM68+~u)J&jhQ`9yrOljoa{=8WC)*WvPotvEYgKFBX4ze8r4 zNiyuGmyQ#cV~$6Gi}TDyym?C=YwHxn6nTDEkh)k=Dc*81nFPWDL77&^qmUQt7cGhKeMe_!K_OclA_SpYj?3GA(>A~7i}`N zBn_&rAYG8O7a+lpy%O%Ubb=&_&E5iJOQtOp{x1}47i#8-KJW87@8S;1s|sSVMft<3 z-GYJ6d$`y>LTQSp2vE-`YHa7|stsXqh>#4*Y`P2%0NitytmhSE7eMPX0NejKPh6Cz Qe}|usQ>@~ diff --git a/packages/as-sha256/build/untouched.wat b/packages/as-sha256/build/untouched.wat index 9054d70a..e762062b 100644 --- a/packages/as-sha256/build/untouched.wat +++ b/packages/as-sha256/build/untouched.wat @@ -1,25 +1,18 @@ (module - (type $i32_=>_none (func (param i32))) - (type $none_=>_none (func)) - (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $0 (func (param i32) (result i32))) + (type $1 (func (param i32 i32))) + (type $2 (func)) + (type $3 (func (param i32 i32) (result i32))) + (type $4 (func (param i32))) + (type $5 (func (param i32 i32 i32))) + (type $6 (func (param i32 i32 i32 i32))) + (type $7 (func (param i32 i32 i64) (result i32))) (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 16) "\00\01\00\00\01\00\00\00\00\00\00\00\00\01\00\00\98/\8aB\91D7q\cf\fb\c0\b5\a5\db\b5\e9[\c2V9\f1\11\f1Y\a4\82?\92\d5^\1c\ab\98\aa\07\d8\01[\83\12\be\851$\c3}\0cUt]\ber\fe\b1\de\80\a7\06\dc\9bt\f1\9b\c1\c1i\9b\e4\86G\be\ef\c6\9d\c1\0f\cc\a1\0c$o,\e9-\aa\84tJ\dc\a9\b0\\\da\88\f9vRQ>\98m\c61\a8\c8\'\03\b0\c7\7fY\bf\f3\0b\e0\c6G\91\a7\d5Qc\ca\06g))\14\85\n\b7\'8!\1b.\fcm,M\13\0d8STs\ne\bb\njv.\c9\c2\81\85,r\92\a1\e8\bf\a2Kf\1a\a8p\8bK\c2\a3Ql\c7\19\e8\92\d1$\06\99\d6\855\0e\f4p\a0j\10\16\c1\a4\19\08l7\1eLwH\'\b5\bc\b04\b3\0c\1c9J\aa\d8NO\ca\9c[\f3o.h\ee\82\8ftoc\a5x\14x\c8\84\08\02\c7\8c\fa\ff\be\90\eblP\a4\f7\a3\f9\be\f2xq\c6") - (data (i32.const 288) "\10\00\00\00\01\00\00\00\03\00\00\00\10\00\00\00 \00\00\00 \00\00\00\00\01\00\00@\00\00\00") - (data (i32.const 320) "\00\01\00\00\01\00\00\00\00\00\00\00\00\01\00\00\98/\8a\c2\91D7q\cf\fb\c0\b5\a5\db\b5\e9[\c2V9\f1\11\f1Y\a4\82?\92\d5^\1c\ab\98\aa\07\d8\01[\83\12\be\851$\c3}\0cUt]\ber\fe\b1\de\80\a7\06\dc\9bt\f3\9b\c1\c1i\9bd\86G\fe\f0\c6\ed\e1\0fT\f2\0c$o4\e9O\be\84\c9l\1eA\b9a\fa\88\f9\16RQ\c6\f2mZ\8e\a8e\fc\19\b0\c7\9e\d9\b9\c31\12\9a\a0\ea\0e\e7+#\b1\fd\b0>5\c7\d5\bai0_m\97\cb\8f\11\0fZ\fd\ee\1e\dc\89\b65\n\04z\0b\de\9d\ca\f4X\16[]\e1\86>\7f\00\80\89\0872\ea\07\a57\95\abo\10a@\17\f1\d6\8c\0dm;\aa\cd7\be\bb\c0\da;a\83c\a3H\db1\e9\02\0b\a7\\\d1o\ca\fa\1aR1\8431\95\1a\d4n\90xCm\f2\91\9c\c3\bd\ab\cc\9e\e6\a0\c9\b5<\b6/S\c6A\c7\d2\a3~#\07hK\95\a4v\1d\19L") - (data (i32.const 592) "\10\00\00\00\01\00\00\00\03\00\00\00\10\00\00\00P\01\00\00P\01\00\00\00\01\00\00@\00\00\00") - (data (i32.const 624) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00") - (data (i32.const 672) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") - (table $0 1 funcref) (global $assembly/index/DIGEST_LENGTH i32 (i32.const 32)) (global $assembly/index/INPUT_LENGTH i32 (i32.const 512)) - (global $assembly/index/K i32 (i32.const 304)) + (global $assembly/index/K i32 (i32.const 320)) (global $assembly/index/kPtr (mut i32) (i32.const 0)) - (global $assembly/index/W64 i32 (i32.const 608)) + (global $assembly/index/W64 i32 (i32.const 656)) (global $assembly/index/w64Ptr (mut i32) (i32.const 0)) (global $assembly/index/H0 (mut i32) (i32.const 0)) (global $assembly/index/H1 (mut i32) (i32.const 0)) @@ -40,9 +33,15 @@ (global $assembly/index/i (mut i32) (i32.const 0)) (global $assembly/index/t1 (mut i32) (i32.const 0)) (global $assembly/index/t2 (mut i32) (i32.const 0)) - (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) - (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) + (global $~lib/shared/runtime/Runtime.Stub i32 (i32.const 0)) + (global $~lib/shared/runtime/Runtime.Minimal i32 (i32.const 1)) + (global $~lib/shared/runtime/Runtime.Incremental i32 (i32.const 2)) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/native/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) + (global $~lib/rt/tcms/fromSpace (mut i32) (i32.const 0)) + (global $~lib/rt/tcms/white (mut i32) (i32.const 0)) + (global $~lib/rt/tcms/total (mut i32) (i32.const 0)) + (global $~lib/native/ASC_RUNTIME i32 (i32.const 1)) (global $assembly/index/M (mut i32) (i32.const 0)) (global $assembly/index/mPtr (mut i32) (i32.const 0)) (global $assembly/index/W (mut i32) (i32.const 0)) @@ -53,8 +52,21 @@ (global $assembly/index/outputPtr (mut i32) (i32.const 0)) (global $assembly/index/mLength (mut i32) (i32.const 0)) (global $assembly/index/bytesHashed (mut i32) (i32.const 0)) - (global $~lib/heap/__heap_base i32 (i32.const 728)) - (export "memory" (memory $0)) + (global $assembly/index/tmpW (mut i32) (i32.const 0)) + (global $~lib/memory/__heap_base i32 (i32.const 1012)) + (memory $0 1) + (data $0 (i32.const 12) "\1c\01\00\00\00\00\00\00\00\00\00\00\01\00\00\00\00\01\00\00\98/\8aB\91D7q\cf\fb\c0\b5\a5\db\b5\e9[\c2V9\f1\11\f1Y\a4\82?\92\d5^\1c\ab\98\aa\07\d8\01[\83\12\be\851$\c3}\0cUt]\ber\fe\b1\de\80\a7\06\dc\9bt\f1\9b\c1\c1i\9b\e4\86G\be\ef\c6\9d\c1\0f\cc\a1\0c$o,\e9-\aa\84tJ\dc\a9\b0\\\da\88\f9vRQ>\98m\c61\a8\c8\'\03\b0\c7\7fY\bf\f3\0b\e0\c6G\91\a7\d5Qc\ca\06g))\14\85\n\b7\'8!\1b.\fcm,M\13\r8STs\ne\bb\njv.\c9\c2\81\85,r\92\a1\e8\bf\a2Kf\1a\a8p\8bK\c2\a3Ql\c7\19\e8\92\d1$\06\99\d6\855\0e\f4p\a0j\10\16\c1\a4\19\08l7\1eLwH\'\b5\bc\b04\b3\0c\1c9J\aa\d8NO\ca\9c[\f3o.h\ee\82\8ftoc\a5x\14x\c8\84\08\02\c7\8c\fa\ff\be\90\eblP\a4\f7\a3\f9\be\f2xq\c6\00\00\00\00\00\00\00\00\00\00\00\00") + (data $1 (i32.const 300) ",\00\00\00\00\00\00\00\00\00\00\00\04\00\00\00\10\00\00\00 \00\00\00 \00\00\00\00\01\00\00@\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data $2 (i32.const 348) "\1c\01\00\00\00\00\00\00\00\00\00\00\01\00\00\00\00\01\00\00\98/\8a\c2\91D7q\cf\fb\c0\b5\a5\db\b5\e9[\c2V9\f1\11\f1Y\a4\82?\92\d5^\1c\ab\98\aa\07\d8\01[\83\12\be\851$\c3}\0cUt]\ber\fe\b1\de\80\a7\06\dc\9bt\f3\9b\c1\c1i\9bd\86G\fe\f0\c6\ed\e1\0fT\f2\0c$o4\e9O\be\84\c9l\1eA\b9a\fa\88\f9\16RQ\c6\f2mZ\8e\a8e\fc\19\b0\c7\9e\d9\b9\c31\12\9a\a0\ea\0e\e7+#\b1\fd\b0>5\c7\d5\bai0_m\97\cb\8f\11\0fZ\fd\ee\1e\dc\89\b65\n\04z\0b\de\9d\ca\f4X\16[]\e1\86>\7f\00\80\89\0872\ea\07\a57\95\abo\10a@\17\f1\d6\8c\rm;\aa\cd7\be\bb\c0\da;a\83c\a3H\db1\e9\02\0b\a7\\\d1o\ca\fa\1aR1\8431\95\1a\d4n\90xCm\f2\91\9c\c3\bd\ab\cc\9e\e6\a0\c9\b5<\b6/S\c6A\c7\d2\a3~#\07hK\95\a4v\1d\19L\00\00\00\00\00\00\00\00\00\00\00\00") + (data $3 (i32.const 636) ",\00\00\00\00\00\00\00\00\00\00\00\04\00\00\00\10\00\00\00p\01\00\00p\01\00\00\00\01\00\00@\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data $4 (i32.const 684) ",\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00") + (data $5 (i32.const 732) "<\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00&\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00\00\00\00\00\00\00") + (data $6 (i32.const 796) "<\00\00\00\00\00\00\00\00\00\00\00\02\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\00\00\00\00") + (data $7 (i32.const 860) "<\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00c\00m\00s\00.\00t\00s\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data $8 (i32.const 924) "<\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data $9 (i32.const 992) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (table $0 1 1 funcref) + (elem $0 (i32.const 1)) (export "INPUT_LENGTH" (global $assembly/index/INPUT_LENGTH)) (export "input" (global $assembly/index/input)) (export "output" (global $assembly/index/output)) @@ -63,1716 +75,1218 @@ (export "final" (func $assembly/index/final)) (export "digest" (func $assembly/index/digest)) (export "digest64" (func $assembly/index/digest64)) + (export "memory" (memory $0)) (start $~start) - (func $~lib/rt/stub/maybeGrowMemory (; 1 ;) (param $0 i32) - (local $1 i32) + (func $~lib/array/Array#get:dataStart (param $0 i32) (result i32) + local.get $0 + i32.load offset=4 + ) + (func $~lib/rt/tlsf/Root#set:flMap (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store + ) + (func $~lib/rt/common/BLOCK#get:mmInfo (param $0 i32) (result i32) + local.get $0 + i32.load + ) + (func $~lib/rt/common/BLOCK#set:mmInfo (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store + ) + (func $~lib/rt/tlsf/Block#set:prev (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/Block#set:next (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=8 + ) + (func $~lib/rt/tlsf/Block#get:prev (param $0 i32) (result i32) + local.get $0 + i32.load offset=4 + ) + (func $~lib/rt/tlsf/Block#get:next (param $0 i32) (result i32) + local.get $0 + i32.load offset=8 + ) + (func $~lib/rt/tlsf/Root#get:flMap (param $0 i32) (result i32) + local.get $0 + i32.load + ) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - memory.size - local.set $1 + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) local.get $1 - i32.const 16 - i32.shl + call $~lib/rt/common/BLOCK#get:mmInfo local.set $2 - local.get $0 + i32.const 1 + drop local.get $2 - i32.gt_u + i32.const 1 + i32.and + i32.eqz if - local.get $0 - local.get $2 - i32.sub - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 + i32.const 0 + i32.const 944 + i32.const 268 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 12 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 270 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $4 + local.get $3 + i32.const 4 i32.shr_u - local.set $3 - local.get $1 - local.tee $4 + local.set $5 + else local.get $3 - local.tee $5 - local.get $4 - local.get $5 - i32.gt_s + local.tee $6 + i32.const 1073741820 + local.tee $7 + local.get $6 + local.get $7 + i32.lt_u select + local.set $8 + i32.const 31 + local.get $8 + i32.clz + i32.sub local.set $4 + local.get $8 local.get $4 - memory.grow + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $5 + local.get $4 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $4 + end + i32.const 1 + drop + local.get $4 + i32.const 23 + i32.lt_u + if (result i32) + local.get $5 + i32.const 16 + i32.lt_u + else i32.const 0 - i32.lt_s + end + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 284 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/tlsf/Block#get:prev + local.set $9 + local.get $1 + call $~lib/rt/tlsf/Block#get:next + local.set $10 + local.get $9 + if + local.get $9 + local.get $10 + call $~lib/rt/tlsf/Block#set:next + end + local.get $10 + if + local.get $10 + local.get $9 + call $~lib/rt/tlsf/Block#set:prev + end + local.get $1 + block $~lib/rt/tlsf/GETHEAD|inlined.0 (result i32) + local.get $0 + local.set $11 + local.get $4 + local.set $12 + local.get $5 + local.set $13 + local.get $11 + local.get $12 + i32.const 4 + i32.shl + local.get $13 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + br $~lib/rt/tlsf/GETHEAD|inlined.0 + end + i32.eq + if + local.get $0 + local.set $14 + local.get $4 + local.set $15 + local.get $5 + local.set $16 + local.get $10 + local.set $17 + local.get $14 + local.get $15 + i32.const 4 + i32.shl + local.get $16 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $17 + i32.store offset=96 + local.get $10 + i32.eqz if - local.get $3 - memory.grow - i32.const 0 - i32.lt_s + block $~lib/rt/tlsf/GETSL|inlined.0 (result i32) + local.get $0 + local.set $18 + local.get $4 + local.set $19 + local.get $18 + local.get $19 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + br $~lib/rt/tlsf/GETSL|inlined.0 + end + local.set $20 + local.get $0 + local.set $21 + local.get $4 + local.set $22 + local.get $20 + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $20 + local.set $23 + local.get $21 + local.get $22 + i32.const 2 + i32.shl + i32.add + local.get $23 + i32.store offset=4 + local.get $20 + i32.eqz if - unreachable + local.get $0 + local.get $0 + call $~lib/rt/tlsf/Root#get:flMap + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + call $~lib/rt/tlsf/Root#set:flMap end end end - local.get $0 - global.set $~lib/rt/stub/offset ) - (func $~lib/rt/stub/__alloc (; 2 ;) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - local.get $0 - i32.const 1073741808 - i32.gt_u + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) + (local $24 i32) + (local $25 i32) + (local $26 i32) + (local $27 i32) + (local $28 i32) + i32.const 1 + drop + local.get $1 + i32.eqz if + i32.const 0 + i32.const 944 + i32.const 201 + i32.const 14 + call $~lib/builtins/abort unreachable end - global.get $~lib/rt/stub/offset - i32.const 16 - i32.add + local.get $1 + call $~lib/rt/common/BLOCK#get:mmInfo local.set $2 - local.get $0 - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor + i32.const 1 + drop + local.get $2 + i32.const 1 i32.and - local.tee $3 - i32.const 16 - local.tee $4 - local.get $3 + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 203 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + block $~lib/rt/tlsf/GETRIGHT|inlined.0 (result i32) + local.get $1 + local.set $3 + local.get $3 + i32.const 4 + i32.add + local.get $3 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + br $~lib/rt/tlsf/GETRIGHT|inlined.0 + end + local.set $4 local.get $4 - i32.gt_u - select + call $~lib/rt/common/BLOCK#get:mmInfo local.set $5 - local.get $2 - local.get $5 - i32.add - call $~lib/rt/stub/maybeGrowMemory - local.get $2 - i32.const 16 - i32.sub - local.set $6 - local.get $6 local.get $5 - i32.store - local.get $6 i32.const 1 - i32.store offset=4 - local.get $6 - local.get $1 - i32.store offset=8 - local.get $6 - local.get $0 - i32.store offset=12 - local.get $2 - ) - (func $~lib/memory/memory.fill (; 3 ;) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i64) - (local $9 i32) - block $~lib/util/memory/memset|inlined.0 + i32.and + if local.get $0 - local.set $5 + local.get $4 + call $~lib/rt/tlsf/removeBlock local.get $1 - local.set $4 local.get $2 - local.set $3 - local.get $3 - i32.eqz - if - br $~lib/util/memory/memset|inlined.0 - end - local.get $5 - local.get $4 - i32.store8 + i32.const 4 + i32.add local.get $5 - local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and i32.add - i32.const 1 - i32.sub + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + block $~lib/rt/tlsf/GETRIGHT|inlined.1 (result i32) + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.add + local.get $6 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + br $~lib/rt/tlsf/GETRIGHT|inlined.1 + end + local.set $4 local.get $4 - i32.store8 - local.get $3 - i32.const 2 - i32.le_u - if - br $~lib/util/memory/memset|inlined.0 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $5 + end + local.get $2 + i32.const 2 + i32.and + if + block $~lib/rt/tlsf/GETFREELEFT|inlined.0 (result i32) + local.get $1 + local.set $7 + local.get $7 + i32.const 4 + i32.sub + i32.load + br $~lib/rt/tlsf/GETFREELEFT|inlined.0 end - local.get $5 + local.set $8 + local.get $8 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $9 i32.const 1 - i32.add - local.get $4 - i32.store8 - local.get $5 - i32.const 2 - i32.add - local.get $4 - i32.store8 - local.get $5 - local.get $3 - i32.add - i32.const 2 - i32.sub - local.get $4 - i32.store8 - local.get $5 - local.get $3 - i32.add - i32.const 3 - i32.sub - local.get $4 - i32.store8 - local.get $3 - i32.const 6 - i32.le_u + drop + local.get $9 + i32.const 1 + i32.and + i32.eqz if - br $~lib/util/memory/memset|inlined.0 + i32.const 0 + i32.const 944 + i32.const 221 + i32.const 16 + call $~lib/builtins/abort + unreachable end - local.get $5 - i32.const 3 - i32.add - local.get $4 - i32.store8 - local.get $5 - local.get $3 - i32.add + local.get $0 + local.get $8 + call $~lib/rt/tlsf/removeBlock + local.get $8 + local.set $1 + local.get $1 + local.get $9 i32.const 4 - i32.sub - local.get $4 - i32.store8 - local.get $3 - i32.const 8 - i32.le_u - if - br $~lib/util/memory/memset|inlined.0 - end - i32.const 0 - local.get $5 - i32.sub - i32.const 3 - i32.and - local.set $6 - local.get $5 - local.get $6 i32.add - local.set $5 - local.get $3 - local.get $6 - i32.sub - local.set $3 - local.get $3 - i32.const -4 - i32.and - local.set $3 + local.get $2 + i32.const 3 i32.const -1 - i32.const 255 - i32.div_u - local.get $4 - i32.const 255 + i32.xor i32.and - i32.mul - local.set $7 - local.get $5 - local.get $7 - i32.store - local.get $5 - local.get $3 i32.add + local.tee $2 + call $~lib/rt/common/BLOCK#set:mmInfo + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $10 + i32.const 1 + drop + local.get $10 + i32.const 12 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 233 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $1 + i32.const 4 + i32.add + local.get $10 + i32.add + local.get $4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 234 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $10 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $11 + local.get $10 i32.const 4 + i32.shr_u + local.set $12 + else + local.get $10 + local.tee $13 + i32.const 1073741820 + local.tee $14 + local.get $13 + local.get $14 + i32.lt_u + select + local.set $15 + i32.const 31 + local.get $15 + i32.clz i32.sub - local.get $7 - i32.store - local.get $3 - i32.const 8 - i32.le_u - if - br $~lib/util/memory/memset|inlined.0 - end - local.get $5 + local.set $11 + local.get $15 + local.get $11 i32.const 4 - i32.add - local.get $7 - i32.store - local.get $5 - i32.const 8 - i32.add - local.get $7 - i32.store - local.get $5 - local.get $3 - i32.add - i32.const 12 i32.sub - local.get $7 - i32.store - local.get $5 - local.get $3 - i32.add + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $12 + local.get $11 i32.const 8 + i32.const 1 i32.sub - local.get $7 - i32.store - local.get $3 - i32.const 24 - i32.le_u - if - br $~lib/util/memory/memset|inlined.0 - end - local.get $5 - i32.const 12 - i32.add - local.get $7 - i32.store - local.get $5 - i32.const 16 - i32.add - local.get $7 - i32.store - local.get $5 - i32.const 20 - i32.add - local.get $7 - i32.store - local.get $5 - i32.const 24 - i32.add - local.get $7 - i32.store - local.get $5 - local.get $3 - i32.add - i32.const 28 - i32.sub - local.get $7 - i32.store - local.get $5 - local.get $3 - i32.add - i32.const 24 - i32.sub - local.get $7 - i32.store - local.get $5 - local.get $3 - i32.add - i32.const 20 i32.sub - local.get $7 - i32.store - local.get $5 - local.get $3 - i32.add + local.set $11 + end + i32.const 1 + drop + local.get $11 + i32.const 23 + i32.lt_u + if (result i32) + local.get $12 i32.const 16 - i32.sub - local.get $7 - i32.store - i32.const 24 - local.get $5 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 251 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + block $~lib/rt/tlsf/GETHEAD|inlined.1 (result i32) + local.get $0 + local.set $16 + local.get $11 + local.set $17 + local.get $12 + local.set $18 + local.get $16 + local.get $17 i32.const 4 - i32.and + i32.shl + local.get $18 i32.add - local.set $6 - local.get $5 - local.get $6 + i32.const 2 + i32.shl i32.add - local.set $5 - local.get $3 - local.get $6 - i32.sub - local.set $3 - local.get $7 - i64.extend_i32_u - local.get $7 - i64.extend_i32_u - i64.const 32 - i64.shl - i64.or - local.set $8 - loop $while-continue|0 - local.get $3 - i32.const 32 - i32.ge_u - local.set $9 - local.get $9 - if - local.get $5 - local.get $8 - i64.store - local.get $5 - i32.const 8 - i32.add - local.get $8 - i64.store - local.get $5 - i32.const 16 - i32.add - local.get $8 - i64.store - local.get $5 - i32.const 24 - i32.add - local.get $8 - i64.store - local.get $3 - i32.const 32 - i32.sub - local.set $3 - local.get $5 - i32.const 32 - i32.add - local.set $5 - br $while-continue|0 - end - end + i32.load offset=96 + br $~lib/rt/tlsf/GETHEAD|inlined.1 end - ) - (func $~lib/rt/stub/__retain (; 4 ;) (param $0 i32) (result i32) + local.set $19 + local.get $1 + i32.const 0 + call $~lib/rt/tlsf/Block#set:prev + local.get $1 + local.get $19 + call $~lib/rt/tlsf/Block#set:next + local.get $19 + if + local.get $19 + local.get $1 + call $~lib/rt/tlsf/Block#set:prev + end + local.get $0 + local.set $20 + local.get $11 + local.set $21 + local.get $12 + local.set $22 + local.get $1 + local.set $23 + local.get $20 + local.get $21 + i32.const 4 + i32.shl + local.get $22 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $23 + i32.store offset=96 + local.get $0 local.get $0 + call $~lib/rt/tlsf/Root#get:flMap + i32.const 1 + local.get $11 + i32.shl + i32.or + call $~lib/rt/tlsf/Root#set:flMap + local.get $0 + local.set $26 + local.get $11 + local.set $27 + block $~lib/rt/tlsf/GETSL|inlined.1 (result i32) + local.get $0 + local.set $24 + local.get $11 + local.set $25 + local.get $24 + local.get $25 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + br $~lib/rt/tlsf/GETSL|inlined.1 + end + i32.const 1 + local.get $12 + i32.shl + i32.or + local.set $28 + local.get $26 + local.get $27 + i32.const 2 + i32.shl + i32.add + local.get $28 + i32.store offset=4 ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i64) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + local.get $2 + i32.wrap_i64 + local.set $3 + i32.const 1 + drop local.get $1 - i32.const 1073741808 - i32.gt_u + i64.extend_i32_u + local.get $2 + i64.le_u + i32.eqz if - i32.const 640 - i32.const 688 - i32.const 54 - i32.const 42 + i32.const 0 + i32.const 944 + i32.const 382 + i32.const 14 call $~lib/builtins/abort unreachable end local.get $1 - i32.const 0 - call $~lib/rt/stub/__alloc - local.set $2 - local.get $2 - i32.const 0 - local.get $1 - call $~lib/memory/memory.fill - local.get $2 - call $~lib/rt/stub/__retain - ) - (func $start:assembly/index (; 6 ;) - (local $0 i32) - (local $1 i32) - i32.const 304 - i32.load offset=4 - global.set $assembly/index/kPtr - i32.const 608 - i32.load offset=4 - global.set $assembly/index/w64Ptr - global.get $~lib/heap/__heap_base + i32.const 4 + i32.add i32.const 15 i32.add i32.const 15 i32.const -1 i32.xor i32.and - global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset - global.set $~lib/rt/stub/offset - i32.const 0 - i32.const 64 - call $~lib/arraybuffer/ArrayBuffer#constructor - global.set $assembly/index/M - global.get $assembly/index/M - global.set $assembly/index/mPtr - i32.const 0 - i32.const 256 - call $~lib/arraybuffer/ArrayBuffer#constructor - global.set $assembly/index/W - global.get $assembly/index/W - global.set $assembly/index/wPtr + i32.const 4 + i32.sub + local.set $1 + local.get $3 + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $3 + block $~lib/rt/tlsf/GETTAIL|inlined.0 (result i32) + local.get $0 + local.set $4 + local.get $4 + i32.load offset=1568 + br $~lib/rt/tlsf/GETTAIL|inlined.0 + end + local.set $5 i32.const 0 - i32.const 512 - call $~lib/arraybuffer/ArrayBuffer#constructor - global.set $assembly/index/input - global.get $assembly/index/input - global.set $assembly/index/inputPtr + local.set $6 + local.get $5 + if + i32.const 1 + drop + local.get $1 + local.get $5 + i32.const 4 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 389 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.sub + local.get $5 + i32.eq + if + local.get $1 + i32.const 16 + i32.sub + local.set $1 + local.get $5 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $6 + else + end + else + i32.const 1 + drop + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 402 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $3 + local.get $1 + i32.sub + local.set $7 + local.get $7 + i32.const 4 + i32.const 12 + i32.add + i32.const 4 + i32.add + i32.lt_u + if + i32.const 0 + return + end + local.get $7 + i32.const 2 + i32.const 4 + i32.mul + i32.sub + local.set $8 + local.get $1 + local.set $9 + local.get $9 + local.get $8 + i32.const 1 + i32.or + local.get $6 + i32.const 2 + i32.and + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $9 i32.const 0 - i32.const 32 - call $~lib/arraybuffer/ArrayBuffer#constructor - global.set $assembly/index/output - global.get $assembly/index/output - global.set $assembly/index/outputPtr - ) - (func $assembly/index/init (; 7 ;) - i32.const 1779033703 - global.set $assembly/index/H0 - i32.const -1150833019 - global.set $assembly/index/H1 - i32.const 1013904242 - global.set $assembly/index/H2 - i32.const -1521486534 - global.set $assembly/index/H3 - i32.const 1359893119 - global.set $assembly/index/H4 - i32.const -1694144372 - global.set $assembly/index/H5 - i32.const 528734635 - global.set $assembly/index/H6 - i32.const 1541459225 - global.set $assembly/index/H7 + call $~lib/rt/tlsf/Block#set:prev + local.get $9 i32.const 0 - global.set $assembly/index/mLength + call $~lib/rt/tlsf/Block#set:next + local.get $1 + i32.const 4 + i32.add + local.get $8 + i32.add + local.set $5 + local.get $5 i32.const 0 - global.set $assembly/index/bytesHashed + i32.const 2 + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $0 + local.set $10 + local.get $5 + local.set $11 + local.get $10 + local.get $11 + i32.store offset=1568 + local.get $0 + local.get $9 + call $~lib/rt/tlsf/insertBlock + i32.const 1 + return ) - (func $~lib/util/memory/memcpy (; 8 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/rt/tlsf/initialize + (local $0 i32) + (local $1 i32) + (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) - loop $while-continue|0 + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + i32.const 0 + drop + global.get $~lib/memory/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $0 + memory.size + local.set $1 + local.get $0 + i32.const 1572 + i32.add + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $2 + local.get $2 + local.get $1 + i32.gt_s + if (result i32) local.get $2 - if (result i32) - local.get $1 - i32.const 3 - i32.and - else - i32.const 0 - end - local.set $5 - local.get $5 - if - local.get $0 - local.tee $6 - i32.const 1 - i32.add - local.set $0 - local.get $6 - local.get $1 - local.tee $6 - i32.const 1 - i32.add - local.set $1 - local.get $6 - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - br $while-continue|0 - end + local.get $1 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable end local.get $0 - i32.const 3 - i32.and + local.set $3 + local.get $3 i32.const 0 - i32.eq - if - loop $while-continue|1 - local.get $2 - i32.const 16 - i32.ge_u - local.set $5 - local.get $5 - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $0 - i32.const 8 - i32.add - local.get $1 - i32.const 8 - i32.add - i32.load - i32.store - local.get $0 - i32.const 12 - i32.add - local.get $1 - i32.const 12 - i32.add - i32.load - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $while-continue|1 - end - end - local.get $2 - i32.const 8 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.get $1 - i32.const 4 - i32.add - i32.load - i32.store - local.get $0 - i32.const 8 - i32.add - local.set $0 - local.get $1 - i32.const 8 - i32.add - local.set $1 - end - local.get $2 - i32.const 4 - i32.and - if - local.get $0 - local.get $1 - i32.load - i32.store - local.get $0 - i32.const 4 - i32.add - local.set $0 - local.get $1 - i32.const 4 - i32.add - local.set $1 - end - local.get $2 - i32.const 2 - i32.and + call $~lib/rt/tlsf/Root#set:flMap + local.get $3 + local.set $4 + i32.const 0 + local.set $5 + local.get $4 + local.get $5 + i32.store offset=1568 + i32.const 0 + local.set $6 + loop $for-loop|0 + local.get $6 + i32.const 23 + i32.lt_u if - local.get $0 - local.get $1 - i32.load16_u - i32.store16 - local.get $0 - i32.const 2 - i32.add - local.set $0 - local.get $1 + local.get $3 + local.set $7 + local.get $6 + local.set $8 + i32.const 0 + local.set $9 + local.get $7 + local.get $8 i32.const 2 + i32.shl i32.add - local.set $1 - end - local.get $2 - i32.const 1 - i32.and - if - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - end - return - end - local.get $2 - i32.const 32 - i32.ge_u - if - block $break|2 - block $case2|2 - block $case1|2 - block $case0|2 - local.get $0 - i32.const 3 - i32.and - local.set $5 - local.get $5 - i32.const 1 - i32.eq - br_if $case0|2 - local.get $5 - i32.const 2 - i32.eq - br_if $case1|2 - local.get $5 - i32.const 3 - i32.eq - br_if $case2|2 - br $break|2 - end - local.get $1 - i32.load - local.set $3 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 + local.get $9 + i32.store offset=4 + i32.const 0 + local.set $10 + loop $for-loop|1 + local.get $10 + i32.const 16 + i32.lt_u + if + local.get $3 + local.set $11 + local.get $6 + local.set $12 + local.get $10 + local.set $13 + i32.const 0 + local.set $14 + local.get $11 + local.get $12 + i32.const 4 + i32.shl + local.get $13 i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 + i32.const 2 + i32.shl i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 + local.get $14 + i32.store offset=96 + local.get $10 i32.const 1 i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $2 - i32.const 3 - i32.sub - local.set $2 - loop $while-continue|3 - local.get $2 - i32.const 17 - i32.ge_u - local.set $5 - local.get $5 - if - local.get $1 - i32.const 1 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 24 - i32.shr_u - local.get $4 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 5 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 24 - i32.shr_u - local.get $3 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 9 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 24 - i32.shr_u - local.get $4 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 13 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 24 - i32.shr_u - local.get $3 - i32.const 8 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $while-continue|3 - end - end - br $break|2 - end - local.get $1 - i32.load - local.set $3 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $2 - i32.const 2 - i32.sub - local.set $2 - loop $while-continue|4 - local.get $2 - i32.const 18 - i32.ge_u - local.set $5 - local.get $5 - if - local.get $1 - i32.const 2 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 16 - i32.shr_u - local.get $4 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 6 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 16 - i32.shr_u - local.get $3 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 10 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 16 - i32.shr_u - local.get $4 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 14 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 16 - i32.shr_u - local.get $3 - i32.const 16 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $while-continue|4 - end + local.set $10 + br $for-loop|1 end - br $break|2 end - local.get $1 - i32.load - local.set $3 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 + local.get $6 i32.const 1 i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - loop $while-continue|5 - local.get $2 - i32.const 19 - i32.ge_u - local.set $5 - local.get $5 - if - local.get $1 - i32.const 3 - i32.add - i32.load - local.set $4 - local.get $0 - local.get $3 - i32.const 8 - i32.shr_u - local.get $4 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 7 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 4 - i32.add - local.get $4 - i32.const 8 - i32.shr_u - local.get $3 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 11 - i32.add - i32.load - local.set $4 - local.get $0 - i32.const 8 - i32.add - local.get $3 - i32.const 8 - i32.shr_u - local.get $4 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 15 - i32.add - i32.load - local.set $3 - local.get $0 - i32.const 12 - i32.add - local.get $4 - i32.const 8 - i32.shr_u - local.get $3 - i32.const 24 - i32.shl - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.set $1 - local.get $0 - i32.const 16 - i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $while-continue|5 - end - end - br $break|2 + local.set $6 + br $for-loop|0 end - end - local.get $2 - i32.const 16 - i32.and - if - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - end - local.get $2 - i32.const 8 - i32.and - if - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 + end + local.get $0 + i32.const 1572 + i32.add + local.set $15 + i32.const 0 + drop + local.get $3 + local.get $15 + memory.size + i64.extend_i32_s + i64.const 16 + i64.shl + call $~lib/rt/tlsf/addMemory + drop + local.get $3 + global.set $~lib/rt/tlsf/ROOT + ) + (func $~lib/rt/tlsf/computeSize (param $0 i32) (result i32) + local.get $0 + i32.const 12 + i32.le_u + if (result i32) + i32.const 12 + else local.get $0 - local.tee $5 - i32.const 1 + i32.const 4 i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 + i32.const 15 i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 + i32.const 15 + i32.const -1 + i32.xor + i32.and + i32.const 4 + i32.sub end - local.get $2 - i32.const 4 - i32.and + return + ) + (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) + local.get $0 + i32.const 1073741820 + i32.gt_u if + i32.const 816 + i32.const 944 + i32.const 461 + i32.const 29 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/tlsf/computeSize + return + ) + (func $~lib/rt/tlsf/roundSize (param $0 i32) (result i32) + local.get $0 + i32.const 536870910 + i32.lt_u + if (result i32) local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 + i32.const 27 local.get $0 - local.tee $5 - i32.const 1 + i32.clz + i32.sub + i32.shl i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 + i32.sub + else local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 end - local.get $2 - i32.const 2 - i32.and + return + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + local.get $1 + i32.const 256 + i32.lt_u if - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 + i32.const 0 + local.set $2 local.get $1 - local.tee $5 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $1 + call $~lib/rt/tlsf/roundSize + local.set $4 + i32.const 4 + i32.const 8 + i32.mul i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 + i32.sub + local.get $4 + i32.clz + i32.sub + local.set $2 + local.get $4 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 + i32.const 4 + i32.shl + i32.xor + local.set $3 + local.get $2 + i32.const 8 i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 + i32.sub + i32.sub + local.set $2 end - local.get $2 i32.const 1 - i32.and + drop + local.get $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $3 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz if + i32.const 0 + i32.const 944 + i32.const 334 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + block $~lib/rt/tlsf/GETSL|inlined.2 (result i32) local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 + local.set $5 + local.get $2 + local.set $6 local.get $5 - local.get $1 - local.tee $5 - i32.const 1 + local.get $6 + i32.const 2 + i32.shl i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 + i32.load offset=4 + br $~lib/rt/tlsf/GETSL|inlined.2 end - ) - (func $~lib/memory/memory.copy (; 9 ;) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - block $~lib/util/memory/memmove|inlined.0 + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.shl + i32.and + local.set $7 + i32.const 0 + local.set $8 + local.get $7 + i32.eqz + if local.get $0 - local.set $5 - local.get $1 - local.set $4 + call $~lib/rt/tlsf/Root#get:flMap + i32.const 0 + i32.const -1 + i32.xor local.get $2 - local.set $3 - local.get $5 - local.get $4 - i32.eq - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $4 - local.get $3 + i32.const 1 i32.add - local.get $5 - i32.le_u - if (result i32) - i32.const 1 - else - local.get $5 - local.get $3 - i32.add - local.get $4 - i32.le_u - end - if - local.get $5 - local.get $4 - local.get $3 - call $~lib/util/memory/memcpy - br $~lib/util/memory/memmove|inlined.0 - end - local.get $5 - local.get $4 - i32.lt_u + i32.shl + i32.and + local.set $9 + local.get $9 + i32.eqz if - local.get $4 - i32.const 7 - i32.and - local.get $5 - i32.const 7 - i32.and - i32.eq - if - loop $while-continue|0 - local.get $5 - i32.const 7 - i32.and - local.set $6 - local.get $6 - if - local.get $3 - i32.eqz - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $3 - i32.const 1 - i32.sub - local.set $3 - local.get $5 - local.tee $7 - i32.const 1 - i32.add - local.set $5 - local.get $7 - local.get $4 - local.tee $7 - i32.const 1 - i32.add - local.set $4 - local.get $7 - i32.load8_u - i32.store8 - br $while-continue|0 - end - end - loop $while-continue|1 - local.get $3 - i32.const 8 - i32.ge_u - local.set $6 - local.get $6 - if - local.get $5 - local.get $4 - i64.load - i64.store - local.get $3 - i32.const 8 - i32.sub - local.set $3 - local.get $5 - i32.const 8 - i32.add - local.set $5 - local.get $4 - i32.const 8 - i32.add - local.set $4 - br $while-continue|1 - end - end - end - loop $while-continue|2 - local.get $3 - local.set $6 - local.get $6 - if - local.get $5 - local.tee $7 - i32.const 1 - i32.add - local.set $5 - local.get $7 - local.get $4 - local.tee $7 - i32.const 1 - i32.add - local.set $4 - local.get $7 - i32.load8_u - i32.store8 - local.get $3 - i32.const 1 - i32.sub - local.set $3 - br $while-continue|2 - end - end + i32.const 0 + local.set $8 else - local.get $4 - i32.const 7 - i32.and - local.get $5 - i32.const 7 - i32.and - i32.eq + local.get $9 + i32.ctz + local.set $2 + block $~lib/rt/tlsf/GETSL|inlined.3 (result i32) + local.get $0 + local.set $10 + local.get $2 + local.set $11 + local.get $10 + local.get $11 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + br $~lib/rt/tlsf/GETSL|inlined.3 + end + local.set $7 + i32.const 1 + drop + local.get $7 + i32.eqz if - loop $while-continue|3 - local.get $5 - local.get $3 - i32.add - i32.const 7 - i32.and - local.set $6 - local.get $6 - if - local.get $3 - i32.eqz - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $5 - local.get $3 - i32.const 1 - i32.sub - local.tee $3 - i32.add - local.get $4 - local.get $3 - i32.add - i32.load8_u - i32.store8 - br $while-continue|3 - end - end - loop $while-continue|4 - local.get $3 - i32.const 8 - i32.ge_u - local.set $6 - local.get $6 - if - local.get $3 - i32.const 8 - i32.sub - local.set $3 - local.get $5 - local.get $3 - i32.add - local.get $4 - local.get $3 - i32.add - i64.load - i64.store - br $while-continue|4 - end - end + i32.const 0 + i32.const 944 + i32.const 347 + i32.const 18 + call $~lib/builtins/abort + unreachable end - loop $while-continue|5 - local.get $3 - local.set $6 - local.get $6 - if - local.get $5 - local.get $3 - i32.const 1 - i32.sub - local.tee $3 - i32.add - local.get $4 - local.get $3 - i32.add - i32.load8_u - i32.store8 - br $while-continue|5 - end + block $~lib/rt/tlsf/GETHEAD|inlined.2 (result i32) + local.get $0 + local.set $12 + local.get $2 + local.set $13 + local.get $7 + i32.ctz + local.set $14 + local.get $12 + local.get $13 + i32.const 4 + i32.shl + local.get $14 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + br $~lib/rt/tlsf/GETHEAD|inlined.2 end + local.set $8 + end + else + block $~lib/rt/tlsf/GETHEAD|inlined.3 (result i32) + local.get $0 + local.set $15 + local.get $2 + local.set $16 + local.get $7 + i32.ctz + local.set $17 + local.get $15 + local.get $16 + i32.const 4 + i32.shl + local.get $17 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + br $~lib/rt/tlsf/GETHEAD|inlined.3 end + local.set $8 end + local.get $8 + return ) - (func $assembly/index/hashBlocks (; 10 ;) (param $0 i32) (param $1 i32) + (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1780,316 +1294,818 @@ (local $6 i32) (local $7 i32) (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - global.get $assembly/index/H0 - global.set $assembly/index/a - global.get $assembly/index/H1 - global.set $assembly/index/b - global.get $assembly/index/H2 - global.set $assembly/index/c - global.get $assembly/index/H3 - global.set $assembly/index/d - global.get $assembly/index/H4 - global.set $assembly/index/e - global.get $assembly/index/H5 - global.set $assembly/index/f - global.get $assembly/index/H6 - global.set $assembly/index/g - global.get $assembly/index/H7 - global.set $assembly/index/h i32.const 0 - global.set $assembly/index/i - loop $for-loop|0 - global.get $assembly/index/i - i32.const 16 - i32.lt_u - local.set $2 - local.get $2 + drop + local.get $1 + i32.const 256 + i32.ge_u + if + local.get $1 + call $~lib/rt/tlsf/roundSize + local.set $1 + end + memory.size + local.set $2 + local.get $1 + i32.const 4 + local.get $2 + i32.const 16 + i32.shl + i32.const 4 + i32.sub + block $~lib/rt/tlsf/GETTAIL|inlined.1 (result i32) + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + br $~lib/rt/tlsf/GETTAIL|inlined.1 + end + i32.ne + i32.shl + i32.add + local.set $1 + local.get $1 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $4 + local.get $2 + local.tee $5 + local.get $4 + local.tee $6 + local.get $5 + local.get $6 + i32.gt_s + select + local.set $7 + local.get $7 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $4 + memory.grow + i32.const 0 + i32.lt_s if - local.get $0 - local.set $9 - global.get $assembly/index/i - local.set $8 - local.get $1 - local.set $4 - global.get $assembly/index/i - local.set $3 - local.get $3 - i32.const 2 - i32.shl - local.set $5 - local.get $4 - local.set $7 - local.get $5 - i32.const 0 - i32.add - local.set $6 - local.get $7 - local.get $6 - i32.add - i32.load8_u - i32.const 255 - i32.and - i32.const 24 - i32.shl - local.get $4 - local.set $7 - local.get $5 - i32.const 1 - i32.add - local.set $6 - local.get $7 - local.get $6 - i32.add - i32.load8_u - i32.const 255 - i32.and - i32.const 16 - i32.shl - i32.or - local.get $4 - local.set $7 - local.get $5 - i32.const 2 - i32.add - local.set $6 - local.get $7 - local.get $6 - i32.add - i32.load8_u - i32.const 255 - i32.and - i32.const 8 - i32.shl - i32.or - local.get $4 - local.set $7 - local.get $5 - i32.const 3 - i32.add - local.set $6 - local.get $7 - local.get $6 - i32.add - i32.load8_u - i32.const 255 - i32.and - i32.const 0 - i32.shl - i32.or - local.set $6 - local.get $9 - local.get $8 - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store - global.get $assembly/index/i - i32.const 1 - i32.add - global.set $assembly/index/i - br $for-loop|0 + unreachable end end + memory.size + local.set $8 + local.get $0 + local.get $2 i32.const 16 - global.set $assembly/index/i - loop $for-loop|1 - global.get $assembly/index/i - i32.const 64 - i32.lt_u - local.set $2 + i32.shl + local.get $8 + i64.extend_i32_s + i64.const 16 + i64.shl + call $~lib/rt/tlsf/addMemory + drop + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + local.get $1 + call $~lib/rt/common/BLOCK#get:mmInfo + local.set $3 + i32.const 1 + drop + local.get $2 + i32.const 4 + i32.add + i32.const 15 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 361 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.sub + local.set $4 + local.get $4 + i32.const 4 + i32.const 12 + i32.add + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $1 + i32.const 4 + i32.add local.get $2 - if - local.get $0 - local.set $11 - global.get $assembly/index/i - local.set $10 - local.get $0 - local.set $3 - global.get $assembly/index/i - i32.const 2 - i32.sub + i32.add + local.set $5 + local.get $5 + local.get $4 + i32.const 4 + i32.sub + i32.const 1 + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo + local.get $0 + local.get $5 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const 1 + i32.const -1 + i32.xor + i32.and + call $~lib/rt/common/BLOCK#set:mmInfo + block $~lib/rt/tlsf/GETRIGHT|inlined.3 (result i32) + local.get $1 local.set $7 - local.get $3 local.get $7 - i32.const 2 - i32.shl + i32.const 4 i32.add - i32.load - local.set $4 - local.get $4 - i32.const 17 - i32.rotr - local.get $4 - i32.const 19 - i32.rotr - i32.xor - local.get $4 - i32.const 10 - i32.shr_u + local.get $7 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 i32.xor - local.get $0 + i32.and + i32.add + br $~lib/rt/tlsf/GETRIGHT|inlined.3 + end + block $~lib/rt/tlsf/GETRIGHT|inlined.2 (result i32) + local.get $1 local.set $6 - global.get $assembly/index/i - i32.const 7 - i32.sub - local.set $5 local.get $6 - local.get $5 - i32.const 2 - i32.shl - i32.add - i32.load - i32.add - local.get $0 - local.set $9 - global.get $assembly/index/i - i32.const 15 - i32.sub - local.set $8 - local.get $9 - local.get $8 - i32.const 2 - i32.shl + i32.const 4 i32.add - i32.load - local.set $7 - local.get $7 - i32.const 7 - i32.rotr - local.get $7 - i32.const 18 - i32.rotr - i32.xor - local.get $7 + local.get $6 + call $~lib/rt/common/BLOCK#get:mmInfo i32.const 3 - i32.shr_u + i32.const -1 i32.xor + i32.and i32.add - local.get $0 - local.set $4 - global.get $assembly/index/i + br $~lib/rt/tlsf/GETRIGHT|inlined.2 + end + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 2 + i32.const -1 + i32.xor + i32.and + call $~lib/rt/common/BLOCK#set:mmInfo + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.set $2 + local.get $0 + local.get $2 + call $~lib/rt/tlsf/searchBlock + local.set $3 + local.get $3 + i32.eqz + if + local.get $0 + local.get $2 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $2 + call $~lib/rt/tlsf/searchBlock + local.set $3 + i32.const 1 + drop + local.get $3 + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 499 i32.const 16 - i32.sub - local.set $3 - local.get $4 - local.get $3 - i32.const 2 - i32.shl - i32.add - i32.load - i32.add - local.set $5 - local.get $11 - local.get $10 - i32.const 2 - i32.shl - i32.add - local.get $5 - i32.store - global.get $assembly/index/i - i32.const 1 - i32.add - global.set $assembly/index/i - br $for-loop|1 + call $~lib/builtins/abort + unreachable end end + i32.const 1 + drop + local.get $3 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 501 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $3 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $3 + local.get $2 + call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop + local.get $3 + return + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (result i32) + global.get $~lib/rt/tlsf/ROOT + i32.eqz + if + call $~lib/rt/tlsf/initialize + end + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/allocateBlock + i32.const 4 + i32.add + return + ) + (func $~lib/rt/tcms/Object#set:rtId (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=12 + ) + (func $~lib/rt/tcms/Object#set:rtSize (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=16 + ) + (func $~lib/rt/tcms/Object#set:nextWithColor (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=4 + ) + (func $~lib/rt/tcms/Object#set:prev (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + i32.store offset=8 + ) + (func $~lib/rt/tcms/initLazy (param $0 i32) (result i32) + local.get $0 + local.get $0 + call $~lib/rt/tcms/Object#set:nextWithColor + local.get $0 + local.get $0 + call $~lib/rt/tcms/Object#set:prev + local.get $0 + return + ) + (func $~lib/rt/tcms/Object#get:prev (param $0 i32) (result i32) + local.get $0 + i32.load offset=8 + ) + (func $~lib/rt/tcms/Object#get:nextWithColor (param $0 i32) (result i32) + local.get $0 + i32.load offset=4 + ) + (func $~lib/rt/tcms/Object#set:next (param $0 i32) (param $1 i32) + local.get $0 + local.get $1 + local.get $0 + call $~lib/rt/tcms/Object#get:nextWithColor + i32.const 3 + i32.and + i32.or + call $~lib/rt/tcms/Object#set:nextWithColor + ) + (func $~lib/rt/tcms/Object#linkTo (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + local.get $1 + call $~lib/rt/tcms/Object#get:prev + local.set $3 + local.get $0 + local.get $1 + local.get $2 + i32.or + call $~lib/rt/tcms/Object#set:nextWithColor + local.get $0 + local.get $3 + call $~lib/rt/tcms/Object#set:prev + local.get $3 + local.get $0 + call $~lib/rt/tcms/Object#set:next + local.get $1 + local.get $0 + call $~lib/rt/tcms/Object#set:prev + ) + (func $~lib/rt/tcms/Object#get:size (param $0 i32) (result i32) + i32.const 4 + local.get $0 + call $~lib/rt/common/BLOCK#get:mmInfo + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + return + ) + (func $~lib/rt/tcms/__new (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $0 + i32.const 1073741804 + i32.gt_u + if + i32.const 816 + i32.const 880 + i32.const 125 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + i32.const 16 + local.get $0 + i32.add + call $~lib/rt/tlsf/__alloc + i32.const 4 + i32.sub + local.set $2 + local.get $2 + local.get $1 + call $~lib/rt/tcms/Object#set:rtId + local.get $2 + local.get $0 + call $~lib/rt/tcms/Object#set:rtSize + local.get $2 + global.get $~lib/rt/tcms/fromSpace + global.get $~lib/rt/tcms/white + call $~lib/rt/tcms/Object#linkTo + global.get $~lib/rt/tcms/total + local.get $2 + call $~lib/rt/tcms/Object#get:size + i32.add + global.set $~lib/rt/tcms/total + local.get $2 + i32.const 20 + i32.add + return + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $1 + i32.const 1073741820 + i32.gt_u + if + i32.const 704 + i32.const 752 + i32.const 52 + i32.const 43 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 1 + call $~lib/rt/tcms/__new + local.set $2 + i32.const 1 + global.get $~lib/shared/runtime/Runtime.Incremental + i32.ne + drop + local.get $2 + i32.const 0 + local.get $1 + memory.fill + local.get $2 + return + ) + (func $start:assembly/index + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + global.get $assembly/index/K + call $~lib/array/Array#get:dataStart + global.set $assembly/index/kPtr + global.get $assembly/index/W64 + call $~lib/array/Array#get:dataStart + global.set $assembly/index/w64Ptr + i32.const 992 + call $~lib/rt/tcms/initLazy + global.set $~lib/rt/tcms/fromSpace + i32.const 0 + i32.const 64 + call $~lib/arraybuffer/ArrayBuffer#constructor + global.set $assembly/index/M + global.get $assembly/index/M + global.set $assembly/index/mPtr + i32.const 0 + i32.const 256 + call $~lib/arraybuffer/ArrayBuffer#constructor + global.set $assembly/index/W + global.get $assembly/index/W + global.set $assembly/index/wPtr + i32.const 0 + global.get $assembly/index/INPUT_LENGTH + call $~lib/arraybuffer/ArrayBuffer#constructor + global.set $assembly/index/input + global.get $assembly/index/input + global.set $assembly/index/inputPtr + i32.const 0 + global.get $assembly/index/DIGEST_LENGTH + call $~lib/arraybuffer/ArrayBuffer#constructor + global.set $assembly/index/output + global.get $assembly/index/output + global.set $assembly/index/outputPtr + ) + (func $assembly/index/init + i32.const 1779033703 + global.set $assembly/index/H0 + i32.const -1150833019 + global.set $assembly/index/H1 + i32.const 1013904242 + global.set $assembly/index/H2 + i32.const -1521486534 + global.set $assembly/index/H3 + i32.const 1359893119 + global.set $assembly/index/H4 + i32.const -1694144372 + global.set $assembly/index/H5 + i32.const 528734635 + global.set $assembly/index/H6 + i32.const 1541459225 + global.set $assembly/index/H7 + i32.const 0 + global.set $assembly/index/mLength + i32.const 0 + global.set $assembly/index/bytesHashed + ) + (func $assembly/index/hashBlocks (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) + (local $24 i32) + (local $25 i32) + (local $26 i32) + (local $27 i32) + (local $28 i32) + (local $29 i32) + (local $30 i32) + (local $31 i32) + (local $32 i32) + (local $33 i32) + (local $34 i32) + (local $35 i32) + global.get $assembly/index/H0 + global.set $assembly/index/a + global.get $assembly/index/H1 + global.set $assembly/index/b + global.get $assembly/index/H2 + global.set $assembly/index/c + global.get $assembly/index/H3 + global.set $assembly/index/d + global.get $assembly/index/H4 + global.set $assembly/index/e + global.get $assembly/index/H5 + global.set $assembly/index/f + global.get $assembly/index/H6 + global.set $assembly/index/g + global.get $assembly/index/H7 + global.set $assembly/index/h i32.const 0 global.set $assembly/index/i - loop $for-loop|2 + loop $for-loop|0 global.get $assembly/index/i i32.const 64 i32.lt_u - local.set $2 - local.get $2 if - global.get $assembly/index/h - global.get $assembly/index/e - local.set $6 - local.get $6 - i32.const 6 - i32.rotr - local.get $6 - i32.const 11 - i32.rotr - i32.xor - local.get $6 - i32.const 25 - i32.rotr - i32.xor - i32.add - global.get $assembly/index/e - local.set $7 - global.get $assembly/index/f - local.set $9 - global.get $assembly/index/g - local.set $8 - local.get $7 - local.get $9 - i32.and - local.get $7 - i32.const -1 - i32.xor - local.get $8 - i32.and - i32.xor - i32.add - global.get $assembly/index/kPtr - local.set $4 global.get $assembly/index/i - local.set $3 - local.get $4 - local.get $3 - i32.const 2 - i32.shl - i32.add - i32.load - i32.add + i32.const 16 + i32.lt_u + if (result i32) + block $assembly/index/load32be|inlined.0 (result i32) + local.get $1 + local.set $2 + global.get $assembly/index/i + local.set $3 + local.get $3 + i32.const 2 + i32.shl + local.set $4 + block $assembly/index/load8|inlined.0 (result i32) + local.get $2 + local.set $5 + local.get $4 + i32.const 0 + i32.add + local.set $6 + local.get $5 + local.get $6 + i32.add + i32.load8_u + br $assembly/index/load8|inlined.0 + end + i32.const 255 + i32.and + i32.const 24 + i32.shl + block $assembly/index/load8|inlined.1 (result i32) + local.get $2 + local.set $7 + local.get $4 + i32.const 1 + i32.add + local.set $8 + local.get $7 + local.get $8 + i32.add + i32.load8_u + br $assembly/index/load8|inlined.1 + end + i32.const 255 + i32.and + i32.const 16 + i32.shl + i32.or + block $assembly/index/load8|inlined.2 (result i32) + local.get $2 + local.set $9 + local.get $4 + i32.const 2 + i32.add + local.set $10 + local.get $9 + local.get $10 + i32.add + i32.load8_u + br $assembly/index/load8|inlined.2 + end + i32.const 255 + i32.and + i32.const 8 + i32.shl + i32.or + block $assembly/index/load8|inlined.3 (result i32) + local.get $2 + local.set $11 + local.get $4 + i32.const 3 + i32.add + local.set $12 + local.get $11 + local.get $12 + i32.add + i32.load8_u + br $assembly/index/load8|inlined.3 + end + i32.const 255 + i32.and + i32.const 0 + i32.shl + i32.or + br $assembly/index/load32be|inlined.0 + end + else + block $assembly/index/SIG1|inlined.0 (result i32) + block $assembly/index/load32|inlined.0 (result i32) + local.get $0 + local.set $13 + global.get $assembly/index/i + i32.const 2 + i32.sub + local.set $14 + local.get $13 + local.get $14 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.0 + end + local.set $15 + local.get $15 + i32.const 17 + i32.rotr + local.get $15 + i32.const 19 + i32.rotr + i32.xor + local.get $15 + i32.const 10 + i32.shr_u + i32.xor + br $assembly/index/SIG1|inlined.0 + end + block $assembly/index/load32|inlined.1 (result i32) + local.get $0 + local.set $16 + global.get $assembly/index/i + i32.const 7 + i32.sub + local.set $17 + local.get $16 + local.get $17 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.1 + end + i32.add + block $assembly/index/SIG0|inlined.0 (result i32) + block $assembly/index/load32|inlined.2 (result i32) + local.get $0 + local.set $18 + global.get $assembly/index/i + i32.const 15 + i32.sub + local.set $19 + local.get $18 + local.get $19 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.2 + end + local.set $20 + local.get $20 + i32.const 7 + i32.rotr + local.get $20 + i32.const 18 + i32.rotr + i32.xor + local.get $20 + i32.const 3 + i32.shr_u + i32.xor + br $assembly/index/SIG0|inlined.0 + end + i32.add + block $assembly/index/load32|inlined.3 (result i32) + local.get $0 + local.set $21 + global.get $assembly/index/i + i32.const 16 + i32.sub + local.set $22 + local.get $21 + local.get $22 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.3 + end + i32.add + end + global.set $assembly/index/tmpW local.get $0 - local.set $10 + local.set $23 global.get $assembly/index/i - local.set $5 - local.get $10 - local.get $5 + local.set $24 + global.get $assembly/index/tmpW + local.set $25 + local.get $23 + local.get $24 i32.const 2 i32.shl i32.add - i32.load + local.get $25 + i32.store + global.get $assembly/index/h + block $assembly/index/EP1|inlined.0 (result i32) + global.get $assembly/index/e + local.set $26 + local.get $26 + i32.const 6 + i32.rotr + local.get $26 + i32.const 11 + i32.rotr + i32.xor + local.get $26 + i32.const 25 + i32.rotr + i32.xor + br $assembly/index/EP1|inlined.0 + end + i32.add + block $assembly/index/CH|inlined.0 (result i32) + global.get $assembly/index/e + local.set $27 + global.get $assembly/index/f + local.set $28 + global.get $assembly/index/g + local.set $29 + local.get $27 + local.get $28 + i32.and + local.get $27 + i32.const -1 + i32.xor + local.get $29 + i32.and + i32.xor + br $assembly/index/CH|inlined.0 + end + i32.add + block $assembly/index/load32|inlined.4 (result i32) + global.get $assembly/index/kPtr + local.set $30 + global.get $assembly/index/i + local.set $31 + local.get $30 + local.get $31 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.4 + end + i32.add + global.get $assembly/index/tmpW i32.add global.set $assembly/index/t1 - global.get $assembly/index/a - local.set $11 - local.get $11 - i32.const 2 - i32.rotr - local.get $11 - i32.const 13 - i32.rotr - i32.xor - local.get $11 - i32.const 22 - i32.rotr - i32.xor - global.get $assembly/index/a - local.set $9 - global.get $assembly/index/b - local.set $8 - global.get $assembly/index/c - local.set $6 - local.get $9 - local.get $8 - i32.and - local.get $9 - local.get $6 - i32.and - i32.xor - local.get $8 - local.get $6 - i32.and - i32.xor + block $assembly/index/EP0|inlined.0 (result i32) + global.get $assembly/index/a + local.set $32 + local.get $32 + i32.const 2 + i32.rotr + local.get $32 + i32.const 13 + i32.rotr + i32.xor + local.get $32 + i32.const 22 + i32.rotr + i32.xor + br $assembly/index/EP0|inlined.0 + end + block $assembly/index/MAJ|inlined.0 (result i32) + global.get $assembly/index/a + local.set $33 + global.get $assembly/index/b + local.set $34 + global.get $assembly/index/c + local.set $35 + local.get $33 + local.get $34 + i32.and + local.get $33 + local.get $35 + i32.and + i32.xor + local.get $34 + local.get $35 + i32.and + i32.xor + br $assembly/index/MAJ|inlined.0 + end i32.add global.set $assembly/index/t2 global.get $assembly/index/g @@ -2116,7 +2132,7 @@ i32.const 1 i32.add global.set $assembly/index/i - br $for-loop|2 + br $for-loop|0 end end global.get $assembly/index/H0 @@ -2152,10 +2168,9 @@ i32.add global.set $assembly/index/H7 ) - (func $assembly/index/update (; 11 ;) (param $0 i32) (param $1 i32) + (func $assembly/index/update (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) - (local $4 i32) i32.const 0 local.set $2 global.get $assembly/index/bytesHashed @@ -2177,7 +2192,7 @@ i32.const 64 global.get $assembly/index/mLength i32.sub - call $~lib/memory/memory.copy + memory.copy global.get $assembly/index/mLength i32.const 64 global.get $assembly/index/mLength @@ -2207,7 +2222,7 @@ i32.add local.get $0 local.get $1 - call $~lib/memory/memory.copy + memory.copy global.get $assembly/index/mLength local.get $1 i32.add @@ -2231,8 +2246,6 @@ i32.const 64 i32.div_s i32.lt_s - local.set $4 - local.get $4 if global.get $assembly/index/wPtr local.get $0 @@ -2263,7 +2276,7 @@ local.get $1 i32.const 63 i32.and - call $~lib/memory/memory.copy + memory.copy global.get $assembly/index/mLength local.get $1 i32.const 63 @@ -2272,7 +2285,21 @@ global.set $assembly/index/mLength end ) - (func $~lib/polyfills/bswap (; 12 ;) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (param $0 i32) (result i32) + i32.const 1 + 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.const -16711936 i32.and @@ -2286,7 +2313,21 @@ i32.or return ) - (func $~lib/polyfills/bswap (; 13 ;) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (param $0 i32) (result i32) + i32.const 1 + 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.const -16711936 i32.and @@ -2300,12 +2341,45 @@ i32.or return ) - (func $assembly/index/final (; 14 ;) (param $0 i32) + (func $assembly/index/final (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) + (local $24 i32) + (local $25 i32) + (local $26 i32) + (local $27 i32) + (local $28 i32) + (local $29 i32) + (local $30 i32) + (local $31 i32) + (local $32 i32) + (local $33 i32) + (local $34 i32) + (local $35 i32) + (local $36 i32) + (local $37 i32) + (local $38 i32) global.get $assembly/index/bytesHashed i32.const 63 i32.and @@ -2313,15 +2387,15 @@ i32.lt_s if global.get $assembly/index/mPtr - local.set $3 + local.set $1 global.get $assembly/index/mLength local.set $2 i32.const 128 - local.set $1 - local.get $3 + local.set $3 + local.get $1 local.get $2 i32.add - local.get $1 + local.get $3 i32.store8 global.get $assembly/index/mLength i32.const 1 @@ -2337,31 +2411,29 @@ global.get $assembly/index/mPtr global.get $assembly/index/mLength i32.add - local.set $3 + local.set $4 i32.const 0 - local.set $2 + local.set $5 i32.const 64 global.get $assembly/index/mLength i32.sub - local.set $1 - local.get $3 - local.get $1 + local.set $6 + local.get $4 + local.get $6 i32.add - local.set $4 + local.set $7 loop $while-continue|0 - local.get $3 local.get $4 + local.get $7 i32.lt_u - local.set $5 - local.get $5 if - local.get $3 - local.get $2 + local.get $4 + local.get $5 i32.store8 - local.get $3 + local.get $4 i32.const 1 i32.add - local.set $3 + local.set $4 br $while-continue|0 end end @@ -2378,15 +2450,15 @@ i32.ge_s if global.get $assembly/index/mPtr - local.set $2 + local.set $8 global.get $assembly/index/mLength - local.set $1 + local.set $9 i32.const 128 - local.set $5 - local.get $2 - local.get $1 + local.set $10 + local.get $8 + local.get $9 i32.add - local.get $5 + local.get $10 i32.store8 global.get $assembly/index/mLength i32.const 1 @@ -2396,33 +2468,31 @@ global.get $assembly/index/mPtr global.get $assembly/index/mLength i32.add - local.set $5 + local.set $11 i32.const 0 - local.set $4 + local.set $12 i32.const 64 global.get $assembly/index/mLength i32.sub i32.const 8 i32.sub - local.set $3 - local.get $5 - local.get $3 + local.set $13 + local.get $11 + local.get $13 i32.add - local.set $2 + local.set $14 loop $while-continue|1 - local.get $5 - local.get $2 + local.get $11 + local.get $14 i32.lt_u - local.set $1 - local.get $1 if - local.get $5 - local.get $4 + local.get $11 + local.get $12 i32.store8 - local.get $5 + local.get $11 i32.const 1 i32.add - local.set $5 + local.set $11 br $while-continue|1 end end @@ -2450,119 +2520,119 @@ global.get $assembly/index/mPtr call $assembly/index/hashBlocks local.get $0 - local.set $4 + local.set $15 i32.const 0 - local.set $3 + local.set $16 global.get $assembly/index/H0 call $~lib/polyfills/bswap - local.set $1 - local.get $4 - local.get $3 + local.set $17 + local.get $15 + local.get $16 i32.const 2 i32.shl i32.add - local.get $1 + local.get $17 i32.store local.get $0 - local.set $1 + local.set $18 i32.const 1 - local.set $2 + local.set $19 global.get $assembly/index/H1 call $~lib/polyfills/bswap - local.set $5 - local.get $1 - local.get $2 + local.set $20 + local.get $18 + local.get $19 i32.const 2 i32.shl i32.add - local.get $5 + local.get $20 i32.store local.get $0 - local.set $5 + local.set $21 i32.const 2 - local.set $4 + local.set $22 global.get $assembly/index/H2 call $~lib/polyfills/bswap - local.set $3 - local.get $5 - local.get $4 + local.set $23 + local.get $21 + local.get $22 i32.const 2 i32.shl i32.add - local.get $3 + local.get $23 i32.store local.get $0 - local.set $3 + local.set $24 i32.const 3 - local.set $1 + local.set $25 global.get $assembly/index/H3 call $~lib/polyfills/bswap - local.set $2 - local.get $3 - local.get $1 + local.set $26 + local.get $24 + local.get $25 i32.const 2 i32.shl i32.add - local.get $2 + local.get $26 i32.store local.get $0 - local.set $2 + local.set $27 i32.const 4 - local.set $5 + local.set $28 global.get $assembly/index/H4 call $~lib/polyfills/bswap - local.set $4 - local.get $2 - local.get $5 + local.set $29 + local.get $27 + local.get $28 i32.const 2 i32.shl i32.add - local.get $4 + local.get $29 i32.store local.get $0 - local.set $4 + local.set $30 i32.const 5 - local.set $3 + local.set $31 global.get $assembly/index/H5 call $~lib/polyfills/bswap - local.set $1 - local.get $4 - local.get $3 + local.set $32 + local.get $30 + local.get $31 i32.const 2 i32.shl i32.add - local.get $1 + local.get $32 i32.store local.get $0 - local.set $1 + local.set $33 i32.const 6 - local.set $2 + local.set $34 global.get $assembly/index/H6 call $~lib/polyfills/bswap - local.set $5 - local.get $1 - local.get $2 + local.set $35 + local.get $33 + local.get $34 i32.const 2 i32.shl i32.add - local.get $5 + local.get $35 i32.store local.get $0 - local.set $5 + local.set $36 i32.const 7 - local.set $4 + local.set $37 global.get $assembly/index/H7 call $~lib/polyfills/bswap - local.set $3 - local.get $5 - local.get $4 + local.set $38 + local.get $36 + local.get $37 i32.const 2 i32.shl i32.add - local.get $3 + local.get $38 i32.store ) - (func $assembly/index/digest (; 15 ;) (param $0 i32) + (func $assembly/index/digest (param $0 i32) call $assembly/index/init global.get $assembly/index/inputPtr local.get $0 @@ -2570,11 +2640,17 @@ global.get $assembly/index/outputPtr call $assembly/index/final ) - (func $assembly/index/hashPreCompW (; 16 ;) (param $0 i32) + (func $assembly/index/hashPreCompW (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) global.get $assembly/index/H0 global.set $assembly/index/a global.get $assembly/index/H1 @@ -2597,82 +2673,95 @@ global.get $assembly/index/i i32.const 64 i32.lt_u - local.set $1 - local.get $1 if global.get $assembly/index/h - global.get $assembly/index/e - local.set $2 - local.get $2 - i32.const 6 - i32.rotr - local.get $2 - i32.const 11 - i32.rotr - i32.xor - local.get $2 - i32.const 25 - i32.rotr - i32.xor - i32.add - global.get $assembly/index/e - local.set $4 - global.get $assembly/index/f - local.set $3 - global.get $assembly/index/g - local.set $2 - local.get $4 - local.get $3 - i32.and - local.get $4 - i32.const -1 - i32.xor - local.get $2 - i32.and - i32.xor + block $assembly/index/EP1|inlined.1 (result i32) + global.get $assembly/index/e + local.set $1 + local.get $1 + i32.const 6 + i32.rotr + local.get $1 + i32.const 11 + i32.rotr + i32.xor + local.get $1 + i32.const 25 + i32.rotr + i32.xor + br $assembly/index/EP1|inlined.1 + end i32.add - local.get $0 - local.set $3 - global.get $assembly/index/i - local.set $2 - local.get $3 - local.get $2 - i32.const 2 - i32.shl + block $assembly/index/CH|inlined.1 (result i32) + global.get $assembly/index/e + local.set $2 + global.get $assembly/index/f + local.set $3 + global.get $assembly/index/g + local.set $4 + local.get $2 + local.get $3 + i32.and + local.get $2 + i32.const -1 + i32.xor + local.get $4 + i32.and + i32.xor + br $assembly/index/CH|inlined.1 + end i32.add - i32.load + block $assembly/index/load32|inlined.5 (result i32) + local.get $0 + local.set $5 + global.get $assembly/index/i + local.set $6 + local.get $5 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.5 + end i32.add global.set $assembly/index/t1 - global.get $assembly/index/a - local.set $4 - local.get $4 - i32.const 2 - i32.rotr - local.get $4 - i32.const 13 - i32.rotr - i32.xor - local.get $4 - i32.const 22 - i32.rotr - i32.xor - global.get $assembly/index/a - local.set $4 - global.get $assembly/index/b - local.set $3 - global.get $assembly/index/c - local.set $2 - local.get $4 - local.get $3 - i32.and - local.get $4 - local.get $2 - i32.and - i32.xor - local.get $3 - local.get $2 - i32.and - i32.xor + block $assembly/index/EP0|inlined.1 (result i32) + global.get $assembly/index/a + local.set $7 + local.get $7 + i32.const 2 + i32.rotr + local.get $7 + i32.const 13 + i32.rotr + i32.xor + local.get $7 + i32.const 22 + i32.rotr + i32.xor + br $assembly/index/EP0|inlined.1 + end + block $assembly/index/MAJ|inlined.1 (result i32) + global.get $assembly/index/a + local.set $8 + global.get $assembly/index/b + local.set $9 + global.get $assembly/index/c + local.set $10 + local.get $8 + local.get $9 + i32.and + local.get $8 + local.get $10 + i32.and + i32.xor + local.get $9 + local.get $10 + i32.and + i32.xor + br $assembly/index/MAJ|inlined.1 + end i32.add global.set $assembly/index/t2 global.get $assembly/index/g @@ -2735,10 +2824,31 @@ i32.add global.set $assembly/index/H7 ) - (func $assembly/index/digest64 (; 17 ;) (param $0 i32) (param $1 i32) + (func $assembly/index/digest64 (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + (local $22 i32) + (local $23 i32) + (local $24 i32) + (local $25 i32) call $assembly/index/init global.get $assembly/index/wPtr local.get $0 @@ -2746,119 +2856,119 @@ global.get $assembly/index/w64Ptr call $assembly/index/hashPreCompW local.get $1 - local.set $4 + local.set $2 i32.const 0 local.set $3 global.get $assembly/index/H0 call $~lib/polyfills/bswap - local.set $2 - local.get $4 + local.set $4 + local.get $2 local.get $3 i32.const 2 i32.shl i32.add - local.get $2 + local.get $4 i32.store local.get $1 - local.set $4 + local.set $5 i32.const 1 - local.set $3 + local.set $6 global.get $assembly/index/H1 call $~lib/polyfills/bswap - local.set $2 - local.get $4 - local.get $3 + local.set $7 + local.get $5 + local.get $6 i32.const 2 i32.shl i32.add - local.get $2 + local.get $7 i32.store local.get $1 - local.set $4 + local.set $8 i32.const 2 - local.set $3 + local.set $9 global.get $assembly/index/H2 call $~lib/polyfills/bswap - local.set $2 - local.get $4 - local.get $3 + local.set $10 + local.get $8 + local.get $9 i32.const 2 i32.shl i32.add - local.get $2 + local.get $10 i32.store local.get $1 - local.set $4 + local.set $11 i32.const 3 - local.set $3 + local.set $12 global.get $assembly/index/H3 call $~lib/polyfills/bswap - local.set $2 - local.get $4 - local.get $3 + local.set $13 + local.get $11 + local.get $12 i32.const 2 i32.shl i32.add - local.get $2 + local.get $13 i32.store local.get $1 - local.set $4 + local.set $14 i32.const 4 - local.set $3 + local.set $15 global.get $assembly/index/H4 call $~lib/polyfills/bswap - local.set $2 - local.get $4 - local.get $3 + local.set $16 + local.get $14 + local.get $15 i32.const 2 i32.shl i32.add - local.get $2 + local.get $16 i32.store local.get $1 - local.set $4 + local.set $17 i32.const 5 - local.set $3 + local.set $18 global.get $assembly/index/H5 call $~lib/polyfills/bswap - local.set $2 - local.get $4 - local.get $3 + local.set $19 + local.get $17 + local.get $18 i32.const 2 i32.shl i32.add - local.get $2 + local.get $19 i32.store local.get $1 - local.set $4 + local.set $20 i32.const 6 - local.set $3 + local.set $21 global.get $assembly/index/H6 call $~lib/polyfills/bswap - local.set $2 - local.get $4 - local.get $3 + local.set $22 + local.get $20 + local.get $21 i32.const 2 i32.shl i32.add - local.get $2 + local.get $22 i32.store local.get $1 - local.set $4 + local.set $23 i32.const 7 - local.set $3 + local.set $24 global.get $assembly/index/H7 call $~lib/polyfills/bswap - local.set $2 - local.get $4 - local.get $3 + local.set $25 + local.get $23 + local.get $24 i32.const 2 i32.shl i32.add - local.get $2 + local.get $25 i32.store ) - (func $~start (; 18 ;) + (func $~start call $start:assembly/index ) ) diff --git a/packages/as-sha256/src/index.ts b/packages/as-sha256/src/index.ts index 6fa451bd..fc6014d4 100644 --- a/packages/as-sha256/src/index.ts +++ b/packages/as-sha256/src/index.ts @@ -18,9 +18,7 @@ export function digest(data: Uint8Array): Uint8Array { if (data.length <= ctx.INPUT_LENGTH) { inputUint8Array.set(data); ctx.digest(data.length); - const output = new Uint8Array(32); - output.set(outputUint8Array); - return output; + return outputUint8Array.slice(0, 32); } ctx.init(); @@ -32,9 +30,7 @@ export function digest64(data: Uint8Array): Uint8Array { if (data.length === 64) { inputUint8Array.set(data); ctx.digest64(wasmInputValue, wasmOutputValue); - const output = new Uint8Array(32); - output.set(outputUint8Array); - return output; + return outputUint8Array.slice(0, 32); } throw new Error("InvalidLengthForDigest64"); } @@ -44,9 +40,7 @@ export function digest2Bytes32(bytes1: Uint8Array, bytes2: Uint8Array): Uint8Arr inputUint8Array.set(bytes1); inputUint8Array.set(bytes2, 32); ctx.digest64(wasmInputValue, wasmOutputValue); - const output = new Uint8Array(32); - output.set(outputUint8Array); - return output; + return outputUint8Array.slice(0, 32); } throw new Error("InvalidLengthForDigest64"); } @@ -98,7 +92,5 @@ function update(data: Uint8Array): void { function final(): Uint8Array { ctx.final(wasmOutputValue); - const output = new Uint8Array(32); - output.set(outputUint8Array); - return output; + return outputUint8Array.slice(0, 32); } diff --git a/packages/as-sha256/src/wasmCode.ts b/packages/as-sha256/src/wasmCode.ts index 102d56e6..cd4788db 100644 --- a/packages/as-sha256/src/wasmCode.ts +++ b/packages/as-sha256/src/wasmCode.ts @@ -2,4 +2,4 @@ // DO NOT modify this file by hand! // eslint-disable-next-line prettier/prettier -export const wasmCode = Uint8Array.from([0,97,115,109,1,0,0,0,1,31,6,96,1,127,0,96,2,127,127,0,96,0,0,96,1,127,1,127,96,3,127,127,127,0,96,4,127,127,127,127,0,2,13,1,3,101,110,118,5,97,98,111,114,116,0,5,3,16,15,0,3,1,3,2,2,4,1,1,3,0,0,0,1,2,5,3,1,0,1,6,172,1,34,127,0,65,128,4,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,7,86,9,6,109,101,109,111,114,121,2,0,12,73,78,80,85,84,95,76,69,78,71,84,72,3,0,5,105,110,112,117,116,3,28,6,111,117,116,112,117,116,3,30,4,105,110,105,116,0,6,6,117,112,100,97,116,101,0,9,5,102,105,110,97,108,0,11,6,100,105,103,101,115,116,0,12,8,100,105,103,101,115,116,54,52,0,14,8,1,15,10,202,14,15,70,1,2,127,32,0,63,0,34,2,65,16,116,34,1,75,4,64,32,2,32,0,32,1,107,65,255,255,3,106,65,128,128,124,113,65,16,118,34,1,32,2,32,1,74,27,64,0,65,0,72,4,64,32,1,64,0,65,0,72,4,64,0,11,11,11,32,0,36,23,11,82,1,3,127,32,0,65,240,255,255,255,3,75,4,64,0,11,35,23,65,16,106,34,2,32,0,65,15,106,65,112,113,34,1,65,16,32,1,65,16,75,27,34,3,106,16,1,32,2,65,16,107,34,1,32,3,54,2,0,32,1,65,1,54,2,4,32,1,65,0,54,2,8,32,1,32,0,54,2,12,32,2,11,37,1,1,127,3,64,32,1,4,64,32,0,34,2,65,1,106,33,0,32,2,65,0,58,0,0,32,1,65,1,107,33,1,12,1,11,11,11,41,1,1,127,32,0,65,240,255,255,255,3,75,4,64,65,128,5,65,176,5,65,54,65,42,16,0,0,11,32,0,16,2,34,1,32,0,16,3,32,1,11,71,0,65,180,2,40,2,0,36,1,65,228,4,40,2,0,36,2,65,224,5,36,22,65,224,5,36,23,65,192,0,16,4,36,24,35,24,36,25,65,128,2,16,4,36,26,35,26,36,27,65,128,4,16,4,36,28,35,28,36,29,65,32,16,4,36,30,35,30,36,31,11,74,0,65,231,204,167,208,6,36,3,65,133,221,158,219,123,36,4,65,242,230,187,227,3,36,5,65,186,234,191,170,122,36,6,65,255,164,185,136,5,36,7,65,140,209,149,216,121,36,8,65,171,179,143,252,1,36,9,65,153,154,131,223,5,36,10,65,0,36,32,65,0,36,33,11,103,1,2,127,2,64,32,2,33,3,32,0,32,1,70,13,0,32,0,32,1,73,4,64,3,64,32,3,4,64,32,0,34,2,65,1,106,33,0,32,1,34,4,65,1,106,33,1,32,2,32,4,45,0,0,58,0,0,32,3,65,1,107,33,3,12,1,11,11,5,3,64,32,3,4,64,32,3,65,1,107,34,3,32,0,106,32,1,32,3,106,45,0,0,58,0,0,12,1,11,11,11,11,11,231,3,1,1,127,35,3,36,11,35,4,36,12,35,5,36,13,35,6,36,14,35,7,36,15,35,8,36,16,35,9,36,17,35,10,36,18,65,0,36,19,3,64,35,19,65,16,73,4,64,32,0,35,19,65,2,116,106,32,1,35,19,65,2,116,34,2,106,45,0,0,65,24,116,32,1,32,2,65,1,106,106,45,0,0,65,16,116,114,32,1,32,2,65,2,106,106,45,0,0,65,8,116,114,32,1,32,2,65,3,106,106,45,0,0,114,54,2,0,35,19,65,1,106,36,19,12,1,11,11,65,16,36,19,3,64,35,19,65,192,0,73,4,64,32,0,35,19,65,2,116,106,32,0,35,19,65,16,107,65,2,116,106,40,2,0,32,0,35,19,65,7,107,65,2,116,106,40,2,0,32,0,35,19,65,2,107,65,2,116,106,40,2,0,34,1,65,17,120,32,1,65,19,120,115,32,1,65,10,118,115,106,32,0,35,19,65,15,107,65,2,116,106,40,2,0,34,1,65,7,120,32,1,65,18,120,115,32,1,65,3,118,115,106,106,54,2,0,35,19,65,1,106,36,19,12,1,11,11,65,0,36,19,3,64,35,19,65,192,0,73,4,64,32,0,35,19,65,2,116,106,40,2,0,35,1,35,19,65,2,116,106,40,2,0,35,18,35,15,34,1,65,6,120,32,1,65,11,120,115,32,1,65,25,120,115,106,35,15,34,1,35,16,113,35,17,32,1,65,127,115,113,115,106,106,106,36,20,35,11,34,1,65,2,120,32,1,65,13,120,115,32,1,65,22,120,115,35,11,34,1,35,12,34,2,113,32,1,35,13,34,1,113,115,32,1,32,2,113,115,106,36,21,35,17,36,18,35,16,36,17,35,15,36,16,35,14,35,20,106,36,15,35,13,36,14,35,12,36,13,35,11,36,12,35,20,35,21,106,36,11,35,19,65,1,106,36,19,12,1,11,11,35,3,35,11,106,36,3,35,4,35,12,106,36,4,35,5,35,13,106,36,5,35,6,35,14,106,36,6,35,7,35,15,106,36,7,35,8,35,16,106,36,8,35,9,35,17,106,36,9,35,10,35,18,106,36,10,11,177,1,1,2,127,32,1,35,33,106,36,33,35,32,4,64,65,192,0,35,32,107,32,1,76,4,64,35,25,35,32,106,32,0,65,192,0,35,32,107,16,7,35,32,65,192,0,35,32,107,106,36,32,65,192,0,35,32,107,33,2,32,1,65,192,0,35,32,107,107,33,1,35,27,35,25,16,8,65,0,36,32,5,35,25,35,32,106,32,0,32,1,16,7,32,1,35,32,106,36,32,15,11,11,3,64,32,3,32,1,65,192,0,109,72,4,64,35,27,32,0,32,2,106,16,8,32,3,65,1,106,33,3,32,2,65,64,107,33,2,12,1,11,11,32,1,65,63,113,4,64,35,25,35,32,106,32,0,32,2,106,32,1,65,63,113,34,0,16,7,32,0,35,32,106,36,32,11,11,25,0,32,0,65,128,254,131,120,113,65,8,119,32,0,65,255,129,252,7,113,65,8,120,114,11,173,2,1,2,127,35,33,65,63,113,65,63,72,4,64,35,25,35,32,106,65,128,1,58,0,0,35,32,65,1,106,36,32,11,35,33,65,63,113,65,56,78,4,64,35,25,35,32,106,34,1,65,192,0,35,32,107,106,33,2,3,64,32,1,32,2,73,4,64,32,1,65,0,58,0,0,32,1,65,1,106,33,1,12,1,11,11,35,27,35,25,16,8,65,0,36,32,11,35,33,65,63,113,65,63,78,4,64,35,25,35,32,106,65,128,1,58,0,0,35,32,65,1,106,36,32,11,35,25,35,32,106,34,1,65,56,35,32,107,106,33,2,3,64,32,1,32,2,73,4,64,32,1,65,0,58,0,0,32,1,65,1,106,33,1,12,1,11,11,35,25,65,56,106,35,33,65,128,128,128,128,2,109,16,10,54,2,0,35,25,65,60,106,35,33,65,3,116,16,10,54,2,0,35,27,35,25,16,8,32,0,35,3,16,10,54,2,0,32,0,65,4,106,35,4,16,10,54,2,0,32,0,65,8,106,35,5,16,10,54,2,0,32,0,65,12,106,35,6,16,10,54,2,0,32,0,65,16,106,35,7,16,10,54,2,0,32,0,65,20,106,35,8,16,10,54,2,0,32,0,65,24,106,35,9,16,10,54,2,0,32,0,65,28,106,35,10,16,10,54,2,0,11,14,0,16,6,35,29,32,0,16,9,35,31,16,11,11,253,1,1,2,127,35,3,36,11,35,4,36,12,35,5,36,13,35,6,36,14,35,7,36,15,35,8,36,16,35,9,36,17,35,10,36,18,65,0,36,19,3,64,35,19,65,192,0,73,4,64,32,0,35,19,65,2,116,106,40,2,0,35,18,35,15,34,1,65,6,120,32,1,65,11,120,115,32,1,65,25,120,115,106,35,15,34,1,35,16,113,35,17,32,1,65,127,115,113,115,106,106,36,20,35,11,34,1,65,2,120,32,1,65,13,120,115,32,1,65,22,120,115,35,11,34,1,35,12,34,2,113,32,1,35,13,34,1,113,115,32,1,32,2,113,115,106,36,21,35,17,36,18,35,16,36,17,35,15,36,16,35,14,35,20,106,36,15,35,13,36,14,35,12,36,13,35,11,36,12,35,20,35,21,106,36,11,35,19,65,1,106,36,19,12,1,11,11,35,3,35,11,106,36,3,35,4,35,12,106,36,4,35,5,35,13,106,36,5,35,6,35,14,106,36,6,35,7,35,15,106,36,7,35,8,35,16,106,36,8,35,9,35,17,106,36,9,35,10,35,18,106,36,10,11,107,0,16,6,35,27,32,0,16,8,35,2,16,13,32,1,35,3,16,10,54,2,0,32,1,65,4,106,35,4,16,10,54,2,0,32,1,65,8,106,35,5,16,10,54,2,0,32,1,65,12,106,35,6,16,10,54,2,0,32,1,65,16,106,35,7,16,10,54,2,0,32,1,65,20,106,35,8,16,10,54,2,0,32,1,65,24,106,35,9,16,10,54,2,0,32,1,65,28,106,35,10,16,10,54,2,0,11,4,0,16,5,11,11,222,5,6,0,65,17,11,143,2,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,152,47,138,66,145,68,55,113,207,251,192,181,165,219,181,233,91,194,86,57,241,17,241,89,164,130,63,146,213,94,28,171,152,170,7,216,1,91,131,18,190,133,49,36,195,125,12,85,116,93,190,114,254,177,222,128,167,6,220,155,116,241,155,193,193,105,155,228,134,71,190,239,198,157,193,15,204,161,12,36,111,44,233,45,170,132,116,74,220,169,176,92,218,136,249,118,82,81,62,152,109,198,49,168,200,39,3,176,199,127,89,191,243,11,224,198,71,145,167,213,81,99,202,6,103,41,41,20,133,10,183,39,56,33,27,46,252,109,44,77,19,13,56,83,84,115,10,101,187,10,106,118,46,201,194,129,133,44,114,146,161,232,191,162,75,102,26,168,112,139,75,194,163,81,108,199,25,232,146,209,36,6,153,214,133,53,14,244,112,160,106,16,22,193,164,25,8,108,55,30,76,119,72,39,181,188,176,52,179,12,28,57,74,170,216,78,79,202,156,91,243,111,46,104,238,130,143,116,111,99,165,120,20,120,200,132,8,2,199,140,250,255,190,144,235,108,80,164,247,163,249,190,242,120,113,198,0,65,160,2,11,29,16,0,0,0,1,0,0,0,3,0,0,0,16,0,0,0,32,0,0,0,32,0,0,0,0,1,0,0,64,0,65,193,2,11,143,2,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,152,47,138,194,145,68,55,113,207,251,192,181,165,219,181,233,91,194,86,57,241,17,241,89,164,130,63,146,213,94,28,171,152,170,7,216,1,91,131,18,190,133,49,36,195,125,12,85,116,93,190,114,254,177,222,128,167,6,220,155,116,243,155,193,193,105,155,100,134,71,254,240,198,237,225,15,84,242,12,36,111,52,233,79,190,132,201,108,30,65,185,97,250,136,249,22,82,81,198,242,109,90,142,168,101,252,25,176,199,158,217,185,195,49,18,154,160,234,14,231,43,35,177,253,176,62,53,199,213,186,105,48,95,109,151,203,143,17,15,90,253,238,30,220,137,182,53,10,4,122,11,222,157,202,244,88,22,91,93,225,134,62,127,0,128,137,8,55,50,234,7,165,55,149,171,111,16,97,64,23,241,214,140,13,109,59,170,205,55,190,187,192,218,59,97,131,99,163,72,219,49,233,2,11,167,92,209,111,202,250,26,82,49,132,51,49,149,26,212,110,144,120,67,109,242,145,156,195,189,171,204,158,230,160,201,181,60,182,47,83,198,65,199,210,163,126,35,7,104,75,149,164,118,29,25,76,0,65,208,4,11,29,16,0,0,0,1,0,0,0,3,0,0,0,16,0,0,0,80,1,0,0,80,1,0,0,0,1,0,0,64,0,65,240,4,11,43,28,0,0,0,1,0,0,0,1,0,0,0,28,0,0,0,73,0,110,0,118,0,97,0,108,0,105,0,100,0,32,0,108,0,101,0,110,0,103,0,116,0,104,0,65,160,5,11,53,38,0,0,0,1,0,0,0,1,0,0,0,38,0,0,0,126,0,108,0,105,0,98,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115]); +export const wasmCode = Uint8Array.from([0,97,115,109,1,0,0,0,1,31,6,96,1,127,0,96,2,127,127,0,96,0,0,96,1,127,1,127,96,3,127,127,127,0,96,4,127,127,127,127,0,2,13,1,3,101,110,118,5,97,98,111,114,116,0,5,3,16,15,0,3,1,3,2,2,4,1,1,3,0,0,0,1,2,5,3,1,0,1,6,177,1,35,127,0,65,128,4,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,127,1,65,0,11,7,86,9,6,109,101,109,111,114,121,2,0,12,73,78,80,85,84,95,76,69,78,71,84,72,3,0,5,105,110,112,117,116,3,28,6,111,117,116,112,117,116,3,30,4,105,110,105,116,0,6,6,117,112,100,97,116,101,0,9,5,102,105,110,97,108,0,11,6,100,105,103,101,115,116,0,12,8,100,105,103,101,115,116,54,52,0,14,8,1,15,10,146,14,15,70,1,2,127,32,0,63,0,34,2,65,16,116,34,1,75,4,64,32,2,32,0,32,1,107,65,255,255,3,106,65,128,128,124,113,65,16,118,34,1,32,2,32,1,74,27,64,0,65,0,72,4,64,32,1,64,0,65,0,72,4,64,0,11,11,11,32,0,36,23,11,82,1,3,127,32,0,65,240,255,255,255,3,75,4,64,0,11,35,23,65,16,106,34,2,32,0,65,15,106,65,112,113,34,1,65,16,32,1,65,16,75,27,34,3,106,16,1,32,2,65,16,107,34,1,32,3,54,2,0,32,1,65,1,54,2,4,32,1,65,0,54,2,8,32,1,32,0,54,2,12,32,2,11,37,1,1,127,3,64,32,1,4,64,32,0,34,2,65,1,106,33,0,32,2,65,0,58,0,0,32,1,65,1,107,33,1,12,1,11,11,11,41,1,1,127,32,0,65,240,255,255,255,3,75,4,64,65,128,5,65,176,5,65,54,65,42,16,0,0,11,32,0,16,2,34,1,32,0,16,3,32,1,11,71,0,65,180,2,40,2,0,36,1,65,228,4,40,2,0,36,2,65,224,5,36,22,65,224,5,36,23,65,192,0,16,4,36,24,35,24,36,25,65,128,2,16,4,36,26,35,26,36,27,65,128,4,16,4,36,28,35,28,36,29,65,32,16,4,36,30,35,30,36,31,11,74,0,65,231,204,167,208,6,36,3,65,133,221,158,219,123,36,4,65,242,230,187,227,3,36,5,65,186,234,191,170,122,36,6,65,255,164,185,136,5,36,7,65,140,209,149,216,121,36,8,65,171,179,143,252,1,36,9,65,153,154,131,223,5,36,10,65,0,36,32,65,0,36,33,11,103,1,2,127,2,64,32,2,33,3,32,0,32,1,70,13,0,32,0,32,1,73,4,64,3,64,32,3,4,64,32,0,34,2,65,1,106,33,0,32,1,34,4,65,1,106,33,1,32,2,32,4,45,0,0,58,0,0,32,3,65,1,107,33,3,12,1,11,11,5,3,64,32,3,4,64,32,3,65,1,107,34,3,32,0,106,32,1,32,3,106,45,0,0,58,0,0,12,1,11,11,11,11,11,175,3,1,2,127,35,3,36,11,35,4,36,12,35,5,36,13,35,6,36,14,35,7,36,15,35,8,36,16,35,9,36,17,35,10,36,18,65,0,36,19,3,64,35,19,65,192,0,73,4,64,35,19,65,16,73,4,127,32,1,35,19,65,2,116,34,2,106,45,0,0,65,24,116,32,1,32,2,65,1,106,106,45,0,0,65,16,116,114,32,1,32,2,65,2,106,106,45,0,0,65,8,116,114,32,1,32,2,65,3,106,106,45,0,0,114,5,32,0,35,19,65,16,107,65,2,116,106,40,2,0,32,0,35,19,65,7,107,65,2,116,106,40,2,0,32,0,35,19,65,2,107,65,2,116,106,40,2,0,34,2,65,17,120,32,2,65,19,120,115,32,2,65,10,118,115,106,32,0,35,19,65,15,107,65,2,116,106,40,2,0,34,2,65,7,120,32,2,65,18,120,115,32,2,65,3,118,115,106,106,11,36,34,32,0,35,19,65,2,116,106,35,34,54,2,0,35,34,35,1,35,19,65,2,116,106,40,2,0,35,18,35,15,34,2,65,6,120,32,2,65,11,120,115,32,2,65,25,120,115,106,35,15,34,2,35,16,113,35,17,32,2,65,127,115,113,115,106,106,106,36,20,35,11,34,2,65,2,120,32,2,65,13,120,115,32,2,65,22,120,115,35,11,34,2,35,12,34,3,113,32,2,35,13,34,2,113,115,32,2,32,3,113,115,106,36,21,35,17,36,18,35,16,36,17,35,15,36,16,35,14,35,20,106,36,15,35,13,36,14,35,12,36,13,35,11,36,12,35,20,35,21,106,36,11,35,19,65,1,106,36,19,12,1,11,11,35,3,35,11,106,36,3,35,4,35,12,106,36,4,35,5,35,13,106,36,5,35,6,35,14,106,36,6,35,7,35,15,106,36,7,35,8,35,16,106,36,8,35,9,35,17,106,36,9,35,10,35,18,106,36,10,11,177,1,1,2,127,32,1,35,33,106,36,33,35,32,4,64,65,192,0,35,32,107,32,1,76,4,64,35,25,35,32,106,32,0,65,192,0,35,32,107,16,7,35,32,65,192,0,35,32,107,106,36,32,65,192,0,35,32,107,33,2,32,1,65,192,0,35,32,107,107,33,1,35,27,35,25,16,8,65,0,36,32,5,35,25,35,32,106,32,0,32,1,16,7,32,1,35,32,106,36,32,15,11,11,3,64,32,3,32,1,65,192,0,109,72,4,64,35,27,32,0,32,2,106,16,8,32,3,65,1,106,33,3,32,2,65,64,107,33,2,12,1,11,11,32,1,65,63,113,4,64,35,25,35,32,106,32,0,32,2,106,32,1,65,63,113,34,0,16,7,32,0,35,32,106,36,32,11,11,25,0,32,0,65,128,254,131,120,113,65,8,119,32,0,65,255,129,252,7,113,65,8,120,114,11,173,2,1,2,127,35,33,65,63,113,65,63,72,4,64,35,25,35,32,106,65,128,1,58,0,0,35,32,65,1,106,36,32,11,35,33,65,63,113,65,56,78,4,64,35,25,35,32,106,34,1,65,192,0,35,32,107,106,33,2,3,64,32,1,32,2,73,4,64,32,1,65,0,58,0,0,32,1,65,1,106,33,1,12,1,11,11,35,27,35,25,16,8,65,0,36,32,11,35,33,65,63,113,65,63,78,4,64,35,25,35,32,106,65,128,1,58,0,0,35,32,65,1,106,36,32,11,35,25,35,32,106,34,1,65,56,35,32,107,106,33,2,3,64,32,1,32,2,73,4,64,32,1,65,0,58,0,0,32,1,65,1,106,33,1,12,1,11,11,35,25,65,56,106,35,33,65,128,128,128,128,2,109,16,10,54,2,0,35,25,65,60,106,35,33,65,3,116,16,10,54,2,0,35,27,35,25,16,8,32,0,35,3,16,10,54,2,0,32,0,65,4,106,35,4,16,10,54,2,0,32,0,65,8,106,35,5,16,10,54,2,0,32,0,65,12,106,35,6,16,10,54,2,0,32,0,65,16,106,35,7,16,10,54,2,0,32,0,65,20,106,35,8,16,10,54,2,0,32,0,65,24,106,35,9,16,10,54,2,0,32,0,65,28,106,35,10,16,10,54,2,0,11,14,0,16,6,35,29,32,0,16,9,35,31,16,11,11,253,1,1,2,127,35,3,36,11,35,4,36,12,35,5,36,13,35,6,36,14,35,7,36,15,35,8,36,16,35,9,36,17,35,10,36,18,65,0,36,19,3,64,35,19,65,192,0,73,4,64,32,0,35,19,65,2,116,106,40,2,0,35,18,35,15,34,1,65,6,120,32,1,65,11,120,115,32,1,65,25,120,115,106,35,15,34,1,35,16,113,35,17,32,1,65,127,115,113,115,106,106,36,20,35,11,34,1,65,2,120,32,1,65,13,120,115,32,1,65,22,120,115,35,11,34,1,35,12,34,2,113,32,1,35,13,34,1,113,115,32,1,32,2,113,115,106,36,21,35,17,36,18,35,16,36,17,35,15,36,16,35,14,35,20,106,36,15,35,13,36,14,35,12,36,13,35,11,36,12,35,20,35,21,106,36,11,35,19,65,1,106,36,19,12,1,11,11,35,3,35,11,106,36,3,35,4,35,12,106,36,4,35,5,35,13,106,36,5,35,6,35,14,106,36,6,35,7,35,15,106,36,7,35,8,35,16,106,36,8,35,9,35,17,106,36,9,35,10,35,18,106,36,10,11,107,0,16,6,35,27,32,0,16,8,35,2,16,13,32,1,35,3,16,10,54,2,0,32,1,65,4,106,35,4,16,10,54,2,0,32,1,65,8,106,35,5,16,10,54,2,0,32,1,65,12,106,35,6,16,10,54,2,0,32,1,65,16,106,35,7,16,10,54,2,0,32,1,65,20,106,35,8,16,10,54,2,0,32,1,65,24,106,35,9,16,10,54,2,0,32,1,65,28,106,35,10,16,10,54,2,0,11,4,0,16,5,11,11,222,5,6,0,65,17,11,143,2,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,152,47,138,66,145,68,55,113,207,251,192,181,165,219,181,233,91,194,86,57,241,17,241,89,164,130,63,146,213,94,28,171,152,170,7,216,1,91,131,18,190,133,49,36,195,125,12,85,116,93,190,114,254,177,222,128,167,6,220,155,116,241,155,193,193,105,155,228,134,71,190,239,198,157,193,15,204,161,12,36,111,44,233,45,170,132,116,74,220,169,176,92,218,136,249,118,82,81,62,152,109,198,49,168,200,39,3,176,199,127,89,191,243,11,224,198,71,145,167,213,81,99,202,6,103,41,41,20,133,10,183,39,56,33,27,46,252,109,44,77,19,13,56,83,84,115,10,101,187,10,106,118,46,201,194,129,133,44,114,146,161,232,191,162,75,102,26,168,112,139,75,194,163,81,108,199,25,232,146,209,36,6,153,214,133,53,14,244,112,160,106,16,22,193,164,25,8,108,55,30,76,119,72,39,181,188,176,52,179,12,28,57,74,170,216,78,79,202,156,91,243,111,46,104,238,130,143,116,111,99,165,120,20,120,200,132,8,2,199,140,250,255,190,144,235,108,80,164,247,163,249,190,242,120,113,198,0,65,160,2,11,29,16,0,0,0,1,0,0,0,3,0,0,0,16,0,0,0,32,0,0,0,32,0,0,0,0,1,0,0,64,0,65,193,2,11,143,2,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,152,47,138,194,145,68,55,113,207,251,192,181,165,219,181,233,91,194,86,57,241,17,241,89,164,130,63,146,213,94,28,171,152,170,7,216,1,91,131,18,190,133,49,36,195,125,12,85,116,93,190,114,254,177,222,128,167,6,220,155,116,243,155,193,193,105,155,100,134,71,254,240,198,237,225,15,84,242,12,36,111,52,233,79,190,132,201,108,30,65,185,97,250,136,249,22,82,81,198,242,109,90,142,168,101,252,25,176,199,158,217,185,195,49,18,154,160,234,14,231,43,35,177,253,176,62,53,199,213,186,105,48,95,109,151,203,143,17,15,90,253,238,30,220,137,182,53,10,4,122,11,222,157,202,244,88,22,91,93,225,134,62,127,0,128,137,8,55,50,234,7,165,55,149,171,111,16,97,64,23,241,214,140,13,109,59,170,205,55,190,187,192,218,59,97,131,99,163,72,219,49,233,2,11,167,92,209,111,202,250,26,82,49,132,51,49,149,26,212,110,144,120,67,109,242,145,156,195,189,171,204,158,230,160,201,181,60,182,47,83,198,65,199,210,163,126,35,7,104,75,149,164,118,29,25,76,0,65,208,4,11,29,16,0,0,0,1,0,0,0,3,0,0,0,16,0,0,0,80,1,0,0,80,1,0,0,0,1,0,0,64,0,65,240,4,11,43,28,0,0,0,1,0,0,0,1,0,0,0,28,0,0,0,73,0,110,0,118,0,97,0,108,0,105,0,100,0,32,0,108,0,101,0,110,0,103,0,116,0,104,0,65,160,5,11,53,38,0,0,0,1,0,0,0,1,0,0,0,38,0,0,0,126,0,108,0,105,0,98,0,47,0,97,0,114,0,114,0,97,0,121,0,98,0,117,0,102,0,102,0,101,0,114,0,46,0,116,0,115]); diff --git a/packages/as-sha256/test/perf/index.test.ts b/packages/as-sha256/test/perf/index.test.ts index b772165c..17fdd3d1 100644 --- a/packages/as-sha256/test/perf/index.test.ts +++ b/packages/as-sha256/test/perf/index.test.ts @@ -1,12 +1,17 @@ -import {itBench} from "@dapplion/benchmark"; +import {itBench, setBenchOpts} from "@dapplion/benchmark"; import * as sha256 from "../../src"; -// Aug 10 2021 +// Feb 2024 Mac M1 // digestTwoHashObjects vs digest64 vs digest -// ✓ digestTwoHashObjects 50023 times 19.17366 ops/s 52.15488 ms/op - 1151 runs 60.0 s -// ✓ digest64 50023 times 18.21352 ops/s 54.90425 ms/op - 1093 runs 60.0 s -// ✓ digest 50023 times 10.60461 ops/s 94.29865 ms/op - 637 runs 60.1 s +// ✓ digestTwoHashObjects 50023 times 29.85028 ops/s 33.50052 ms/op x0.968 284 runs 10.1 s +// ✓ digest64 50023 times 27.80544 ops/s 35.96419 ms/op x0.985 265 runs 10.0 s +// ✓ digest 50023 times 28.02601 ops/s 35.68114 ms/op x0.974 268 runs 10.1 s + describe("digestTwoHashObjects vs digest64 vs digest", () => { + setBenchOpts({ + minMs: 10000, + }); + const input = Buffer.from("gajindergajindergajindergajindergajindergajindergajindergajinder", "utf8"); const input1 = "gajindergajindergajindergajinder"; const input2 = "gajindergajindergajindergajinder";