Skip to content
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

fuzzgen: Generate stack load/store instructions #4438

Merged
merged 2 commits into from
Jul 13, 2022

Conversation

afonso360
Copy link
Contributor

👋 Hey,

This PR adds stack slots and stack loads and stores to the functions generated by fuzzgen. We use only the specialized instructions stack_store/stack_load and not the more general combo of stack_addr + store/load.

This also generates random stack slots, that are zero initialized on the first block of the function to prevent reading uninitialized memory.

This has run overnight on a (not very fast) x86 server, and so far hasn't found any issues.

cc: @cfallin @jameysharp

@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Jul 13, 2022
@jameysharp jameysharp self-requested a review July 13, 2022 14:56
Copy link
Contributor

@jameysharp jameysharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great except I have one question about a seemingly-unrelated change. Otherwise I'm looking forward to merging this! I think it'll be great to have more coverage in this fuzz target.

Comment on lines 277 to 283
let imm64 = match ty {
I8 => self.u.arbitrary::<i8>()? as i64,
I16 => self.u.arbitrary::<i16>()? as i64,
I32 => self.u.arbitrary::<i32>()? as i64,
I64 => self.u.arbitrary::<i64>()?,
ty if ty == I8 => self.u.arbitrary::<i8>()? as i64,
ty if ty == I16 => self.u.arbitrary::<i16>()? as i64,
ty if ty == I32 => self.u.arbitrary::<i32>()? as i64,
ty if ty == I64 => self.u.arbitrary::<i64>()?,
_ => unreachable!(),
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unnecessary, right? I'd like to keep the simpler syntax unless there's some reason it needs to change.

Copy link
Contributor Author

@afonso360 afonso360 Jul 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My editor was complaining that we were always matching on I8 as a variable name and that the others were unused.

But looking at it again it probably would also generate a compile warning, so i think it might be a bug in CLion.

Ill revert this change.

Copy link
Contributor

@jameysharp jameysharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I'll let this auto-merge assuming CI passes, which I expect it will.

@jameysharp jameysharp enabled auto-merge (squash) July 13, 2022 18:22
@jameysharp jameysharp merged commit 03ece34 into bytecodealliance:main Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants