Call trampolines with the actual number of provided operands

When calling indirectly, the number of required operands might not be known at compile time and providing the actual number of operands instead solves this.
This commit is contained in:
dcodeIO
2018-03-23 15:00:09 +01:00
parent 4adb69f73a
commit 2738eee9cd
13 changed files with 150 additions and 76 deletions

View File

@ -23,7 +23,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=2 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 1)
)
)
)
(unreachable)
@ -48,7 +51,7 @@
(i32.const 3)
(i32.const 0)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(block
(call $abort
@ -66,7 +69,7 @@
(i32.const 3)
(i32.const 4)
(i32.const 0)
(i32.const 1)
(i32.const 2)
)
(i32.const 5)
)

View File

@ -26,7 +26,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=2 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 1)
)
)
)
(unreachable)
@ -53,7 +56,7 @@
(i32.const 3)
(i32.const 0)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(i32.const 0)
)
@ -75,7 +78,7 @@
(i32.const 3)
(i32.const 4)
(i32.const 0)
(i32.const 1)
(i32.const 2)
)
(i32.const 5)
)

View File

@ -62,7 +62,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -203,7 +206,7 @@
(i32.const 1)
(i32.const 2)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
(i32.const 3)
)

View File

@ -96,7 +96,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -251,7 +254,7 @@
(i32.const 1)
(i32.const 2)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
(i32.const 3)
)

View File

@ -2844,7 +2844,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -2952,7 +2955,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -4037,7 +4043,7 @@
(get_global $std/array/arr)
(i32.const 44)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if
@ -4057,7 +4063,7 @@
(get_global $std/array/arr)
(i32.const 42)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if
@ -4080,7 +4086,7 @@
(get_global $std/array/arr)
(i32.const 45)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if
@ -4257,7 +4263,7 @@
(get_global $std/array/arr)
(i32.const 44)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if
@ -4280,7 +4286,7 @@
(get_global $std/array/arr)
(i32.const 42)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if
@ -4303,7 +4309,7 @@
(get_global $std/array/arr)
(i32.const 45)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if

View File

@ -3192,7 +3192,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -3310,7 +3313,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -4523,7 +4529,7 @@
(get_global $std/array/arr)
(i32.const 44)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if
@ -4548,7 +4554,7 @@
(get_global $std/array/arr)
(i32.const 42)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if
@ -4573,7 +4579,7 @@
(get_global $std/array/arr)
(i32.const 45)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if
@ -4766,7 +4772,7 @@
(get_global $std/array/arr)
(i32.const 44)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if
@ -4791,7 +4797,7 @@
(get_global $std/array/arr)
(i32.const 42)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if
@ -4816,7 +4822,7 @@
(get_global $std/array/arr)
(i32.const 45)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(if

View File

@ -2135,7 +2135,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=2 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 1)
)
)
)
(unreachable)
@ -2195,7 +2198,7 @@
(get_global $std/arraybuffer/buffer)
(i32.const 0)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
)
(if
@ -2235,7 +2238,7 @@
(get_global $std/arraybuffer/buffer)
(i32.const 1)
(i32.const 0)
(i32.const 1)
(i32.const 2)
)
)
(if
@ -2260,7 +2263,7 @@
(get_global $std/arraybuffer/buffer)
(i32.const -1)
(i32.const 0)
(i32.const 1)
(i32.const 2)
)
)
(if
@ -2381,7 +2384,7 @@
(get_global $std/arraybuffer/buffer)
(i32.const 42)
(i32.const 0)
(i32.const 1)
(i32.const 2)
)
)
(if

View File

@ -2441,7 +2441,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=2 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 1)
)
)
)
(unreachable)
@ -2506,7 +2509,7 @@
(get_global $std/arraybuffer/buffer)
(i32.const 0)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
)
(if
@ -2550,7 +2553,7 @@
(get_global $std/arraybuffer/buffer)
(i32.const 1)
(i32.const 0)
(i32.const 1)
(i32.const 2)
)
)
(if
@ -2577,7 +2580,7 @@
(get_global $std/arraybuffer/buffer)
(i32.const -1)
(i32.const 0)
(i32.const 1)
(i32.const 2)
)
)
(if
@ -2708,7 +2711,7 @@
(get_global $std/arraybuffer/buffer)
(i32.const 42)
(i32.const 0)
(i32.const 1)
(i32.const 2)
)
)
(if

View File

@ -284,7 +284,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -390,7 +393,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -526,7 +532,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -546,7 +555,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -940,7 +952,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $2)
(i32.sub
(get_local $2)
(i32.const 1)
)
)
)
(unreachable)
@ -3358,7 +3373,7 @@
(get_global $std/string/str)
(i32.const 108)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(block
@ -3377,7 +3392,7 @@
(get_global $std/string/str)
(i32.const 128)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(block
@ -3396,7 +3411,7 @@
(get_global $std/string/str)
(i32.const 144)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(block
@ -3415,7 +3430,7 @@
(get_global $std/string/str)
(i32.const 156)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
(i32.const 2)
)
@ -3435,7 +3450,7 @@
(get_global $std/string/str)
(i32.const 164)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
(i32.const -1)
)
@ -3454,7 +3469,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 172)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 0)
)
@ -3473,7 +3488,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 180)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 1)
)
@ -3492,7 +3507,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 188)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 5)
)
@ -3511,7 +3526,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 204)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 455)
)
@ -3530,7 +3545,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 220)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 3855)
)
@ -3549,7 +3564,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 236)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 3855)
)
@ -3568,7 +3583,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 252)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 11)
)
@ -3587,7 +3602,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 264)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 1)
)

View File

@ -349,7 +349,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -473,7 +476,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -634,7 +640,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -654,7 +663,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $3)
(i32.sub
(get_local $3)
(i32.const 2)
)
)
)
(unreachable)
@ -1097,7 +1109,10 @@
(block $N=0
(block $N=invalid
(br_table $N=0 $N=1 $N=invalid
(get_local $2)
(i32.sub
(get_local $2)
(i32.const 1)
)
)
)
(unreachable)
@ -3854,7 +3869,7 @@
(get_global $std/string/str)
(i32.const 108)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(block
@ -3873,7 +3888,7 @@
(get_global $std/string/str)
(i32.const 128)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(block
@ -3892,7 +3907,7 @@
(get_global $std/string/str)
(i32.const 144)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
)
(block
@ -3912,7 +3927,7 @@
(get_global $std/string/str)
(i32.const 156)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
(i32.const 2)
)
@ -3934,7 +3949,7 @@
(get_global $std/string/str)
(i32.const 164)
(i32.const 0)
(i32.const 0)
(i32.const 2)
)
(i32.const -1)
)
@ -3955,7 +3970,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 172)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 0)
)
@ -3976,7 +3991,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 180)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 1)
)
@ -3997,7 +4012,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 188)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 5)
)
@ -4018,7 +4033,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 204)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 455)
)
@ -4039,7 +4054,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 220)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 3855)
)
@ -4060,7 +4075,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 236)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 3855)
)
@ -4081,7 +4096,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 252)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 11)
)
@ -4102,7 +4117,7 @@
(call "$(lib)/string/parseInt|trampoline"
(i32.const 264)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
(f64.const 1)
)