2018-01-28 15:13:31 +01:00
|
|
|
(module
|
|
|
|
(type $ii (func (param i32) (result i32)))
|
|
|
|
(type $v (func))
|
2018-02-02 03:07:54 +01:00
|
|
|
(global "$(lib)/allocator/arena/HEAP_OFFSET" (mut i32) (i32.const 0))
|
2018-01-28 15:13:31 +01:00
|
|
|
(global $std/new/aClass (mut i32) (i32.const 0))
|
|
|
|
(global $HEAP_BASE i32 (i32.const 4))
|
|
|
|
(memory $0 1)
|
|
|
|
(export "memory" (memory $0))
|
|
|
|
(start $start)
|
2018-02-02 03:07:54 +01:00
|
|
|
(func "$(lib)/allocator/arena/allocate_memory" (; 0 ;) (type $ii) (param $0 i32) (result i32)
|
2018-01-28 19:14:20 +01:00
|
|
|
(local $1 i32)
|
|
|
|
(local $2 i32)
|
|
|
|
(local $3 i32)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:14:2
|
2018-01-28 15:30:49 +01:00
|
|
|
(if
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:14:6
|
2018-01-28 15:30:49 +01:00
|
|
|
(i32.eqz
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:14:7
|
2018-01-28 15:30:49 +01:00
|
|
|
(get_local $0)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:14:20
|
2018-01-28 19:14:20 +01:00
|
|
|
(return
|
|
|
|
(i32.const 0)
|
2018-01-28 15:30:49 +01:00
|
|
|
)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:18:2
|
2018-01-28 15:30:49 +01:00
|
|
|
(if
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:18:6
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.and
|
|
|
|
(if (result i32)
|
2018-02-02 03:07:54 +01:00
|
|
|
(tee_local $0
|
|
|
|
(i32.gt_u
|
|
|
|
;;@ (lib)/allocator/arena.ts:16:2
|
|
|
|
(tee_local $2
|
|
|
|
;;@ (lib)/allocator/arena.ts:16:12
|
|
|
|
(i32.and
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.add
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:16:13
|
|
|
|
(i32.add
|
|
|
|
;;@ (lib)/allocator/arena.ts:15:2
|
|
|
|
(tee_local $3
|
|
|
|
;;@ (lib)/allocator/arena.ts:15:12
|
|
|
|
(get_global "$(lib)/allocator/arena/HEAP_OFFSET")
|
|
|
|
)
|
|
|
|
;;@ (lib)/allocator/arena.ts:16:19
|
|
|
|
(get_local $0)
|
2018-01-28 19:14:20 +01:00
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:16:26
|
|
|
|
(i32.const 7)
|
2018-01-28 19:14:20 +01:00
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(i32.const -8)
|
2018-01-28 19:14:20 +01:00
|
|
|
)
|
2018-01-28 15:30:49 +01:00
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:17:2
|
|
|
|
(tee_local $1
|
|
|
|
;;@ (lib)/allocator/arena.ts:17:14
|
|
|
|
(i32.shl
|
|
|
|
(current_memory)
|
|
|
|
;;@ (lib)/allocator/arena.ts:17:41
|
|
|
|
(i32.const 16)
|
|
|
|
)
|
2018-01-28 15:30:49 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:18:21
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.lt_s
|
|
|
|
(grow_memory
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:19:4
|
2018-01-28 19:14:20 +01:00
|
|
|
(select
|
2018-02-02 03:07:54 +01:00
|
|
|
(tee_local $0
|
|
|
|
;;@ (lib)/allocator/arena.ts:20:6
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.shr_u
|
|
|
|
(i32.sub
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:20:7
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.and
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:20:8
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.add
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:20:9
|
|
|
|
(get_local $2)
|
|
|
|
;;@ (lib)/allocator/arena.ts:20:15
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.const 65535)
|
|
|
|
)
|
|
|
|
(i32.const -65536)
|
2018-01-28 15:13:31 +01:00
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:20:36
|
2018-01-28 19:14:20 +01:00
|
|
|
(get_local $1)
|
2018-01-28 15:13:31 +01:00
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:20:46
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.const 16)
|
2018-01-28 15:13:31 +01:00
|
|
|
)
|
|
|
|
)
|
2018-01-28 19:14:20 +01:00
|
|
|
(tee_local $1
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:21:6
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.shr_u
|
2018-01-28 15:13:31 +01:00
|
|
|
(get_local $1)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:21:46
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.const 16)
|
2018-01-28 15:13:31 +01:00
|
|
|
)
|
2018-01-28 19:14:20 +01:00
|
|
|
)
|
|
|
|
(i32.gt_u
|
2018-02-02 03:07:54 +01:00
|
|
|
(get_local $0)
|
2018-01-28 15:13:31 +01:00
|
|
|
(get_local $1)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:23:6
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.const 0)
|
2018-01-28 15:13:31 +01:00
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
(get_local $0)
|
2018-01-28 15:13:31 +01:00
|
|
|
)
|
2018-01-28 19:14:20 +01:00
|
|
|
(i32.const 1)
|
2018-01-28 15:13:31 +01:00
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:23:9
|
2018-01-28 19:14:20 +01:00
|
|
|
(unreachable)
|
2018-01-28 15:13:31 +01:00
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:24:2
|
|
|
|
(set_global "$(lib)/allocator/arena/HEAP_OFFSET"
|
|
|
|
;;@ (lib)/allocator/arena.ts:24:16
|
|
|
|
(get_local $2)
|
2018-01-28 15:30:49 +01:00
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ (lib)/allocator/arena.ts:25:9
|
|
|
|
(get_local $3)
|
2018-01-28 15:13:31 +01:00
|
|
|
)
|
2018-01-28 19:14:20 +01:00
|
|
|
(func $start (; 1 ;) (type $v)
|
2018-01-28 15:13:31 +01:00
|
|
|
(local $0 i32)
|
|
|
|
(local $1 i32)
|
2018-02-02 03:07:54 +01:00
|
|
|
(set_global "$(lib)/allocator/arena/HEAP_OFFSET"
|
|
|
|
;;@ (lib)/allocator/arena.ts:11:25
|
2018-01-28 15:13:31 +01:00
|
|
|
(get_global $HEAP_BASE)
|
|
|
|
)
|
|
|
|
(set_global $std/new/aClass
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ std/new.ts:13:13
|
2018-01-28 15:13:31 +01:00
|
|
|
(block (result i32)
|
|
|
|
(i32.store
|
|
|
|
(tee_local $0
|
2018-02-02 03:07:54 +01:00
|
|
|
(call "$(lib)/allocator/arena/allocate_memory"
|
2018-01-28 15:13:31 +01:00
|
|
|
(i32.const 8)
|
|
|
|
)
|
|
|
|
)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ std/new.ts:5:16
|
2018-01-28 15:13:31 +01:00
|
|
|
(i32.const 1)
|
|
|
|
)
|
|
|
|
(f32.store offset=4
|
|
|
|
(get_local $0)
|
2018-02-02 03:07:54 +01:00
|
|
|
;;@ std/new.ts:6:22
|
2018-01-28 15:13:31 +01:00
|
|
|
(f32.const 2)
|
|
|
|
)
|
|
|
|
(i32.store
|
|
|
|
(tee_local $1
|
|
|
|
(get_local $0)
|
|
|
|
)
|
|
|
|
(i32.add
|
|
|
|
(i32.load
|
|
|
|
(get_local $1)
|
|
|
|
)
|
|
|
|
(i32.const 1)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(f32.store offset=4
|
|
|
|
(get_local $1)
|
|
|
|
(f32.const 3)
|
|
|
|
)
|
|
|
|
(get_local $0)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|