Repository navigation
Support multi-memory in all memory ops and in apply/resolve-names - #1962
Conversation
|
Further inspection revealed a large number of additional memory ops (atomics, SIMD splat and zero, etc.) that weren't parsing memidx when the memarg flag was set. The validator also had memidx=0 hardcoded for several of these (including memory.fill). Just pushed a second commit that tries to handle this comprehensively by always parsing alignment and memidx in the same place, and carrying them together through the binary readers. This should get reviewed again before merging because it's a much bigger change now. (Edited to add: this also now reflects the updated order of immediates in the binary format in the multi-memory proposal.) |
| CALLBACK(OnAtomicStoreExpr, opcode, alignment_log2, offset); | ||
| CALLBACK(OnOpcodeUint32Uint32, alignment_log2, offset); | ||
| CALLBACK(OnAtomicStoreExpr, opcode, memidx, alignment_log2, offset); | ||
| CHECK_RESULT(CallbackAlignMemOffset(memidx, alignment_log2, offset)); |
There was a problem hiding this comment.
Nice! This change certainly looks like a step in the right direction.
What do you think about combining ReadAlignMem with ReadAddress into a single function ReadMemroyLocation which would replace ReadAlignMem and include the reading of the offset? Could that function also include CallbackAlignMemOffset (removing the need for that new function)?
There was a problem hiding this comment.
Done. I couldn't quite combine it with the CallbackAlignMemOffset because that needs to happen after the callback for the actual expression (otherwise all the opcnts and dumps are off), but I was able to clean it up a little.
(The multi-memory proposal tests don't currently test writing or execution of multi-memory SIMD ops or atomics.)
Previously, wabt could parse multi-memory SIMD loads/stores but not write them. (The testsuite for the multi-memory proposal doesn't currently test writing or execution of multi-memory SIMD ops, so this is untested. However, it does appear to roundtrip its own output on the "memory-multi" test.)
Closes #1958.