2018-03-04 17:25:32 +01:00
|
|
|
(module
|
|
|
|
(type $ii (func (param i32) (result i32)))
|
|
|
|
(type $iv (func (param i32)))
|
|
|
|
(type $v (func))
|
2018-04-03 23:56:48 +02:00
|
|
|
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
|
|
|
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
2018-06-09 02:27:10 +02:00
|
|
|
(global $HEAP_BASE i32 (i32.const 8))
|
2018-06-28 01:44:32 +02:00
|
|
|
(memory $0 0)
|
2018-04-03 23:56:48 +02:00
|
|
|
(export "allocate_memory" (func $~lib/allocator/arena/allocate_memory))
|
|
|
|
(export "free_memory" (func $~lib/allocator/arena/free_memory))
|
|
|
|
(export "reset_memory" (func $~lib/allocator/arena/reset_memory))
|
2018-03-04 17:25:32 +01:00
|
|
|
(export "memory" (memory $0))
|
2018-03-19 19:36:39 +01:00
|
|
|
(start $start)
|
2018-04-03 23:56:48 +02:00
|
|
|
(func $~lib/allocator/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32)
|
2018-03-04 17:25:32 +01:00
|
|
|
(local $1 i32)
|
|
|
|
(local $2 i32)
|
|
|
|
(local $3 i32)
|
|
|
|
(local $4 i32)
|
2018-04-08 00:43:38 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:17:2
|
2018-03-04 17:25:32 +01:00
|
|
|
(if
|
2018-04-08 00:43:38 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:17:6
|
|
|
|
(get_local $0)
|
|
|
|
;;@ ~lib/allocator/arena.ts:17:12
|
2018-04-03 23:56:48 +02:00
|
|
|
(block
|
2018-04-08 00:43:38 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:18:4
|
|
|
|
(if
|
|
|
|
;;@ ~lib/allocator/arena.ts:18:8
|
|
|
|
(i32.gt_u
|
|
|
|
(get_local $0)
|
|
|
|
;;@ ~lib/allocator/arena.ts:18:15
|
|
|
|
(i32.const 1073741824)
|
|
|
|
)
|
|
|
|
;;@ ~lib/allocator/arena.ts:18:28
|
|
|
|
(unreachable)
|
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:22:4
|
|
|
|
(if
|
|
|
|
;;@ ~lib/allocator/arena.ts:22:8
|
|
|
|
(i32.gt_u
|
|
|
|
;;@ ~lib/allocator/arena.ts:20:4
|
2018-06-09 02:27:10 +02:00
|
|
|
(tee_local $0
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:20:17
|
|
|
|
(i32.and
|
|
|
|
(i32.add
|
|
|
|
;;@ ~lib/allocator/arena.ts:20:18
|
|
|
|
(i32.add
|
|
|
|
;;@ ~lib/allocator/arena.ts:19:4
|
|
|
|
(tee_local $1
|
|
|
|
;;@ ~lib/allocator/arena.ts:19:14
|
|
|
|
(get_global $~lib/allocator/arena/offset)
|
|
|
|
)
|
|
|
|
;;@ ~lib/allocator/arena.ts:20:24
|
|
|
|
(get_local $0)
|
|
|
|
)
|
|
|
|
;;@ ~lib/allocator/arena.ts:20:31
|
|
|
|
(i32.const 7)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
(i32.const -8)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:22:17
|
|
|
|
(i32.shl
|
|
|
|
;;@ ~lib/allocator/arena.ts:21:4
|
2018-06-09 02:27:10 +02:00
|
|
|
(tee_local $2
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:21:22
|
|
|
|
(current_memory)
|
|
|
|
)
|
|
|
|
;;@ ~lib/allocator/arena.ts:22:39
|
|
|
|
(i32.const 16)
|
|
|
|
)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:25:6
|
|
|
|
(if
|
|
|
|
;;@ ~lib/allocator/arena.ts:25:10
|
|
|
|
(i32.lt_s
|
|
|
|
(grow_memory
|
|
|
|
;;@ ~lib/allocator/arena.ts:24:24
|
|
|
|
(select
|
|
|
|
;;@ ~lib/allocator/arena.ts:24:28
|
2018-06-09 02:27:10 +02:00
|
|
|
(get_local $2)
|
2018-04-03 23:56:48 +02:00
|
|
|
(tee_local $4
|
|
|
|
;;@ ~lib/allocator/arena.ts:23:6
|
|
|
|
(tee_local $3
|
|
|
|
;;@ ~lib/allocator/arena.ts:23:24
|
|
|
|
(i32.shr_u
|
|
|
|
(i32.and
|
|
|
|
;;@ ~lib/allocator/arena.ts:23:25
|
|
|
|
(i32.add
|
|
|
|
;;@ ~lib/allocator/arena.ts:23:26
|
|
|
|
(i32.sub
|
2018-06-09 02:27:10 +02:00
|
|
|
(get_local $0)
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:23:35
|
|
|
|
(get_local $1)
|
|
|
|
)
|
|
|
|
;;@ ~lib/allocator/arena.ts:23:41
|
|
|
|
(i32.const 65535)
|
|
|
|
)
|
|
|
|
(i32.const -65536)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:23:64
|
|
|
|
(i32.const 16)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
)
|
|
|
|
(i32.gt_s
|
2018-06-09 02:27:10 +02:00
|
|
|
(get_local $2)
|
2018-04-03 23:56:48 +02:00
|
|
|
(get_local $4)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:25:37
|
|
|
|
(i32.const 0)
|
|
|
|
)
|
2018-06-09 02:27:10 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:25:40
|
2018-04-03 23:56:48 +02:00
|
|
|
(if
|
|
|
|
;;@ ~lib/allocator/arena.ts:26:12
|
|
|
|
(i32.lt_s
|
|
|
|
(grow_memory
|
|
|
|
;;@ ~lib/allocator/arena.ts:26:24
|
|
|
|
(get_local $3)
|
|
|
|
)
|
|
|
|
;;@ ~lib/allocator/arena.ts:26:39
|
|
|
|
(i32.const 0)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
2018-06-09 02:27:10 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:26:42
|
2018-04-03 23:56:48 +02:00
|
|
|
(unreachable)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:31:4
|
|
|
|
(set_global $~lib/allocator/arena/offset
|
|
|
|
;;@ ~lib/allocator/arena.ts:31:13
|
2018-06-09 02:27:10 +02:00
|
|
|
(get_local $0)
|
2018-04-03 23:56:48 +02:00
|
|
|
)
|
|
|
|
;;@ ~lib/allocator/arena.ts:32:11
|
|
|
|
(return
|
|
|
|
(get_local $1)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:34:9
|
|
|
|
(i32.const 0)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
(func $~lib/allocator/arena/free_memory (; 1 ;) (type $iv) (param $0 i32)
|
2018-03-04 17:25:32 +01:00
|
|
|
(nop)
|
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
(func $~lib/allocator/arena/reset_memory (; 2 ;) (type $v)
|
2018-06-28 01:44:32 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:44:2
|
2018-04-03 23:56:48 +02:00
|
|
|
(set_global $~lib/allocator/arena/offset
|
|
|
|
;;@ ~lib/allocator/arena.ts:44:11
|
|
|
|
(get_global $~lib/allocator/arena/startOffset)
|
2018-03-19 19:36:39 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
(func $start (; 3 ;) (type $v)
|
2018-04-03 23:56:48 +02:00
|
|
|
(set_global $~lib/allocator/arena/startOffset
|
|
|
|
;;@ ~lib/allocator/arena.ts:12:25
|
2018-03-04 17:25:32 +01:00
|
|
|
(i32.and
|
|
|
|
(i32.add
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:12:26
|
2018-03-04 17:25:32 +01:00
|
|
|
(get_global $HEAP_BASE)
|
2018-04-03 23:56:48 +02:00
|
|
|
;;@ ~lib/allocator/arena.ts:12:38
|
2018-03-04 17:25:32 +01:00
|
|
|
(i32.const 7)
|
|
|
|
)
|
|
|
|
(i32.const -8)
|
|
|
|
)
|
|
|
|
)
|
2018-04-03 23:56:48 +02:00
|
|
|
(set_global $~lib/allocator/arena/offset
|
|
|
|
;;@ ~lib/allocator/arena.ts:13:20
|
|
|
|
(get_global $~lib/allocator/arena/startOffset)
|
2018-03-19 19:36:39 +01:00
|
|
|
)
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
|
|
|
)
|