Skip to content

Commit b30d660

Browse files
committed
Remove unneeded check for 4-arg type
1 parent b296fcc commit b30d660

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed

Python/emscripten_trampoline.c

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ EM_JS(CountArgsFunc, _PyEM_GetCountArgsPtr, (), {
3737
// (type $type1 (func (param i32) (result i32)))
3838
// (type $type2 (func (param i32 i32) (result i32)))
3939
// (type $type3 (func (param i32 i32 i32) (result i32)))
40-
// (type $type4 (func (param i32 i32 i32 i32) (result i32)))
4140
// (type $blocktype (func (param i32) (result)))
4241
// (table $funcs (import "e" "t") 0 funcref)
4342
// (export "f" (func $f))
@@ -46,14 +45,6 @@ EM_JS(CountArgsFunc, _PyEM_GetCountArgsPtr, (), {
4645
// local.get $fptr
4746
// table.get $funcs
4847
// local.tee $fref
49-
// ref.test $type4
50-
// (block $b (type $blocktype)
51-
// i32.eqz
52-
// br_if $b
53-
// i32.const 4
54-
// return
55-
// )
56-
// local.get $fref
5748
// ref.test $type3
5849
// (block $b (type $blocktype)
5950
// i32.eqz
@@ -93,13 +84,12 @@ addOnPreRun(() => {
9384
const code = new Uint8Array([
9485
0x00, 0x61, 0x73, 0x6d, // \0asm magic number
9586
0x01, 0x00, 0x00, 0x00, // version 1
96-
0x01, 0x23, // Type section, body is 0x23 bytes
97-
0x06, // 6 entries
87+
0x01, 0x1b, // Type section, body is 0x1b bytes
88+
0x05, // 6 entries
9889
0x60, 0x00, 0x01, 0x7f, // (type $type0 (func (param) (result i32)))
9990
0x60, 0x01, 0x7f, 0x01, 0x7f, // (type $type1 (func (param i32) (result i32)))
10091
0x60, 0x02, 0x7f, 0x7f, 0x01, 0x7f, // (type $type2 (func (param i32 i32) (result i32)))
10192
0x60, 0x03, 0x7f, 0x7f, 0x7f, 0x01, 0x7f, // (type $type3 (func (param i32 i32 i32) (result i32)))
102-
0x60, 0x04, 0x7f, 0x7f, 0x7f, 0x7f, 0x01, 0x7f, // (type $type4 (func (param i32 i32 i32 i32) (result i32)))
10393
0x60, 0x01, 0x7f, 0x00, // (type $blocktype (func (param i32) (result)))
10494
0x02, 0x09, // Import section, 0x9 byte body
10595
0x01, // 1 import (table $funcs (import "e" "t") 0 funcref)
@@ -116,24 +106,15 @@ addOnPreRun(() => {
116106
0x00, // a function
117107
0x00, // at index 0
118108

119-
0x0a, 0x52, // Code section,
120-
0x01, 0x50, // one entry of length 50
109+
0x0a, 0x44, // Code section,
110+
0x01, 0x42, // one entry of length 50
121111
0x01, 0x01, 0x70, // one local of type funcref
122112
// Body of the function
123113
0x20, 0x00, // local.get $fptr
124114
0x25, 0x00, // table.get $funcs
125115
0x22, 0x01, // local.tee $fref
126-
0xfb, 0x14, 0x04, // ref.test $type4
127-
0x02, 0x05, // block $b (type $blocktype)
128-
0x45, // i32.eqz
129-
0x0d, 0x00, // br_if $b
130-
0x41, 0x04, // i32.const 4
131-
0x0f, // return
132-
0x0b, // end block
133-
134-
0x20, 0x01, // local.get $fref
135116
0xfb, 0x14, 0x03, // ref.test $type3
136-
0x02, 0x05, // block $b (type $blocktype)
117+
0x02, 0x04, // block $b (type $blocktype)
137118
0x45, // i32.eqz
138119
0x0d, 0x00, // br_if $b
139120
0x41, 0x03, // i32.const 3
@@ -142,7 +123,7 @@ addOnPreRun(() => {
142123

143124
0x20, 0x01, // local.get $fref
144125
0xfb, 0x14, 0x02, // ref.test $type2
145-
0x02, 0x05, // block $b (type $blocktype)
126+
0x02, 0x04, // block $b (type $blocktype)
146127
0x45, // i32.eqz
147128
0x0d, 0x00, // br_if $b
148129
0x41, 0x02, // i32.const 2
@@ -151,7 +132,7 @@ addOnPreRun(() => {
151132

152133
0x20, 0x01, // local.get $fref
153134
0xfb, 0x14, 0x01, // ref.test $type1
154-
0x02, 0x05, // block $b (type $blocktype)
135+
0x02, 0x04, // block $b (type $blocktype)
155136
0x45, // i32.eqz
156137
0x0d, 0x00, // br_if $b
157138
0x41, 0x01, // i32.const 1
@@ -160,7 +141,7 @@ addOnPreRun(() => {
160141

161142
0x20, 0x01, // local.get $fref
162143
0xfb, 0x14, 0x00, // ref.test $type0
163-
0x02, 0x05, // block $b (type $blocktype)
144+
0x02, 0x04, // block $b (type $blocktype)
164145
0x45, // i32.eqz
165146
0x0d, 0x00, // br_if $b
166147
0x41, 0x00, // i32.const 0

0 commit comments

Comments
 (0)