Binary format bikeshed: where the `typeidx` immediate is located
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- wasm
- Domain
- compilers
Research direction
The issue discusses the binary format of the memarg immediate in WebAssembly proposals. Review the spec for multibyte-array-access and acquire-release-atomics to understand the current layout. Examine the parser code that handles these flags and immediates. The goal is to propose a consistent ordering of immediates based on flag bits, ensuring the change is compatible with existing and related proposals.
Written by the indexing model from the issue text.
Description
Currently this proposal specifies memarg ::= flags:u32 offset:u32 typeidx:u32 when flags has bit 5 set, but subjectively I find this a bit inconsistent with other immediates-specified-by-flags. For example bit 6, implying a memory index immediate, looks like memarg ::= flags:u32 memidx:u32 offset:u32. For the acquire-release-atomics proposal bit 4 implies memarg ::= flags:u32 ordering:u8 offset:u32 (at least I'm pretty sure given my current reading of the explainer and parser).
I opened a somewhat related issue at WebAssembly/acquire-release-atomics#28 but I think it'd be a bit nicer if the flags bits had payloads present after the flags leb in increasing order of the bits. Specifically I'd propose:
;; already specified in core wasm
memarg ::= flags:u32 offset:u32 if (flags >> 4) == 0b000
| flags:u32 memidx:u32 offset:u32 if (flags >> 4) == 0b100
;; added by acquire-release-atomics
memarg ::= ...
| flags:u32 ordering:u8 offset:u32 if (flags >> 4) == 0b001
| flags:u32 ordering:u8 memidx:u32 offset:u32 if (flags >> 4) == 0b101
;; added by multibyte-array-access
memarg ::= ...
| flags:u32 typeidx:u32 offset:u32 if (flags >> 4) == 0b010
;; added by both
memarg ::= ...
| flags:u32 ordering:u8 typeidx:u32 offset:u32 if (flags >> 4) == 0b011
where 0b110 and 0b111 are both parse errors with this proposal (memory index + type index). The 0b011 case might be invalid for now though while this proposal isn't extended to atomics, though.
Basically though I wanted to ask: what would others think about moving the typeidx immediate to before offset:u32?
EDIT: sorry forgot to finish writing the issue title before I hit submit so the notifications sent out have a pretty bad issue title :(
- Dominant language
- WebAssembly
- Stars
- 4
- Forks
- 1
- Avg merge
- 16h 35m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WebAssembly/multibyte-array-access
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
WebAssembly/multibyte-array-access#8 · 1 comment ·
-
Dart SIMD use case. Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/multibyte-array-access#5 · 11 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
WebAssembly/multibyte-array-access#4 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/multibyte-array-access#3 · 5 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in WebAssembly/multibyte-array-access
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
JakeChampion/lang#10213 ·
-
bug language-server
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
purefunctor/purescript-iris#552 ·
-
enhancement good first issue needs testing
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
bradcypert/plum#58 ·