Repository navigation
Implement elem.drop - #7658
Implement elem.drop#7658
elem.drop#7658Conversation
|
@tlively I think this is ready, but it changes ids of some existing instructions (see CI failure). Is this a problem? I can't find where/how the ids are defined. Could you point me to the right code if we need to revert the id changes? |
|
The IDs are just the |
tlively
left a comment
There was a problem hiding this comment.
Code LGTM. Can you add a test in test/lit/basic showing that the parsing and printing work as expected? You can use e.g. test/lit/basic/f16.wast as an example. The new test should also be added to the list of unfuzzable tests in scripts/test/fuzzing.py until we have fuzzing support for elem.drop.
|
The fuzzer errors on this: (module
(type $0 (func))
(rec
(type $1 (sub (struct (field i64) (field i8) (field f32) (field (mut (ref $6))))))
(type $2 (array (mut i64)))
(type $3 (sub (array (ref $10))))
(type $4 (array (mut (ref null $2))))
(type $5 (sub (array (mut v128))))
(type $6 (struct (field v128) (field i16)))
(type $7 (sub (func (param f32 i64))))
(type $8 (func (param (ref null $3))))
(type $9 (sub (func (result (ref null $6)))))
(type $10 (sub (struct (field (mut i64)) (field (mut (ref struct))))))
)
(type $11 (func (param i32)))
(type $12 (func (param f32)))
(rec
(type $13 (sub (array (mut v128))))
(type $14 (sub (array (mut anyref))))
(type $15 (sub $9 (func (result (ref $6)))))
(type $16 (sub (struct)))
(type $17 (sub $14 (array (mut anyref))))
(type $18 (sub final $9 (func (result (ref $6)))))
(type $19 (sub $7 (func (param f32 i64))))
(type $20 (sub (func (param (ref $17)) (result nullexternref))))
(type $21 (sub final $9 (func (result (ref $6)))))
(type $22 (sub $14 (array (mut anyref))))
)
(type $23 (func (param f32) (result (ref $21))))
(import "fuzzing-support" "log-f32" (func $fimport$0 (type $12) (param f32)))
(import "fuzzing-support" "wasmtag" (tag $eimport$0 (type $11) (param i32)))
(table $0 68 funcref)
(elem $0 (i32.const 0) $0)
(export "drop_active_invoker" (func $2))
(export "func_47" (func $1))
(func $0 (type $0)
)
(func $1 (type $23) (param $0 f32) (result (ref $21))
(try
(do
(call_indirect $0 (type $0)
(i32.const 0)
)
(call $fimport$0
(f32.const 0)
)
(unreachable)
)
(catch $eimport$0
(drop
(pop i32)
)
)
(catch_all
)
)
(unreachable)
)
(func $2 (type $0)
(elem.drop $0)
)
)
|
|
(btw @osa1 you can run the fuzzer locally, see docs at the top here: https://github.com/WebAssembly/binaryen/blob/main/scripts/fuzz_opt.py ) |
|
Thanks for the ping. I'll have a look tomorrow. (Sorry I forgot to add this to the unfuzzable tests as @tlively suggested, but I'll see if it's easy to implement. If not I'll add it to the list.) |
Don't drop the segment in the module as the module can be used again later. Instead add the segment to the dropped segments set. Fixes the fuzzing issue described in #7658 (comment).
Fixes #7209.