Share test runner between allocators

This commit is contained in:
dcodeIO 2018-02-19 23:07:35 +01:00
parent 67f6efee1e
commit d8cdb663cb
9 changed files with 2320 additions and 284 deletions

View File

@ -1,2 +1,3 @@
import "./buddy";
export { allocate_memory, free_memory };
export { set_memory };

View File

@ -3,6 +3,7 @@
(type $iv (func (param i32)))
(type $iiv (func (param i32 i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $iiiv (func (param i32 i32 i32)))
(type $v (func))
(global $assembly/buddy/BUCKET_START (mut i32) (i32.const 0))
(global $assembly/buddy/BUCKET_END (mut i32) (i32.const 0))
@ -15,6 +16,7 @@
(memory $0 1)
(export "allocate_memory" (func $assembly/buddy/allocate_memory))
(export "free_memory" (func $assembly/buddy/free_memory))
(export "set_memory" (func "$(lib)/memory/set_memory"))
(export "memory" (memory $0))
(start $start)
(func $assembly/buddy/update_max_ptr (; 0 ;) (type $ii) (param $0 i32) (result i32)
@ -1057,7 +1059,505 @@
)
)
)
(func $start (; 15 ;) (type $v)
(func "$(lib)/memory/set_memory" (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i64)
(local $4 i32)
;;@ (lib)/memory.ts:196:2
(if
;;@ (lib)/memory.ts:196:6
(i32.eqz
;;@ (lib)/memory.ts:196:7
(get_local $2)
)
;;@ (lib)/memory.ts:197:4
(return)
)
;;@ (lib)/memory.ts:198:2
(i32.store8
;;@ (lib)/memory.ts:198:12
(get_local $0)
;;@ (lib)/memory.ts:198:18
(get_local $1)
)
;;@ (lib)/memory.ts:199:2
(i32.store8
;;@ (lib)/memory.ts:199:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:199:19
(get_local $2)
)
;;@ (lib)/memory.ts:199:23
(i32.const 1)
)
;;@ (lib)/memory.ts:199:26
(get_local $1)
)
;;@ (lib)/memory.ts:200:2
(if
;;@ (lib)/memory.ts:200:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:200:11
(i32.const 2)
)
;;@ (lib)/memory.ts:201:4
(return)
)
;;@ (lib)/memory.ts:203:2
(i32.store8
;;@ (lib)/memory.ts:203:12
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:203:19
(i32.const 1)
)
;;@ (lib)/memory.ts:203:22
(get_local $1)
)
;;@ (lib)/memory.ts:204:2
(i32.store8
;;@ (lib)/memory.ts:204:12
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:204:19
(i32.const 2)
)
;;@ (lib)/memory.ts:204:22
(get_local $1)
)
;;@ (lib)/memory.ts:205:2
(i32.store8
;;@ (lib)/memory.ts:205:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:205:19
(get_local $2)
)
;;@ (lib)/memory.ts:205:23
(i32.const 2)
)
;;@ (lib)/memory.ts:205:26
(get_local $1)
)
;;@ (lib)/memory.ts:206:2
(i32.store8
;;@ (lib)/memory.ts:206:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:206:19
(get_local $2)
)
;;@ (lib)/memory.ts:206:23
(i32.const 3)
)
;;@ (lib)/memory.ts:206:26
(get_local $1)
)
;;@ (lib)/memory.ts:207:2
(if
;;@ (lib)/memory.ts:207:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:207:11
(i32.const 6)
)
;;@ (lib)/memory.ts:208:4
(return)
)
;;@ (lib)/memory.ts:209:2
(i32.store8
;;@ (lib)/memory.ts:209:12
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:209:19
(i32.const 3)
)
;;@ (lib)/memory.ts:209:22
(get_local $1)
)
;;@ (lib)/memory.ts:210:2
(i32.store8
;;@ (lib)/memory.ts:210:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:210:19
(get_local $2)
)
;;@ (lib)/memory.ts:210:23
(i32.const 4)
)
;;@ (lib)/memory.ts:210:26
(get_local $1)
)
;;@ (lib)/memory.ts:211:2
(if
;;@ (lib)/memory.ts:211:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:211:11
(i32.const 8)
)
;;@ (lib)/memory.ts:212:4
(return)
)
;;@ (lib)/memory.ts:223:2
(i32.store
;;@ (lib)/memory.ts:216:2
(tee_local $0
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:215:2
(tee_local $4
;;@ (lib)/memory.ts:215:17
(i32.and
(i32.sub
(i32.const 0)
;;@ (lib)/memory.ts:215:18
(get_local $0)
)
;;@ (lib)/memory.ts:215:25
(i32.const 3)
)
)
)
)
;;@ (lib)/memory.ts:220:2
(tee_local $1
;;@ (lib)/memory.ts:220:17
(i32.mul
;;@ (lib)/memory.ts:220:33
(get_local $1)
(i32.const 16843009)
)
)
)
;;@ (lib)/memory.ts:224:2
(i32.store
;;@ (lib)/memory.ts:224:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:218:2
(tee_local $2
(i32.and
(i32.sub
;;@ (lib)/memory.ts:217:2
(get_local $2)
;;@ (lib)/memory.ts:217:7
(get_local $4)
)
;;@ (lib)/memory.ts:218:7
(i32.const -4)
)
)
)
;;@ (lib)/memory.ts:224:24
(i32.const 4)
)
;;@ (lib)/memory.ts:224:27
(get_local $1)
)
;;@ (lib)/memory.ts:225:2
(if
;;@ (lib)/memory.ts:225:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:225:11
(i32.const 8)
)
;;@ (lib)/memory.ts:226:4
(return)
)
;;@ (lib)/memory.ts:227:2
(i32.store
;;@ (lib)/memory.ts:227:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:227:20
(i32.const 4)
)
;;@ (lib)/memory.ts:227:23
(get_local $1)
)
;;@ (lib)/memory.ts:228:2
(i32.store
;;@ (lib)/memory.ts:228:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:228:20
(i32.const 8)
)
;;@ (lib)/memory.ts:228:23
(get_local $1)
)
;;@ (lib)/memory.ts:229:2
(i32.store
;;@ (lib)/memory.ts:229:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:229:20
(get_local $2)
)
;;@ (lib)/memory.ts:229:24
(i32.const 12)
)
;;@ (lib)/memory.ts:229:28
(get_local $1)
)
;;@ (lib)/memory.ts:230:2
(i32.store
;;@ (lib)/memory.ts:230:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:230:20
(get_local $2)
)
;;@ (lib)/memory.ts:230:24
(i32.const 8)
)
;;@ (lib)/memory.ts:230:27
(get_local $1)
)
;;@ (lib)/memory.ts:231:2
(if
;;@ (lib)/memory.ts:231:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:231:11
(i32.const 24)
)
;;@ (lib)/memory.ts:232:4
(return)
)
;;@ (lib)/memory.ts:233:2
(i32.store
;;@ (lib)/memory.ts:233:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:233:20
(i32.const 12)
)
;;@ (lib)/memory.ts:233:24
(get_local $1)
)
;;@ (lib)/memory.ts:234:2
(i32.store
;;@ (lib)/memory.ts:234:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:234:20
(i32.const 16)
)
;;@ (lib)/memory.ts:234:24
(get_local $1)
)
;;@ (lib)/memory.ts:235:2
(i32.store
;;@ (lib)/memory.ts:235:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:235:20
(i32.const 20)
)
;;@ (lib)/memory.ts:235:24
(get_local $1)
)
;;@ (lib)/memory.ts:236:2
(i32.store
;;@ (lib)/memory.ts:236:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:236:20
(i32.const 24)
)
;;@ (lib)/memory.ts:236:24
(get_local $1)
)
;;@ (lib)/memory.ts:237:2
(i32.store
;;@ (lib)/memory.ts:237:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:237:20
(get_local $2)
)
;;@ (lib)/memory.ts:237:24
(i32.const 28)
)
;;@ (lib)/memory.ts:237:28
(get_local $1)
)
;;@ (lib)/memory.ts:238:2
(i32.store
;;@ (lib)/memory.ts:238:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:238:20
(get_local $2)
)
;;@ (lib)/memory.ts:238:24
(i32.const 24)
)
;;@ (lib)/memory.ts:238:28
(get_local $1)
)
;;@ (lib)/memory.ts:239:2
(i32.store
;;@ (lib)/memory.ts:239:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:239:20
(get_local $2)
)
;;@ (lib)/memory.ts:239:24
(i32.const 20)
)
;;@ (lib)/memory.ts:239:28
(get_local $1)
)
;;@ (lib)/memory.ts:240:2
(i32.store
;;@ (lib)/memory.ts:240:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:240:20
(get_local $2)
)
;;@ (lib)/memory.ts:240:24
(i32.const 16)
)
;;@ (lib)/memory.ts:240:28
(get_local $1)
)
;;@ (lib)/memory.ts:244:2
(set_local $0
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:243:2
(tee_local $4
;;@ (lib)/memory.ts:243:6
(i32.add
;;@ (lib)/memory.ts:243:11
(i32.and
;;@ (lib)/memory.ts:243:12
(get_local $0)
;;@ (lib)/memory.ts:243:19
(i32.const 4)
)
;;@ (lib)/memory.ts:243:6
(i32.const 24)
)
)
)
)
;;@ (lib)/memory.ts:245:2
(set_local $2
(i32.sub
(get_local $2)
;;@ (lib)/memory.ts:245:7
(get_local $4)
)
)
;;@ (lib)/memory.ts:248:2
(set_local $3
;;@ (lib)/memory.ts:248:17
(i64.or
(i64.extend_u/i32
(get_local $1)
)
;;@ (lib)/memory.ts:248:28
(i64.shl
;;@ (lib)/memory.ts:248:29
(i64.extend_u/i32
(get_local $1)
)
;;@ (lib)/memory.ts:248:41
(i64.const 32)
)
)
)
(loop $continue|0
(if
;;@ (lib)/memory.ts:249:9
(i32.ge_u
(get_local $2)
;;@ (lib)/memory.ts:249:14
(i32.const 32)
)
(block
;;@ (lib)/memory.ts:250:4
(i64.store
;;@ (lib)/memory.ts:250:15
(get_local $0)
;;@ (lib)/memory.ts:250:21
(get_local $3)
)
;;@ (lib)/memory.ts:251:4
(i64.store
;;@ (lib)/memory.ts:251:15
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:251:22
(i32.const 8)
)
;;@ (lib)/memory.ts:251:25
(get_local $3)
)
;;@ (lib)/memory.ts:252:4
(i64.store
;;@ (lib)/memory.ts:252:15
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:252:22
(i32.const 16)
)
;;@ (lib)/memory.ts:252:26
(get_local $3)
)
;;@ (lib)/memory.ts:253:4
(i64.store
;;@ (lib)/memory.ts:253:15
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:253:22
(i32.const 24)
)
;;@ (lib)/memory.ts:253:26
(get_local $3)
)
;;@ (lib)/memory.ts:254:4
(set_local $2
(i32.sub
(get_local $2)
;;@ (lib)/memory.ts:254:9
(i32.const 32)
)
)
;;@ (lib)/memory.ts:255:4
(set_local $0
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:255:12
(i32.const 32)
)
)
(br $continue|0)
)
)
)
)
(func $start (; 16 ;) (type $v)
(set_global $assembly/buddy/BUCKET_START
;;@ assembly/buddy.ts:92:26
(get_global $HEAP_BASE)

View File

@ -5,6 +5,7 @@
(type $iv (func (param i32)))
(type $iiv (func (param i32 i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $iiiv (func (param i32 i32 i32)))
(type $v (func))
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
(global $assembly/buddy/HEADER_SIZE i32 (i32.const 8))
@ -26,6 +27,7 @@
(data (i32.const 4) "\11\00\00\00a\00s\00s\00e\00m\00b\00l\00y\00/\00b\00u\00d\00d\00y\00.\00t\00s\00")
(export "allocate_memory" (func $assembly/buddy/allocate_memory))
(export "free_memory" (func $assembly/buddy/free_memory))
(export "set_memory" (func "$(lib)/memory/set_memory"))
(export "memory" (memory $0))
(start $start)
(func $assembly/buddy/update_max_ptr (; 1 ;) (type $ii) (param $0 i32) (result i32)
@ -1281,7 +1283,527 @@
)
)
)
(func $start (; 17 ;) (type $v)
(func "$(lib)/memory/set_memory" (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i64)
;;@ (lib)/memory.ts:196:2
(if
;;@ (lib)/memory.ts:196:6
(i32.eqz
;;@ (lib)/memory.ts:196:7
(get_local $2)
)
;;@ (lib)/memory.ts:197:4
(return)
)
;;@ (lib)/memory.ts:198:2
(i32.store8
;;@ (lib)/memory.ts:198:12
(get_local $0)
;;@ (lib)/memory.ts:198:18
(get_local $1)
)
;;@ (lib)/memory.ts:199:2
(i32.store8
;;@ (lib)/memory.ts:199:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:199:19
(get_local $2)
)
;;@ (lib)/memory.ts:199:23
(i32.const 1)
)
;;@ (lib)/memory.ts:199:26
(get_local $1)
)
;;@ (lib)/memory.ts:200:2
(if
;;@ (lib)/memory.ts:200:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:200:11
(i32.const 2)
)
;;@ (lib)/memory.ts:201:4
(return)
)
;;@ (lib)/memory.ts:203:2
(i32.store8
;;@ (lib)/memory.ts:203:12
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:203:19
(i32.const 1)
)
;;@ (lib)/memory.ts:203:22
(get_local $1)
)
;;@ (lib)/memory.ts:204:2
(i32.store8
;;@ (lib)/memory.ts:204:12
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:204:19
(i32.const 2)
)
;;@ (lib)/memory.ts:204:22
(get_local $1)
)
;;@ (lib)/memory.ts:205:2
(i32.store8
;;@ (lib)/memory.ts:205:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:205:19
(get_local $2)
)
;;@ (lib)/memory.ts:205:23
(i32.const 2)
)
;;@ (lib)/memory.ts:205:26
(get_local $1)
)
;;@ (lib)/memory.ts:206:2
(i32.store8
;;@ (lib)/memory.ts:206:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:206:19
(get_local $2)
)
;;@ (lib)/memory.ts:206:23
(i32.const 3)
)
;;@ (lib)/memory.ts:206:26
(get_local $1)
)
;;@ (lib)/memory.ts:207:2
(if
;;@ (lib)/memory.ts:207:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:207:11
(i32.const 6)
)
;;@ (lib)/memory.ts:208:4
(return)
)
;;@ (lib)/memory.ts:209:2
(i32.store8
;;@ (lib)/memory.ts:209:12
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:209:19
(i32.const 3)
)
;;@ (lib)/memory.ts:209:22
(get_local $1)
)
;;@ (lib)/memory.ts:210:2
(i32.store8
;;@ (lib)/memory.ts:210:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:210:19
(get_local $2)
)
;;@ (lib)/memory.ts:210:23
(i32.const 4)
)
;;@ (lib)/memory.ts:210:26
(get_local $1)
)
;;@ (lib)/memory.ts:211:2
(if
;;@ (lib)/memory.ts:211:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:211:11
(i32.const 8)
)
;;@ (lib)/memory.ts:212:4
(return)
)
;;@ (lib)/memory.ts:215:2
(set_local $3
;;@ (lib)/memory.ts:215:17
(i32.and
(i32.sub
(i32.const 0)
;;@ (lib)/memory.ts:215:18
(get_local $0)
)
;;@ (lib)/memory.ts:215:25
(i32.const 3)
)
)
;;@ (lib)/memory.ts:216:2
(set_local $0
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:216:10
(get_local $3)
)
)
;;@ (lib)/memory.ts:217:2
(set_local $2
(i32.sub
(get_local $2)
;;@ (lib)/memory.ts:217:7
(get_local $3)
)
)
;;@ (lib)/memory.ts:218:2
(set_local $2
(i32.and
(get_local $2)
;;@ (lib)/memory.ts:218:7
(i32.const -4)
)
)
;;@ (lib)/memory.ts:220:2
(set_local $4
;;@ (lib)/memory.ts:220:17
(i32.mul
(i32.div_u
(i32.const -1)
;;@ (lib)/memory.ts:220:27
(i32.const 255)
)
;;@ (lib)/memory.ts:220:33
(get_local $1)
)
)
;;@ (lib)/memory.ts:223:2
(i32.store
;;@ (lib)/memory.ts:223:13
(get_local $0)
;;@ (lib)/memory.ts:223:19
(get_local $4)
)
;;@ (lib)/memory.ts:224:2
(i32.store
;;@ (lib)/memory.ts:224:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:224:20
(get_local $2)
)
;;@ (lib)/memory.ts:224:24
(i32.const 4)
)
;;@ (lib)/memory.ts:224:27
(get_local $4)
)
;;@ (lib)/memory.ts:225:2
(if
;;@ (lib)/memory.ts:225:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:225:11
(i32.const 8)
)
;;@ (lib)/memory.ts:226:4
(return)
)
;;@ (lib)/memory.ts:227:2
(i32.store
;;@ (lib)/memory.ts:227:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:227:20
(i32.const 4)
)
;;@ (lib)/memory.ts:227:23
(get_local $4)
)
;;@ (lib)/memory.ts:228:2
(i32.store
;;@ (lib)/memory.ts:228:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:228:20
(i32.const 8)
)
;;@ (lib)/memory.ts:228:23
(get_local $4)
)
;;@ (lib)/memory.ts:229:2
(i32.store
;;@ (lib)/memory.ts:229:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:229:20
(get_local $2)
)
;;@ (lib)/memory.ts:229:24
(i32.const 12)
)
;;@ (lib)/memory.ts:229:28
(get_local $4)
)
;;@ (lib)/memory.ts:230:2
(i32.store
;;@ (lib)/memory.ts:230:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:230:20
(get_local $2)
)
;;@ (lib)/memory.ts:230:24
(i32.const 8)
)
;;@ (lib)/memory.ts:230:27
(get_local $4)
)
;;@ (lib)/memory.ts:231:2
(if
;;@ (lib)/memory.ts:231:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:231:11
(i32.const 24)
)
;;@ (lib)/memory.ts:232:4
(return)
)
;;@ (lib)/memory.ts:233:2
(i32.store
;;@ (lib)/memory.ts:233:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:233:20
(i32.const 12)
)
;;@ (lib)/memory.ts:233:24
(get_local $4)
)
;;@ (lib)/memory.ts:234:2
(i32.store
;;@ (lib)/memory.ts:234:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:234:20
(i32.const 16)
)
;;@ (lib)/memory.ts:234:24
(get_local $4)
)
;;@ (lib)/memory.ts:235:2
(i32.store
;;@ (lib)/memory.ts:235:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:235:20
(i32.const 20)
)
;;@ (lib)/memory.ts:235:24
(get_local $4)
)
;;@ (lib)/memory.ts:236:2
(i32.store
;;@ (lib)/memory.ts:236:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:236:20
(i32.const 24)
)
;;@ (lib)/memory.ts:236:24
(get_local $4)
)
;;@ (lib)/memory.ts:237:2
(i32.store
;;@ (lib)/memory.ts:237:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:237:20
(get_local $2)
)
;;@ (lib)/memory.ts:237:24
(i32.const 28)
)
;;@ (lib)/memory.ts:237:28
(get_local $4)
)
;;@ (lib)/memory.ts:238:2
(i32.store
;;@ (lib)/memory.ts:238:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:238:20
(get_local $2)
)
;;@ (lib)/memory.ts:238:24
(i32.const 24)
)
;;@ (lib)/memory.ts:238:28
(get_local $4)
)
;;@ (lib)/memory.ts:239:2
(i32.store
;;@ (lib)/memory.ts:239:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:239:20
(get_local $2)
)
;;@ (lib)/memory.ts:239:24
(i32.const 20)
)
;;@ (lib)/memory.ts:239:28
(get_local $4)
)
;;@ (lib)/memory.ts:240:2
(i32.store
;;@ (lib)/memory.ts:240:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:240:20
(get_local $2)
)
;;@ (lib)/memory.ts:240:24
(i32.const 16)
)
;;@ (lib)/memory.ts:240:28
(get_local $4)
)
;;@ (lib)/memory.ts:243:2
(set_local $3
;;@ (lib)/memory.ts:243:6
(i32.add
(i32.const 24)
;;@ (lib)/memory.ts:243:11
(i32.and
;;@ (lib)/memory.ts:243:12
(get_local $0)
;;@ (lib)/memory.ts:243:19
(i32.const 4)
)
)
)
;;@ (lib)/memory.ts:244:2
(set_local $0
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:244:10
(get_local $3)
)
)
;;@ (lib)/memory.ts:245:2
(set_local $2
(i32.sub
(get_local $2)
;;@ (lib)/memory.ts:245:7
(get_local $3)
)
)
;;@ (lib)/memory.ts:248:2
(set_local $5
;;@ (lib)/memory.ts:248:17
(i64.or
(i64.extend_u/i32
(get_local $4)
)
;;@ (lib)/memory.ts:248:28
(i64.shl
;;@ (lib)/memory.ts:248:29
(i64.extend_u/i32
(get_local $4)
)
;;@ (lib)/memory.ts:248:41
(i64.const 32)
)
)
)
;;@ (lib)/memory.ts:249:2
(block $break|0
(loop $continue|0
(if
;;@ (lib)/memory.ts:249:9
(i32.ge_u
(get_local $2)
;;@ (lib)/memory.ts:249:14
(i32.const 32)
)
(block
(block
;;@ (lib)/memory.ts:250:4
(i64.store
;;@ (lib)/memory.ts:250:15
(get_local $0)
;;@ (lib)/memory.ts:250:21
(get_local $5)
)
;;@ (lib)/memory.ts:251:4
(i64.store
;;@ (lib)/memory.ts:251:15
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:251:22
(i32.const 8)
)
;;@ (lib)/memory.ts:251:25
(get_local $5)
)
;;@ (lib)/memory.ts:252:4
(i64.store
;;@ (lib)/memory.ts:252:15
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:252:22
(i32.const 16)
)
;;@ (lib)/memory.ts:252:26
(get_local $5)
)
;;@ (lib)/memory.ts:253:4
(i64.store
;;@ (lib)/memory.ts:253:15
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:253:22
(i32.const 24)
)
;;@ (lib)/memory.ts:253:26
(get_local $5)
)
;;@ (lib)/memory.ts:254:4
(set_local $2
(i32.sub
(get_local $2)
;;@ (lib)/memory.ts:254:9
(i32.const 32)
)
)
;;@ (lib)/memory.ts:255:4
(set_local $0
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:255:12
(i32.const 32)
)
)
)
(br $continue|0)
)
)
)
)
)
(func $start (; 18 ;) (type $v)
(set_global $assembly/buddy/BUCKET_START
;;@ assembly/buddy.ts:92:26
(get_global $HEAP_BASE)

View File

@ -19,15 +19,7 @@ function test(file) {
return String.fromCharCode.apply(String, str);
}
// TODO: create an actual test-runner
var ptr1 = exports.allocate_memory(16);
var ptr2 = exports.allocate_memory(16);
if (ptr1 == ptr2) throw Error();
exports.free_memory(ptr1);
exports.free_memory(ptr2);
ptr2 = exports.allocate_memory(16);
if (ptr1 != ptr2) throw Error();
exports.free_memory(ptr2);
require("../runner")(exports, 20, 20000);
console.log("mem final: " + exports.memory.buffer.byteLength);
console.log();

View File

@ -1,15 +1,15 @@
function runner(tlsf, runs, allocs) {
function runner(allocator, runs, allocs) {
var ptrs = [];
function randomAlloc(maxSize) {
if (!maxSize) maxSize = 8192;
var size = ((Math.random() * maxSize) >>> 0) + 1;
size = (size + 3) & ~3;
var ptr = tlsf.allocate_memory(size);
var ptr = allocator.allocate_memory(size);
if (!ptr) throw Error();
if (ptrs.indexOf(ptr) >= 0) throw Error();
if (tlsf.set_memory)
tlsf.set_memory(ptr, 0xdc, size);
if (allocator.set_memory)
allocator.set_memory(ptr, 0xdc, size);
ptrs.push(ptr);
return ptr;
}
@ -20,7 +20,7 @@ function runner(tlsf, runs, allocs) {
var ptr = ptrs[idx];
ptrs.splice(idx, 1);
if (typeof ptr !== "number") throw Error();
tlsf.free_memory(ptr);
allocator.free_memory(ptr);
}
function randomFree() {
@ -28,14 +28,14 @@ function runner(tlsf, runs, allocs) {
var ptr = ptrs[idx];
if (typeof ptr !== "number") throw Error();
ptrs.splice(idx, 1);
tlsf.free_memory(ptr);
allocator.free_memory(ptr);
}
// remember the smallest possible memory address
var base = tlsf.allocate_memory(64);
var base = allocator.allocate_memory(64);
console.log("base: " + base);
tlsf.free_memory(base);
console.log("mem initial: " + tlsf.memory.buffer.byteLength);
allocator.free_memory(base);
console.log("mem initial: " + allocator.memory.buffer.byteLength);
try {
for (var j = 0; j < runs; ++j) {
@ -55,17 +55,18 @@ function runner(tlsf, runs, allocs) {
while (ptrs.length) randomFree();
// should now be possible to reuse the entire memory
// just try a large portion of the memory here because of SL+1 for allocs
var size = ((tlsf.memory.buffer.byteLength - base) * 9 / 10) >>> 0;
var ptr = tlsf.allocate_memory(size);
if (tlsf.set_memory)
tlsf.set_memory(ptr, 0xac, size);
// just try a large portion of the memory here, for example because of
// SL+1 for allocations in TLSF
var size = ((allocator.memory.buffer.byteLength - base) * 9 / 10) >>> 0;
var ptr = allocator.allocate_memory(size);
if (allocator.set_memory)
allocator.set_memory(ptr, 0xac, size);
if (ptr !== base)
throw Error("expected " + base + " but got " + ptr);
tlsf.free_memory(ptr);
allocator.free_memory(ptr);
}
} finally {
// mem(tlsf.memory, 0, 0x10000);
// mem(allocator.memory, 0, 0x10000);
}
}

View File

@ -1,2 +1,3 @@
import "allocator/tlsf";
export { allocate_memory, free_memory };
export { set_memory };

View File

@ -1,5 +1,4 @@
const fs = require("fs");
const runner = require("./runner");
function test(file) {
console.log("Testing '" + file + "' ...\n");
@ -20,7 +19,7 @@ function test(file) {
return String.fromCharCode.apply(String, str);
}
runner(exports, 20, 20000); // picked so I/O isn't the bottleneck
require("../runner")(exports, 20, 20000); // picked so I/O isn't the bottleneck
console.log("mem final: " + exports.memory.buffer.byteLength);
console.log();
}

View File

@ -12,6 +12,7 @@
(memory $0 1)
(export "allocate_memory" (func "$(lib)/allocator/tlsf/allocate_memory"))
(export "free_memory" (func "$(lib)/allocator/tlsf/free_memory"))
(export "set_memory" (func "$(lib)/memory/set_memory"))
(export "memory" (memory $0))
(start $start)
(func "$(lib)/allocator/tlsf/Root#set:tailRef" (; 0 ;) (type $iiv) (param $0 i32) (param $1 i32)
@ -1093,30 +1094,30 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
;;@ (lib)/allocator/tlsf.ts:438:2
;;@ (lib)/allocator/tlsf.ts:439:2
(if
;;@ (lib)/allocator/tlsf.ts:438:6
;;@ (lib)/allocator/tlsf.ts:439:6
(i32.eqz
;;@ (lib)/allocator/tlsf.ts:437:2
;;@ (lib)/allocator/tlsf.ts:438:2
(tee_local $2
;;@ (lib)/allocator/tlsf.ts:437:13
;;@ (lib)/allocator/tlsf.ts:438:13
(get_global "$(lib)/allocator/tlsf/ROOT")
)
)
;;@ (lib)/allocator/tlsf.ts:438:13
;;@ (lib)/allocator/tlsf.ts:439:13
(block
;;@ (lib)/allocator/tlsf.ts:440:4
;;@ (lib)/allocator/tlsf.ts:441:4
(set_global "$(lib)/allocator/tlsf/ROOT"
;;@ (lib)/allocator/tlsf.ts:440:11
;;@ (lib)/allocator/tlsf.ts:441:11
(tee_local $2
;;@ (lib)/allocator/tlsf.ts:439:4
;;@ (lib)/allocator/tlsf.ts:440:4
(tee_local $4
;;@ (lib)/allocator/tlsf.ts:439:21
;;@ (lib)/allocator/tlsf.ts:440:21
(i32.and
(i32.add
;;@ (lib)/allocator/tlsf.ts:439:22
;;@ (lib)/allocator/tlsf.ts:440:22
(get_global $HEAP_BASE)
;;@ (lib)/allocator/tlsf.ts:439:34
;;@ (lib)/allocator/tlsf.ts:440:34
(i32.const 3)
)
(i32.const -4)
@ -1124,65 +1125,65 @@
)
)
)
;;@ (lib)/allocator/tlsf.ts:441:4
;;@ (lib)/allocator/tlsf.ts:442:4
(call "$(lib)/allocator/tlsf/Root#set:tailRef"
(get_local $2)
;;@ (lib)/allocator/tlsf.ts:441:19
;;@ (lib)/allocator/tlsf.ts:442:19
(i32.const 0)
)
;;@ (lib)/allocator/tlsf.ts:442:4
;;@ (lib)/allocator/tlsf.ts:443:4
(i32.store
(get_local $2)
;;@ (lib)/allocator/tlsf.ts:442:17
;;@ (lib)/allocator/tlsf.ts:443:17
(i32.const 0)
)
(loop $continue|0
(if
;;@ (lib)/allocator/tlsf.ts:443:28
;;@ (lib)/allocator/tlsf.ts:444:28
(i32.lt_u
(get_local $1)
;;@ (lib)/allocator/tlsf.ts:443:33
;;@ (lib)/allocator/tlsf.ts:444:33
(i32.const 23)
)
(block
;;@ (lib)/allocator/tlsf.ts:444:11
;;@ (lib)/allocator/tlsf.ts:445:11
(call "$(lib)/allocator/tlsf/Root#setSLMap"
;;@ (lib)/allocator/tlsf.ts:444:6
;;@ (lib)/allocator/tlsf.ts:445:6
(get_local $2)
;;@ (lib)/allocator/tlsf.ts:444:20
;;@ (lib)/allocator/tlsf.ts:445:20
(get_local $1)
;;@ (lib)/allocator/tlsf.ts:444:24
;;@ (lib)/allocator/tlsf.ts:445:24
(i32.const 0)
)
;;@ (lib)/allocator/tlsf.ts:445:11
;;@ (lib)/allocator/tlsf.ts:446:11
(set_local $3
;;@ (lib)/allocator/tlsf.ts:445:25
;;@ (lib)/allocator/tlsf.ts:446:25
(i32.const 0)
)
(loop $continue|1
(if
;;@ (lib)/allocator/tlsf.ts:445:28
;;@ (lib)/allocator/tlsf.ts:446:28
(i32.lt_u
(get_local $3)
;;@ (lib)/allocator/tlsf.ts:445:33
;;@ (lib)/allocator/tlsf.ts:446:33
(i32.const 32)
)
(block
;;@ (lib)/allocator/tlsf.ts:446:13
;;@ (lib)/allocator/tlsf.ts:447:13
(call "$(lib)/allocator/tlsf/Root#setHead"
;;@ (lib)/allocator/tlsf.ts:446:8
;;@ (lib)/allocator/tlsf.ts:447:8
(get_local $2)
;;@ (lib)/allocator/tlsf.ts:446:21
;;@ (lib)/allocator/tlsf.ts:447:21
(get_local $1)
;;@ (lib)/allocator/tlsf.ts:446:25
;;@ (lib)/allocator/tlsf.ts:447:25
(get_local $3)
;;@ (lib)/allocator/tlsf.ts:446:29
;;@ (lib)/allocator/tlsf.ts:447:29
(i32.const 0)
)
;;@ (lib)/allocator/tlsf.ts:445:42
;;@ (lib)/allocator/tlsf.ts:446:42
(set_local $3
(i32.add
;;@ (lib)/allocator/tlsf.ts:445:44
;;@ (lib)/allocator/tlsf.ts:446:44
(get_local $3)
(i32.const 1)
)
@ -1191,10 +1192,10 @@
)
)
)
;;@ (lib)/allocator/tlsf.ts:443:42
;;@ (lib)/allocator/tlsf.ts:444:42
(set_local $1
(i32.add
;;@ (lib)/allocator/tlsf.ts:443:44
;;@ (lib)/allocator/tlsf.ts:444:44
(get_local $1)
(i32.const 1)
)
@ -1203,75 +1204,75 @@
)
)
)
;;@ (lib)/allocator/tlsf.ts:448:9
;;@ (lib)/allocator/tlsf.ts:449:9
(drop
(call "$(lib)/allocator/tlsf/Root#addMemory"
;;@ (lib)/allocator/tlsf.ts:448:4
;;@ (lib)/allocator/tlsf.ts:449:4
(get_local $2)
;;@ (lib)/allocator/tlsf.ts:448:19
;;@ (lib)/allocator/tlsf.ts:449:19
(i32.add
(get_local $4)
;;@ (lib)/allocator/tlsf.ts:448:32
;;@ (lib)/allocator/tlsf.ts:449:32
(i32.const 3044)
)
;;@ (lib)/allocator/tlsf.ts:448:43
;;@ (lib)/allocator/tlsf.ts:449:43
(i32.shl
(current_memory)
;;@ (lib)/allocator/tlsf.ts:448:63
;;@ (lib)/allocator/tlsf.ts:449:63
(i32.const 16)
)
)
)
)
)
;;@ (lib)/allocator/tlsf.ts:452:2
;;@ (lib)/allocator/tlsf.ts:453:2
(set_local $1
;;@ (lib)/allocator/tlsf.ts:452:20
;;@ (lib)/allocator/tlsf.ts:453:20
(i32.const 0)
)
;;@ (lib)/allocator/tlsf.ts:453:2
;;@ (lib)/allocator/tlsf.ts:454:2
(if
(select
;;@ (lib)/allocator/tlsf.ts:453:14
;;@ (lib)/allocator/tlsf.ts:454:14
(i32.lt_u
(get_local $0)
;;@ (lib)/allocator/tlsf.ts:453:21
;;@ (lib)/allocator/tlsf.ts:454:21
(i32.const 1073741824)
)
(get_local $0)
;;@ (lib)/allocator/tlsf.ts:453:6
;;@ (lib)/allocator/tlsf.ts:454:6
(get_local $0)
)
;;@ (lib)/allocator/tlsf.ts:453:37
;;@ (lib)/allocator/tlsf.ts:454:37
(block
;;@ (lib)/allocator/tlsf.ts:457:4
;;@ (lib)/allocator/tlsf.ts:458:4
(if
;;@ (lib)/allocator/tlsf.ts:457:8
;;@ (lib)/allocator/tlsf.ts:458:8
(i32.eqz
;;@ (lib)/allocator/tlsf.ts:456:4
;;@ (lib)/allocator/tlsf.ts:457:4
(tee_local $1
;;@ (lib)/allocator/tlsf.ts:456:21
;;@ (lib)/allocator/tlsf.ts:457:21
(call "$(lib)/allocator/tlsf/Root#search"
;;@ (lib)/allocator/tlsf.ts:456:16
;;@ (lib)/allocator/tlsf.ts:457:16
(get_local $2)
;;@ (lib)/allocator/tlsf.ts:454:4
;;@ (lib)/allocator/tlsf.ts:455:4
(tee_local $0
;;@ (lib)/allocator/tlsf.ts:454:11
;;@ (lib)/allocator/tlsf.ts:455:11
(select
(tee_local $1
;;@ (lib)/allocator/tlsf.ts:454:22
;;@ (lib)/allocator/tlsf.ts:455:22
(i32.and
(i32.add
;;@ (lib)/allocator/tlsf.ts:454:23
;;@ (lib)/allocator/tlsf.ts:455:23
(get_local $0)
;;@ (lib)/allocator/tlsf.ts:454:30
;;@ (lib)/allocator/tlsf.ts:455:30
(i32.const 3)
)
(i32.const -4)
)
)
(tee_local $3
;;@ (lib)/allocator/tlsf.ts:454:51
;;@ (lib)/allocator/tlsf.ts:455:51
(i32.const 12)
)
(i32.gt_u
@ -1283,36 +1284,36 @@
)
)
)
;;@ (lib)/allocator/tlsf.ts:457:16
;;@ (lib)/allocator/tlsf.ts:458:16
(block
;;@ (lib)/allocator/tlsf.ts:462:6
;;@ (lib)/allocator/tlsf.ts:463:6
(if
;;@ (lib)/allocator/tlsf.ts:462:10
;;@ (lib)/allocator/tlsf.ts:463:10
(i32.lt_s
(grow_memory
;;@ (lib)/allocator/tlsf.ts:461:24
;;@ (lib)/allocator/tlsf.ts:462:24
(select
(tee_local $1
;;@ (lib)/allocator/tlsf.ts:460:6
;;@ (lib)/allocator/tlsf.ts:461:6
(tee_local $4
;;@ (lib)/allocator/tlsf.ts:460:24
;;@ (lib)/allocator/tlsf.ts:461:24
(current_memory)
)
)
(tee_local $3
;;@ (lib)/allocator/tlsf.ts:461:41
;;@ (lib)/allocator/tlsf.ts:462:41
(i32.shr_u
(i32.and
;;@ (lib)/allocator/tlsf.ts:461:42
;;@ (lib)/allocator/tlsf.ts:462:42
(i32.add
;;@ (lib)/allocator/tlsf.ts:461:43
;;@ (lib)/allocator/tlsf.ts:462:43
(get_local $0)
;;@ (lib)/allocator/tlsf.ts:461:50
;;@ (lib)/allocator/tlsf.ts:462:50
(i32.const 65535)
)
(i32.const -65536)
)
;;@ (lib)/allocator/tlsf.ts:461:73
;;@ (lib)/allocator/tlsf.ts:462:73
(i32.const 16)
)
)
@ -1322,108 +1323,108 @@
)
)
)
;;@ (lib)/allocator/tlsf.ts:462:37
;;@ (lib)/allocator/tlsf.ts:463:37
(i32.const 0)
)
;;@ (lib)/allocator/tlsf.ts:463:8
;;@ (lib)/allocator/tlsf.ts:464:8
(unreachable)
)
;;@ (lib)/allocator/tlsf.ts:465:11
;;@ (lib)/allocator/tlsf.ts:466:11
(drop
(call "$(lib)/allocator/tlsf/Root#addMemory"
;;@ (lib)/allocator/tlsf.ts:465:6
;;@ (lib)/allocator/tlsf.ts:466:6
(get_local $2)
;;@ (lib)/allocator/tlsf.ts:465:21
;;@ (lib)/allocator/tlsf.ts:466:21
(i32.shl
(get_local $4)
;;@ (lib)/allocator/tlsf.ts:465:43
;;@ (lib)/allocator/tlsf.ts:466:43
(i32.const 16)
)
;;@ (lib)/allocator/tlsf.ts:465:47
;;@ (lib)/allocator/tlsf.ts:466:47
(i32.shl
;;@ (lib)/allocator/tlsf.ts:464:23
;;@ (lib)/allocator/tlsf.ts:465:23
(current_memory)
;;@ (lib)/allocator/tlsf.ts:465:68
;;@ (lib)/allocator/tlsf.ts:466:68
(i32.const 16)
)
)
)
;;@ (lib)/allocator/tlsf.ts:466:6
;;@ (lib)/allocator/tlsf.ts:467:6
(set_local $1
;;@ (lib)/allocator/tlsf.ts:466:14
;;@ (lib)/allocator/tlsf.ts:467:14
(call "$(lib)/allocator/tlsf/Root#search"
;;@ (lib)/allocator/tlsf.ts:466:21
;;@ (lib)/allocator/tlsf.ts:467:21
(get_local $2)
;;@ (lib)/allocator/tlsf.ts:466:33
;;@ (lib)/allocator/tlsf.ts:467:33
(get_local $0)
)
)
)
)
;;@ (lib)/allocator/tlsf.ts:470:4
;;@ (lib)/allocator/tlsf.ts:471:4
(set_local $1
;;@ (lib)/allocator/tlsf.ts:470:16
;;@ (lib)/allocator/tlsf.ts:471:16
(call "$(lib)/allocator/tlsf/Root#use"
;;@ (lib)/allocator/tlsf.ts:470:11
;;@ (lib)/allocator/tlsf.ts:471:11
(get_local $2)
;;@ (lib)/allocator/tlsf.ts:470:20
;;@ (lib)/allocator/tlsf.ts:471:20
(get_local $1)
;;@ (lib)/allocator/tlsf.ts:470:27
;;@ (lib)/allocator/tlsf.ts:471:27
(get_local $0)
)
)
)
)
;;@ (lib)/allocator/tlsf.ts:473:9
;;@ (lib)/allocator/tlsf.ts:474:9
(get_local $1)
)
(func "$(lib)/allocator/tlsf/free_memory" (; 13 ;) (type $iv) (param $0 i32)
(local $1 i32)
(local $2 i32)
;;@ (lib)/allocator/tlsf.ts:478:2
;;@ (lib)/allocator/tlsf.ts:480:2
(if
;;@ (lib)/allocator/tlsf.ts:478:6
;;@ (lib)/allocator/tlsf.ts:480:6
(get_local $0)
;;@ (lib)/allocator/tlsf.ts:480:4
;;@ (lib)/allocator/tlsf.ts:482:4
(if
;;@ (lib)/allocator/tlsf.ts:479:4
;;@ (lib)/allocator/tlsf.ts:481:4
(tee_local $1
;;@ (lib)/allocator/tlsf.ts:479:15
;;@ (lib)/allocator/tlsf.ts:481:15
(get_global "$(lib)/allocator/tlsf/ROOT")
)
;;@ (lib)/allocator/tlsf.ts:480:14
;;@ (lib)/allocator/tlsf.ts:482:14
(block
;;@ (lib)/allocator/tlsf.ts:484:6
;;@ (lib)/allocator/tlsf.ts:486:6
(i32.store
;;@ (lib)/allocator/tlsf.ts:481:6
;;@ (lib)/allocator/tlsf.ts:483:6
(tee_local $2
;;@ (lib)/allocator/tlsf.ts:481:18
;;@ (lib)/allocator/tlsf.ts:483:18
(i32.sub
;;@ (lib)/allocator/tlsf.ts:481:36
;;@ (lib)/allocator/tlsf.ts:483:36
(get_local $0)
;;@ (lib)/allocator/tlsf.ts:481:43
;;@ (lib)/allocator/tlsf.ts:483:43
(i32.const 4)
)
)
;;@ (lib)/allocator/tlsf.ts:484:19
;;@ (lib)/allocator/tlsf.ts:486:19
(i32.or
;;@ (lib)/allocator/tlsf.ts:482:22
;;@ (lib)/allocator/tlsf.ts:484:22
(i32.load
(get_local $2)
)
;;@ (lib)/allocator/tlsf.ts:484:31
;;@ (lib)/allocator/tlsf.ts:486:31
(i32.const 1)
)
)
;;@ (lib)/allocator/tlsf.ts:485:11
;;@ (lib)/allocator/tlsf.ts:487:11
(call "$(lib)/allocator/tlsf/Root#insert"
;;@ (lib)/allocator/tlsf.ts:485:6
;;@ (lib)/allocator/tlsf.ts:487:6
(get_local $1)
;;@ (lib)/allocator/tlsf.ts:485:18
;;@ (lib)/allocator/tlsf.ts:487:18
(i32.sub
;;@ (lib)/allocator/tlsf.ts:485:36
;;@ (lib)/allocator/tlsf.ts:487:36
(get_local $0)
;;@ (lib)/allocator/tlsf.ts:485:43
;;@ (lib)/allocator/tlsf.ts:487:43
(i32.const 4)
)
)
@ -1431,7 +1432,505 @@
)
)
)
(func $start (; 14 ;) (type $v)
(func "$(lib)/memory/set_memory" (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i64)
(local $4 i32)
;;@ (lib)/memory.ts:196:2
(if
;;@ (lib)/memory.ts:196:6
(i32.eqz
;;@ (lib)/memory.ts:196:7
(get_local $2)
)
;;@ (lib)/memory.ts:197:4
(return)
)
;;@ (lib)/memory.ts:198:2
(i32.store8
;;@ (lib)/memory.ts:198:12
(get_local $0)
;;@ (lib)/memory.ts:198:18
(get_local $1)
)
;;@ (lib)/memory.ts:199:2
(i32.store8
;;@ (lib)/memory.ts:199:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:199:19
(get_local $2)
)
;;@ (lib)/memory.ts:199:23
(i32.const 1)
)
;;@ (lib)/memory.ts:199:26
(get_local $1)
)
;;@ (lib)/memory.ts:200:2
(if
;;@ (lib)/memory.ts:200:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:200:11
(i32.const 2)
)
;;@ (lib)/memory.ts:201:4
(return)
)
;;@ (lib)/memory.ts:203:2
(i32.store8
;;@ (lib)/memory.ts:203:12
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:203:19
(i32.const 1)
)
;;@ (lib)/memory.ts:203:22
(get_local $1)
)
;;@ (lib)/memory.ts:204:2
(i32.store8
;;@ (lib)/memory.ts:204:12
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:204:19
(i32.const 2)
)
;;@ (lib)/memory.ts:204:22
(get_local $1)
)
;;@ (lib)/memory.ts:205:2
(i32.store8
;;@ (lib)/memory.ts:205:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:205:19
(get_local $2)
)
;;@ (lib)/memory.ts:205:23
(i32.const 2)
)
;;@ (lib)/memory.ts:205:26
(get_local $1)
)
;;@ (lib)/memory.ts:206:2
(i32.store8
;;@ (lib)/memory.ts:206:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:206:19
(get_local $2)
)
;;@ (lib)/memory.ts:206:23
(i32.const 3)
)
;;@ (lib)/memory.ts:206:26
(get_local $1)
)
;;@ (lib)/memory.ts:207:2
(if
;;@ (lib)/memory.ts:207:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:207:11
(i32.const 6)
)
;;@ (lib)/memory.ts:208:4
(return)
)
;;@ (lib)/memory.ts:209:2
(i32.store8
;;@ (lib)/memory.ts:209:12
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:209:19
(i32.const 3)
)
;;@ (lib)/memory.ts:209:22
(get_local $1)
)
;;@ (lib)/memory.ts:210:2
(i32.store8
;;@ (lib)/memory.ts:210:12
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:210:19
(get_local $2)
)
;;@ (lib)/memory.ts:210:23
(i32.const 4)
)
;;@ (lib)/memory.ts:210:26
(get_local $1)
)
;;@ (lib)/memory.ts:211:2
(if
;;@ (lib)/memory.ts:211:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:211:11
(i32.const 8)
)
;;@ (lib)/memory.ts:212:4
(return)
)
;;@ (lib)/memory.ts:223:2
(i32.store
;;@ (lib)/memory.ts:216:2
(tee_local $0
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:215:2
(tee_local $4
;;@ (lib)/memory.ts:215:17
(i32.and
(i32.sub
(i32.const 0)
;;@ (lib)/memory.ts:215:18
(get_local $0)
)
;;@ (lib)/memory.ts:215:25
(i32.const 3)
)
)
)
)
;;@ (lib)/memory.ts:220:2
(tee_local $1
;;@ (lib)/memory.ts:220:17
(i32.mul
;;@ (lib)/memory.ts:220:33
(get_local $1)
(i32.const 16843009)
)
)
)
;;@ (lib)/memory.ts:224:2
(i32.store
;;@ (lib)/memory.ts:224:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:218:2
(tee_local $2
(i32.and
(i32.sub
;;@ (lib)/memory.ts:217:2
(get_local $2)
;;@ (lib)/memory.ts:217:7
(get_local $4)
)
;;@ (lib)/memory.ts:218:7
(i32.const -4)
)
)
)
;;@ (lib)/memory.ts:224:24
(i32.const 4)
)
;;@ (lib)/memory.ts:224:27
(get_local $1)
)
;;@ (lib)/memory.ts:225:2
(if
;;@ (lib)/memory.ts:225:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:225:11
(i32.const 8)
)
;;@ (lib)/memory.ts:226:4
(return)
)
;;@ (lib)/memory.ts:227:2
(i32.store
;;@ (lib)/memory.ts:227:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:227:20
(i32.const 4)
)
;;@ (lib)/memory.ts:227:23
(get_local $1)
)
;;@ (lib)/memory.ts:228:2
(i32.store
;;@ (lib)/memory.ts:228:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:228:20
(i32.const 8)
)
;;@ (lib)/memory.ts:228:23
(get_local $1)
)
;;@ (lib)/memory.ts:229:2
(i32.store
;;@ (lib)/memory.ts:229:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:229:20
(get_local $2)
)
;;@ (lib)/memory.ts:229:24
(i32.const 12)
)
;;@ (lib)/memory.ts:229:28
(get_local $1)
)
;;@ (lib)/memory.ts:230:2
(i32.store
;;@ (lib)/memory.ts:230:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:230:20
(get_local $2)
)
;;@ (lib)/memory.ts:230:24
(i32.const 8)
)
;;@ (lib)/memory.ts:230:27
(get_local $1)
)
;;@ (lib)/memory.ts:231:2
(if
;;@ (lib)/memory.ts:231:6
(i32.le_u
(get_local $2)
;;@ (lib)/memory.ts:231:11
(i32.const 24)
)
;;@ (lib)/memory.ts:232:4
(return)
)
;;@ (lib)/memory.ts:233:2
(i32.store
;;@ (lib)/memory.ts:233:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:233:20
(i32.const 12)
)
;;@ (lib)/memory.ts:233:24
(get_local $1)
)
;;@ (lib)/memory.ts:234:2
(i32.store
;;@ (lib)/memory.ts:234:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:234:20
(i32.const 16)
)
;;@ (lib)/memory.ts:234:24
(get_local $1)
)
;;@ (lib)/memory.ts:235:2
(i32.store
;;@ (lib)/memory.ts:235:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:235:20
(i32.const 20)
)
;;@ (lib)/memory.ts:235:24
(get_local $1)
)
;;@ (lib)/memory.ts:236:2
(i32.store
;;@ (lib)/memory.ts:236:13
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:236:20
(i32.const 24)
)
;;@ (lib)/memory.ts:236:24
(get_local $1)
)
;;@ (lib)/memory.ts:237:2
(i32.store
;;@ (lib)/memory.ts:237:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:237:20
(get_local $2)
)
;;@ (lib)/memory.ts:237:24
(i32.const 28)
)
;;@ (lib)/memory.ts:237:28
(get_local $1)
)
;;@ (lib)/memory.ts:238:2
(i32.store
;;@ (lib)/memory.ts:238:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:238:20
(get_local $2)
)
;;@ (lib)/memory.ts:238:24
(i32.const 24)
)
;;@ (lib)/memory.ts:238:28
(get_local $1)
)
;;@ (lib)/memory.ts:239:2
(i32.store
;;@ (lib)/memory.ts:239:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:239:20
(get_local $2)
)
;;@ (lib)/memory.ts:239:24
(i32.const 20)
)
;;@ (lib)/memory.ts:239:28
(get_local $1)
)
;;@ (lib)/memory.ts:240:2
(i32.store
;;@ (lib)/memory.ts:240:13
(i32.sub
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:240:20
(get_local $2)
)
;;@ (lib)/memory.ts:240:24
(i32.const 16)
)
;;@ (lib)/memory.ts:240:28
(get_local $1)
)
;;@ (lib)/memory.ts:244:2
(set_local $0
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:243:2
(tee_local $4
;;@ (lib)/memory.ts:243:6
(i32.add
;;@ (lib)/memory.ts:243:11
(i32.and
;;@ (lib)/memory.ts:243:12
(get_local $0)
;;@ (lib)/memory.ts:243:19
(i32.const 4)
)
;;@ (lib)/memory.ts:243:6
(i32.const 24)
)
)
)
)
;;@ (lib)/memory.ts:245:2
(set_local $2
(i32.sub
(get_local $2)
;;@ (lib)/memory.ts:245:7
(get_local $4)
)
)
;;@ (lib)/memory.ts:248:2
(set_local $3
;;@ (lib)/memory.ts:248:17
(i64.or
(i64.extend_u/i32
(get_local $1)
)
;;@ (lib)/memory.ts:248:28
(i64.shl
;;@ (lib)/memory.ts:248:29
(i64.extend_u/i32
(get_local $1)
)
;;@ (lib)/memory.ts:248:41
(i64.const 32)
)
)
)
(loop $continue|0
(if
;;@ (lib)/memory.ts:249:9
(i32.ge_u
(get_local $2)
;;@ (lib)/memory.ts:249:14
(i32.const 32)
)
(block
;;@ (lib)/memory.ts:250:4
(i64.store
;;@ (lib)/memory.ts:250:15
(get_local $0)
;;@ (lib)/memory.ts:250:21
(get_local $3)
)
;;@ (lib)/memory.ts:251:4
(i64.store
;;@ (lib)/memory.ts:251:15
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:251:22
(i32.const 8)
)
;;@ (lib)/memory.ts:251:25
(get_local $3)
)
;;@ (lib)/memory.ts:252:4
(i64.store
;;@ (lib)/memory.ts:252:15
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:252:22
(i32.const 16)
)
;;@ (lib)/memory.ts:252:26
(get_local $3)
)
;;@ (lib)/memory.ts:253:4
(i64.store
;;@ (lib)/memory.ts:253:15
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:253:22
(i32.const 24)
)
;;@ (lib)/memory.ts:253:26
(get_local $3)
)
;;@ (lib)/memory.ts:254:4
(set_local $2
(i32.sub
(get_local $2)
;;@ (lib)/memory.ts:254:9
(i32.const 32)
)
)
;;@ (lib)/memory.ts:255:4
(set_local $0
(i32.add
(get_local $0)
;;@ (lib)/memory.ts:255:12
(i32.const 32)
)
)
(br $continue|0)
)
)
)
)
(func $start (; 15 ;) (type $v)
(nop)
)
)

File diff suppressed because it is too large Load Diff