2018-03-04 17:25:32 +01:00
|
|
|
(module
|
2019-02-21 00:11:22 +01:00
|
|
|
(type $_ (func))
|
2018-07-18 23:49:32 +02:00
|
|
|
(type $iiii (func (param i32 i32 i32) (result i32)))
|
2018-07-19 02:10:04 +02:00
|
|
|
(type $ii (func (param i32) (result i32)))
|
2019-02-21 00:11:22 +01:00
|
|
|
(type $i_ (func (param i32)))
|
|
|
|
(memory $0 0)
|
|
|
|
(table $0 1 funcref)
|
|
|
|
(elem (i32.const 0) $null)
|
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-07-19 02:10:04 +02:00
|
|
|
(export "memory" (memory $0))
|
2019-02-21 00:11:22 +01:00
|
|
|
(export "table" (table $0))
|
2018-07-18 23:49:32 +02:00
|
|
|
(export "memory.compare" (func $~lib/memory/memory.compare))
|
|
|
|
(export "memory.allocate" (func $~lib/memory/memory.allocate))
|
|
|
|
(export "memory.free" (func $~lib/memory/memory.free))
|
|
|
|
(export "memory.reset" (func $~lib/memory/memory.reset))
|
2018-03-19 19:36:39 +01:00
|
|
|
(start $start)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/internal/memory/memcmp (; 0 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
2018-07-18 23:49:32 +02:00
|
|
|
(local $3 i32)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
i32.eq
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
return
|
|
|
|
end
|
|
|
|
loop $continue|0
|
|
|
|
local.get $2
|
|
|
|
i32.const 0
|
|
|
|
i32.ne
|
|
|
|
local.tee $3
|
|
|
|
if (result i32)
|
|
|
|
local.get $0
|
|
|
|
i32.load8_u
|
|
|
|
local.get $1
|
|
|
|
i32.load8_u
|
|
|
|
i32.eq
|
|
|
|
else
|
|
|
|
local.get $3
|
|
|
|
end
|
|
|
|
if
|
|
|
|
local.get $2
|
|
|
|
i32.const 1
|
|
|
|
i32.sub
|
|
|
|
local.set $2
|
|
|
|
local.get $0
|
|
|
|
i32.const 1
|
|
|
|
i32.add
|
|
|
|
local.set $0
|
|
|
|
local.get $1
|
|
|
|
i32.const 1
|
|
|
|
i32.add
|
|
|
|
local.set $1
|
|
|
|
br $continue|0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local.get $2
|
|
|
|
if (result i32)
|
|
|
|
local.get $0
|
|
|
|
i32.load8_u
|
|
|
|
local.get $1
|
|
|
|
i32.load8_u
|
|
|
|
i32.sub
|
|
|
|
else
|
|
|
|
i32.const 0
|
|
|
|
end
|
2018-07-18 23:49:32 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/memory/memory.compare (; 1 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
local.get $2
|
|
|
|
call $~lib/internal/memory/memcmp
|
2018-07-19 02:10:04 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/allocator/arena/__memory_allocate (; 2 ;) (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)
|
2019-02-21 00:11:22 +01:00
|
|
|
local.get $0
|
|
|
|
i32.const 1073741824
|
|
|
|
i32.gt_u
|
|
|
|
if
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
global.get $~lib/allocator/arena/offset
|
|
|
|
local.tee $2
|
|
|
|
local.get $0
|
|
|
|
i32.const 1
|
|
|
|
local.tee $1
|
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
i32.gt_u
|
|
|
|
select
|
|
|
|
i32.add
|
|
|
|
i32.const 7
|
|
|
|
i32.add
|
|
|
|
i32.const -8
|
|
|
|
i32.and
|
|
|
|
local.tee $3
|
|
|
|
current_memory
|
|
|
|
local.tee $1
|
|
|
|
i32.const 16
|
|
|
|
i32.shl
|
|
|
|
i32.gt_u
|
|
|
|
if
|
|
|
|
local.get $1
|
|
|
|
local.get $3
|
|
|
|
local.get $2
|
|
|
|
i32.sub
|
|
|
|
i32.const 65535
|
|
|
|
i32.add
|
|
|
|
i32.const -65536
|
|
|
|
i32.and
|
|
|
|
i32.const 16
|
|
|
|
i32.shr_u
|
|
|
|
local.tee $0
|
|
|
|
local.tee $4
|
|
|
|
local.get $1
|
|
|
|
local.get $4
|
|
|
|
i32.gt_s
|
|
|
|
select
|
|
|
|
grow_memory
|
|
|
|
i32.const 0
|
|
|
|
i32.lt_s
|
|
|
|
if
|
|
|
|
local.get $0
|
|
|
|
grow_memory
|
|
|
|
i32.const 0
|
|
|
|
i32.lt_s
|
|
|
|
if
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local.get $3
|
|
|
|
global.set $~lib/allocator/arena/offset
|
|
|
|
local.get $2
|
|
|
|
)
|
|
|
|
(func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
|
|
|
local.get $0
|
|
|
|
call $~lib/allocator/arena/__memory_allocate
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/memory/memory.free (; 4 ;) (type $i_) (param $0 i32)
|
|
|
|
nop
|
2018-07-18 23:49:32 +02:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $~lib/memory/memory.reset (; 5 ;) (type $_)
|
|
|
|
global.get $~lib/allocator/arena/startOffset
|
|
|
|
global.set $~lib/allocator/arena/offset
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $start (; 6 ;) (type $_)
|
|
|
|
i32.const 8
|
|
|
|
global.set $~lib/allocator/arena/startOffset
|
|
|
|
global.get $~lib/allocator/arena/startOffset
|
|
|
|
global.set $~lib/allocator/arena/offset
|
2018-03-19 19:36:39 +01:00
|
|
|
)
|
2019-02-21 00:11:22 +01:00
|
|
|
(func $null (; 7 ;) (type $_)
|
|
|
|
nop
|
2018-03-04 17:25:32 +01:00
|
|
|
)
|
|
|
|
)
|