diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 52789433..02c2991f 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -26,7 +26,7 @@ jobs: with: cache: yarn node-version: 18 - - run: yarn --immutable && yarn build + - run: yarn --immutable && yarn build && yarn generate - name: Run benchmarks run: yarn benchmark diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7648faa..10492a0c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,8 @@ jobs: run: yarn --immutable - name: Build run: yarn build + - name: Generate + run: yarn generate - name: Check types run: yarn check-types - name: Lint diff --git a/package.json b/package.json index 4ad705e5..3b6e5d33 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "packageManager": "yarn@3.2.3", "scripts": { "clean": "yarn workspaces foreach -vp run clean", + "generate": "yarn workspaces foreach -vp run generate", "build": "yarn clean && yarn workspaces foreach -vp --topological run build", "lint": "yarn workspaces foreach -vp run lint", "check-types": "yarn workspaces foreach -vp run check-types", diff --git a/packages/as-sha256/as-pect.config.js b/packages/as-sha256/as-pect.config.js deleted file mode 100644 index 30150c73..00000000 --- a/packages/as-sha256/as-pect.config.js +++ /dev/null @@ -1,69 +0,0 @@ -module.exports = { - /** - * A set of globs passed to the glob package that qualify typescript files for testing. - */ - include: ["assembly/__tests__/**/*.spec.ts"], - /** - * A set of globs passed to the glob package that quality files to be added to each test. - */ - add: ["assembly/__tests__/**/*.include.ts"], - /** - * All the compiler flags needed for this test suite. Make sure that a binary file is output. - */ - flags: { - /** To output a wat file, uncomment the following line. */ - // "--textFile": ["output.wat"], - /** A runtime must be provided here. */ - "--runtime": ["full"] // Acceptable values are: full, half, stub (arena), and none - }, - /** - * A set of regexp that will disclude source files from testing. - */ - disclude: [/node_modules/], - /** - * Add your required AssemblyScript imports here. - */ - imports: {}, - /** - * All performance statistics reporting can be configured here. - */ - performance: { - /** Enable performance statistics gathering for every test. */ - enabled: false, - /** Set the maximum number of samples to run for every test. */ - maxSamples: 10000, - /** Set the maximum test run time in milliseconds for every test. */ - maxTestRunTime: 5000, - /** Report the median time in the default reporter for every test. */ - reportMedian: true, - /** Report the average time in milliseconds for every test. */ - reportAverage: true, - /** Report the standard deviation for every test. */ - reportStandardDeviation: false, - /** Report the maximum run time in milliseconds for every test. */ - reportMax: false, - /** Report the minimum run time in milliseconds for every test. */ - reportMin: false, - }, - /** - * Add a custom reporter here if you want one. The following example is in typescript. - * - * @example - * import { TestReporter, TestGroup, TestResult, TestContext } from "as-pect"; - * - * export class CustomReporter extends TestReporter { - * // implement each abstract method here - * public abstract onStart(suite: TestContext): void; - * public abstract onGroupStart(group: TestGroup): void; - * public abstract onGroupFinish(group: TestGroup): void; - * public abstract onTestStart(group: TestGroup, result: TestResult): void; - * public abstract onTestFinish(group: TestGroup, result: TestResult): void; - * public abstract onFinish(suite: TestContext): void; - * } - */ - // reporter: new CustomReporter(), - /** - * Specify if the binary wasm file should be written to the file system. - */ - outputBinary: false, -}; diff --git a/packages/as-sha256/build/optimized.wasm b/packages/as-sha256/build/optimized.wasm index f9ae82be..97f5d0da 100644 Binary files a/packages/as-sha256/build/optimized.wasm and b/packages/as-sha256/build/optimized.wasm differ diff --git a/packages/as-sha256/build/optimized.wat b/packages/as-sha256/build/optimized.wat index f5378361..24cd1564 100644 --- a/packages/as-sha256/build/optimized.wat +++ b/packages/as-sha256/build/optimized.wat @@ -1,18 +1,12 @@ (module - (type $i32_=>_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 i32))) + (type $1 (func (param i32) (result i32))) + (type $2 (func (param i32))) + (type $3 (func (param i32 i32) (result i32))) + (type $4 (func)) + (type $5 (func (param i32 i32 i32 i32))) + (type $6 (func (param i32 i32 i64))) (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/INPUT_LENGTH i32 (i32.const 512)) (global $assembly/index/kPtr (mut i32) (i32.const 0)) (global $assembly/index/w64Ptr (mut i32) (i32.const 0)) @@ -35,8 +29,9 @@ (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/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/rt/tcms/fromSpace (mut i32) (i32.const 0)) + (global $~lib/rt/tcms/total (mut i32) (i32.const 0)) (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 +42,25 @@ (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)) + (memory $0 1) + (data $0 (i32.const 1036) "\1c\01") + (data $0.1 (i32.const 1048) "\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") + (data $1 (i32.const 1324) ",") + (data $1.1 (i32.const 1336) "\04\00\00\00\10\00\00\00 \04\00\00 \04\00\00\00\01\00\00@") + (data $2 (i32.const 1372) "\1c\01") + (data $2.1 (i32.const 1384) "\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") + (data $3 (i32.const 1660) ",") + (data $3.1 (i32.const 1672) "\04\00\00\00\10\00\00\00p\05\00\00p\05\00\00\00\01\00\00@") + (data $4 (i32.const 1708) ",") + (data $4.1 (i32.const 1720) "\02\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h") + (data $5 (i32.const 1756) "<") + (data $5.1 (i32.const 1768) "\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") + (data $6 (i32.const 1820) "<") + (data $6.1 (i32.const 1832) "\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") + (data $7 (i32.const 1884) "<") + (data $7.1 (i32.const 1896) "\02\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00c\00m\00s\00.\00t\00s") + (data $8 (i32.const 1948) "<") + (data $8.1 (i32.const 1960) "\02\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") (export "INPUT_LENGTH" (global $assembly/index/INPUT_LENGTH)) (export "input" (global $assembly/index/input)) (export "output" (global $assembly/index/output)) @@ -56,38 +69,554 @@ (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/rt/tlsf/Root#set:flMap (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/removeBlock (param $0 i32) (param $1 i32) (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + i32.const -4 + i32.and + local.tee $3 + i32.const 256 + i32.lt_u + if (result i32) + local.get $3 + i32.const 4 + i32.shr_u + else + i32.const 31 + i32.const 1073741820 + local.get $3 + local.get $3 + i32.const 1073741820 + i32.ge_u + select + local.tee $3 + i32.clz + i32.sub + local.tee $4 + i32.const 7 + i32.sub + local.set $2 + local.get $3 + local.get $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + end + local.set $3 + local.get $1 + i32.load offset=8 + local.set $5 + local.get $1 + i32.load offset=4 + local.tee $4 + if + local.get $4 + local.get $5 + call $~lib/rt/tlsf/Block#set:next + end + local.get $5 + if + local.get $5 + local.get $4 + call $~lib/rt/tlsf/Block#set:prev + end + local.get $1 local.get $0 - memory.size + local.get $2 + i32.const 4 + i32.shl + local.get $3 + i32.add + i32.const 2 + i32.shl + i32.add + local.tee $1 + i32.load offset=96 + i32.eq + if + local.get $1 + local.get $5 + i32.store offset=96 + local.get $5 + i32.eqz + if + local.get $0 + local.get $2 + i32.const 2 + i32.shl + i32.add + local.tee $1 + i32.load offset=4 + i32.const -2 + local.get $3 + i32.rotl + i32.and + local.set $3 + local.get $1 + local.get $3 + i32.store offset=4 + local.get $3 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const -2 + local.get $2 + i32.rotl + 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.get $1 + i32.load + local.set $3 + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load local.tee $2 - i32.const 16 + i32.const 1 + i32.and + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 + i32.const 4 + i32.add + local.get $2 + i32.const -4 + i32.and + i32.add + local.tee $3 + call $~lib/rt/tlsf/Root#set:flMap + local.get $1 + i32.const 4 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $2 + end + local.get $3 + i32.const 2 + i32.and + if + local.get $1 + i32.const 4 + i32.sub + i32.load + local.tee $1 + i32.load + local.set $6 + local.get $0 + local.get $1 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $6 + i32.const 4 + i32.add + local.get $3 + i32.const -4 + i32.and + i32.add + local.tee $3 + call $~lib/rt/tlsf/Root#set:flMap + end + local.get $4 + local.get $2 + i32.const 2 + i32.or + call $~lib/rt/tlsf/Root#set:flMap + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $0 + local.get $3 + i32.const -4 + i32.and + local.tee $2 + i32.const 256 + i32.lt_u + if (result i32) + local.get $2 + i32.const 4 + i32.shr_u + else + i32.const 31 + i32.const 1073741820 + local.get $2 + local.get $2 + i32.const 1073741820 + i32.ge_u + select + local.tee $2 + i32.clz + i32.sub + local.tee $3 + i32.const 7 + i32.sub + local.set $5 + local.get $2 + local.get $3 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + end + local.tee $2 + local.get $5 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $3 + local.get $1 + i32.const 0 + call $~lib/rt/tlsf/Block#set:prev + local.get $1 + local.get $3 + call $~lib/rt/tlsf/Block#set:next + local.get $3 + if + local.get $3 + local.get $1 + call $~lib/rt/tlsf/Block#set:prev + end + local.get $0 + local.get $5 + i32.const 4 + i32.shl + local.get $2 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $1 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $5 + i32.shl + i32.or + call $~lib/rt/tlsf/Root#set:flMap + local.get $0 + local.get $5 + i32.const 2 + i32.shl + i32.add + local.tee $0 + local.get $0 + i32.load offset=4 + i32.const 1 + local.get $2 + i32.shl + i32.or + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i64) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.const 19 + i32.add + i32.const -16 + i32.and + i32.const 4 + i32.sub + local.set $1 + local.get $0 + i32.load offset=1568 + local.tee $3 + if + local.get $3 + local.get $1 + i32.const 16 + i32.sub + local.tee $5 + i32.eq + if + local.get $3 + i32.load + local.set $4 + local.get $5 + local.set $1 + end + end + local.get $2 + i32.wrap_i64 + i32.const -16 + i32.and + local.get $1 + i32.sub + local.tee $3 + i32.const 20 + i32.lt_u + if + return + end + local.get $1 + local.get $4 + i32.const 2 + i32.and + local.get $3 + i32.const 8 + i32.sub + local.tee $3 + i32.const 1 + i32.or + i32.or + call $~lib/rt/tlsf/Root#set:flMap + local.get $1 + i32.const 0 + call $~lib/rt/tlsf/Block#set:prev + local.get $1 + i32.const 0 + call $~lib/rt/tlsf/Block#set:next + local.get $1 + i32.const 4 + i32.add + local.get $3 + i32.add + local.tee $3 + i32.const 2 + call $~lib/rt/tlsf/Root#set:flMap + local.get $0 + local.get $3 + i32.store offset=1568 + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + ) + (func $~lib/rt/tlsf/roundSize (param $0 i32) (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 + local.get $0 + local.get $0 + i32.const 536870910 + i32.lt_u + select + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + local.get $1 + i32.const 256 + i32.lt_u + if (result i32) + local.get $1 + i32.const 4 + i32.shr_u + else + i32.const 31 + local.get $1 + call $~lib/rt/tlsf/roundSize + local.tee $1 + i32.clz + i32.sub + local.tee $3 + i32.const 7 + i32.sub + local.set $2 + local.get $1 + local.get $3 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + end + local.set $1 + local.get $0 + local.get $2 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const -1 + local.get $1 + i32.shl + i32.and local.tee $1 + if (result i32) + local.get $0 + local.get $1 + i32.ctz + local.get $2 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + else + local.get $0 + i32.load + i32.const -1 + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $0 + local.get $0 + local.get $1 + i32.ctz + local.tee $0 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.ctz + local.get $0 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + else + i32.const 0 + end + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + local.get $1 + i32.const 1073741820 i32.gt_u if + i32.const 1840 + i32.const 1968 + i32.const 461 + i32.const 29 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 12 + local.get $1 + i32.const 19 + i32.add + i32.const -16 + i32.and + i32.const 4 + i32.sub + local.get $1 + i32.const 12 + i32.le_u + select + local.tee $1 + call $~lib/rt/tlsf/searchBlock + local.tee $2 + i32.eqz + if + local.get $1 + i32.const 256 + i32.ge_u + if (result i32) + local.get $1 + call $~lib/rt/tlsf/roundSize + else + local.get $1 + end + local.set $2 + memory.size + local.tee $3 local.get $2 + i32.const 4 local.get $0 - local.get $1 + i32.load offset=1568 + local.get $3 + i32.const 16 + i32.shl + i32.const 4 i32.sub + i32.ne + i32.shl + i32.add i32.const 65535 i32.add i32.const -65536 i32.and i32.const 16 i32.shr_u - local.tee $1 + local.tee $2 local.get $2 - local.get $1 - i32.gt_s + local.get $3 + i32.lt_s select memory.grow i32.const 0 i32.lt_s if - local.get $1 + local.get $2 memory.grow i32.const 0 i32.lt_s @@ -95,129 +624,239 @@ unreachable end end + local.get $0 + local.get $3 + i32.const 16 + i32.shl + memory.size + i64.extend_i32_s + i64.const 16 + i64.shl + call $~lib/rt/tlsf/addMemory + local.get $0 + local.get $1 + call $~lib/rt/tlsf/searchBlock + local.set $2 + end + local.get $2 + i32.load + drop + local.get $0 + local.get $2 + call $~lib/rt/tlsf/removeBlock + local.get $2 + i32.load + local.tee $3 + i32.const -4 + i32.and + local.get $1 + i32.sub + local.tee $4 + i32.const 16 + i32.ge_u + if + local.get $2 + local.get $1 + local.get $3 + i32.const 2 + i32.and + i32.or + call $~lib/rt/tlsf/Root#set:flMap + local.get $2 + i32.const 4 + i32.add + local.get $1 + i32.add + local.tee $1 + local.get $4 + i32.const 4 + i32.sub + i32.const 1 + i32.or + call $~lib/rt/tlsf/Root#set:flMap + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + else + local.get $2 + local.get $3 + i32.const -2 + i32.and + call $~lib/rt/tlsf/Root#set:flMap + local.get $2 + i32.const 4 + i32.add + local.get $2 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $0 + local.get $0 + i32.load + i32.const -3 + i32.and + call $~lib/rt/tlsf/Root#set:flMap + end + local.get $2 + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + local.get $0 + i32.const 1073741820 + i32.gt_u + if + i32.const 1728 + i32.const 1776 + i32.const 52 + i32.const 43 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 1073741804 + i32.gt_u + if + i32.const 1840 + i32.const 1904 + i32.const 125 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/rt/tlsf/ROOT + i32.eqz + if + memory.size + local.tee $2 + i32.const 0 + i32.le_s + if (result i32) + i32.const 1 + local.get $2 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + i32.const 2048 + i32.const 0 + call $~lib/rt/tlsf/Root#set:flMap + i32.const 3616 + i32.const 0 + i32.store + loop $for-loop|0 + local.get $1 + i32.const 23 + i32.lt_u + if + local.get $1 + i32.const 2 + i32.shl + i32.const 2048 + i32.add + i32.const 0 + i32.store offset=4 + i32.const 0 + local.set $2 + loop $for-loop|1 + local.get $2 + i32.const 16 + i32.lt_u + if + local.get $1 + i32.const 4 + i32.shl + local.get $2 + i32.add + i32.const 2 + i32.shl + i32.const 2048 + i32.add + i32.const 0 + i32.store offset=96 + local.get $2 + i32.const 1 + i32.add + local.set $2 + br $for-loop|1 + end + end + local.get $1 + i32.const 1 + i32.add + local.set $1 + br $for-loop|0 + end + end + i32.const 2048 + i32.const 3620 + memory.size + i64.extend_i32_s + i64.const 16 + i64.shl + call $~lib/rt/tlsf/addMemory + i32.const 2048 + global.set $~lib/rt/tlsf/ROOT end + global.get $~lib/rt/tlsf/ROOT local.get $0 - global.set $~lib/rt/stub/offset - ) - (func $~lib/rt/stub/__alloc (; 2 ;) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - local.get $0 - i32.const 1073741808 - i32.gt_u - if - unreachable - end - global.get $~lib/rt/stub/offset i32.const 16 i32.add + call $~lib/rt/tlsf/allocateBlock local.tee $2 + i32.const 1 + i32.store offset=12 + local.get $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 + i32.store offset=16 + global.get $~lib/rt/tcms/fromSpace local.tee $3 - i32.add - call $~lib/rt/stub/maybeGrowMemory + i32.load offset=8 + local.set $1 local.get $2 - i32.const 16 - i32.sub - local.tee $1 local.get $3 - i32.store + call $~lib/rt/tlsf/Block#set:prev + local.get $2 local.get $1 - i32.const 1 - i32.store offset=4 + call $~lib/rt/tlsf/Block#set:next local.get $1 - i32.const 0 - i32.store offset=8 + local.get $2 local.get $1 - local.get $0 - i32.store offset=12 + i32.load offset=4 + i32.const 3 + i32.and + i32.or + call $~lib/rt/tlsf/Block#set:prev + local.get $3 local.get $2 - ) - (func $~lib/memory/memory.fill (; 3 ;) (param $0 i32) (param $1 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 - i32.gt_u - if - i32.const 640 - i32.const 688 - i32.const 54 - i32.const 42 - call $~lib/builtins/abort - unreachable - end - local.get $0 - call $~lib/rt/stub/__alloc + call $~lib/rt/tlsf/Block#set:next + global.get $~lib/rt/tcms/total + local.get $2 + i32.load + i32.const -4 + i32.and + i32.const 4 + i32.add + i32.add + global.set $~lib/rt/tcms/total + local.get $2 + i32.const 20 + i32.add local.tee $1 + i32.const 0 local.get $0 - call $~lib/memory/memory.fill + memory.fill local.get $1 ) - (func $start:assembly/index (; 5 ;) - i32.const 308 - i32.load - global.set $assembly/index/kPtr - i32.const 612 - i32.load - 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 64 - call $~lib/arraybuffer/ArrayBuffer#constructor - global.set $assembly/index/M - global.get $assembly/index/M - global.set $assembly/index/mPtr - 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 - call $~lib/arraybuffer/ArrayBuffer#constructor - global.set $assembly/index/input - global.get $assembly/index/input - global.set $assembly/index/inputPtr - 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 (; 6 ;) + (func $assembly/index/init i32.const 1779033703 global.set $assembly/index/H0 i32.const -1150833019 @@ -239,66 +878,7 @@ i32.const 0 global.set $assembly/index/bytesHashed ) - (func $~lib/memory/memory.copy (; 7 ;) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - block $~lib/util/memory/memmove|inlined.0 - local.get $2 - local.set $3 - local.get $0 - local.get $1 - i32.eq - br_if $~lib/util/memory/memmove|inlined.0 - local.get $0 - local.get $1 - i32.lt_u - if - 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) + (func $assembly/index/hashBlocks (param $0 i32) (param $1 i32) (local $2 i32) global.get $assembly/index/H0 global.set $assembly/index/a @@ -327,12 +907,16 @@ global.get $assembly/index/i i32.const 2 i32.shl + local.tee $2 i32.add local.get $1 - global.get $assembly/index/i - i32.const 2 - i32.shl - local.tee $2 + local.get $2 + i32.const 3 + i32.add + i32.add + i32.load8_u + local.get $1 + local.get $2 i32.add i32.load8_u i32.const 24 @@ -355,12 +939,6 @@ 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 @@ -458,12 +1036,11 @@ global.get $assembly/index/i i32.const 2 i32.shl + local.tee $1 i32.add i32.load + local.get $1 global.get $assembly/index/kPtr - global.get $assembly/index/i - i32.const 2 - i32.shl i32.add i32.load global.get $assembly/index/h @@ -506,20 +1083,20 @@ i32.const 22 i32.rotr i32.xor - global.get $assembly/index/a - local.tee $1 global.get $assembly/index/b + local.tee $1 + global.get $assembly/index/c local.tee $2 i32.and local.get $1 - global.get $assembly/index/c + global.get $assembly/index/a local.tee $1 i32.and - i32.xor local.get $1 local.get $2 i32.and i32.xor + i32.xor i32.add global.set $assembly/index/t2 global.get $assembly/index/g @@ -582,11 +1159,11 @@ 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 global.get $assembly/index/bytesHashed + local.get $1 i32.add global.set $assembly/index/bytesHashed global.get $assembly/index/mLength @@ -594,6 +1171,7 @@ i32.const 64 global.get $assembly/index/mLength i32.sub + local.tee $2 local.get $1 i32.le_s if @@ -601,14 +1179,10 @@ global.get $assembly/index/mLength i32.add local.get $0 - i32.const 64 - global.get $assembly/index/mLength - i32.sub - call $~lib/memory/memory.copy - global.get $assembly/index/mLength - i32.const 64 + local.get $2 + memory.copy global.get $assembly/index/mLength - i32.sub + local.get $2 i32.add global.set $assembly/index/mLength i32.const 64 @@ -632,9 +1206,9 @@ 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 return @@ -666,6 +1240,7 @@ local.get $1 i32.const 63 i32.and + local.tee $1 if global.get $assembly/index/mPtr global.get $assembly/index/mLength @@ -674,17 +1249,14 @@ local.get $2 i32.add 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.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) local.get $0 i32.const -16711936 i32.and @@ -697,14 +1269,14 @@ i32.rotr i32.or ) - (func $assembly/index/final (; 11 ;) (param $0 i32) + (func $assembly/index/final (param $0 i32) (local $1 i32) (local $2 i32) global.get $assembly/index/bytesHashed i32.const 63 i32.and i32.const 63 - i32.lt_s + i32.lt_u if global.get $assembly/index/mPtr global.get $assembly/index/mLength @@ -720,7 +1292,7 @@ i32.const 63 i32.and i32.const 56 - i32.ge_s + i32.ge_u if global.get $assembly/index/mPtr global.get $assembly/index/mLength @@ -756,7 +1328,7 @@ i32.const 63 i32.and i32.const 63 - i32.ge_s + i32.ge_u if global.get $assembly/index/mPtr global.get $assembly/index/mLength @@ -793,21 +1365,17 @@ end end global.get $assembly/index/mPtr - i32.const 56 - i32.add global.get $assembly/index/bytesHashed i32.const 536870912 i32.div_s call $~lib/polyfills/bswap - i32.store + i32.store offset=56 global.get $assembly/index/mPtr - i32.const 60 - i32.add global.get $assembly/index/bytesHashed i32.const 3 i32.shl call $~lib/polyfills/bswap - i32.store + i32.store offset=60 global.get $assembly/index/wPtr global.get $assembly/index/mPtr call $assembly/index/hashBlocks @@ -816,49 +1384,35 @@ call $~lib/polyfills/bswap i32.store local.get $0 - i32.const 4 - i32.add global.get $assembly/index/H1 call $~lib/polyfills/bswap - i32.store + i32.store offset=4 local.get $0 - i32.const 8 - i32.add global.get $assembly/index/H2 call $~lib/polyfills/bswap - i32.store + i32.store offset=8 local.get $0 - i32.const 12 - i32.add global.get $assembly/index/H3 call $~lib/polyfills/bswap - i32.store + i32.store offset=12 local.get $0 - i32.const 16 - i32.add global.get $assembly/index/H4 call $~lib/polyfills/bswap - i32.store + i32.store offset=16 local.get $0 - i32.const 20 - i32.add global.get $assembly/index/H5 call $~lib/polyfills/bswap - i32.store + i32.store offset=20 local.get $0 - i32.const 24 - i32.add global.get $assembly/index/H6 call $~lib/polyfills/bswap - i32.store + i32.store offset=24 local.get $0 - i32.const 28 - i32.add global.get $assembly/index/H7 call $~lib/polyfills/bswap - i32.store + i32.store offset=28 ) - (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,7 +1420,7 @@ 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) global.get $assembly/index/H0 @@ -937,20 +1491,20 @@ 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 $2 + global.get $assembly/index/a + local.tee $2 + i32.and local.get $1 local.get $2 i32.and i32.xor + i32.xor i32.add global.set $assembly/index/t2 global.get $assembly/index/g @@ -1013,7 +1567,7 @@ 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) call $assembly/index/init global.get $assembly/index/wPtr local.get $0 @@ -1025,49 +1579,68 @@ call $~lib/polyfills/bswap i32.store local.get $1 - i32.const 4 - i32.add global.get $assembly/index/H1 call $~lib/polyfills/bswap - i32.store + i32.store offset=4 local.get $1 - i32.const 8 - i32.add global.get $assembly/index/H2 call $~lib/polyfills/bswap - i32.store + i32.store offset=8 local.get $1 - i32.const 12 - i32.add global.get $assembly/index/H3 call $~lib/polyfills/bswap - i32.store + i32.store offset=12 local.get $1 - i32.const 16 - i32.add global.get $assembly/index/H4 call $~lib/polyfills/bswap - i32.store + i32.store offset=16 local.get $1 - i32.const 20 - i32.add global.get $assembly/index/H5 call $~lib/polyfills/bswap - i32.store + i32.store offset=20 local.get $1 - i32.const 24 - i32.add global.get $assembly/index/H6 call $~lib/polyfills/bswap - i32.store + i32.store offset=24 local.get $1 - i32.const 28 - i32.add global.get $assembly/index/H7 call $~lib/polyfills/bswap - i32.store + i32.store offset=28 ) - (func $~start (; 15 ;) - call $start:assembly/index + (func $~start + i32.const 1348 + i32.load + global.set $assembly/index/kPtr + i32.const 1684 + i32.load + global.set $assembly/index/w64Ptr + i32.const 2016 + i32.const 2016 + call $~lib/rt/tlsf/Block#set:prev + i32.const 2016 + i32.const 2016 + call $~lib/rt/tlsf/Block#set:next + i32.const 2016 + global.set $~lib/rt/tcms/fromSpace + 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 256 + call $~lib/arraybuffer/ArrayBuffer#constructor + global.set $assembly/index/W + global.get $assembly/index/W + global.set $assembly/index/wPtr + i32.const 512 + call $~lib/arraybuffer/ArrayBuffer#constructor + global.set $assembly/index/input + global.get $assembly/index/input + global.set $assembly/index/inputPtr + i32.const 32 + call $~lib/arraybuffer/ArrayBuffer#constructor + global.set $assembly/index/output + global.get $assembly/index/output + global.set $assembly/index/outputPtr ) ) diff --git a/packages/as-sha256/build/untouched.wasm b/packages/as-sha256/build/untouched.wasm index 72afc8bd..a409f9f3 100644 Binary files a/packages/as-sha256/build/untouched.wasm and b/packages/as-sha256/build/untouched.wasm differ diff --git a/packages/as-sha256/build/untouched.wat b/packages/as-sha256/build/untouched.wat index 9054d70a..c28450e7 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,20 @@ (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 $~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 +74,1695 @@ (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 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $2 - i32.const 3 - i32.sub - local.set $2 - 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 - end - br $break|2 - end - local.get $1 - i32.load - local.set $3 - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $2 - i32.const 1 - i32.sub - local.set $2 - loop $while-continue|5 - local.get $2 - i32.const 19 - i32.ge_u - local.set $5 - local.get $5 + 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 $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 + 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.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 + local.get $13 i32.add - local.get $3 - i32.const 8 - i32.shr_u - local.get $4 - i32.const 24 + i32.const 2 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 + local.get $14 + i32.store offset=96 + local.get $10 + i32.const 1 i32.add - local.set $0 - local.get $2 - i32.const 16 - i32.sub - local.set $2 - br $while-continue|5 + local.set $10 + br $for-loop|1 end end - br $break|2 + local.get $6 + i32.const 1 + i32.add + 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 + 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 8 - 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 + 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 + 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 - 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 + i32.const 4 + i32.shr_u + local.set $3 + else local.get $1 - local.tee $5 + 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 + 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 + 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 + 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.tee $5 + call $~lib/rt/tlsf/Root#get:flMap + i32.const 0 + i32.const -1 + i32.xor + local.get $2 i32.const 1 i32.add - local.set $0 - local.get $5 + 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 + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 347 + i32.const 18 + call $~lib/builtins/abort + unreachable + 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 $~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 - local.tee $5 - i32.const 1 - i32.add + call $~lib/rt/tlsf/roundSize local.set $1 - local.get $5 - i32.load8_u - i32.store8 + 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.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.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 + 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 $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 $2 + local.get $3 + i32.const 2 + i32.and + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo local.get $1 - local.tee $5 - i32.const 1 + i32.const 4 i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 - local.get $0 - local.tee $5 - i32.const 1 + local.get $2 i32.add - local.set $0 + local.set $5 local.get $5 - local.get $1 - local.tee $5 + local.get $4 + i32.const 4 + i32.sub i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 + i32.or + call $~lib/rt/common/BLOCK#set:mmInfo local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 local.get $5 + call $~lib/rt/tlsf/insertBlock + else local.get $1 - local.tee $5 + local.get $3 i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 + 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 - i32.const 2 - i32.and + call $~lib/rt/tlsf/searchBlock + local.set $3 + local.get $3 + i32.eqz 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 $2 + call $~lib/rt/tlsf/growMemory 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 $2 + call $~lib/rt/tlsf/searchBlock + local.set $3 i32.const 1 - i32.add - local.set $1 - local.get $5 - i32.load8_u - i32.store8 + drop + local.get $3 + i32.eqz + if + i32.const 0 + i32.const 944 + i32.const 499 + i32.const 16 + call $~lib/builtins/abort + unreachable + end end - local.get $2 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 - 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 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 $~lib/memory/memory.copy (; 9 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start:assembly/index + (local $0 i32) + (local $1 i32) + (local $2 i32) (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - block $~lib/util/memory/memmove|inlined.0 - local.get $0 - local.set $5 - local.get $1 - local.set $4 - local.get $2 - local.set $3 - local.get $5 - local.get $4 - i32.eq - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $4 - local.get $3 - i32.add - local.get $5 - i32.le_u - if (result i32) - i32.const 1 - else - local.get $5 - local.get $3 - i32.add - local.get $4 - i32.le_u - end - if - local.get $5 - local.get $4 - local.get $3 - call $~lib/util/memory/memcpy - br $~lib/util/memory/memmove|inlined.0 - end - local.get $5 - local.get $4 - i32.lt_u - if - local.get $4 - i32.const 7 - i32.and - local.get $5 - i32.const 7 - i32.and - i32.eq - if - 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 - else - local.get $4 - i32.const 7 - i32.and - local.get $5 - i32.const 7 - i32.and - i32.eq - 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 - 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 - end - end - end + 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 (; 10 ;) (param $0 i32) (param $1 i32) + (func $assembly/index/hashBlocks (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1783,109 +1773,151 @@ (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 - 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 + (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) + (local $39 i32) + (local $40 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 + if + local.get $0 + local.set $13 + global.get $assembly/index/i + local.set $14 + 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 + local.set $15 + local.get $13 + local.get $14 i32.const 2 i32.shl i32.add - local.get $6 + local.get $15 i32.store global.get $assembly/index/i i32.const 1 @@ -1900,95 +1932,111 @@ global.get $assembly/index/i i32.const 64 i32.lt_u - local.set $2 - 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 - local.set $7 - local.get $3 - local.get $7 - i32.const 2 - i32.shl - 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 - i32.xor - local.get $0 - 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 + local.set $26 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.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 - i32.const 3 - i32.shr_u - i32.xor + local.set $27 + block $assembly/index/SIG1|inlined.0 (result i32) + block $assembly/index/load32|inlined.0 (result i32) + local.get $0 + local.set $16 + global.get $assembly/index/i + i32.const 2 + 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.0 + end + local.set $18 + local.get $18 + i32.const 17 + i32.rotr + local.get $18 + i32.const 19 + i32.rotr + i32.xor + local.get $18 + 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 $19 + global.get $assembly/index/i + i32.const 7 + i32.sub + local.set $20 + local.get $19 + local.get $20 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.1 + end i32.add - local.get $0 - local.set $4 - global.get $assembly/index/i - i32.const 16 - i32.sub - local.set $3 - local.get $4 - local.get $3 - i32.const 2 - i32.shl + block $assembly/index/SIG0|inlined.0 (result i32) + block $assembly/index/load32|inlined.2 (result i32) + local.get $0 + local.set $21 + global.get $assembly/index/i + i32.const 15 + 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.2 + end + local.set $23 + local.get $23 + i32.const 7 + i32.rotr + local.get $23 + i32.const 18 + i32.rotr + i32.xor + local.get $23 + i32.const 3 + i32.shr_u + i32.xor + br $assembly/index/SIG0|inlined.0 + end i32.add - i32.load + block $assembly/index/load32|inlined.3 (result i32) + local.get $0 + local.set $24 + global.get $assembly/index/i + i32.const 16 + i32.sub + local.set $25 + local.get $24 + local.get $25 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.3 + end i32.add - local.set $5 - local.get $11 - local.get $10 + local.set $28 + local.get $26 + local.get $27 i32.const 2 i32.shl i32.add - local.get $5 + local.get $28 i32.store global.get $assembly/index/i i32.const 1 @@ -2003,93 +2051,109 @@ 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 + block $assembly/index/EP1|inlined.0 (result i32) + global.get $assembly/index/e + local.set $29 + local.get $29 + i32.const 6 + i32.rotr + local.get $29 + i32.const 11 + i32.rotr + i32.xor + local.get $29 + i32.const 25 + i32.rotr + i32.xor + br $assembly/index/EP1|inlined.0 + end i32.add - i32.load + block $assembly/index/CH|inlined.0 (result i32) + global.get $assembly/index/e + local.set $30 + global.get $assembly/index/f + local.set $31 + global.get $assembly/index/g + local.set $32 + local.get $30 + local.get $31 + i32.and + local.get $30 + i32.const -1 + i32.xor + local.get $32 + i32.and + i32.xor + br $assembly/index/CH|inlined.0 + end i32.add - local.get $0 - local.set $10 - global.get $assembly/index/i - local.set $5 - local.get $10 - local.get $5 - i32.const 2 - i32.shl + block $assembly/index/load32|inlined.4 (result i32) + global.get $assembly/index/kPtr + local.set $33 + global.get $assembly/index/i + local.set $34 + local.get $33 + local.get $34 + i32.const 2 + i32.shl + i32.add + i32.load + br $assembly/index/load32|inlined.4 + end i32.add - i32.load + block $assembly/index/load32|inlined.5 (result i32) + local.get $0 + local.set $35 + global.get $assembly/index/i + local.set $36 + local.get $35 + local.get $36 + 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 $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 $37 + local.get $37 + i32.const 2 + i32.rotr + local.get $37 + i32.const 13 + i32.rotr + i32.xor + local.get $37 + 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 $38 + global.get $assembly/index/b + local.set $39 + global.get $assembly/index/c + local.set $40 + local.get $38 + local.get $39 + i32.and + local.get $38 + local.get $40 + i32.and + i32.xor + local.get $39 + local.get $40 + i32.and + i32.xor + br $assembly/index/MAJ|inlined.0 + end i32.add global.set $assembly/index/t2 global.get $assembly/index/g @@ -2152,10 +2216,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 +2240,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 +2270,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 +2294,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 +2324,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 +2333,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 +2361,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 +2389,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 +2435,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 +2459,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 +2498,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 +2516,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 +2568,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 +2688,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 +2721,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.6 (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.6 + 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 +2872,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 +2904,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/package.json b/packages/as-sha256/package.json index 93c50457..30a6194e 100644 --- a/packages/as-sha256/package.json +++ b/packages/as-sha256/package.json @@ -28,28 +28,23 @@ "build" ], "scripts": { - "clean": "rm -rf ./dist && node -r ts-node/register ./scripts/codegen.ts", + "generate": "rm -rf ./dist && node -r ts-node/register ./scripts/codegen.ts", "build": "yarn asbuild:untouched && yarn asbuild:optimized && yarn build:lib", - "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --runtime none --validate --debug", - "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat --runtime none --validate -O3z --noAssert", + "asbuild:untouched": "asc assembly/index.ts -o build/untouched.wasm -t build/untouched.wat --runtime minimal --target debug", + "asbuild:optimized": "asc assembly/index.ts -o build/optimized.wasm -t build/optimized.wat --runtime minimal --target release -O3z --noAssert", "build:lib": "run -T tsc -p tsconfig.build.json", "build:web": "run -T webpack --mode production --entry ./index.js --output ./dist/as-sha256.min.js", - "test": "yarn run test:as-ci && yarn run test:unit", + "test": "yarn run test:unit", "test:unit": "yarn run test:unit:node && yarn run test:unit:browser", "test:unit:node": "run -T mocha -r ts-node/register test/unit/*.test.ts", "test:unit:browser": "run -T karma start --single-run --browsers ChromeHeadless,FirefoxHeadless karma.config.js", "benchmark": "node -r ts-node/register ./node_modules/.bin/benchmark 'test/perf/index.test.ts'", "benchmark:local": "yarn benchmark --local", - "test:ci": "yarn test:as-ci", - "test:as": "asp --nortrace --verbose", - "test:as-ci": "asp --nortrace 2> /dev/null" + "test:ci": "yarn test:as-ci" }, "devDependencies": { - "@as-pect/assembly": "2.8.1", - "@as-pect/cli": "2.8.1", - "@as-pect/core": "2.8.1", "@chainsafe/babel-plugin-inline-binary-import": "^1.0.3", - "assemblyscript": "0.9.2", + "assemblyscript": "^0.27.24", "benchmark": "^2.1.4" } } diff --git a/packages/as-sha256/src/wasmCode.ts b/packages/as-sha256/src/wasmCode.ts index 102d56e6..5b06b4c3 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,37,7,96,2,127,127,0,96,1,127,1,127,96,1,127,0,96,2,127,127,1,127,96,0,0,96,4,127,127,127,127,0,96,3,127,127,126,0,2,13,1,3,101,110,118,5,97,98,111,114,116,0,5,3,20,19,0,0,0,0,0,6,1,3,3,1,4,0,0,1,2,2,2,0,4,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,12,73,78,80,85,84,95,76,69,78,71,84,72,3,0,5,105,110,112,117,116,3,29,6,111,117,116,112,117,116,3,31,4,105,110,105,116,0,11,6,117,112,100,97,116,101,0,13,5,102,105,110,97,108,0,15,6,100,105,103,101,115,116,0,16,8,100,105,103,101,115,116,54,52,0,18,6,109,101,109,111,114,121,2,0,8,1,19,12,1,18,10,209,22,19,9,0,32,0,32,1,54,2,0,11,9,0,32,0,32,1,54,2,4,11,9,0,32,0,32,1,54,2,8,11,192,1,1,4,127,32,1,40,2,0,65,124,113,34,3,65,128,2,73,4,127,32,3,65,4,118,5,65,31,65,252,255,255,255,3,32,3,32,3,65,252,255,255,255,3,79,27,34,3,103,107,34,4,65,7,107,33,2,32,3,32,4,65,4,107,118,65,16,115,11,33,3,32,1,40,2,8,33,5,32,1,40,2,4,34,4,4,64,32,4,32,5,16,3,11,32,5,4,64,32,5,32,4,16,2,11,32,1,32,0,32,2,65,4,116,32,3,106,65,2,116,106,34,1,40,2,96,70,4,64,32,1,32,5,54,2,96,32,5,69,4,64,32,0,32,2,65,2,116,106,34,1,40,2,4,65,126,32,3,119,113,33,3,32,1,32,3,54,2,4,32,3,69,4,64,32,0,32,0,40,2,0,65,126,32,2,119,113,16,1,11,11,11,11,181,2,1,5,127,32,1,40,2,0,33,3,32,1,65,4,106,32,1,40,2,0,65,124,113,106,34,4,40,2,0,34,2,65,1,113,4,64,32,0,32,4,16,4,32,1,32,3,65,4,106,32,2,65,124,113,106,34,3,16,1,32,1,65,4,106,32,1,40,2,0,65,124,113,106,34,4,40,2,0,33,2,11,32,3,65,2,113,4,64,32,1,65,4,107,40,2,0,34,1,40,2,0,33,6,32,0,32,1,16,4,32,1,32,6,65,4,106,32,3,65,124,113,106,34,3,16,1,11,32,4,32,2,65,2,114,16,1,32,4,65,4,107,32,1,54,2,0,32,0,32,3,65,124,113,34,2,65,128,2,73,4,127,32,2,65,4,118,5,65,31,65,252,255,255,255,3,32,2,32,2,65,252,255,255,255,3,79,27,34,2,103,107,34,3,65,7,107,33,5,32,2,32,3,65,4,107,118,65,16,115,11,34,2,32,5,65,4,116,106,65,2,116,106,40,2,96,33,3,32,1,65,0,16,2,32,1,32,3,16,3,32,3,4,64,32,3,32,1,16,2,11,32,0,32,5,65,4,116,32,2,106,65,2,116,106,32,1,54,2,96,32,0,32,0,40,2,0,65,1,32,5,116,114,16,1,32,0,32,5,65,2,116,106,34,0,32,0,40,2,4,65,1,32,2,116,114,54,2,4,11,130,1,1,3,127,32,1,65,19,106,65,112,113,65,4,107,33,1,32,0,40,2,160,12,34,3,4,64,32,3,32,1,65,16,107,34,5,70,4,64,32,3,40,2,0,33,4,32,5,33,1,11,11,32,2,167,65,112,113,32,1,107,34,3,65,20,73,4,64,15,11,32,1,32,4,65,2,113,32,3,65,8,107,34,3,65,1,114,114,16,1,32,1,65,0,16,2,32,1,65,0,16,3,32,1,65,4,106,32,3,106,34,3,65,2,16,1,32,0,32,3,54,2,160,12,32,0,32,1,16,5,11,29,0,32,0,65,1,65,27,32,0,103,107,116,106,65,1,107,32,0,32,0,65,254,255,255,255,1,73,27,11,142,1,1,2,127,32,1,65,128,2,73,4,127,32,1,65,4,118,5,65,31,32,1,16,7,34,1,103,107,34,3,65,7,107,33,2,32,1,32,3,65,4,107,118,65,16,115,11,33,1,32,0,32,2,65,2,116,106,40,2,4,65,127,32,1,116,113,34,1,4,127,32,0,32,1,104,32,2,65,4,116,106,65,2,116,106,40,2,96,5,32,0,40,2,0,65,127,32,2,65,1,106,116,113,34,1,4,127,32,0,32,0,32,1,104,34,0,65,2,116,106,40,2,4,104,32,0,65,4,116,106,65,2,116,106,40,2,96,5,65,0,11,11,11,148,2,1,3,127,32,1,65,252,255,255,255,3,75,4,64,65,176,14,65,176,15,65,205,3,65,29,16,0,0,11,32,0,65,12,32,1,65,19,106,65,112,113,65,4,107,32,1,65,12,77,27,34,1,16,8,34,2,69,4,64,32,1,65,128,2,79,4,127,32,1,16,7,5,32,1,11,33,2,63,0,34,3,32,2,65,4,32,0,40,2,160,12,32,3,65,16,116,65,4,107,71,116,106,65,255,255,3,106,65,128,128,124,113,65,16,118,34,2,32,2,32,3,72,27,64,0,65,0,72,4,64,32,2,64,0,65,0,72,4,64,0,11,11,32,0,32,3,65,16,116,63,0,172,66,16,134,16,6,32,0,32,1,16,8,33,2,11,32,2,40,2,0,26,32,0,32,2,16,4,32,2,40,2,0,34,3,65,124,113,32,1,107,34,4,65,16,79,4,64,32,2,32,1,32,3,65,2,113,114,16,1,32,2,65,4,106,32,1,106,34,1,32,4,65,4,107,65,1,114,16,1,32,0,32,1,16,5,5,32,2,32,3,65,126,113,16,1,32,2,65,4,106,32,2,40,2,0,65,124,113,106,34,0,32,0,40,2,0,65,125,113,16,1,11,32,2,11,169,2,1,3,127,32,0,65,252,255,255,255,3,75,4,64,65,192,13,65,240,13,65,52,65,43,16,0,0,11,32,0,65,236,255,255,255,3,75,4,64,65,176,14,65,240,14,65,253,0,65,30,16,0,0,11,35,22,69,4,64,63,0,34,2,65,0,76,4,127,65,1,32,2,107,64,0,65,0,72,5,65,0,11,4,64,0,11,65,128,16,65,0,16,1,65,160,28,65,0,54,2,0,3,64,32,1,65,23,73,4,64,32,1,65,2,116,65,128,16,106,65,0,54,2,4,65,0,33,2,3,64,32,2,65,16,73,4,64,32,1,65,4,116,32,2,106,65,2,116,65,128,16,106,65,0,54,2,96,32,2,65,1,106,33,2,12,1,11,11,32,1,65,1,106,33,1,12,1,11,11,65,128,16,65,164,28,63,0,172,66,16,134,16,6,65,128,16,36,22,11,35,22,32,0,65,16,106,16,9,34,2,65,1,54,2,12,32,2,32,0,54,2,16,35,23,34,3,40,2,8,33,1,32,2,32,3,16,2,32,2,32,1,16,3,32,1,32,2,32,1,40,2,4,65,3,113,114,16,2,32,3,32,2,16,3,35,24,32,2,40,2,0,65,124,113,65,4,106,106,36,24,32,2,65,20,106,34,1,65,0,32,0,252,11,0,32,1,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,33,65,0,36,34,11,227,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,34,2,106,32,1,32,2,65,3,106,106,45,0,0,32,1,32,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,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,34,1,106,40,2,0,32,1,35,1,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,12,34,1,35,13,34,2,113,32,1,35,11,34,1,113,32,1,32,2,113,115,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,174,1,1,2,127,35,34,32,1,106,36,34,35,33,4,64,65,192,0,35,33,107,34,2,32,1,76,4,64,35,26,35,33,106,32,0,32,2,252,10,0,0,35,33,32,2,106,36,33,65,192,0,35,33,107,33,2,32,1,65,192,0,35,33,107,107,33,1,35,28,35,26,16,12,65,0,36,33,5,35,26,35,33,106,32,0,32,1,252,10,0,0,35,33,32,1,106,36,33,15,11,11,3,64,32,3,32,1,65,192,0,109,72,4,64,35,28,32,0,32,2,106,16,12,32,3,65,1,106,33,3,32,2,65,64,107,33,2,12,1,11,11,32,1,65,63,113,34,1,4,64,35,26,35,33,106,32,0,32,2,106,32,1,252,10,0,0,35,33,32,1,106,36,33,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,146,2,1,2,127,35,34,65,63,113,65,63,73,4,64,35,26,35,33,106,65,128,1,58,0,0,35,33,65,1,106,36,33,11,35,34,65,63,113,65,56,79,4,64,35,26,35,33,106,34,1,65,192,0,35,33,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,28,35,26,16,12,65,0,36,33,11,35,34,65,63,113,65,63,79,4,64,35,26,35,33,106,65,128,1,58,0,0,35,33,65,1,106,36,33,11,35,26,35,33,106,34,1,65,56,35,33,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,26,35,34,65,128,128,128,128,2,109,16,14,54,2,56,35,26,35,34,65,3,116,16,14,54,2,60,35,28,35,26,16,12,32,0,35,3,16,14,54,2,0,32,0,35,4,16,14,54,2,4,32,0,35,5,16,14,54,2,8,32,0,35,6,16,14,54,2,12,32,0,35,7,16,14,54,2,16,32,0,35,8,16,14,54,2,20,32,0,35,9,16,14,54,2,24,32,0,35,10,16,14,54,2,28,11,14,0,16,11,35,30,32,0,16,13,35,32,16,15,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,12,34,2,35,13,34,1,113,32,2,35,11,34,2,113,32,1,32,2,113,115,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,86,0,16,11,35,28,32,0,16,12,35,2,16,17,32,1,35,3,16,14,54,2,0,32,1,35,4,16,14,54,2,4,32,1,35,5,16,14,54,2,8,32,1,35,6,16,14,54,2,12,32,1,35,7,16,14,54,2,16,32,1,35,8,16,14,54,2,20,32,1,35,9,16,14,54,2,24,32,1,35,10,16,14,54,2,28,11,82,0,65,196,10,40,2,0,36,1,65,148,13,40,2,0,36,2,65,224,15,65,224,15,16,2,65,224,15,65,224,15,16,3,65,224,15,36,23,65,192,0,16,10,36,25,35,25,36,26,65,128,2,16,10,36,27,35,27,36,28,65,128,4,16,10,36,29,35,29,36,30,65,32,16,10,36,31,35,31,36,32,11,11,253,6,18,0,65,140,8,11,2,28,1,0,65,152,8,11,136,2,1,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,172,10,11,1,44,0,65,184,10,11,21,4,0,0,0,16,0,0,0,32,4,0,0,32,4,0,0,0,1,0,0,64,0,65,220,10,11,2,28,1,0,65,232,10,11,136,2,1,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,252,12,11,1,44,0,65,136,13,11,21,4,0,0,0,16,0,0,0,112,5,0,0,112,5,0,0,0,1,0,0,64,0,65,172,13,11,1,44,0,65,184,13,11,35,2,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,220,13,11,1,60,0,65,232,13,11,45,2,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,0,65,156,14,11,1,60,0,65,168,14,11,47,2,0,0,0,40,0,0,0,65,0,108,0,108,0,111,0,99,0,97,0,116,0,105,0,111,0,110,0,32,0,116,0,111,0,111,0,32,0,108,0,97,0,114,0,103,0,101,0,65,220,14,11,1,60,0,65,232,14,11,37,2,0,0,0,30,0,0,0,126,0,108,0,105,0,98,0,47,0,114,0,116,0,47,0,116,0,99,0,109,0,115,0,46,0,116,0,115,0,65,156,15,11,1,60,0,65,168,15,11,37,2,0,0,0,30,0,0,0,126,0,108,0,105,0,98,0,47,0,114,0,116,0,47,0,116,0,108,0,115,0,102,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..dfcd296e 100644 --- a/packages/as-sha256/test/perf/index.test.ts +++ b/packages/as-sha256/test/perf/index.test.ts @@ -1,12 +1,16 @@ -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 28.82303 ops/s 34.69448 ms/op x1.002 1715 runs 60.0 s +// ✓ digest64 50023 times 27.30382 ops/s 36.62491 ms/op x1.003 1625 runs 60.0 s +// ✓ digest 50023 times 27.31207 ops/s 36.61385 ms/op x0.999 1624 runs 60.0 s describe("digestTwoHashObjects vs digest64 vs digest", () => { + setBenchOpts({ + minMs: 60000, + }); + const input = Buffer.from("gajindergajindergajindergajindergajindergajindergajindergajinder", "utf8"); const input1 = "gajindergajindergajindergajinder"; const input2 = "gajindergajindergajindergajinder"; diff --git a/yarn.lock b/yarn.lock index d7a77ab5..96c2eb19 100644 --- a/yarn.lock +++ b/yarn.lock @@ -76,42 +76,6 @@ __metadata: languageName: node linkType: hard -"@as-pect/assembly@npm:2.8.1, @as-pect/assembly@npm:^2.8.1": - version: 2.8.1 - resolution: "@as-pect/assembly@npm:2.8.1" - checksum: af0b6ce001f868d57f26ae587b2957d415553d7e7dbc2fadb9f88897c8a7839e3c595fca07918d4d49ab76d4762d121514869ed7f3b096a064fbfcdd24aa33fc - languageName: node - linkType: hard - -"@as-pect/cli@npm:2.8.1": - version: 2.8.1 - resolution: "@as-pect/cli@npm:2.8.1" - dependencies: - "@as-pect/assembly": ^2.8.1 - "@as-pect/core": ^2.8.1 - chalk: ^3.0.0 - glob: ^7.1.6 - bin: - asp: bin/asp - checksum: f7f3ac8ca36e7c2f3ef9704130c0d8cfaaf80afc12b6c6b9754cc6ac33a31f0bcac9fddb2a9720bb5814e80121f3201c83ccaed1342f722a19cc12df7b721741 - languageName: node - linkType: hard - -"@as-pect/core@npm:2.8.1, @as-pect/core@npm:^2.8.1": - version: 2.8.1 - resolution: "@as-pect/core@npm:2.8.1" - dependencies: - "@as-pect/assembly": ^2.8.1 - chalk: ^3.0.0 - csv-stringify: ^5.3.6 - long: ^4.0.0 - dependenciesMeta: - csv-stringify: - optional: true - checksum: be01e02c7578c768faf53c8566a88aeceba280be78beaa08645e523396cf4a8efb03bdb09800686a104f970216371e98b6d68a8c7e740034a93b64011842f6d1 - languageName: node - linkType: hard - "@azure/abort-controller@npm:^1.0.0": version: 1.0.4 resolution: "@azure/abort-controller@npm:1.0.4" @@ -1628,11 +1592,8 @@ __metadata: version: 0.0.0-use.local resolution: "@chainsafe/as-sha256@workspace:packages/as-sha256" dependencies: - "@as-pect/assembly": 2.8.1 - "@as-pect/cli": 2.8.1 - "@as-pect/core": 2.8.1 "@chainsafe/babel-plugin-inline-binary-import": ^1.0.3 - assemblyscript: 0.9.2 + assemblyscript: ^0.27.24 benchmark: ^2.1.4 languageName: unknown linkType: soft @@ -3309,16 +3270,16 @@ __metadata: languageName: node linkType: hard -"assemblyscript@npm:0.9.2": - version: 0.9.2 - resolution: "assemblyscript@npm:0.9.2" +"assemblyscript@npm:^0.27.24": + version: 0.27.24 + resolution: "assemblyscript@npm:0.27.24" dependencies: - binaryen: 90.0.0-nightly.20200214 - long: ^4.0.0 + binaryen: 116.0.0-nightly.20240114 + long: ^5.2.1 bin: - asc: bin/asc - asinit: bin/asinit - checksum: 192edb9604596def901fcfd4ef89880a5d3f3920b617028fb0216510165ef3b545ac74f01b2573f68a4d0bd4c5bb6eb98ca16a0c1a8ecee6fa73898ff8c77b76 + asc: bin/asc.js + asinit: bin/asinit.js + checksum: ce63dbf855f8811cfb67d2fa2d142baab36191e64d798c0069ab61f25fa09b9d06fb21f7a41c8d31d1b62d9b2d2398d9486a3107d9993b48f79fc38e29f58c10 languageName: node linkType: hard @@ -3623,12 +3584,13 @@ __metadata: languageName: node linkType: hard -"binaryen@npm:90.0.0-nightly.20200214": - version: 90.0.0-nightly.20200214 - resolution: "binaryen@npm:90.0.0-nightly.20200214" +"binaryen@npm:116.0.0-nightly.20240114": + version: 116.0.0-nightly.20240114 + resolution: "binaryen@npm:116.0.0-nightly.20240114" bin: wasm-opt: bin/wasm-opt - checksum: f1f9848610ac775137e67a9c8feeff5ed5376a97b3e1b759c471b31b026f4de1639404a3acc166289306d2003fe873fa0d3fa7c8878d207b8e801dc106249dfe + wasm2js: bin/wasm2js + checksum: 95e14b87c27fef94fb4008dcd63fa61ea66f69bcb179f7f73f56dfb39aed58afec6957ef18acacfce15e4874a0da402b0fc3d47ee392a9b906a97e7634bbbad3 languageName: node linkType: hard @@ -4146,16 +4108,6 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^3.0.0": - version: 3.0.0 - resolution: "chalk@npm:3.0.0" - dependencies: - ansi-styles: ^4.1.0 - supports-color: ^7.1.0 - checksum: ee650b0a065b3d7a6fda258e75d3a86fc8e4effa55871da730a9e42ccb035bf5fd203525e5a1ef45ec2582ecc4f65b47eb11357c526b84dd29a14fb162c414d2 - languageName: node - linkType: hard - "chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.2": version: 4.1.2 resolution: "chalk@npm:4.1.2" @@ -4903,7 +4855,7 @@ __metadata: languageName: node linkType: hard -"csv-stringify@npm:^5.3.6, csv-stringify@npm:^5.6.2": +"csv-stringify@npm:^5.6.2": version: 5.6.5 resolution: "csv-stringify@npm:5.6.5" checksum: 125194dcf24a94e9c03eb53b3bc4b79cc6611747e73fe3c0e8a342a9f385caeb4e88c0827e89a4c508b45ea99bdc64a339b487f80048a50fabcbb3a7d87ea1a9 @@ -8585,10 +8537,10 @@ __metadata: languageName: node linkType: hard -"long@npm:^4.0.0": - version: 4.0.0 - resolution: "long@npm:4.0.0" - checksum: 50a6417d15b06104dbe4e3d4a667c39b137f130a9108ea8752b352a4cfae047531a3ac351c181792f3f8768fe17cca6b0f406674a541a86fb638aaac560d83ed +"long@npm:^5.2.1": + version: 5.2.3 + resolution: "long@npm:5.2.3" + checksum: 6a0da658f5ef683b90330b1af76f06790c623e148222da9d75b60e266bbf88f803232dd21464575681638894a84091616e7f89557aa087fd14116c0f4e0e43d9 languageName: node linkType: hard