-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fuzzer: Better fuzzing of globals #6611
Conversation
Here is an example output from this: (global $global$32 (ref null $12) (struct.new $12
(ref.func $1)
(f32.const -3402823466385288598117041e14)
(struct.new $8
(ref.func $1)
(global.get $global$29)
(i32.const 127)
(global.get $global$19)
(f32.const 0)
)
)) The |
src/tools/fuzzing/fuzzing.cpp
Outdated
// We also do so if this is a tuple type and we are not in a function, because | ||
// atm tuple globals have only limited support, and in particular we do not | ||
// support a global.get from one such global to another (a tuple global must | ||
// contain a tuple.make instruction). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect us to support arbitrary constant expressions as the children of the tuple.make
, though. For example, do things break if we allow a global.get
child?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that should work, but it would require us to check if we are the toplevel or not, at this location. There isn't a nice way to do that atm. Do you think it's worth it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think it's worth doing at some point, but not necessarily in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized it is just as simple to disallow only tuple.make
at the toplevel, and pushed that now. With that we can get tuple globals whose values include global.get
s.
With this PR we generate
global.get
s in globals, which we did not do before.We do that by replacing
makeConst
(the only thing we did before, for thecontents of globals) with
makeTrivial
, and add code tomakeTrivial
to sometimesmake a
global.get
. When no suitable global exists,makeGlobalGet
will emit aconstant, so there is no danger in trying.
Also raise the number of globals a little.
Also explicitly note the current limitation of requiring all tuple globals to contain
tuple.make
and nothing else, including notglobal.get
, and avoid adding suchinvalid
global.get
s in tuple globals in the fuzzer.