-
Notifications
You must be signed in to change notification settings - Fork 835
Add script to generate relaxed atomics spec test #8220
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
base: main
Are you sure you want to change the base?
Conversation
2200bdf to
0c37e1b
Compare
|
I had a mistake with the section's length calculation, which was only coincidentally correct when 2 instructions were being tested. I fixed it now and tested it locally with more ops. |
| def binary_test_example(): | ||
| return r'''(module binary | ||
| "\00asm\01\00\00\00" ;; header + version | ||
| "\01\05\01\60\00\01\7f\03\02\01\00\05\05\01\03\17\80\02" ;; other sections | ||
| "\0a\0c\01" ;; code section | ||
| "\0a\00" ;; func size + decl count | ||
| "\41\33" ;; i32.const 51 | ||
| "\fe\10" ;; i32.atomic.load | ||
| "\62" ;; 2 | (1<<5) | (1<<6): Alignment of 2 (32-bit load), with bit 5 set indicating that the next byte is a memory ordering | ||
| "\00" ;; memory index | ||
| "\01" ;; acqrel ordering | ||
| "\00" ;; offset | ||
| "\0b" ;; end | ||
| )''' |
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.
It would be nice to have this level of detail (or more) in the comments for all binary modules. One way to do this would be to stamp out one module per instruction under test (or possibly one function per instruction) using the same template each time. If you put an unreachable before and after the instruction you won't need to change the template for different instruction types.
Part of #8165. test/spec/relaxed-atomics.wast was generated by the script.
Will add missing instructions e.g. load8, i64 instructions, etc once the approach looks good.