Skip to content

Conversation

@stevenfontanella
Copy link
Member

@stevenfontanella stevenfontanella commented Jan 20, 2026

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.

@stevenfontanella stevenfontanella changed the title Add script to generate spec test Add script to generate relaxed atomics spec test Jan 20, 2026
@stevenfontanella stevenfontanella marked this pull request as ready for review January 20, 2026 23:31
@stevenfontanella
Copy link
Member Author

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.

Comment on lines +115 to +128
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
)'''
Copy link
Member

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.

stevenfontanella added a commit that referenced this pull request Jan 23, 2026
Part of #8165. Fuzzing and library support will be added in a future PR
with all instructions together. relaxed-atomics.wast is updated using
the WIP script in #8220.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants