@@ -35,7 +35,7 @@ EM_JS(CountArgsFunc, _PyEM_GetCountArgsPtr, (), {
35
35
// (type $type1 (func (param i32) (result i32)))
36
36
// (type $type2 (func (param i32 i32) (result i32)))
37
37
// (type $type3 (func (param i32 i32 i32) (result i32)))
38
- // (type $blocktype (func (param i32 ) (result)))
38
+ // (type $blocktype (func (param) (result)))
39
39
// (table $funcs (import "e" "t") 0 funcref)
40
40
// (export "f" (func $f))
41
41
// (func $f (param $fptr i32) (result i32)
@@ -44,36 +44,28 @@ EM_JS(CountArgsFunc, _PyEM_GetCountArgsPtr, (), {
44
44
// table.get $funcs
45
45
// local.tee $fref
46
46
// ref.test $type3
47
- // (block $b (type $blocktype)
48
- // i32.eqz
49
- // br_if $b
47
+ // if $blocktype
50
48
// i32.const 3
51
49
// return
52
- //)
50
+ //end
53
51
// local.get $fref
54
52
// ref.test $type2
55
- // (block $b (type $blocktype)
56
- // i32.eqz
57
- // br_if $b
53
+ // if $blocktype
58
54
// i32.const 2
59
55
// return
60
- //)
56
+ //end
61
57
// local.get $fref
62
58
// ref.test $type1
63
- // (block $b (type $blocktype)
64
- // i32.eqz
65
- // br_if $b
59
+ // if $blocktype
66
60
// i32.const 1
67
61
// return
68
- //)
62
+ //end
69
63
// local.get $fref
70
64
// ref.test $type0
71
- // (block $b (type $blocktype)
72
- // i32.eqz
73
- // br_if $b
65
+ // if $blocktype
74
66
// i32.const 0
75
67
// return
76
- //)
68
+ //end
77
69
// i32.const -1
78
70
// )
79
71
// )
@@ -88,13 +80,13 @@ function getPyEMCountArgsPtr() {
88
80
const code = new Uint8Array ([
89
81
0x00 ,0x61 ,0x73 ,0x6d ,// \0asm magic number
90
82
0x01 ,0x00 ,0x00 ,0x00 ,// version 1
91
- 0x01 ,0x1b ,// Type section, body is0x1b bytes
83
+ 0x01 ,0x1a ,// Type section, body is0x1a bytes
92
84
0x05 ,// 6 entries
93
- 0x60 ,0x00 ,0x01 ,0x7f ,// (type $type0 (func (param) (result i32)))
94
- 0x60 ,0x01 ,0x7f ,0x01 ,0x7f ,// (type $type1 (func (param i32) (result i32)))
95
- 0x60 ,0x02 ,0x7f ,0x7f ,0x01 ,0x7f ,// (type $type2 (func (param i32 i32) (result i32)))
96
- 0x60 ,0x03 ,0x7f ,0x7f ,0x7f ,0x01 ,0x7f ,// (type $type3 (func (param i32 i32 i32) (result i32)))
97
- 0x60 ,0x01 , 0x7f , 0x00 ,// (type $blocktype (func (param i32 ) (result)))
85
+ 0x60 ,0x00 ,0x01 ,0x7f ,// (type $type0 (func (param) (result i32)))
86
+ 0x60 ,0x01 ,0x7f ,0x01 ,0x7f ,// (type $type1 (func (param i32) (result i32)))
87
+ 0x60 ,0x02 ,0x7f ,0x7f ,0x01 ,0x7f ,// (type $type2 (func (param i32 i32) (result i32)))
88
+ 0x60 ,0x03 ,0x7f ,0x7f ,0x7f ,0x01 ,0x7f ,// (type $type3 (func (param i32 i32 i32) (result i32)))
89
+ 0x60 ,0x00 , 0x00 ,// (type $blocktype (func (param) (result)))
98
90
0x02 ,0x09 ,// Import section, 0x9 byte body
99
91
0x01 ,// 1 import (table $funcs (import "e" "t") 0 funcref)
100
92
0x01 ,0x65 ,// "e"
@@ -110,44 +102,36 @@ function getPyEMCountArgsPtr() {
110
102
0x00 ,// a function
111
103
0x00 ,// at index 0
112
104
113
- 0x0a ,0x44 ,// Code section,
114
- 0x01 ,0x42 ,// one entry of length50
105
+ 0x0a ,56 ,// Code section,
106
+ 0x01 ,54 ,// one entry of length54
115
107
0x01 ,0x01 ,0x70 ,// one local of type funcref
116
108
// Body of the function
117
109
0x20 ,0x00 ,// local.get $fptr
118
110
0x25 ,0x00 ,// table.get $funcs
119
111
0x22 ,0x01 ,// local.tee $fref
120
112
0xfb ,0x14 ,0x03 ,// ref.test $type3
121
- 0x02 ,0x04 ,// block $b (type $blocktype)
122
- 0x45 ,// i32.eqz
123
- 0x0d ,0x00 ,// br_if $b
113
+ 0x04 ,0x04 ,// if (type $blocktype)
124
114
0x41 ,0x03 ,// i32.const 3
125
115
0x0f ,// return
126
116
0x0b ,// end block
127
117
128
118
0x20 ,0x01 ,// local.get $fref
129
119
0xfb ,0x14 ,0x02 ,// ref.test $type2
130
- 0x02 ,0x04 ,// block $b (type $blocktype)
131
- 0x45 ,// i32.eqz
132
- 0x0d ,0x00 ,// br_if $b
120
+ 0x04 ,0x04 ,// if (type $blocktype)
133
121
0x41 ,0x02 ,// i32.const 2
134
122
0x0f ,// return
135
123
0x0b ,// end block
136
124
137
125
0x20 ,0x01 ,// local.get $fref
138
126
0xfb ,0x14 ,0x01 ,// ref.test $type1
139
- 0x02 ,0x04 ,// block $b (type $blocktype)
140
- 0x45 ,// i32.eqz
141
- 0x0d ,0x00 ,// br_if $b
127
+ 0x04 ,0x04 ,// if (type $blocktype)
142
128
0x41 ,0x01 ,// i32.const 1
143
129
0x0f ,// return
144
130
0x0b ,// end block
145
131
146
132
0x20 ,0x01 ,// local.get $fref
147
133
0xfb ,0x14 ,0x00 ,// ref.test $type0
148
- 0x02 ,0x04 ,// block $b (type $blocktype)
149
- 0x45 ,// i32.eqz
150
- 0x0d ,0x00 ,// br_if $b
134
+ 0x04 ,0x04 ,// if (type $blocktype)
151
135
0x41 ,0x00 ,// i32.const 0
152
136
0x0f ,// return
153
137
0x0b ,// end block