fuzzgen: Generate stack load/store instructions#4438
fuzzgen: Generate stack load/store instructions#4438jameysharp merged 2 commits intobytecodealliance:mainfrom
Conversation
jameysharp
left a comment
There was a problem hiding this comment.
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.
| 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!(), | ||
| }; |
There was a problem hiding this comment.
This change is unnecessary, right? I'd like to keep the simpler syntax unless there's some reason it needs to change.
There was a problem hiding this comment.
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.
jameysharp
left a comment
There was a problem hiding this comment.
Looks great! I'll let this auto-merge assuming CI passes, which I expect it will.
👋 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_loadand not the more general combo ofstack_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