Inline jump tables in parsed br_table instructions (#5755)

As jump tables are used by at most one br_table instruction, inline their definition in those instructions instead of requiring them to be declared as function-level metadata.
This commit is contained in:
Trevor Elliott
2023-02-09 14:24:04 -08:00
committed by GitHub
parent 202d3af16a
commit 15fe9c7c93
23 changed files with 54 additions and 200 deletions

View File

@@ -1,19 +1,15 @@
test verifier
function %br_invalid_default(i32) {
jt0 = jump_table [block1, block1]
block0(v0: i32):
br_table v0, block2, jt0 ; error: invalid block reference block2
br_table v0, block2, [block1, block1] ; error: invalid block reference block2
block1:
return
}
function %br(i32) {
jt0 = jump_table [block1, block2] ; error: invalid block reference block2
block0(v0: i32):
br_table v0, block1, jt0
br_table v0, block1, [block1, block3] ; error: invalid block reference block3
block1:
return
}

View File

@@ -66,10 +66,9 @@ function %fn_call_incorrect_arg_type(i64) {
; TODO: Should we instead just verify that jump tables contain no blocks that take arguments? This
; error doesn't occur if no instruction uses the jump table.
function %jump_table_args() {
jt1 = jump_table [block1]
block0:
v0 = iconst.i32 0
br_table v0, block2, jt1 ; error: takes no arguments, but had target block1 with 1 arguments
br_table v0, block2, [block1] ; error: takes no arguments, but had target block1 with 1 arguments
block1(v5: i32):
return