2018-12-07 14:33:32 +01:00
|
|
|
(module
|
|
|
|
(type $ii (func (param i32) (result i32)))
|
|
|
|
(type $iiii (func (param i32 i32 i32) (result i32)))
|
|
|
|
(type $iFFF (func (param i32 f64 f64) (result f64)))
|
2019-02-07 15:26:26 +01:00
|
|
|
(type $_ (func))
|
2018-12-07 14:33:32 +01:00
|
|
|
(memory $0 0)
|
2019-02-05 17:12:10 +01:00
|
|
|
(table $0 1 funcref)
|
2018-12-07 14:33:32 +01:00
|
|
|
(elem (i32.const 0) $null)
|
|
|
|
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
|
|
|
|
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
|
|
|
|
(global $~lib/internal/allocator/AL_MASK i32 (i32.const 7))
|
|
|
|
(global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824))
|
|
|
|
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
|
|
|
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
|
|
|
(global $optional-typeparameters/tConcrete (mut i32) (i32.const 0))
|
|
|
|
(global $optional-typeparameters/tDerived (mut i32) (i32.const 0))
|
|
|
|
(global $HEAP_BASE i32 (i32.const 8))
|
|
|
|
(export "memory" (memory $0))
|
|
|
|
(export "table" (table $0))
|
|
|
|
(start $start)
|
|
|
|
(func $optional-typeparameters/testConcrete<i32,i32> (; 0 ;) (type $ii) (param $0 i32) (result i32)
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $0
|
2018-12-07 14:33:32 +01:00
|
|
|
)
|
|
|
|
(func $optional-typeparameters/testDerived<i32,i32> (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $0
|
2018-12-07 14:33:32 +01:00
|
|
|
)
|
|
|
|
(func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
|
|
|
(local $1 i32)
|
|
|
|
(local $2 i32)
|
|
|
|
(local $3 i32)
|
|
|
|
(local $4 i32)
|
|
|
|
(local $5 i32)
|
|
|
|
(local $6 i32)
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $0
|
|
|
|
global.get $~lib/internal/allocator/MAX_SIZE_32
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.gt_u
|
|
|
|
if
|
|
|
|
unreachable
|
|
|
|
end
|
2019-02-05 17:12:10 +01:00
|
|
|
global.get $~lib/allocator/arena/offset
|
|
|
|
local.set $1
|
|
|
|
local.get $1
|
|
|
|
local.get $0
|
|
|
|
local.tee $2
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.const 1
|
2019-02-05 17:12:10 +01:00
|
|
|
local.tee $3
|
|
|
|
local.get $2
|
|
|
|
local.get $3
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.gt_u
|
|
|
|
select
|
|
|
|
i32.add
|
2019-02-05 17:12:10 +01:00
|
|
|
global.get $~lib/internal/allocator/AL_MASK
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.add
|
2019-02-05 17:12:10 +01:00
|
|
|
global.get $~lib/internal/allocator/AL_MASK
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
2019-02-05 17:12:10 +01:00
|
|
|
local.set $4
|
2018-12-07 14:33:32 +01:00
|
|
|
current_memory
|
2019-02-05 17:12:10 +01:00
|
|
|
local.set $5
|
|
|
|
local.get $4
|
|
|
|
local.get $5
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.const 16
|
|
|
|
i32.shl
|
|
|
|
i32.gt_u
|
|
|
|
if
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $4
|
|
|
|
local.get $1
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.sub
|
|
|
|
i32.const 65535
|
|
|
|
i32.add
|
|
|
|
i32.const 65535
|
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
|
|
|
i32.const 16
|
|
|
|
i32.shr_u
|
2019-02-05 17:12:10 +01:00
|
|
|
local.set $2
|
|
|
|
local.get $5
|
|
|
|
local.tee $3
|
|
|
|
local.get $2
|
|
|
|
local.tee $6
|
|
|
|
local.get $3
|
|
|
|
local.get $6
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.gt_s
|
|
|
|
select
|
2019-02-05 17:12:10 +01:00
|
|
|
local.set $3
|
|
|
|
local.get $3
|
2018-12-07 14:33:32 +01:00
|
|
|
grow_memory
|
|
|
|
i32.const 0
|
|
|
|
i32.lt_s
|
|
|
|
if
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $2
|
2018-12-07 14:33:32 +01:00
|
|
|
grow_memory
|
|
|
|
i32.const 0
|
|
|
|
i32.lt_s
|
|
|
|
if
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $4
|
|
|
|
global.set $~lib/allocator/arena/offset
|
|
|
|
local.get $1
|
2018-12-07 14:33:32 +01:00
|
|
|
)
|
|
|
|
(func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $0
|
2018-12-07 14:33:32 +01:00
|
|
|
call $~lib/allocator/arena/__memory_allocate
|
|
|
|
return
|
|
|
|
)
|
2019-02-02 16:03:21 +01:00
|
|
|
(func $optional-typeparameters/TestConcrete<i32,i32>#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32)
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $0
|
2019-02-02 16:03:21 +01:00
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/memory/memory.allocate
|
2019-02-05 17:12:10 +01:00
|
|
|
local.set $0
|
2019-02-02 16:03:21 +01:00
|
|
|
end
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $0
|
2019-02-02 16:03:21 +01:00
|
|
|
)
|
|
|
|
(func $optional-typeparameters/TestConcrete<i32,i32>#test<i32> (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $1
|
|
|
|
local.get $2
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.add
|
|
|
|
)
|
2019-02-02 16:03:21 +01:00
|
|
|
(func $optional-typeparameters/TestDerived<f64,f64>#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $0
|
2019-02-02 16:03:21 +01:00
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/memory/memory.allocate
|
2019-02-05 17:12:10 +01:00
|
|
|
local.set $0
|
2019-02-02 16:03:21 +01:00
|
|
|
end
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $0
|
2019-02-02 16:03:21 +01:00
|
|
|
)
|
|
|
|
(func $optional-typeparameters/TestDerived<f64,f64>#test<f64> (; 7 ;) (type $iFFF) (param $0 i32) (param $1 f64) (param $2 f64) (result f64)
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $1
|
|
|
|
local.get $2
|
2018-12-07 14:33:32 +01:00
|
|
|
f64.add
|
|
|
|
)
|
2019-02-07 15:26:26 +01:00
|
|
|
(func $start (; 8 ;) (type $_)
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.const 1
|
|
|
|
call $optional-typeparameters/testConcrete<i32,i32>
|
|
|
|
drop
|
|
|
|
i32.const 2
|
|
|
|
call $optional-typeparameters/testDerived<i32,i32>
|
|
|
|
drop
|
2019-02-05 17:12:10 +01:00
|
|
|
global.get $HEAP_BASE
|
|
|
|
global.get $~lib/internal/allocator/AL_MASK
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.add
|
2019-02-05 17:12:10 +01:00
|
|
|
global.get $~lib/internal/allocator/AL_MASK
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.const -1
|
|
|
|
i32.xor
|
|
|
|
i32.and
|
2019-02-05 17:12:10 +01:00
|
|
|
global.set $~lib/allocator/arena/startOffset
|
|
|
|
global.get $~lib/allocator/arena/startOffset
|
|
|
|
global.set $~lib/allocator/arena/offset
|
2019-02-02 16:03:21 +01:00
|
|
|
i32.const 0
|
|
|
|
call $optional-typeparameters/TestConcrete<i32,i32>#constructor
|
2019-02-05 17:12:10 +01:00
|
|
|
global.set $optional-typeparameters/tConcrete
|
|
|
|
global.get $optional-typeparameters/tConcrete
|
2018-12-07 14:33:32 +01:00
|
|
|
i32.const 1
|
|
|
|
i32.const 2
|
|
|
|
call $optional-typeparameters/TestConcrete<i32,i32>#test<i32>
|
|
|
|
drop
|
2019-02-02 16:03:21 +01:00
|
|
|
i32.const 0
|
|
|
|
call $optional-typeparameters/TestDerived<f64,f64>#constructor
|
2019-02-05 17:12:10 +01:00
|
|
|
global.set $optional-typeparameters/tDerived
|
|
|
|
global.get $optional-typeparameters/tDerived
|
2018-12-07 14:33:32 +01:00
|
|
|
f64.const 1
|
|
|
|
f64.const 2
|
|
|
|
call $optional-typeparameters/TestDerived<f64,f64>#test<f64>
|
|
|
|
drop
|
|
|
|
)
|
2019-02-07 15:26:26 +01:00
|
|
|
(func $null (; 9 ;) (type $_)
|
2018-12-07 14:33:32 +01:00
|
|
|
)
|
|
|
|
)
|