From 0c537c3363a26449bf0c0480e1e8c61cac5491e3 Mon Sep 17 00:00:00 2001 From: dcode Date: Sat, 9 Mar 2019 02:04:08 +0100 Subject: [PATCH] test a few things --- std/assembly/internal/runtime.ts | 20 +- tests/compiler/std/gc-integration.ts | 2 - .../compiler/std/gc-integration.untouched.wat | 12 - tests/compiler/std/runtime.optimized.wat | 3002 +++++++++++++ tests/compiler/std/runtime.ts | 60 + tests/compiler/std/runtime.untouched.wat | 3733 +++++++++++++++++ 6 files changed, 6803 insertions(+), 26 deletions(-) create mode 100644 tests/compiler/std/runtime.optimized.wat create mode 100644 tests/compiler/std/runtime.ts create mode 100644 tests/compiler/std/runtime.untouched.wat diff --git a/std/assembly/internal/runtime.ts b/std/assembly/internal/runtime.ts index 3841fd8b..a979094a 100644 --- a/std/assembly/internal/runtime.ts +++ b/std/assembly/internal/runtime.ts @@ -25,7 +25,7 @@ export class HEADER { /** Magic value used to validate common runtime headers. */ @inline export const HEADER_MAGIC: u32 = 0xA55E4B17; -/** Aligns an allocation to actual block size. */ +/** Aligns an allocation to actual block size. Primarily targets TLSF. */ export function ALIGN(payloadSize: usize): usize { // round up to power of 2, e.g. with HEADER_SIZE=8: // 0 -> 2^3 = 8 @@ -36,14 +36,6 @@ export function ALIGN(payloadSize: usize): usize { return 1 << (32 - clz(payloadSize + HEADER_SIZE - 1)); } -/** Gets to the common runtime header of the specified reference. */ -export function UNREF(ref: usize): HEADER { - assert(ref >= HEAP_BASE + HEADER_SIZE); // must be a heap object - var header = changetype
(ref - HEADER_SIZE); - assert(header.classId == HEADER_MAGIC); // must be unregistered - return header; -} - /** Allocates a new object and returns a pointer to its payload. */ export function ALLOC(payloadSize: u32): usize { var header = changetype
(memory.allocate(ALIGN(payloadSize))); @@ -60,7 +52,7 @@ export function ALLOC(payloadSize: u32): usize { /** Reallocates an object if necessary. Returns a pointer to its (moved) payload. */ export function REALLOC(ref: usize, newPayloadSize: u32): usize { - var header = UNREF(ref); + var header = changetype
(ref - HEADER_SIZE); var payloadSize = header.payloadSize; if (payloadSize < newPayloadSize) { let newAlignedSize = ALIGN(newPayloadSize); @@ -93,13 +85,17 @@ export function REALLOC(ref: usize, newPayloadSize: u32): usize { /** Frees an object. Must not have been registered with GC yet. */ export function FREE(ref: usize): void { - var header = UNREF(ref); + assert(ref >= HEAP_BASE + HEADER_SIZE); // must be a heap object + var header = changetype
(ref - HEADER_SIZE); + assert(header.classId == HEADER_MAGIC); // must be unregistered memory.free(changetype(header)); } /** Registers a managed object with GC. Cannot be changed anymore afterwards. */ export function REGISTER(ref: usize, parentRef: usize): void { - var header = UNREF(ref); + assert(ref >= HEAP_BASE + HEADER_SIZE); // must be a heap object + var header = changetype
(ref - HEADER_SIZE); + assert(header.classId == HEADER_MAGIC); // must be unregistered header.classId = __rt_classid(); if (GC) __REGISTER_IMPL(ref, parentRef); // tslint:disable-line } diff --git a/tests/compiler/std/gc-integration.ts b/tests/compiler/std/gc-integration.ts index 2510e497..f8963875 100644 --- a/tests/compiler/std/gc-integration.ts +++ b/tests/compiler/std/gc-integration.ts @@ -17,5 +17,3 @@ var b_ref: B = changetype(32); // global root, non-nullable var i: i32 = 0; __rt_iterateroots((ref: usize): void => { assert(ref == ++i << 3); }); assert(i == 4); - -assert(__rt_classid() != __rt_classid()); diff --git a/tests/compiler/std/gc-integration.untouched.wat b/tests/compiler/std/gc-integration.untouched.wat index 3257d456..7bd4f80b 100644 --- a/tests/compiler/std/gc-integration.untouched.wat +++ b/tests/compiler/std/gc-integration.untouched.wat @@ -58,18 +58,6 @@ call $~lib/env/abort unreachable end - i32.const 43 - i32.const 44 - i32.ne - i32.eqz - if - i32.const 0 - i32.const 8 - i32.const 21 - i32.const 0 - call $~lib/env/abort - unreachable - end ) (func $start (; 3 ;) (type $FUNCSIG$v) call $start:std/gc-integration diff --git a/tests/compiler/std/runtime.optimized.wat b/tests/compiler/std/runtime.optimized.wat new file mode 100644 index 00000000..8f243117 --- /dev/null +++ b/tests/compiler/std/runtime.optimized.wat @@ -0,0 +1,3002 @@ +(module + (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) + (type $FUNCSIG$v (func)) + (type $FUNCSIG$ii (func (param i32) (result i32))) + (type $FUNCSIG$viiddddd (func (param i32 i32 f64 f64 f64 f64 f64))) + (type $FUNCSIG$vii (func (param i32 i32))) + (type $FUNCSIG$viii (func (param i32 i32 i32))) + (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) + (type $FUNCSIG$vi (func (param i32))) + (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64))) + (memory $0 1) + (data (i32.const 8) "\16\00\00\00~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s") + (data (i32.const 56) "\0e\00\00\00s\00t\00d\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s") + (data (i32.const 88) "\08\00\00\00b\00a\00r\00r\00i\00e\00r\001") + (data (i32.const 112) "\08\00\00\00b\00a\00r\00r\00i\00e\00r\002") + (data (i32.const 136) "\08\00\00\00b\00a\00r\00r\00i\00e\00r\003") + (data (i32.const 160) "\18\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s") + (table $0 1 funcref) + (elem (i32.const 0) $null) + (global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0)) + (global $std/runtime/barrier1 (mut i32) (i32.const 0)) + (global $std/runtime/barrier2 (mut i32) (i32.const 0)) + (global $std/runtime/barrier3 (mut i32) (i32.const 0)) + (global $std/runtime/ref1 (mut i32) (i32.const 0)) + (global $std/runtime/header1 (mut i32) (i32.const 0)) + (global $std/runtime/ref2 (mut i32) (i32.const 0)) + (global $std/runtime/header2 (mut i32) (i32.const 0)) + (global $std/runtime/ref3 (mut i32) (i32.const 0)) + (global $std/runtime/ref4 (mut i32) (i32.const 0)) + (global $std/runtime/called (mut i32) (i32.const 0)) + (export "memory" (memory $0)) + (export "table" (table $0)) + (start $start) + (func $~lib/allocator/tlsf/Root#setSLMap (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + local.get $1 + i32.const 22 + i32.ge_u + if + i32.const 0 + i32.const 8 + i32.const 144 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.const 2 + i32.shl + local.get $0 + i32.add + local.get $2 + i32.store offset=4 + ) + (func $~lib/allocator/tlsf/Root#setHead (; 3 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + local.get $1 + i32.const 22 + i32.ge_u + if + i32.const 0 + i32.const 8 + i32.const 167 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const 32 + i32.ge_u + if + i32.const 0 + i32.const 8 + i32.const 168 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.const 5 + i32.shl + local.get $2 + i32.add + i32.const 2 + i32.shl + local.get $0 + i32.add + local.get $3 + i32.store offset=96 + ) + (func $~lib/allocator/tlsf/Block#get:right (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.load + i32.const -4 + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 89 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 8 + i32.add + local.get $0 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $0 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 90 + i32.const 11 + call $~lib/env/abort + unreachable + end + local.get $0 + ) + (func $~lib/allocator/tlsf/fls (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 428 + i32.const 2 + call $~lib/env/abort + unreachable + end + i32.const 31 + local.get $0 + i32.clz + i32.sub + ) + (func $~lib/allocator/tlsf/Root#getHead (; 6 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $1 + i32.const 22 + i32.ge_u + if + i32.const 0 + i32.const 8 + i32.const 158 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const 32 + i32.ge_u + if + i32.const 0 + i32.const 8 + i32.const 159 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.const 5 + i32.shl + local.get $2 + i32.add + i32.const 2 + i32.shl + local.get $0 + i32.add + i32.load offset=96 + ) + (func $~lib/allocator/tlsf/Root#getSLMap (; 7 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + local.get $1 + i32.const 22 + i32.ge_u + if + i32.const 0 + i32.const 8 + i32.const 138 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.const 2 + i32.shl + local.get $0 + i32.add + i32.load offset=4 + ) + (func $~lib/allocator/tlsf/Root#remove (; 8 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.tee $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 258 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const -4 + i32.and + local.tee $3 + i32.const 16 + i32.ge_u + local.tee $2 + if + local.get $3 + i32.const 1073741824 + i32.lt_u + local.set $2 + end + local.get $2 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 260 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $3 + i32.const 256 + i32.lt_u + if (result i32) + local.get $3 + i32.const 8 + i32.div_u + local.set $3 + i32.const 0 + else + local.get $3 + local.get $3 + call $~lib/allocator/tlsf/fls + local.tee $4 + i32.const 5 + i32.sub + i32.shr_u + i32.const 32 + i32.xor + local.set $3 + local.get $4 + i32.const 7 + i32.sub + end + local.set $4 + local.get $1 + i32.load offset=8 + local.set $2 + local.get $1 + i32.load offset=4 + local.tee $5 + if + local.get $5 + local.get $2 + i32.store offset=8 + end + local.get $2 + if + local.get $2 + local.get $5 + i32.store offset=4 + end + local.get $0 + local.get $4 + local.get $3 + call $~lib/allocator/tlsf/Root#getHead + local.get $1 + i32.eq + if + local.get $0 + local.get $4 + local.get $3 + local.get $2 + call $~lib/allocator/tlsf/Root#setHead + local.get $2 + i32.eqz + if + local.get $0 + local.get $4 + local.get $0 + local.get $4 + call $~lib/allocator/tlsf/Root#getSLMap + i32.const 1 + local.get $3 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $2 + call $~lib/allocator/tlsf/Root#setSLMap + local.get $2 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/allocator/tlsf/Block#get:left (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.load + i32.const 2 + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 81 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 4 + i32.sub + i32.load + local.tee $0 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 82 + i32.const 11 + call $~lib/env/abort + unreachable + end + local.get $0 + ) + (func $~lib/allocator/tlsf/Root#setJump (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 334 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + call $~lib/allocator/tlsf/Block#get:right + local.get $1 + i32.ne + if + i32.const 0 + i32.const 8 + i32.const 335 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.load + i32.const 2 + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 336 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.const 4 + i32.sub + local.get $0 + i32.store + ) + (func $~lib/allocator/tlsf/Root#insert (; 11 ;) (type $FUNCSIG$vii) (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.eqz + if + i32.const 0 + i32.const 8 + i32.const 189 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.load + local.tee $5 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 191 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.load + i32.const -4 + i32.and + local.tee $3 + i32.const 16 + i32.ge_u + local.tee $2 + if + local.get $3 + i32.const 1073741824 + i32.lt_u + local.set $2 + end + local.get $2 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 193 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + call $~lib/allocator/tlsf/Block#get:right + local.tee $2 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 197 + i32.const 23 + call $~lib/env/abort + unreachable + end + local.get $2 + local.tee $3 + i32.load + local.tee $6 + i32.const 1 + i32.and + if + local.get $0 + local.get $3 + call $~lib/allocator/tlsf/Root#remove + local.get $1 + local.get $6 + i32.const -4 + i32.and + i32.const 8 + i32.add + local.get $5 + i32.add + local.tee $5 + i32.store + local.get $1 + call $~lib/allocator/tlsf/Block#get:right + local.tee $3 + i32.load + local.set $6 + end + local.get $5 + i32.const 2 + i32.and + if + local.get $1 + call $~lib/allocator/tlsf/Block#get:left + local.tee $2 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 211 + i32.const 24 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.load + local.tee $4 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 213 + i32.const 6 + call $~lib/env/abort + unreachable + end + local.get $0 + local.get $2 + call $~lib/allocator/tlsf/Root#remove + local.get $2 + local.get $5 + i32.const -4 + i32.and + i32.const 8 + i32.add + local.get $4 + i32.add + local.tee $4 + i32.store + local.get $4 + local.set $5 + local.get $2 + local.set $1 + end + local.get $3 + local.get $6 + i32.const 2 + i32.or + i32.store + local.get $1 + local.get $3 + call $~lib/allocator/tlsf/Root#setJump + local.get $5 + i32.const -4 + i32.and + local.tee $3 + i32.const 16 + i32.ge_u + local.tee $4 + if + local.get $3 + i32.const 1073741824 + i32.lt_u + local.set $4 + end + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 226 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + local.get $3 + i32.const 256 + i32.lt_u + if (result i32) + local.get $3 + i32.const 8 + i32.div_u + local.set $4 + i32.const 0 + else + local.get $3 + local.get $3 + call $~lib/allocator/tlsf/fls + local.tee $2 + i32.const 5 + i32.sub + i32.shr_u + i32.const 32 + i32.xor + local.set $4 + local.get $2 + i32.const 7 + i32.sub + end + local.tee $2 + local.get $4 + call $~lib/allocator/tlsf/Root#getHead + local.set $5 + local.get $1 + i32.const 0 + i32.store offset=4 + local.get $1 + local.get $5 + i32.store offset=8 + local.get $5 + if + local.get $5 + local.get $1 + i32.store offset=4 + end + local.get $0 + local.get $2 + local.get $4 + local.get $1 + call $~lib/allocator/tlsf/Root#setHead + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $2 + i32.shl + i32.or + i32.store + local.get $0 + local.get $2 + local.get $0 + local.get $2 + call $~lib/allocator/tlsf/Root#getSLMap + i32.const 1 + local.get $4 + i32.shl + i32.or + call $~lib/allocator/tlsf/Root#setSLMap + ) + (func $~lib/allocator/tlsf/Root#addMemory (; 12 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + local.get $1 + local.get $2 + i32.gt_u + if + i32.const 0 + i32.const 8 + i32.const 377 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.const 7 + i32.and + if + i32.const 0 + i32.const 8 + i32.const 378 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const 7 + i32.and + if + i32.const 0 + i32.const 8 + i32.const 379 + i32.const 4 + call $~lib/env/abort + unreachable + end + i32.const 2912 + i32.load + local.tee $3 + if + local.get $1 + local.get $3 + i32.const 4 + i32.add + i32.lt_u + if + i32.const 0 + i32.const 8 + i32.const 384 + i32.const 6 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.const 8 + i32.sub + local.get $3 + i32.eq + if + local.get $3 + i32.load + local.set $4 + local.get $1 + i32.const 8 + i32.sub + local.set $1 + end + else + local.get $1 + local.get $0 + i32.const 2916 + i32.add + i32.lt_u + if + i32.const 0 + i32.const 8 + i32.const 393 + i32.const 6 + call $~lib/env/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.tee $2 + i32.const 32 + i32.lt_u + if + return + end + local.get $1 + local.get $4 + i32.const 2 + i32.and + local.get $2 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.or + i32.store + local.get $1 + i32.const 0 + i32.store offset=4 + local.get $1 + i32.const 0 + i32.store offset=8 + local.get $1 + local.get $2 + i32.add + i32.const 8 + i32.sub + local.tee $2 + i32.const 2 + i32.store + i32.const 2912 + local.get $2 + i32.store + local.get $0 + local.get $1 + call $~lib/allocator/tlsf/Root#insert + ) + (func $~lib/allocator/tlsf/ffs (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 422 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.ctz + ) + (func $~lib/allocator/tlsf/Root#search (; 14 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $1 + i32.const 16 + i32.ge_u + local.tee $2 + if + local.get $1 + i32.const 1073741824 + i32.lt_u + local.set $2 + end + local.get $2 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 296 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.const 256 + i32.lt_u + if (result i32) + i32.const 0 + local.set $2 + local.get $1 + i32.const 8 + i32.div_u + else + local.get $1 + local.get $1 + call $~lib/allocator/tlsf/fls + local.tee $2 + i32.const 5 + i32.sub + i32.shr_u + i32.const 32 + i32.xor + local.set $1 + local.get $2 + i32.const 7 + i32.sub + local.set $2 + local.get $1 + i32.const 31 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + i32.add + else + local.get $2 + i32.const 1 + i32.add + local.set $2 + i32.const 0 + end + end + local.set $1 + local.get $0 + local.get $2 + call $~lib/allocator/tlsf/Root#getSLMap + i32.const -1 + local.get $1 + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $0 + local.get $2 + local.get $1 + call $~lib/allocator/tlsf/ffs + call $~lib/allocator/tlsf/Root#getHead + else + local.get $0 + i32.load + i32.const -1 + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.tee $2 + if (result i32) + local.get $0 + local.get $2 + call $~lib/allocator/tlsf/ffs + local.tee $2 + call $~lib/allocator/tlsf/Root#getSLMap + local.tee $1 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 323 + i32.const 16 + call $~lib/env/abort + unreachable + end + local.get $0 + local.get $2 + local.get $1 + call $~lib/allocator/tlsf/ffs + call $~lib/allocator/tlsf/Root#getHead + else + i32.const 0 + end + end + ) + (func $~lib/allocator/tlsf/Root#use (; 15 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.tee $4 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 348 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const 16 + i32.ge_u + local.tee $3 + if + local.get $2 + i32.const 1073741824 + i32.lt_u + local.set $3 + end + local.get $3 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 349 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const 7 + i32.and + if + i32.const 0 + i32.const 8 + i32.const 350 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + local.get $1 + call $~lib/allocator/tlsf/Root#remove + local.get $4 + i32.const -4 + i32.and + local.get $2 + i32.sub + local.tee $5 + i32.const 24 + i32.ge_u + if + local.get $1 + local.get $4 + i32.const 2 + i32.and + local.get $2 + i32.or + i32.store + local.get $1 + i32.const 8 + i32.add + local.get $2 + i32.add + local.tee $3 + local.get $5 + i32.const 8 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $3 + call $~lib/allocator/tlsf/Root#insert + else + local.get $1 + local.get $4 + i32.const -2 + i32.and + i32.store + local.get $1 + call $~lib/allocator/tlsf/Block#get:right + local.tee $3 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 368 + i32.const 25 + call $~lib/env/abort + unreachable + end + local.get $3 + local.get $3 + i32.load + i32.const -3 + i32.and + i32.store + end + local.get $1 + i32.const 8 + i32.add + ) + (func $~lib/allocator/tlsf/__memory_allocate (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + global.get $~lib/allocator/tlsf/ROOT + local.tee $3 + i32.eqz + if + i32.const 1 + current_memory + local.tee $4 + i32.gt_s + local.tee $1 + if (result i32) + i32.const 1 + local.get $4 + i32.sub + grow_memory + i32.const 0 + i32.lt_s + else + local.get $1 + end + if + unreachable + end + i32.const 216 + local.set $3 + i32.const 216 + global.set $~lib/allocator/tlsf/ROOT + i32.const 2912 + i32.const 0 + i32.store + i32.const 216 + i32.const 0 + i32.store + i32.const 0 + local.set $1 + loop $repeat|0 + local.get $1 + i32.const 22 + i32.lt_u + if + i32.const 216 + local.get $1 + i32.const 0 + call $~lib/allocator/tlsf/Root#setSLMap + i32.const 0 + local.set $2 + loop $repeat|1 + local.get $2 + i32.const 32 + i32.lt_u + if + i32.const 216 + local.get $1 + local.get $2 + i32.const 0 + call $~lib/allocator/tlsf/Root#setHead + local.get $2 + i32.const 1 + i32.add + local.set $2 + br $repeat|1 + end + end + local.get $1 + i32.const 1 + i32.add + local.set $1 + br $repeat|0 + end + end + i32.const 216 + i32.const 3136 + current_memory + i32.const 16 + i32.shl + call $~lib/allocator/tlsf/Root#addMemory + end + local.get $0 + i32.const 1073741824 + i32.gt_u + if + unreachable + end + block (result i32) + local.get $3 + local.get $0 + i32.const 7 + i32.add + i32.const -8 + i32.and + local.tee $2 + i32.const 16 + local.get $2 + i32.const 16 + i32.gt_u + select + local.tee $0 + call $~lib/allocator/tlsf/Root#search + local.tee $1 + i32.eqz + if + current_memory + local.tee $2 + local.get $0 + i32.const 65535 + i32.add + i32.const -65536 + i32.and + i32.const 16 + i32.shr_u + local.tee $4 + local.tee $1 + local.get $2 + local.get $1 + i32.gt_s + select + grow_memory + i32.const 0 + i32.lt_s + if + local.get $4 + grow_memory + i32.const 0 + i32.lt_s + if + unreachable + end + end + local.get $3 + local.get $2 + i32.const 16 + i32.shl + current_memory + i32.const 16 + i32.shl + call $~lib/allocator/tlsf/Root#addMemory + local.get $3 + local.get $0 + call $~lib/allocator/tlsf/Root#search + local.tee $2 + if (result i32) + local.get $2 + else + i32.const 0 + i32.const 8 + i32.const 480 + i32.const 12 + call $~lib/env/abort + unreachable + end + local.set $1 + end + local.get $1 + i32.load + i32.const -4 + i32.and + local.get $0 + i32.lt_u + end + if + i32.const 0 + i32.const 8 + i32.const 483 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $3 + local.get $1 + local.get $0 + call $~lib/allocator/tlsf/Root#use + ) + (func $~lib/internal/memory/memset (; 17 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $1 + i32.eqz + if + return + end + local.get $0 + i32.const 0 + i32.store8 + local.get $0 + local.get $1 + i32.add + i32.const 1 + i32.sub + i32.const 0 + i32.store8 + local.get $1 + i32.const 2 + i32.le_u + if + return + end + local.get $0 + i32.const 1 + i32.add + i32.const 0 + i32.store8 + local.get $0 + i32.const 2 + i32.add + i32.const 0 + i32.store8 + local.get $0 + local.get $1 + i32.add + local.tee $2 + i32.const 2 + i32.sub + i32.const 0 + i32.store8 + local.get $2 + i32.const 3 + i32.sub + i32.const 0 + i32.store8 + local.get $1 + i32.const 6 + i32.le_u + if + return + end + local.get $0 + i32.const 3 + i32.add + i32.const 0 + i32.store8 + local.get $0 + local.get $1 + i32.add + i32.const 4 + i32.sub + i32.const 0 + i32.store8 + local.get $1 + i32.const 8 + i32.le_u + if + return + end + i32.const 0 + local.get $0 + i32.sub + i32.const 3 + i32.and + local.tee $2 + local.get $0 + i32.add + local.tee $0 + i32.const 0 + i32.store + local.get $1 + local.get $2 + i32.sub + i32.const -4 + i32.and + local.tee $1 + local.get $0 + i32.add + i32.const 4 + i32.sub + i32.const 0 + i32.store + local.get $1 + i32.const 8 + i32.le_u + if + return + end + local.get $0 + i32.const 4 + i32.add + i32.const 0 + i32.store + local.get $0 + i32.const 8 + i32.add + i32.const 0 + i32.store + local.get $0 + local.get $1 + i32.add + local.tee $2 + i32.const 12 + i32.sub + i32.const 0 + i32.store + local.get $2 + i32.const 8 + i32.sub + i32.const 0 + i32.store + local.get $1 + i32.const 24 + i32.le_u + if + return + end + local.get $0 + i32.const 12 + i32.add + i32.const 0 + i32.store + local.get $0 + i32.const 16 + i32.add + i32.const 0 + i32.store + local.get $0 + i32.const 20 + i32.add + i32.const 0 + i32.store + local.get $0 + i32.const 24 + i32.add + i32.const 0 + i32.store + local.get $0 + local.get $1 + i32.add + local.tee $2 + i32.const 28 + i32.sub + i32.const 0 + i32.store + local.get $2 + i32.const 24 + i32.sub + i32.const 0 + i32.store + local.get $2 + i32.const 20 + i32.sub + i32.const 0 + i32.store + local.get $2 + i32.const 16 + i32.sub + i32.const 0 + i32.store + local.get $0 + i32.const 4 + i32.and + i32.const 24 + i32.add + local.tee $2 + local.get $0 + i32.add + local.set $0 + local.get $1 + local.get $2 + i32.sub + local.set $1 + loop $continue|0 + local.get $1 + i32.const 32 + i32.ge_u + if + local.get $0 + i64.const 0 + i64.store + local.get $0 + i32.const 8 + i32.add + i64.const 0 + i64.store + local.get $0 + i32.const 16 + i32.add + i64.const 0 + i64.store + local.get $0 + i32.const 24 + i32.add + i64.const 0 + i64.store + local.get $1 + i32.const 32 + i32.sub + local.set $1 + local.get $0 + i32.const 32 + i32.add + local.set $0 + br $continue|0 + end + end + ) + (func $~lib/internal/runtime/ALLOC (; 18 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + i32.const 1 + i32.const 32 + local.get $0 + i32.const 15 + i32.add + i32.clz + i32.sub + i32.shl + call $~lib/allocator/tlsf/__memory_allocate + local.tee $1 + i32.const -1520547049 + i32.store + local.get $1 + local.get $0 + i32.store offset=4 + local.get $1 + i32.const 0 + i32.store offset=8 + local.get $1 + i32.const 0 + i32.store offset=12 + local.get $1 + i32.const 16 + i32.add + local.tee $1 + local.get $0 + call $~lib/internal/memory/memset + local.get $1 + ) + (func $~lib/internal/memory/memcpy (; 19 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + loop $continue|0 + local.get $1 + i32.const 3 + i32.and + local.get $2 + local.get $2 + select + if + local.get $0 + local.tee $4 + i32.const 1 + i32.add + local.set $0 + local.get $1 + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $4 + local.get $3 + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + br $continue|0 + end + end + local.get $0 + i32.const 3 + i32.and + i32.eqz + if + loop $continue|1 + local.get $2 + i32.const 16 + i32.ge_u + if + local.get $0 + local.get $1 + i32.load + i32.store + local.get $0 + i32.const 4 + i32.add + local.get $1 + i32.const 4 + i32.add + i32.load + i32.store + local.get $0 + i32.const 8 + i32.add + local.get $1 + i32.const 8 + i32.add + i32.load + i32.store + local.get $0 + i32.const 12 + i32.add + local.get $1 + i32.const 12 + i32.add + i32.load + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $continue|1 + end + end + 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 $1 + i32.const 8 + i32.add + local.set $1 + local.get $0 + i32.const 8 + i32.add + local.set $0 + end + local.get $2 + i32.const 4 + i32.and + if + local.get $0 + local.get $1 + i32.load + i32.store + local.get $1 + i32.const 4 + i32.add + local.set $1 + local.get $0 + i32.const 4 + i32.add + local.set $0 + end + local.get $2 + i32.const 2 + i32.and + if + local.get $0 + local.get $1 + i32.load16_u + i32.store16 + local.get $1 + i32.const 2 + i32.add + local.set $1 + local.get $0 + i32.const 2 + i32.add + local.set $0 + end + local.get $2 + i32.const 1 + i32.and + if + local.get $0 + local.get $1 + 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 + local.get $0 + i32.const 3 + i32.and + local.tee $3 + i32.const 1 + i32.ne + if + local.get $3 + i32.const 2 + i32.eq + br_if $case1|2 + local.get $3 + i32.const 3 + i32.eq + br_if $case2|2 + br $break|2 + end + local.get $1 + i32.load + local.set $5 + local.get $0 + local.get $1 + local.tee $3 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $1 + local.set $0 + local.get $1 + local.get $3 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $4 + i32.const 1 + i32.add + local.set $0 + local.get $1 + i32.const 1 + i32.add + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $4 + local.get $3 + i32.load8_u + i32.store8 + local.get $2 + i32.const 3 + i32.sub + local.set $2 + loop $continue|3 + local.get $2 + i32.const 17 + i32.ge_u + if + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.load + local.tee $3 + i32.const 8 + i32.shl + local.get $5 + i32.const 24 + i32.shr_u + i32.or + i32.store + local.get $0 + i32.const 4 + i32.add + local.get $1 + i32.const 5 + i32.add + i32.load + local.tee $5 + i32.const 8 + i32.shl + local.get $3 + i32.const 24 + i32.shr_u + i32.or + i32.store + local.get $0 + i32.const 8 + i32.add + local.get $1 + i32.const 9 + i32.add + i32.load + local.tee $3 + i32.const 8 + i32.shl + local.get $5 + i32.const 24 + i32.shr_u + i32.or + i32.store + local.get $0 + i32.const 12 + i32.add + local.get $1 + i32.const 13 + i32.add + i32.load + local.tee $5 + i32.const 8 + i32.shl + local.get $3 + i32.const 24 + i32.shr_u + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $continue|3 + end + end + br $break|2 + end + local.get $1 + i32.load + local.set $5 + local.get $0 + local.get $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $4 + i32.const 1 + i32.add + local.set $0 + local.get $1 + i32.const 1 + i32.add + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $4 + local.get $3 + i32.load8_u + i32.store8 + local.get $2 + i32.const 2 + i32.sub + local.set $2 + loop $continue|4 + local.get $2 + i32.const 18 + i32.ge_u + if + local.get $0 + local.get $1 + i32.const 2 + i32.add + i32.load + local.tee $3 + i32.const 16 + i32.shl + local.get $5 + i32.const 16 + i32.shr_u + i32.or + i32.store + local.get $0 + i32.const 4 + i32.add + local.get $1 + i32.const 6 + i32.add + i32.load + local.tee $5 + i32.const 16 + i32.shl + local.get $3 + i32.const 16 + i32.shr_u + i32.or + i32.store + local.get $0 + i32.const 8 + i32.add + local.get $1 + i32.const 10 + i32.add + i32.load + local.tee $3 + i32.const 16 + i32.shl + local.get $5 + i32.const 16 + i32.shr_u + i32.or + i32.store + local.get $0 + i32.const 12 + i32.add + local.get $1 + i32.const 14 + i32.add + i32.load + local.tee $5 + i32.const 16 + i32.shl + local.get $3 + i32.const 16 + i32.shr_u + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $continue|4 + end + end + br $break|2 + end + local.get $1 + i32.load + local.set $5 + local.get $0 + local.tee $4 + i32.const 1 + i32.add + local.set $0 + local.get $1 + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $4 + local.get $3 + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + loop $continue|5 + local.get $2 + i32.const 19 + i32.ge_u + if + local.get $0 + local.get $1 + i32.const 3 + i32.add + i32.load + local.tee $3 + i32.const 24 + i32.shl + local.get $5 + i32.const 8 + i32.shr_u + i32.or + i32.store + local.get $0 + i32.const 4 + i32.add + local.get $1 + i32.const 7 + i32.add + i32.load + local.tee $5 + i32.const 24 + i32.shl + local.get $3 + i32.const 8 + i32.shr_u + i32.or + i32.store + local.get $0 + i32.const 8 + i32.add + local.get $1 + i32.const 11 + i32.add + i32.load + local.tee $3 + i32.const 24 + i32.shl + local.get $5 + i32.const 8 + i32.shr_u + i32.or + i32.store + local.get $0 + i32.const 12 + i32.add + local.get $1 + i32.const 15 + i32.add + i32.load + local.tee $5 + i32.const 24 + i32.shl + local.get $3 + i32.const 8 + i32.shr_u + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $continue|5 + end + end + end + end + local.get $2 + i32.const 16 + i32.and + if + local.get $0 + local.get $1 + local.tee $3 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $1 + local.set $0 + local.get $1 + local.get $3 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $4 + i32.const 1 + i32.add + local.set $0 + local.get $1 + i32.const 1 + i32.add + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $4 + local.get $3 + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 8 + i32.and + if + local.get $0 + local.get $1 + local.tee $3 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $1 + local.set $0 + local.get $1 + local.get $3 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $4 + i32.const 1 + i32.add + local.set $0 + local.get $1 + i32.const 1 + i32.add + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $4 + local.get $3 + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 4 + i32.and + if + local.get $0 + local.get $1 + local.tee $3 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $1 + local.set $0 + local.get $1 + local.get $3 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $3 + local.set $0 + local.get $3 + local.get $1 + i32.const 1 + i32.add + local.tee $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $4 + i32.const 1 + i32.add + local.set $0 + local.get $1 + i32.const 1 + i32.add + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $4 + local.get $3 + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 2 + i32.and + if + local.get $0 + local.get $1 + i32.load8_u + i32.store8 + local.get $0 + i32.const 1 + i32.add + local.tee $4 + i32.const 1 + i32.add + local.set $0 + local.get $1 + i32.const 1 + i32.add + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $4 + local.get $3 + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 1 + i32.and + if + local.get $0 + local.get $1 + i32.load8_u + i32.store8 + end + ) + (func $~lib/internal/memory/memmove (; 20 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + local.get $0 + local.get $1 + i32.eq + if + return + end + local.get $1 + local.get $2 + i32.add + local.get $0 + i32.le_u + local.tee $3 + i32.eqz + if + local.get $0 + local.get $2 + i32.add + local.get $1 + i32.le_u + local.set $3 + end + local.get $3 + if + local.get $0 + local.get $1 + local.get $2 + call $~lib/internal/memory/memcpy + return + end + local.get $0 + local.get $1 + i32.lt_u + if + local.get $1 + i32.const 7 + i32.and + local.get $0 + i32.const 7 + i32.and + i32.eq + if + loop $continue|0 + local.get $0 + i32.const 7 + i32.and + if + local.get $2 + i32.eqz + if + return + end + local.get $2 + i32.const 1 + i32.sub + local.set $2 + local.get $0 + local.tee $4 + i32.const 1 + i32.add + local.set $0 + local.get $1 + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $4 + local.get $3 + i32.load8_u + i32.store8 + br $continue|0 + end + end + loop $continue|1 + local.get $2 + i32.const 8 + i32.ge_u + if + local.get $0 + local.get $1 + i64.load + i64.store + local.get $2 + i32.const 8 + i32.sub + local.set $2 + local.get $0 + i32.const 8 + i32.add + local.set $0 + local.get $1 + i32.const 8 + i32.add + local.set $1 + br $continue|1 + end + end + end + loop $continue|2 + local.get $2 + if + local.get $0 + local.tee $4 + i32.const 1 + i32.add + local.set $0 + local.get $1 + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $4 + local.get $3 + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + br $continue|2 + end + end + else + local.get $1 + i32.const 7 + i32.and + local.get $0 + i32.const 7 + i32.and + i32.eq + if + loop $continue|3 + local.get $0 + local.get $2 + i32.add + i32.const 7 + i32.and + if + local.get $2 + i32.eqz + if + return + end + local.get $2 + i32.const 1 + i32.sub + local.tee $2 + local.get $0 + i32.add + local.get $1 + local.get $2 + i32.add + i32.load8_u + i32.store8 + br $continue|3 + end + end + loop $continue|4 + local.get $2 + i32.const 8 + i32.ge_u + if + local.get $2 + i32.const 8 + i32.sub + local.tee $2 + local.get $0 + i32.add + local.get $1 + local.get $2 + i32.add + i64.load + i64.store + br $continue|4 + end + end + end + loop $continue|5 + local.get $2 + if + local.get $2 + i32.const 1 + i32.sub + local.tee $2 + local.get $0 + i32.add + local.get $1 + local.get $2 + i32.add + i32.load8_u + i32.store8 + br $continue|5 + end + end + end + ) + (func $~lib/allocator/tlsf/__memory_free (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + local.get $0 + if + global.get $~lib/allocator/tlsf/ROOT + local.tee $1 + if + local.get $0 + i32.const 8 + i32.sub + local.tee $2 + i32.load + local.tee $3 + i32.const 1 + i32.and + if + i32.const 0 + i32.const 8 + i32.const 494 + i32.const 6 + call $~lib/env/abort + unreachable + end + local.get $2 + local.get $3 + i32.const 1 + i32.or + i32.store + local.get $1 + local.get $0 + i32.const 8 + i32.sub + call $~lib/allocator/tlsf/Root#insert + end + end + ) + (func $~lib/internal/runtime/REALLOC (; 22 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $0 + i32.const 16 + i32.sub + local.tee $5 + i32.load offset=4 + local.tee $2 + local.get $1 + i32.lt_u + if + i32.const 1 + i32.const 32 + local.get $2 + i32.const 15 + i32.add + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.const 32 + local.get $1 + i32.const 15 + i32.add + i32.clz + i32.sub + i32.shl + local.tee $3 + i32.lt_u + if + local.get $3 + call $~lib/allocator/tlsf/__memory_allocate + local.tee $4 + i32.const -1520547049 + i32.store + local.get $4 + i32.const 0 + i32.store offset=8 + local.get $4 + i32.const 0 + i32.store offset=12 + local.get $4 + i32.const 16 + i32.add + local.tee $3 + local.get $0 + local.get $2 + call $~lib/internal/memory/memmove + local.get $2 + local.get $3 + i32.add + local.get $1 + local.get $2 + i32.sub + call $~lib/internal/memory/memset + local.get $5 + call $~lib/allocator/tlsf/__memory_free + local.get $4 + local.set $5 + local.get $3 + local.set $0 + else + local.get $0 + local.get $2 + i32.add + local.get $1 + local.get $2 + i32.sub + call $~lib/internal/memory/memset + end + end + local.get $5 + local.get $1 + i32.store offset=4 + local.get $0 + ) + (func $~lib/internal/runtime/FREE (; 23 ;) (type $FUNCSIG$vi) (param $0 i32) + local.get $0 + i32.const 228 + i32.lt_u + if + i32.const 0 + i32.const 160 + i32.const 88 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + local.tee $0 + i32.load + i32.const -1520547049 + i32.ne + if + i32.const 0 + i32.const 160 + i32.const 90 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + call $~lib/allocator/tlsf/__memory_free + ) + (func $std/runtime/__REGISTER_IMPL (; 24 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + local.get $0 + global.get $std/runtime/ref4 + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 53 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $1 + global.get $std/runtime/ref3 + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 54 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + i32.load + i32.const 43 + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 56 + i32.const 2 + call $~lib/env/abort + unreachable + end + i32.const 1 + global.set $std/runtime/called + ) + (func $~lib/internal/runtime/REGISTER (; 25 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + i32.const 228 + i32.lt_u + if + i32.const 0 + i32.const 160 + i32.const 96 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + local.tee $2 + i32.load + i32.const -1520547049 + i32.ne + if + i32.const 0 + i32.const 160 + i32.const 98 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const 43 + i32.store + local.get $0 + local.get $1 + call $std/runtime/__REGISTER_IMPL + ) + (func $start:std/runtime (; 26 ;) (type $FUNCSIG$v) + (local $0 i32) + (local $1 i32) + (local $2 i32) + loop $repeat|0 + local.get $0 + i32.const 9000 + i32.lt_s + if + i32.const 1 + i32.const 32 + local.get $0 + i32.const 15 + i32.add + i32.clz + i32.sub + i32.shl + local.tee $1 + i32.const 0 + i32.ne + local.tee $2 + if (result i32) + local.get $1 + i32.const 1 + i32.sub + local.get $1 + i32.and + i32.eqz + else + local.get $2 + end + if + local.get $0 + i32.const 1 + i32.add + local.set $0 + br $repeat|0 + else + i32.const 0 + i32.const 56 + i32.const 23 + i32.const 2 + call $~lib/env/abort + unreachable + end + unreachable + end + end + i32.const 16 + global.set $std/runtime/barrier1 + global.get $std/runtime/barrier1 + i32.const 1 + i32.add + global.set $std/runtime/barrier2 + loop $continue|1 + i32.const 1 + i32.const 32 + global.get $std/runtime/barrier2 + i32.const 16 + i32.add + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.const 32 + global.get $std/runtime/barrier2 + i32.const 15 + i32.add + i32.clz + i32.sub + i32.shl + i32.eq + if + global.get $std/runtime/barrier2 + i32.const 1 + i32.add + global.set $std/runtime/barrier2 + br $continue|1 + end + end + global.get $std/runtime/barrier2 + i32.const 1 + i32.add + global.set $std/runtime/barrier3 + loop $continue|2 + i32.const 1 + i32.const 32 + global.get $std/runtime/barrier3 + i32.const 16 + i32.add + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.const 32 + global.get $std/runtime/barrier3 + i32.const 15 + i32.add + i32.clz + i32.sub + i32.shl + i32.eq + if + global.get $std/runtime/barrier3 + i32.const 1 + i32.add + global.set $std/runtime/barrier3 + br $continue|2 + end + end + i32.const 88 + i32.const 1 + global.get $std/runtime/barrier1 + f64.convert_i32_u + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + call $~lib/env/trace + i32.const 112 + i32.const 1 + global.get $std/runtime/barrier2 + f64.convert_i32_u + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + call $~lib/env/trace + i32.const 136 + i32.const 1 + global.get $std/runtime/barrier3 + f64.convert_i32_u + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + call $~lib/env/trace + i32.const 1 + call $~lib/internal/runtime/ALLOC + global.set $std/runtime/ref1 + global.get $std/runtime/ref1 + i32.const 16 + i32.sub + global.set $std/runtime/header1 + global.get $std/runtime/header1 + i32.load + i32.const -1520547049 + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 38 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/header1 + i32.load offset=4 + i32.const 1 + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 39 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/ref1 + local.tee $0 + local.get $0 + global.get $std/runtime/barrier1 + call $~lib/internal/runtime/REALLOC + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 40 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/barrier1 + global.get $std/runtime/header1 + i32.load offset=4 + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 41 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/ref1 + global.get $std/runtime/barrier2 + call $~lib/internal/runtime/REALLOC + global.set $std/runtime/ref2 + global.get $std/runtime/ref1 + global.get $std/runtime/ref2 + i32.eq + if + i32.const 0 + i32.const 56 + i32.const 43 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/ref2 + i32.const 16 + i32.sub + global.set $std/runtime/header2 + global.get $std/runtime/barrier2 + global.get $std/runtime/header2 + i32.load offset=4 + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 45 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/ref2 + call $~lib/internal/runtime/FREE + global.get $std/runtime/barrier2 + call $~lib/internal/runtime/ALLOC + global.set $std/runtime/ref3 + global.get $std/runtime/ref1 + global.get $std/runtime/ref3 + i32.ne + if + i32.const 0 + i32.const 56 + i32.const 48 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/barrier1 + call $~lib/internal/runtime/ALLOC + global.set $std/runtime/ref4 + global.get $std/runtime/ref4 + global.get $std/runtime/ref3 + call $~lib/internal/runtime/REGISTER + global.get $std/runtime/called + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 60 + i32.const 0 + call $~lib/env/abort + unreachable + end + ) + (func $start (; 27 ;) (type $FUNCSIG$v) + call $start:std/runtime + ) + (func $null (; 28 ;) (type $FUNCSIG$v) + nop + ) +) diff --git a/tests/compiler/std/runtime.ts b/tests/compiler/std/runtime.ts new file mode 100644 index 00000000..dd89399e --- /dev/null +++ b/tests/compiler/std/runtime.ts @@ -0,0 +1,60 @@ +import "allocator/tlsf"; +import { + HEADER, + HEADER_SIZE, + HEADER_MAGIC, + ALIGN, + ALLOC, + REALLOC, + FREE, + REGISTER +} from "internal/runtime"; + +class A {} +class B {} +assert(__rt_classid() != __rt_classid()); + +function isPowerOf2(x: i32): bool { + return x != 0 && (x & (x - 1)) == 0; +} + +assert(ALIGN(0) > 0); +for (let i = 0; i < 9000; ++i) { + assert(isPowerOf2(ALIGN(i))); +} + +var barrier1 = ALIGN(0); +var barrier2 = barrier1 + 1; +while (ALIGN(barrier2 + 1) == ALIGN(barrier2)) ++barrier2; +var barrier3 = barrier2 + 1; +while (ALIGN(barrier3 + 1) == ALIGN(barrier3)) ++barrier3; + +trace("barrier1", 1, barrier1); +trace("barrier2", 1, barrier2); +trace("barrier3", 1, barrier3); + +var ref1 = ALLOC(1); +var header1 = changetype
(ref1 - HEADER_SIZE); +assert(header1.classId == HEADER_MAGIC); +assert(header1.payloadSize == 1); +assert(ref1 == REALLOC(ref1, barrier1)); // same segment +assert(header1.payloadSize == barrier1); +var ref2 = REALLOC(ref1, barrier2); +assert(ref1 != ref2); // moves +var header2 = changetype
(ref2 - HEADER_SIZE); +assert(header2.payloadSize == barrier2); +FREE(ref2); +var ref3 = ALLOC(barrier2); +assert(ref1 == ref3); // reuses space of ref1 (free'd in realloc), ref2 (explicitly free'd) + +var ref4 = ALLOC(barrier1); +var called = false; +@global function __REGISTER_IMPL(ref: usize, parentRef: usize): void { + assert(ref == ref4); + assert(parentRef == ref3); + var header = changetype
(ref - HEADER_SIZE); + assert(header.classId == __rt_classid()); + called = true; +} +REGISTER(ref4, ref3); // TODO +assert(called); diff --git a/tests/compiler/std/runtime.untouched.wat b/tests/compiler/std/runtime.untouched.wat new file mode 100644 index 00000000..9de6f5ea --- /dev/null +++ b/tests/compiler/std/runtime.untouched.wat @@ -0,0 +1,3733 @@ +(module + (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) + (type $FUNCSIG$v (func)) + (type $FUNCSIG$ii (func (param i32) (result i32))) + (type $FUNCSIG$viiddddd (func (param i32 i32 f64 f64 f64 f64 f64))) + (type $FUNCSIG$vii (func (param i32 i32))) + (type $FUNCSIG$viii (func (param i32 i32 i32))) + (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) + (type $FUNCSIG$vi (func (param i32))) + (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64))) + (memory $0 1) + (data (i32.const 8) "\16\00\00\00~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s\00") + (data (i32.const 56) "\0e\00\00\00s\00t\00d\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00") + (data (i32.const 88) "\08\00\00\00b\00a\00r\00r\00i\00e\00r\001\00") + (data (i32.const 112) "\08\00\00\00b\00a\00r\00r\00i\00e\00r\002\00") + (data (i32.const 136) "\08\00\00\00b\00a\00r\00r\00i\00e\00r\003\00") + (data (i32.const 160) "\18\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00") + (table $0 1 funcref) + (elem (i32.const 0) $null) + (global $~lib/allocator/tlsf/SL_BITS i32 (i32.const 5)) + (global $~lib/allocator/tlsf/SL_SIZE i32 (i32.const 32)) + (global $~lib/allocator/tlsf/SB_BITS i32 (i32.const 8)) + (global $~lib/allocator/tlsf/SB_SIZE i32 (i32.const 256)) + (global $~lib/allocator/tlsf/FL_BITS i32 (i32.const 22)) + (global $~lib/allocator/tlsf/FREE i32 (i32.const 1)) + (global $~lib/allocator/tlsf/LEFT_FREE i32 (i32.const 2)) + (global $~lib/allocator/tlsf/TAGS i32 (i32.const 3)) + (global $~lib/allocator/tlsf/Block.INFO i32 (i32.const 8)) + (global $~lib/allocator/tlsf/Block.MIN_SIZE i32 (i32.const 16)) + (global $~lib/allocator/tlsf/Block.MAX_SIZE i32 (i32.const 1073741824)) + (global $~lib/allocator/tlsf/Root.SL_START i32 (i32.const 4)) + (global $~lib/allocator/tlsf/Root.SL_END i32 (i32.const 92)) + (global $~lib/allocator/tlsf/Root.HL_START i32 (i32.const 96)) + (global $~lib/allocator/tlsf/Root.HL_END i32 (i32.const 2912)) + (global $~lib/allocator/tlsf/Root.SIZE i32 (i32.const 2916)) + (global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0)) + (global $std/runtime/barrier1 (mut i32) (i32.const 0)) + (global $std/runtime/barrier2 (mut i32) (i32.const 0)) + (global $std/runtime/barrier3 (mut i32) (i32.const 0)) + (global $std/runtime/ref1 (mut i32) (i32.const 0)) + (global $std/runtime/header1 (mut i32) (i32.const 0)) + (global $std/runtime/ref2 (mut i32) (i32.const 0)) + (global $std/runtime/header2 (mut i32) (i32.const 0)) + (global $std/runtime/ref3 (mut i32) (i32.const 0)) + (global $std/runtime/ref4 (mut i32) (i32.const 0)) + (global $std/runtime/called (mut i32) (i32.const 0)) + (global $~lib/memory/HEAP_BASE i32 (i32.const 212)) + (export "memory" (memory $0)) + (export "table" (table $0)) + (start $start) + (func $start:~lib/allocator/tlsf (; 2 ;) (type $FUNCSIG$v) + i32.const 1 + global.get $~lib/allocator/tlsf/SL_BITS + i32.shl + i32.const 32 + i32.le_s + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 122 + i32.const 0 + call $~lib/env/abort + unreachable + end + ) + (func $~lib/internal/runtime/ALIGN (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + i32.const 1 + i32.const 32 + local.get $0 + i32.const 16 + i32.add + i32.const 1 + i32.sub + i32.clz + i32.sub + i32.shl + ) + (func $std/runtime/isPowerOf2 (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + local.get $0 + i32.const 0 + i32.ne + local.tee $1 + if (result i32) + local.get $0 + local.get $0 + i32.const 1 + i32.sub + i32.and + i32.const 0 + i32.eq + else + local.get $1 + end + ) + (func $~lib/allocator/tlsf/Root#set:tailRef (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + i32.const 0 + local.get $1 + i32.store offset=2912 + ) + (func $~lib/allocator/tlsf/Root#setSLMap (; 6 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + local.get $1 + global.get $~lib/allocator/tlsf/FL_BITS + i32.lt_u + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 144 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 4 + i32.mul + i32.add + local.get $2 + i32.store offset=4 + ) + (func $~lib/allocator/tlsf/Root#setHead (; 7 ;) (type $FUNCSIG$viiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + local.get $1 + global.get $~lib/allocator/tlsf/FL_BITS + i32.lt_u + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 167 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + global.get $~lib/allocator/tlsf/SL_SIZE + i32.lt_u + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 168 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + local.get $1 + global.get $~lib/allocator/tlsf/SL_SIZE + i32.mul + local.get $2 + i32.add + i32.const 4 + i32.mul + i32.add + local.get $3 + i32.store offset=96 + ) + (func $~lib/allocator/tlsf/Root#get:tailRef (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + i32.const 0 + i32.load offset=2912 + ) + (func $~lib/allocator/tlsf/Block#get:right (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + local.get $0 + i32.load + global.get $~lib/allocator/tlsf/TAGS + i32.const -1 + i32.xor + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 89 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + global.get $~lib/allocator/tlsf/Block.INFO + i32.add + local.get $0 + i32.load + global.get $~lib/allocator/tlsf/TAGS + i32.const -1 + i32.xor + i32.and + i32.add + local.tee $1 + i32.eqz + if (result i32) + i32.const 0 + i32.const 8 + i32.const 90 + i32.const 11 + call $~lib/env/abort + unreachable + else + local.get $1 + end + ) + (func $~lib/allocator/tlsf/fls (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 428 + i32.const 2 + call $~lib/env/abort + unreachable + end + i32.const 31 + local.get $0 + i32.clz + i32.sub + ) + (func $~lib/allocator/tlsf/Root#getHead (; 11 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + local.get $1 + global.get $~lib/allocator/tlsf/FL_BITS + i32.lt_u + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 158 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + global.get $~lib/allocator/tlsf/SL_SIZE + i32.lt_u + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 159 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + local.get $1 + global.get $~lib/allocator/tlsf/SL_SIZE + i32.mul + local.get $2 + i32.add + i32.const 4 + i32.mul + i32.add + i32.load offset=96 + ) + (func $~lib/allocator/tlsf/Root#getSLMap (; 12 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + local.get $1 + global.get $~lib/allocator/tlsf/FL_BITS + i32.lt_u + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 138 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 4 + i32.mul + i32.add + i32.load offset=4 + ) + (func $~lib/allocator/tlsf/Root#remove (; 13 ;) (type $FUNCSIG$vii) (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.get $1 + i32.load + local.set $2 + local.get $2 + global.get $~lib/allocator/tlsf/FREE + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 258 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + global.get $~lib/allocator/tlsf/TAGS + i32.const -1 + i32.xor + i32.and + local.set $3 + local.get $3 + global.get $~lib/allocator/tlsf/Block.MIN_SIZE + i32.ge_u + local.tee $4 + if (result i32) + local.get $3 + global.get $~lib/allocator/tlsf/Block.MAX_SIZE + i32.lt_u + else + local.get $4 + end + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 260 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $3 + global.get $~lib/allocator/tlsf/SB_SIZE + i32.lt_u + if + i32.const 0 + local.set $5 + local.get $3 + i32.const 8 + i32.div_u + local.set $6 + else + local.get $3 + call $~lib/allocator/tlsf/fls + local.set $5 + local.get $3 + local.get $5 + global.get $~lib/allocator/tlsf/SL_BITS + i32.sub + i32.shr_u + i32.const 1 + global.get $~lib/allocator/tlsf/SL_BITS + i32.shl + i32.xor + local.set $6 + local.get $5 + global.get $~lib/allocator/tlsf/SB_BITS + i32.const 1 + i32.sub + i32.sub + local.set $5 + end + local.get $1 + i32.load offset=4 + local.set $7 + local.get $1 + i32.load offset=8 + local.set $8 + local.get $7 + if + local.get $7 + local.get $8 + i32.store offset=8 + end + local.get $8 + if + local.get $8 + local.get $7 + i32.store offset=4 + end + local.get $1 + local.get $0 + local.get $5 + local.get $6 + call $~lib/allocator/tlsf/Root#getHead + i32.eq + if + local.get $0 + local.get $5 + local.get $6 + local.get $8 + call $~lib/allocator/tlsf/Root#setHead + local.get $8 + i32.eqz + if + local.get $0 + local.get $5 + call $~lib/allocator/tlsf/Root#getSLMap + local.set $4 + local.get $0 + local.get $5 + local.get $4 + i32.const 1 + local.get $6 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $4 + call $~lib/allocator/tlsf/Root#setSLMap + local.get $4 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/allocator/tlsf/Block#get:left (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + local.get $0 + i32.load + global.get $~lib/allocator/tlsf/LEFT_FREE + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 81 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 4 + i32.sub + i32.load + local.tee $1 + i32.eqz + if (result i32) + i32.const 0 + i32.const 8 + i32.const 82 + i32.const 11 + call $~lib/env/abort + unreachable + else + local.get $1 + end + ) + (func $~lib/allocator/tlsf/Root#setJump (; 15 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + local.get $1 + i32.load + global.get $~lib/allocator/tlsf/FREE + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 334 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + call $~lib/allocator/tlsf/Block#get:right + local.get $2 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 335 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.load + global.get $~lib/allocator/tlsf/LEFT_FREE + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 336 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const 4 + i32.sub + local.get $1 + i32.store + ) + (func $~lib/allocator/tlsf/Root#insert (; 16 ;) (type $FUNCSIG$vii) (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.get $1 + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 189 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.load + local.set $2 + local.get $2 + global.get $~lib/allocator/tlsf/FREE + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 191 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.load + global.get $~lib/allocator/tlsf/TAGS + i32.const -1 + i32.xor + i32.and + local.tee $3 + global.get $~lib/allocator/tlsf/Block.MIN_SIZE + i32.ge_u + local.tee $4 + if (result i32) + local.get $3 + global.get $~lib/allocator/tlsf/Block.MAX_SIZE + i32.lt_u + else + local.get $4 + end + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 193 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + call $~lib/allocator/tlsf/Block#get:right + local.tee $4 + i32.eqz + if (result i32) + i32.const 0 + i32.const 8 + i32.const 197 + i32.const 23 + call $~lib/env/abort + unreachable + else + local.get $4 + end + local.set $5 + local.get $5 + i32.load + local.set $6 + local.get $6 + global.get $~lib/allocator/tlsf/FREE + i32.and + if + local.get $0 + local.get $5 + call $~lib/allocator/tlsf/Root#remove + local.get $1 + local.get $2 + global.get $~lib/allocator/tlsf/Block.INFO + local.get $6 + global.get $~lib/allocator/tlsf/TAGS + i32.const -1 + i32.xor + i32.and + i32.add + i32.add + local.tee $2 + i32.store + local.get $1 + call $~lib/allocator/tlsf/Block#get:right + local.set $5 + local.get $5 + i32.load + local.set $6 + end + local.get $2 + global.get $~lib/allocator/tlsf/LEFT_FREE + i32.and + if + local.get $1 + call $~lib/allocator/tlsf/Block#get:left + local.tee $4 + i32.eqz + if (result i32) + i32.const 0 + i32.const 8 + i32.const 211 + i32.const 24 + call $~lib/env/abort + unreachable + else + local.get $4 + end + local.set $4 + local.get $4 + i32.load + local.set $7 + local.get $7 + global.get $~lib/allocator/tlsf/FREE + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 213 + i32.const 6 + call $~lib/env/abort + unreachable + end + local.get $0 + local.get $4 + call $~lib/allocator/tlsf/Root#remove + local.get $4 + local.get $7 + global.get $~lib/allocator/tlsf/Block.INFO + local.get $2 + global.get $~lib/allocator/tlsf/TAGS + i32.const -1 + i32.xor + i32.and + i32.add + i32.add + local.tee $7 + i32.store + local.get $4 + local.set $1 + local.get $7 + local.set $2 + end + local.get $5 + local.get $6 + global.get $~lib/allocator/tlsf/LEFT_FREE + i32.or + i32.store + local.get $0 + local.get $1 + local.get $5 + call $~lib/allocator/tlsf/Root#setJump + local.get $2 + global.get $~lib/allocator/tlsf/TAGS + i32.const -1 + i32.xor + i32.and + local.set $3 + local.get $3 + global.get $~lib/allocator/tlsf/Block.MIN_SIZE + i32.ge_u + local.tee $7 + if (result i32) + local.get $3 + global.get $~lib/allocator/tlsf/Block.MAX_SIZE + i32.lt_u + else + local.get $7 + end + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 226 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $3 + global.get $~lib/allocator/tlsf/SB_SIZE + i32.lt_u + if + i32.const 0 + local.set $8 + local.get $3 + i32.const 8 + i32.div_u + local.set $9 + else + local.get $3 + call $~lib/allocator/tlsf/fls + local.set $8 + local.get $3 + local.get $8 + global.get $~lib/allocator/tlsf/SL_BITS + i32.sub + i32.shr_u + i32.const 1 + global.get $~lib/allocator/tlsf/SL_BITS + i32.shl + i32.xor + local.set $9 + local.get $8 + global.get $~lib/allocator/tlsf/SB_BITS + i32.const 1 + i32.sub + i32.sub + local.set $8 + end + local.get $0 + local.get $8 + local.get $9 + call $~lib/allocator/tlsf/Root#getHead + local.set $10 + local.get $1 + i32.const 0 + i32.store offset=4 + local.get $1 + local.get $10 + i32.store offset=8 + local.get $10 + if + local.get $10 + local.get $1 + i32.store offset=4 + end + local.get $0 + local.get $8 + local.get $9 + local.get $1 + call $~lib/allocator/tlsf/Root#setHead + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $8 + i32.shl + i32.or + i32.store + local.get $0 + local.get $8 + local.get $0 + local.get $8 + call $~lib/allocator/tlsf/Root#getSLMap + i32.const 1 + local.get $9 + i32.shl + i32.or + call $~lib/allocator/tlsf/Root#setSLMap + ) + (func $~lib/allocator/tlsf/Root#addMemory (; 17 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + local.get $1 + local.get $2 + i32.le_u + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 377 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + i32.const 7 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 378 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const 7 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 379 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + call $~lib/allocator/tlsf/Root#get:tailRef + local.set $3 + i32.const 0 + local.set $4 + local.get $3 + if + local.get $1 + local.get $3 + i32.const 4 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 384 + i32.const 6 + call $~lib/env/abort + unreachable + end + local.get $1 + global.get $~lib/allocator/tlsf/Block.INFO + i32.sub + local.get $3 + i32.eq + if + local.get $1 + global.get $~lib/allocator/tlsf/Block.INFO + i32.sub + local.set $1 + local.get $3 + i32.load + local.set $4 + end + else + local.get $1 + local.get $0 + global.get $~lib/allocator/tlsf/Root.SIZE + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 393 + i32.const 6 + call $~lib/env/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.set $5 + local.get $5 + global.get $~lib/allocator/tlsf/Block.INFO + global.get $~lib/allocator/tlsf/Block.MIN_SIZE + i32.add + global.get $~lib/allocator/tlsf/Block.INFO + i32.add + i32.lt_u + if + i32.const 0 + return + end + local.get $5 + i32.const 2 + global.get $~lib/allocator/tlsf/Block.INFO + i32.mul + i32.sub + local.set $6 + local.get $1 + local.set $7 + local.get $7 + local.get $6 + global.get $~lib/allocator/tlsf/FREE + i32.or + local.get $4 + global.get $~lib/allocator/tlsf/LEFT_FREE + i32.and + i32.or + i32.store + local.get $7 + i32.const 0 + i32.store offset=4 + local.get $7 + i32.const 0 + i32.store offset=8 + local.get $1 + local.get $5 + i32.add + global.get $~lib/allocator/tlsf/Block.INFO + i32.sub + local.set $8 + local.get $8 + i32.const 0 + global.get $~lib/allocator/tlsf/LEFT_FREE + i32.or + i32.store + local.get $0 + local.get $8 + call $~lib/allocator/tlsf/Root#set:tailRef + local.get $0 + local.get $7 + call $~lib/allocator/tlsf/Root#insert + i32.const 1 + ) + (func $~lib/allocator/tlsf/ffs (; 18 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 422 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.ctz + ) + (func $~lib/allocator/tlsf/ffs (; 19 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + local.get $0 + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 422 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.ctz + ) + (func $~lib/allocator/tlsf/Root#search (; 20 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + local.get $1 + global.get $~lib/allocator/tlsf/Block.MIN_SIZE + i32.ge_u + local.tee $2 + if (result i32) + local.get $1 + global.get $~lib/allocator/tlsf/Block.MAX_SIZE + i32.lt_u + else + local.get $2 + end + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 296 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $1 + global.get $~lib/allocator/tlsf/SB_SIZE + i32.lt_u + if + i32.const 0 + local.set $3 + local.get $1 + i32.const 8 + i32.div_u + local.set $4 + else + local.get $1 + call $~lib/allocator/tlsf/fls + local.set $3 + local.get $1 + local.get $3 + global.get $~lib/allocator/tlsf/SL_BITS + i32.sub + i32.shr_u + i32.const 1 + global.get $~lib/allocator/tlsf/SL_BITS + i32.shl + i32.xor + local.set $4 + local.get $3 + global.get $~lib/allocator/tlsf/SB_BITS + i32.const 1 + i32.sub + i32.sub + local.set $3 + local.get $4 + global.get $~lib/allocator/tlsf/SL_SIZE + i32.const 1 + i32.sub + i32.lt_u + if + local.get $4 + i32.const 1 + i32.add + local.set $4 + else + local.get $3 + i32.const 1 + i32.add + local.set $3 + i32.const 0 + local.set $4 + end + end + local.get $0 + local.get $3 + call $~lib/allocator/tlsf/Root#getSLMap + i32.const 0 + i32.const -1 + i32.xor + local.get $4 + i32.shl + i32.and + local.set $5 + local.get $5 + i32.eqz + if + local.get $0 + i32.load + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.const 1 + i32.add + i32.shl + i32.and + local.set $2 + local.get $2 + i32.eqz + if + i32.const 0 + local.set $6 + else + local.get $2 + call $~lib/allocator/tlsf/ffs + local.set $3 + local.get $0 + local.get $3 + call $~lib/allocator/tlsf/Root#getSLMap + local.tee $7 + if (result i32) + local.get $7 + else + i32.const 0 + i32.const 8 + i32.const 323 + i32.const 16 + call $~lib/env/abort + unreachable + end + local.set $5 + local.get $0 + local.get $3 + local.get $5 + call $~lib/allocator/tlsf/ffs + call $~lib/allocator/tlsf/Root#getHead + local.set $6 + end + else + local.get $0 + local.get $3 + local.get $5 + call $~lib/allocator/tlsf/ffs + call $~lib/allocator/tlsf/Root#getHead + local.set $6 + end + local.get $6 + ) + (func $~lib/allocator/tlsf/Root#use (; 21 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.set $3 + local.get $3 + global.get $~lib/allocator/tlsf/FREE + i32.and + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 348 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + global.get $~lib/allocator/tlsf/Block.MIN_SIZE + i32.ge_u + local.tee $4 + if (result i32) + local.get $2 + global.get $~lib/allocator/tlsf/Block.MAX_SIZE + i32.lt_u + else + local.get $4 + end + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 349 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const 7 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 350 + i32.const 4 + call $~lib/env/abort + unreachable + end + local.get $0 + local.get $1 + call $~lib/allocator/tlsf/Root#remove + local.get $3 + global.get $~lib/allocator/tlsf/TAGS + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.sub + local.set $5 + local.get $5 + global.get $~lib/allocator/tlsf/Block.INFO + global.get $~lib/allocator/tlsf/Block.MIN_SIZE + i32.add + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + global.get $~lib/allocator/tlsf/LEFT_FREE + i32.and + i32.or + i32.store + local.get $1 + global.get $~lib/allocator/tlsf/Block.INFO + i32.add + local.get $2 + i32.add + local.set $4 + local.get $4 + local.get $5 + global.get $~lib/allocator/tlsf/Block.INFO + i32.sub + global.get $~lib/allocator/tlsf/FREE + i32.or + i32.store + local.get $0 + local.get $4 + call $~lib/allocator/tlsf/Root#insert + else + local.get $1 + local.get $3 + global.get $~lib/allocator/tlsf/FREE + i32.const -1 + i32.xor + i32.and + i32.store + local.get $1 + call $~lib/allocator/tlsf/Block#get:right + local.tee $4 + i32.eqz + if (result i32) + i32.const 0 + i32.const 8 + i32.const 368 + i32.const 25 + call $~lib/env/abort + unreachable + else + local.get $4 + end + local.set $4 + local.get $4 + local.get $4 + i32.load + global.get $~lib/allocator/tlsf/LEFT_FREE + i32.const -1 + i32.xor + i32.and + i32.store + end + local.get $1 + global.get $~lib/allocator/tlsf/Block.INFO + i32.add + ) + (func $~lib/allocator/tlsf/__memory_allocate (; 22 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + global.get $~lib/allocator/tlsf/ROOT + local.set $1 + local.get $1 + i32.eqz + if + global.get $~lib/memory/HEAP_BASE + i32.const 7 + i32.add + i32.const 7 + i32.const -1 + i32.xor + i32.and + local.set $2 + current_memory + local.set $3 + local.get $2 + global.get $~lib/allocator/tlsf/Root.SIZE + 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 $4 + local.get $4 + local.get $3 + i32.gt_s + local.tee $5 + if (result i32) + local.get $4 + local.get $3 + i32.sub + grow_memory + i32.const 0 + i32.lt_s + else + local.get $5 + end + if + unreachable + end + local.get $2 + local.tee $1 + global.set $~lib/allocator/tlsf/ROOT + local.get $1 + i32.const 0 + call $~lib/allocator/tlsf/Root#set:tailRef + local.get $1 + i32.const 0 + i32.store + block $break|0 + i32.const 0 + local.set $5 + loop $repeat|0 + local.get $5 + global.get $~lib/allocator/tlsf/FL_BITS + i32.lt_u + i32.eqz + br_if $break|0 + block + local.get $1 + local.get $5 + i32.const 0 + call $~lib/allocator/tlsf/Root#setSLMap + block $break|1 + i32.const 0 + local.set $6 + loop $repeat|1 + local.get $6 + global.get $~lib/allocator/tlsf/SL_SIZE + i32.lt_u + i32.eqz + br_if $break|1 + local.get $1 + local.get $5 + local.get $6 + i32.const 0 + call $~lib/allocator/tlsf/Root#setHead + local.get $6 + i32.const 1 + i32.add + local.set $6 + br $repeat|1 + unreachable + end + unreachable + end + end + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $repeat|0 + unreachable + end + unreachable + end + local.get $1 + local.get $2 + global.get $~lib/allocator/tlsf/Root.SIZE + i32.add + i32.const 7 + i32.add + i32.const 7 + i32.const -1 + i32.xor + i32.and + current_memory + i32.const 16 + i32.shl + call $~lib/allocator/tlsf/Root#addMemory + drop + end + local.get $0 + global.get $~lib/allocator/tlsf/Block.MAX_SIZE + i32.gt_u + if + unreachable + end + local.get $0 + i32.const 7 + i32.add + i32.const 7 + i32.const -1 + i32.xor + i32.and + local.tee $4 + global.get $~lib/allocator/tlsf/Block.MIN_SIZE + local.tee $3 + local.get $4 + local.get $3 + i32.gt_u + select + local.set $0 + local.get $1 + local.get $0 + call $~lib/allocator/tlsf/Root#search + local.set $7 + local.get $7 + i32.eqz + if + current_memory + local.set $4 + local.get $0 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $3 + local.get $4 + local.tee $2 + local.get $3 + local.tee $5 + local.get $2 + local.get $5 + i32.gt_s + select + local.set $2 + local.get $2 + grow_memory + i32.const 0 + i32.lt_s + if + local.get $3 + grow_memory + i32.const 0 + i32.lt_s + if + unreachable + end + end + current_memory + local.set $5 + local.get $1 + local.get $4 + i32.const 16 + i32.shl + local.get $5 + i32.const 16 + i32.shl + call $~lib/allocator/tlsf/Root#addMemory + drop + local.get $1 + local.get $0 + call $~lib/allocator/tlsf/Root#search + local.tee $6 + i32.eqz + if (result i32) + i32.const 0 + i32.const 8 + i32.const 480 + i32.const 12 + call $~lib/env/abort + unreachable + else + local.get $6 + end + local.set $7 + end + local.get $7 + i32.load + global.get $~lib/allocator/tlsf/TAGS + i32.const -1 + i32.xor + i32.and + local.get $0 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 483 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $1 + local.get $7 + local.get $0 + call $~lib/allocator/tlsf/Root#use + ) + (func $~lib/internal/memory/memset (; 23 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i64) + local.get $2 + i32.eqz + if + return + end + local.get $0 + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 1 + i32.sub + local.get $1 + i32.store8 + local.get $2 + i32.const 2 + i32.le_u + if + return + end + local.get $0 + i32.const 1 + i32.add + local.get $1 + i32.store8 + local.get $0 + i32.const 2 + i32.add + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 2 + i32.sub + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 3 + i32.sub + local.get $1 + i32.store8 + local.get $2 + i32.const 6 + i32.le_u + if + return + end + local.get $0 + i32.const 3 + i32.add + local.get $1 + i32.store8 + local.get $0 + local.get $2 + i32.add + i32.const 4 + i32.sub + local.get $1 + i32.store8 + local.get $2 + i32.const 8 + i32.le_u + if + return + end + i32.const 0 + local.get $0 + i32.sub + i32.const 3 + i32.and + local.set $3 + local.get $0 + local.get $3 + i32.add + local.set $0 + local.get $2 + local.get $3 + i32.sub + local.set $2 + local.get $2 + i32.const -4 + i32.and + local.set $2 + i32.const -1 + i32.const 255 + i32.div_u + local.get $1 + i32.const 255 + i32.and + i32.mul + local.set $4 + local.get $0 + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 4 + i32.sub + local.get $4 + i32.store + local.get $2 + i32.const 8 + i32.le_u + if + return + end + local.get $0 + i32.const 4 + i32.add + local.get $4 + i32.store + local.get $0 + i32.const 8 + i32.add + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 12 + i32.sub + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 8 + i32.sub + local.get $4 + i32.store + local.get $2 + i32.const 24 + i32.le_u + if + return + end + local.get $0 + i32.const 12 + i32.add + local.get $4 + i32.store + local.get $0 + i32.const 16 + i32.add + local.get $4 + i32.store + local.get $0 + i32.const 20 + i32.add + local.get $4 + i32.store + local.get $0 + i32.const 24 + i32.add + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 28 + i32.sub + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 24 + i32.sub + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 20 + i32.sub + local.get $4 + i32.store + local.get $0 + local.get $2 + i32.add + i32.const 16 + i32.sub + local.get $4 + i32.store + i32.const 24 + local.get $0 + i32.const 4 + i32.and + i32.add + local.set $3 + local.get $0 + local.get $3 + i32.add + local.set $0 + local.get $2 + local.get $3 + i32.sub + local.set $2 + local.get $4 + i64.extend_i32_u + local.get $4 + i64.extend_i32_u + i64.const 32 + i64.shl + i64.or + local.set $5 + block $break|0 + loop $continue|0 + local.get $2 + i32.const 32 + i32.ge_u + if + block + local.get $0 + local.get $5 + i64.store + local.get $0 + i32.const 8 + i32.add + local.get $5 + i64.store + local.get $0 + i32.const 16 + i32.add + local.get $5 + i64.store + local.get $0 + i32.const 24 + i32.add + local.get $5 + i64.store + local.get $2 + i32.const 32 + i32.sub + local.set $2 + local.get $0 + i32.const 32 + i32.add + local.set $0 + end + br $continue|0 + end + end + end + ) + (func $~lib/internal/runtime/ALLOC (; 24 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + block $~lib/memory/memory.allocate|inlined.0 (result i32) + local.get $0 + call $~lib/internal/runtime/ALIGN + local.set $1 + local.get $1 + call $~lib/allocator/tlsf/__memory_allocate + br $~lib/memory/memory.allocate|inlined.0 + end + local.set $2 + local.get $2 + i32.const -1520547049 + i32.store + local.get $2 + local.get $0 + i32.store offset=4 + local.get $2 + i32.const 0 + i32.store offset=8 + local.get $2 + i32.const 0 + i32.store offset=12 + local.get $2 + i32.const 16 + i32.add + local.set $3 + block $~lib/memory/memory.fill|inlined.0 + local.get $3 + local.set $1 + i32.const 0 + local.set $4 + local.get $0 + local.set $5 + local.get $1 + local.get $4 + local.get $5 + call $~lib/internal/memory/memset + end + local.get $3 + ) + (func $~lib/internal/memory/memcpy (; 25 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + block $break|0 + loop $continue|0 + local.get $2 + if (result i32) + local.get $1 + i32.const 3 + i32.and + else + local.get $2 + end + if + block + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + end + br $continue|0 + end + end + end + local.get $0 + i32.const 3 + i32.and + i32.const 0 + i32.eq + if + block $break|1 + loop $continue|1 + local.get $2 + i32.const 16 + i32.ge_u + if + block + 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 + end + br $continue|1 + end + end + end + local.get $2 + i32.const 8 + i32.and + if + local.get $0 + local.get $1 + i32.load + i32.store + local.get $0 + i32.const 4 + i32.add + local.get $1 + i32.const 4 + i32.add + i32.load + i32.store + local.get $0 + i32.const 8 + i32.add + local.set $0 + local.get $1 + i32.const 8 + i32.add + local.set $1 + end + local.get $2 + i32.const 4 + i32.and + if + local.get $0 + local.get $1 + i32.load + i32.store + local.get $0 + i32.const 4 + i32.add + local.set $0 + local.get $1 + i32.const 4 + i32.add + local.set $1 + end + local.get $2 + i32.const 2 + i32.and + if + local.get $0 + local.get $1 + i32.load16_u + i32.store16 + local.get $0 + i32.const 2 + i32.add + local.set $0 + local.get $1 + i32.const 2 + i32.add + local.set $1 + end + local.get $2 + i32.const 1 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + return + end + local.get $2 + i32.const 32 + i32.ge_u + if + block $break|2 + block $case2|2 + block $case1|2 + block $case0|2 + local.get $0 + i32.const 3 + i32.and + local.set $5 + local.get $5 + i32.const 1 + i32.eq + br_if $case0|2 + local.get $5 + i32.const 2 + i32.eq + br_if $case1|2 + local.get $5 + i32.const 3 + i32.eq + br_if $case2|2 + br $break|2 + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 3 + i32.sub + local.set $2 + block $break|3 + loop $continue|3 + local.get $2 + i32.const 17 + i32.ge_u + if + block + 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 + end + br $continue|3 + end + end + end + br $break|2 + unreachable + end + unreachable + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 2 + i32.sub + local.set $2 + block $break|4 + loop $continue|4 + local.get $2 + i32.const 18 + i32.ge_u + if + block + 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 + end + br $continue|4 + end + end + end + br $break|2 + unreachable + end + unreachable + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + block $break|5 + loop $continue|5 + local.get $2 + i32.const 19 + i32.ge_u + if + block + local.get $1 + i32.const 3 + i32.add + i32.load + local.set $4 + local.get $0 + local.get $3 + i32.const 8 + i32.shr_u + local.get $4 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 7 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 4 + i32.add + local.get $4 + i32.const 8 + i32.shr_u + local.get $3 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 11 + i32.add + i32.load + local.set $4 + local.get $0 + i32.const 8 + i32.add + local.get $3 + i32.const 8 + i32.shr_u + local.get $4 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 15 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 12 + i32.add + local.get $4 + i32.const 8 + i32.shr_u + local.get $3 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + end + br $continue|5 + end + end + end + br $break|2 + unreachable + end + unreachable + end + end + local.get $2 + i32.const 16 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 8 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 4 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 2 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 1 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + ) + (func $~lib/internal/memory/memmove (; 26 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + local.get $0 + local.get $1 + i32.eq + if + return + end + local.get $1 + local.get $2 + i32.add + local.get $0 + i32.le_u + local.tee $3 + if (result i32) + local.get $3 + else + local.get $0 + local.get $2 + i32.add + local.get $1 + i32.le_u + end + if + local.get $0 + local.get $1 + local.get $2 + call $~lib/internal/memory/memcpy + return + end + local.get $0 + local.get $1 + i32.lt_u + if + local.get $1 + i32.const 7 + i32.and + local.get $0 + i32.const 7 + i32.and + i32.eq + if + block $break|0 + loop $continue|0 + local.get $0 + i32.const 7 + i32.and + if + block + local.get $2 + i32.eqz + if + return + end + local.get $2 + i32.const 1 + i32.sub + local.set $2 + block (result i32) + local.get $0 + local.tee $3 + i32.const 1 + i32.add + local.set $0 + local.get $3 + end + block (result i32) + local.get $1 + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $3 + end + i32.load8_u + i32.store8 + end + br $continue|0 + end + end + end + block $break|1 + loop $continue|1 + local.get $2 + i32.const 8 + i32.ge_u + if + block + local.get $0 + local.get $1 + i64.load + i64.store + local.get $2 + i32.const 8 + i32.sub + local.set $2 + local.get $0 + i32.const 8 + i32.add + local.set $0 + local.get $1 + i32.const 8 + i32.add + local.set $1 + end + br $continue|1 + end + end + end + end + block $break|2 + loop $continue|2 + local.get $2 + if + block + block (result i32) + local.get $0 + local.tee $3 + i32.const 1 + i32.add + local.set $0 + local.get $3 + end + block (result i32) + local.get $1 + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $3 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + end + br $continue|2 + end + end + end + else + local.get $1 + i32.const 7 + i32.and + local.get $0 + i32.const 7 + i32.and + i32.eq + if + block $break|3 + loop $continue|3 + local.get $0 + local.get $2 + i32.add + i32.const 7 + i32.and + if + block + local.get $2 + i32.eqz + if + return + end + local.get $0 + local.get $2 + i32.const 1 + i32.sub + local.tee $2 + i32.add + local.get $1 + local.get $2 + i32.add + i32.load8_u + i32.store8 + end + br $continue|3 + end + end + end + block $break|4 + loop $continue|4 + local.get $2 + i32.const 8 + i32.ge_u + if + block + local.get $2 + i32.const 8 + i32.sub + local.set $2 + local.get $0 + local.get $2 + i32.add + local.get $1 + local.get $2 + i32.add + i64.load + i64.store + end + br $continue|4 + end + end + end + end + block $break|5 + loop $continue|5 + local.get $2 + if + local.get $0 + local.get $2 + i32.const 1 + i32.sub + local.tee $2 + i32.add + local.get $1 + local.get $2 + i32.add + i32.load8_u + i32.store8 + br $continue|5 + end + end + end + end + ) + (func $~lib/allocator/tlsf/__memory_free (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + local.get $0 + if + global.get $~lib/allocator/tlsf/ROOT + local.set $1 + local.get $1 + if + local.get $0 + global.get $~lib/allocator/tlsf/Block.INFO + i32.sub + local.set $2 + local.get $2 + i32.load + local.set $3 + local.get $3 + global.get $~lib/allocator/tlsf/FREE + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 494 + i32.const 6 + call $~lib/env/abort + unreachable + end + local.get $2 + local.get $3 + global.get $~lib/allocator/tlsf/FREE + i32.or + i32.store + local.get $1 + local.get $0 + global.get $~lib/allocator/tlsf/Block.INFO + i32.sub + call $~lib/allocator/tlsf/Root#insert + end + end + ) + (func $~lib/internal/runtime/REALLOC (; 28 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + local.get $0 + i32.const 16 + i32.sub + local.set $2 + local.get $2 + i32.load offset=4 + local.set $3 + local.get $3 + local.get $1 + i32.lt_u + if + local.get $1 + call $~lib/internal/runtime/ALIGN + local.set $4 + local.get $3 + call $~lib/internal/runtime/ALIGN + local.get $4 + i32.lt_u + if + block $~lib/memory/memory.allocate|inlined.1 (result i32) + local.get $4 + local.set $5 + local.get $5 + call $~lib/allocator/tlsf/__memory_allocate + br $~lib/memory/memory.allocate|inlined.1 + end + local.set $5 + local.get $5 + i32.const -1520547049 + i32.store + local.get $5 + i32.const 0 + i32.store offset=8 + local.get $5 + i32.const 0 + i32.store offset=12 + local.get $5 + i32.const 16 + i32.add + local.set $6 + block $~lib/memory/memory.copy|inlined.0 + local.get $6 + local.set $7 + local.get $0 + local.set $8 + local.get $3 + local.set $9 + local.get $7 + local.get $8 + local.get $9 + call $~lib/internal/memory/memmove + end + block $~lib/memory/memory.fill|inlined.1 + local.get $6 + local.get $3 + i32.add + local.set $9 + i32.const 0 + local.set $8 + local.get $1 + local.get $3 + i32.sub + local.set $7 + local.get $9 + local.get $8 + local.get $7 + call $~lib/internal/memory/memset + end + block $~lib/memory/memory.free|inlined.0 + local.get $2 + local.set $7 + local.get $7 + call $~lib/allocator/tlsf/__memory_free + br $~lib/memory/memory.free|inlined.0 + end + local.get $5 + local.set $2 + local.get $6 + local.set $0 + else + local.get $0 + local.get $3 + i32.add + local.set $6 + i32.const 0 + local.set $5 + local.get $1 + local.get $3 + i32.sub + local.set $7 + local.get $6 + local.get $5 + local.get $7 + call $~lib/internal/memory/memset + end + else + nop + end + local.get $2 + local.get $1 + i32.store offset=4 + local.get $0 + ) + (func $~lib/internal/runtime/FREE (; 29 ;) (type $FUNCSIG$vi) (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + global.get $~lib/memory/HEAP_BASE + i32.const 16 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 160 + i32.const 88 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + local.set $1 + local.get $1 + i32.load + i32.const -1520547049 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 160 + i32.const 90 + i32.const 2 + call $~lib/env/abort + unreachable + end + block $~lib/memory/memory.free|inlined.1 + local.get $1 + local.set $2 + local.get $2 + call $~lib/allocator/tlsf/__memory_free + br $~lib/memory/memory.free|inlined.1 + end + ) + (func $std/runtime/__REGISTER_IMPL (; 30 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + global.get $std/runtime/ref4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 53 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $1 + global.get $std/runtime/ref3 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 54 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + local.set $2 + local.get $2 + i32.load + i32.const 43 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 56 + i32.const 2 + call $~lib/env/abort + unreachable + end + i32.const 1 + global.set $std/runtime/called + ) + (func $~lib/internal/runtime/REGISTER (; 31 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $0 + global.get $~lib/memory/HEAP_BASE + i32.const 16 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 160 + i32.const 96 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + local.set $2 + local.get $2 + i32.load + i32.const -1520547049 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 160 + i32.const 98 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $2 + i32.const 43 + i32.store + local.get $0 + local.get $1 + call $std/runtime/__REGISTER_IMPL + ) + (func $start:std/runtime (; 32 ;) (type $FUNCSIG$v) + (local $0 i32) + call $start:~lib/allocator/tlsf + i32.const 43 + i32.const 44 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 15 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 0 + call $~lib/internal/runtime/ALIGN + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 21 + i32.const 0 + call $~lib/env/abort + unreachable + end + block $break|0 + i32.const 0 + local.set $0 + loop $repeat|0 + local.get $0 + i32.const 9000 + i32.lt_s + i32.eqz + br_if $break|0 + local.get $0 + call $~lib/internal/runtime/ALIGN + call $std/runtime/isPowerOf2 + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 23 + i32.const 2 + call $~lib/env/abort + unreachable + end + local.get $0 + i32.const 1 + i32.add + local.set $0 + br $repeat|0 + unreachable + end + unreachable + end + i32.const 0 + call $~lib/internal/runtime/ALIGN + global.set $std/runtime/barrier1 + global.get $std/runtime/barrier1 + i32.const 1 + i32.add + global.set $std/runtime/barrier2 + block $break|1 + loop $continue|1 + global.get $std/runtime/barrier2 + i32.const 1 + i32.add + call $~lib/internal/runtime/ALIGN + global.get $std/runtime/barrier2 + call $~lib/internal/runtime/ALIGN + i32.eq + if + global.get $std/runtime/barrier2 + i32.const 1 + i32.add + global.set $std/runtime/barrier2 + br $continue|1 + end + end + end + global.get $std/runtime/barrier2 + i32.const 1 + i32.add + global.set $std/runtime/barrier3 + block $break|2 + loop $continue|2 + global.get $std/runtime/barrier3 + i32.const 1 + i32.add + call $~lib/internal/runtime/ALIGN + global.get $std/runtime/barrier3 + call $~lib/internal/runtime/ALIGN + i32.eq + if + global.get $std/runtime/barrier3 + i32.const 1 + i32.add + global.set $std/runtime/barrier3 + br $continue|2 + end + end + end + i32.const 88 + i32.const 1 + global.get $std/runtime/barrier1 + f64.convert_i32_u + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + call $~lib/env/trace + i32.const 112 + i32.const 1 + global.get $std/runtime/barrier2 + f64.convert_i32_u + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + call $~lib/env/trace + i32.const 136 + i32.const 1 + global.get $std/runtime/barrier3 + f64.convert_i32_u + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + call $~lib/env/trace + i32.const 1 + call $~lib/internal/runtime/ALLOC + global.set $std/runtime/ref1 + global.get $std/runtime/ref1 + i32.const 16 + i32.sub + global.set $std/runtime/header1 + global.get $std/runtime/header1 + i32.load + i32.const -1520547049 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 38 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/header1 + i32.load offset=4 + i32.const 1 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 39 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/ref1 + global.get $std/runtime/ref1 + global.get $std/runtime/barrier1 + call $~lib/internal/runtime/REALLOC + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 40 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/header1 + i32.load offset=4 + global.get $std/runtime/barrier1 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 41 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/ref1 + global.get $std/runtime/barrier2 + call $~lib/internal/runtime/REALLOC + global.set $std/runtime/ref2 + global.get $std/runtime/ref1 + global.get $std/runtime/ref2 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 43 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/ref2 + i32.const 16 + i32.sub + global.set $std/runtime/header2 + global.get $std/runtime/header2 + i32.load offset=4 + global.get $std/runtime/barrier2 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 45 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/ref2 + call $~lib/internal/runtime/FREE + global.get $std/runtime/barrier2 + call $~lib/internal/runtime/ALLOC + global.set $std/runtime/ref3 + global.get $std/runtime/ref1 + global.get $std/runtime/ref3 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 48 + i32.const 0 + call $~lib/env/abort + unreachable + end + global.get $std/runtime/barrier1 + call $~lib/internal/runtime/ALLOC + global.set $std/runtime/ref4 + global.get $std/runtime/ref4 + global.get $std/runtime/ref3 + call $~lib/internal/runtime/REGISTER + global.get $std/runtime/called + i32.eqz + if + i32.const 0 + i32.const 56 + i32.const 60 + i32.const 0 + call $~lib/env/abort + unreachable + end + ) + (func $start (; 33 ;) (type $FUNCSIG$v) + call $start:std/runtime + ) + (func $null (; 34 ;) (type $FUNCSIG$v) + ) +)