2018-03-12 14:06:39 +01:00
|
|
|
(module
|
|
|
|
(type $iiii (func (param i32 i32 i32) (result i32)))
|
2019-02-07 15:26:26 +01:00
|
|
|
(type $iiii_ (func (param i32 i32 i32 i32)))
|
|
|
|
(type $_ (func))
|
2018-11-08 08:04:24 +01:00
|
|
|
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
2018-10-11 08:49:08 +02:00
|
|
|
(memory $0 1)
|
|
|
|
(data (i32.const 8) "\10\00\00\00c\00a\00l\00l\00-\00o\00p\00t\00i\00o\00n\00a\00l\00.\00t\00s\00")
|
2019-02-05 17:12:10 +01:00
|
|
|
(table $0 2 funcref)
|
2018-10-11 08:49:08 +02:00
|
|
|
(elem (i32.const 0) $null $call-optional/opt|trampoline)
|
2018-04-17 16:04:29 +02:00
|
|
|
(global $~argc (mut i32) (i32.const 0))
|
2018-09-17 01:48:35 +02:00
|
|
|
(global $call-optional/optIndirect (mut i32) (i32.const 1))
|
2018-05-14 16:55:55 +02:00
|
|
|
(global $HEAP_BASE i32 (i32.const 44))
|
2018-03-12 14:06:39 +01:00
|
|
|
(export "memory" (memory $0))
|
2018-03-24 09:46:22 +01:00
|
|
|
(export "table" (table $0))
|
2018-03-12 14:06:39 +01:00
|
|
|
(start $start)
|
|
|
|
(func $call-optional/opt (; 1 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $0
|
|
|
|
local.get $1
|
2018-11-08 08:04:24 +01:00
|
|
|
i32.add
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $2
|
2018-11-08 08:04:24 +01:00
|
|
|
i32.add
|
2018-03-12 14:06:39 +01:00
|
|
|
)
|
2018-03-24 09:46:22 +01:00
|
|
|
(func $call-optional/opt|trampoline (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
2018-11-08 08:04:24 +01:00
|
|
|
block $2of2
|
|
|
|
block $1of2
|
|
|
|
block $0of2
|
|
|
|
block $outOfRange
|
2019-02-05 17:12:10 +01:00
|
|
|
global.get $~argc
|
2018-11-08 08:04:24 +01:00
|
|
|
i32.const 1
|
|
|
|
i32.sub
|
|
|
|
br_table $0of2 $1of2 $2of2 $outOfRange
|
|
|
|
end
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
i32.const -1
|
2019-02-05 17:12:10 +01:00
|
|
|
local.set $1
|
2018-11-08 08:04:24 +01:00
|
|
|
end
|
|
|
|
i32.const -2
|
2019-02-05 17:12:10 +01:00
|
|
|
local.set $2
|
2018-11-08 08:04:24 +01:00
|
|
|
end
|
2019-02-05 17:12:10 +01:00
|
|
|
local.get $0
|
|
|
|
local.get $1
|
|
|
|
local.get $2
|
2018-11-08 08:04:24 +01:00
|
|
|
call $call-optional/opt
|
2018-03-12 14:06:39 +01:00
|
|
|
)
|
2019-02-07 15:26:26 +01:00
|
|
|
(func $start (; 3 ;) (type $_)
|
2018-11-08 08:04:24 +01:00
|
|
|
block (result i32)
|
|
|
|
i32.const 1
|
2019-02-05 17:12:10 +01:00
|
|
|
global.set $~argc
|
2018-11-08 08:04:24 +01:00
|
|
|
i32.const 3
|
|
|
|
i32.const 0
|
|
|
|
i32.const 0
|
|
|
|
call $call-optional/opt|trampoline
|
|
|
|
end
|
|
|
|
i32.const 0
|
|
|
|
i32.eq
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 4
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
block (result i32)
|
|
|
|
i32.const 2
|
2019-02-05 17:12:10 +01:00
|
|
|
global.set $~argc
|
2018-11-08 08:04:24 +01:00
|
|
|
i32.const 3
|
|
|
|
i32.const 4
|
|
|
|
i32.const 0
|
|
|
|
call $call-optional/opt|trampoline
|
|
|
|
end
|
|
|
|
i32.const 5
|
|
|
|
i32.eq
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 5
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
i32.const 3
|
|
|
|
i32.const 4
|
|
|
|
i32.const 5
|
|
|
|
call $call-optional/opt
|
|
|
|
i32.const 12
|
|
|
|
i32.eq
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 6
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
block (result i32)
|
|
|
|
i32.const 1
|
2019-02-05 17:12:10 +01:00
|
|
|
global.set $~argc
|
2018-11-08 08:04:24 +01:00
|
|
|
i32.const 3
|
|
|
|
i32.const 0
|
|
|
|
i32.const 0
|
2019-02-05 17:12:10 +01:00
|
|
|
global.get $call-optional/optIndirect
|
2018-11-08 08:04:24 +01:00
|
|
|
call_indirect (type $iiii)
|
|
|
|
end
|
|
|
|
i32.const 0
|
|
|
|
i32.eq
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 9
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
block (result i32)
|
|
|
|
i32.const 2
|
2019-02-05 17:12:10 +01:00
|
|
|
global.set $~argc
|
2018-11-08 08:04:24 +01:00
|
|
|
i32.const 3
|
|
|
|
i32.const 4
|
|
|
|
i32.const 0
|
2019-02-05 17:12:10 +01:00
|
|
|
global.get $call-optional/optIndirect
|
2018-11-08 08:04:24 +01:00
|
|
|
call_indirect (type $iiii)
|
|
|
|
end
|
|
|
|
i32.const 5
|
|
|
|
i32.eq
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 10
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
|
|
|
block (result i32)
|
|
|
|
i32.const 3
|
2019-02-05 17:12:10 +01:00
|
|
|
global.set $~argc
|
2018-11-08 08:04:24 +01:00
|
|
|
i32.const 3
|
|
|
|
i32.const 4
|
|
|
|
i32.const 5
|
2019-02-05 17:12:10 +01:00
|
|
|
global.get $call-optional/optIndirect
|
2018-11-08 08:04:24 +01:00
|
|
|
call_indirect (type $iiii)
|
|
|
|
end
|
|
|
|
i32.const 12
|
|
|
|
i32.eq
|
|
|
|
i32.eqz
|
|
|
|
if
|
|
|
|
i32.const 0
|
|
|
|
i32.const 8
|
|
|
|
i32.const 11
|
|
|
|
i32.const 0
|
|
|
|
call $~lib/env/abort
|
|
|
|
unreachable
|
|
|
|
end
|
2018-03-12 14:06:39 +01:00
|
|
|
)
|
2019-02-07 15:26:26 +01:00
|
|
|
(func $null (; 4 ;) (type $_)
|
2018-09-17 01:48:35 +02:00
|
|
|
)
|
2018-03-12 14:06:39 +01:00
|
|
|
)
|