il2al: host function rules become two independent conditionals and ignore the new store `s'`
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- ocaml, wasm
- Domain
- compilers
Research direction
The two host-function rules are in spectec/specification/wasm-3.0/4.3-execution.instructions.spectec around lines 184-198. The translation that emits Either only for condition-free rules is in spectec/src/il2al/translate.ml near line 1155, so start there and compare with how memory.grow is handled. Done means the RES and BOT cases become mutually exclusive alternatives, and the store s' from the RES case is applied, as checked by the --prose output.
Written by the indexing model from the issue text.
Description
I came across this while looking at how il2al uses Either for nondeterminism.
The rules Step/call_ref-hostfunc-res and -div (added in #2210) can both apply:
--prose gives:
13. If an element of $hostcall((_HOSTFUNC hf), s, val^n) is some RES, then:
a. Let (RES s' result) be an element of $hostcall((_HOSTFUNC hf), s, val^n).
b. Execute the sequence $lift_result(result).
14. If BOT is contained in $hostcall((_HOSTFUNC hf), s, val^n), then:
...
- Steps 13 and 14 are not alternatives, so when both apply the algorithm does both.
s'is never used, so the store is not updated.
I would expect something like this, as for memory.grow (not sure how AL should update the whole store):
13. Either:
a. Let (RES s' result) be an element of $hostcall((_HOSTFUNC hf), s, val^n).
b. Update the store s to s'.
c. Execute the sequence $lift_result(result).
14. Or:
...
It seems il2al produces Either only for rules without conditions (translate.ml#L1155).
Note: This might be low priority since neither the document nor the reference interpreter uses this algorithm.
- Dominant language
- WebAssembly
- Stars
- 3.5k
- Forks
- 545
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 25
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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/spec
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
WebAssembly/spec#2321 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
WebAssembly/spec#2333 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/spec#2330 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 66/100
WebAssembly/spec#2302 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 53/100
WebAssembly/spec#2301 · 9 comments ·
Maintainers usually reply within 1 day
All issues in WebAssembly/spec
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
DAE2 crashes on call.without.effects with a non ref.func expressionPossibly taken @stevenfontanella claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
WebAssembly/binaryen#9404 ·
Maintainers usually reply within 1 day
-
area:compiler effort:S impact:med platform:windows type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area:Analysis enhancement
Difficulty 1/5 1-3 hours Newbie friendliness 69/100
facebookresearch/atlas-lean#5118 ·
Maintainers usually reply within 1 day
-
C-bugfix
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Quantinuum/hugr#3354 ·
Maintainers usually reply within 1 day