assemblyscript/tests/compiler/function-types.untouched.wat

316 lines
7.0 KiB
Plaintext
Raw Normal View History

2018-03-12 17:44:09 +01:00
(module
(type $FUNCSIG$i (func (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$jjj (func (param i64 i64) (result i64)))
(type $FUNCSIG$ddd (func (param f64 f64) (result f64)))
(type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
(type $FUNCSIG$v (func))
2019-06-05 23:15:39 +02:00
(import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32)))
(memory $0 1)
2019-06-05 23:15:39 +02:00
(data (i32.const 8) "\"\00\00\00\01\00\00\00\01\00\00\00\"\00\00\00f\00u\00n\00c\00t\00i\00o\00n\00-\00t\00y\00p\00e\00s\00.\00t\00s\00")
2019-06-13 15:33:43 +02:00
(data (i32.const 64) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00u\00n\00c\00a\00u\00g\00h\00t\00 \00e\00r\00r\00o\00r\00")
(table $0 5 funcref)
(elem (i32.const 0) $null $function-types/makeAdder<i32>~anonymous|0 $function-types/makeAdder<i64>~anonymous|0 $function-types/makeAdder<f64>~anonymous|0 $function-types/addI32)
2019-06-13 15:33:43 +02:00
(global $~lib/error (mut i32) (i32.const 0))
2018-03-12 17:44:09 +01:00
(global $function-types/i32Adder (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
2018-03-12 17:44:09 +01:00
(global $function-types/i64Adder (mut i32) (i32.const 0))
(export "memory" (memory $0))
(start $start)
(func $function-types/makeAdder<i32>~anonymous|0 (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
local.get $1
i32.add
2018-03-12 17:44:09 +01:00
)
(func $function-types/makeAdder<i32> (; 2 ;) (type $FUNCSIG$i) (result i32)
i32.const 1
2018-03-12 17:44:09 +01:00
)
(func $function-types/makeAdder<i64>~anonymous|0 (; 3 ;) (type $FUNCSIG$jjj) (param $0 i64) (param $1 i64) (result i64)
local.get $0
local.get $1
i64.add
2018-03-12 17:44:09 +01:00
)
(func $function-types/makeAdder<i64> (; 4 ;) (type $FUNCSIG$i) (result i32)
i32.const 2
2018-03-12 17:44:09 +01:00
)
(func $function-types/makeAdder<f64>~anonymous|0 (; 5 ;) (type $FUNCSIG$ddd) (param $0 f64) (param $1 f64) (result f64)
local.get $0
local.get $1
f64.add
)
(func $function-types/makeAdder<f64> (; 6 ;) (type $FUNCSIG$i) (result i32)
i32.const 3
)
(func $function-types/doAddWithFn<i32> (; 7 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
2019-06-13 15:33:43 +02:00
(local $3 i32)
i32.const 2
global.set $~lib/argc
local.get $0
local.get $1
local.get $2
call_indirect (type $FUNCSIG$iii)
2019-06-13 15:33:43 +02:00
local.set $3
global.get $~lib/error
if
i32.const 0
return
end
local.get $3
)
(func $function-types/doAdd<i32> (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
2019-06-13 15:33:43 +02:00
(local $2 i32)
i32.const 2
global.set $~lib/argc
local.get $0
local.get $1
call $function-types/makeAdder<i32>
call_indirect (type $FUNCSIG$iii)
2019-06-13 15:33:43 +02:00
local.set $2
global.get $~lib/error
if
i32.const 0
return
end
local.get $2
)
(func $function-types/addI32 (; 9 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
local.get $1
i32.add
)
(func $function-types/makeAndAdd<i32> (; 10 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
2019-06-13 15:33:43 +02:00
(local $3 i32)
i32.const 2
global.set $~lib/argc
local.get $0
local.get $1
local.get $2
call_indirect (type $FUNCSIG$iii)
2019-06-13 15:33:43 +02:00
local.set $3
global.get $~lib/error
if
i32.const 0
return
end
local.get $3
)
(func $function-types/makeAndAdd<i32>|trampoline (; 11 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
block $1of1
block $0of1
block $outOfRange
global.get $~lib/argc
i32.const 2
i32.sub
br_table $0of1 $1of1 $outOfRange
end
unreachable
end
call $function-types/makeAdder<i32>
local.set $2
end
local.get $0
local.get $1
local.get $2
call $function-types/makeAndAdd<i32>
)
(func $start:function-types (; 12 ;) (type $FUNCSIG$v)
2019-06-13 15:33:43 +02:00
(local $0 i32)
(local $1 i64)
(local $2 f64)
block $uncaughtError
call $function-types/makeAdder<i32>
global.set $function-types/i32Adder
i32.const 2
global.set $~lib/argc
i32.const 1
i32.const 2
global.get $function-types/i32Adder
call_indirect (type $FUNCSIG$iii)
local.set $0
global.get $~lib/error
if
br $uncaughtError
end
local.get $0
i32.const 3
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 11
i32.const 0
call $~lib/builtins/abort
unreachable
end
call $function-types/makeAdder<i64>
global.set $function-types/i64Adder
i32.const 2
global.set $~lib/argc
i64.const 10
i64.const 20
global.get $function-types/i64Adder
call_indirect (type $FUNCSIG$jjj)
local.set $1
global.get $~lib/error
if
br $uncaughtError
end
local.get $1
i64.const 30
i64.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 15
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 2
global.set $~lib/argc
f64.const 1.5
f64.const 2.5
call $function-types/makeAdder<f64>
call_indirect (type $FUNCSIG$ddd)
local.set $2
global.get $~lib/error
if
br $uncaughtError
end
local.get $2
f64.const 4
f64.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 17
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 2
i32.const 3
global.get $function-types/i32Adder
call $function-types/doAddWithFn<i32>
local.set $0
global.get $~lib/error
if
br $uncaughtError
end
local.get $0
i32.const 5
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 23
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 3
i32.const 4
call $function-types/doAdd<i32>
local.set $0
global.get $~lib/error
if
br $uncaughtError
end
local.get $0
i32.const 7
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 29
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 4
i32.const 5
i32.const 4
call $function-types/doAddWithFn<i32>
local.set $0
global.get $~lib/error
if
br $uncaughtError
end
local.get $0
i32.const 9
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 35
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 2
global.set $~lib/argc
i32.const 1
i32.const 2
i32.const 0
2019-06-13 15:33:43 +02:00
call $function-types/makeAndAdd<i32>|trampoline
local.set $0
global.get $~lib/error
if
br $uncaughtError
end
local.get $0
i32.const 3
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 41
i32.const 0
call $~lib/builtins/abort
unreachable
end
i32.const 1
i32.const 2
call $function-types/makeAdder<i32>
call $function-types/makeAndAdd<i32>
local.set $0
global.get $~lib/error
if
br $uncaughtError
end
local.get $0
i32.const 3
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 42
i32.const 0
call $~lib/builtins/abort
unreachable
end
return
end
2019-06-13 15:33:43 +02:00
i32.const 80
i32.const 24
2019-06-11 12:52:16 +02:00
i32.const 1
i32.const 0
2019-06-13 15:33:43 +02:00
call $~lib/builtins/abort
unreachable
2018-03-12 17:44:09 +01:00
)
(func $start (; 13 ;) (type $FUNCSIG$v)
call $start:function-types
)
(func $null (; 14 ;) (type $FUNCSIG$v)
)
2018-03-12 17:44:09 +01:00
)