Inlining breaks asyncify
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- wasm
- Domain
- compilers
Research direction
Start by reproducing the issue with the shown input.wat using bin/wasm-opt -O2 --asyncify -S, then run output.wat with bin/wasm-shell and compare the printed sequence. Inspect commit 1a6efdb4233a077bc6e5e8a340baf5672bb5bced and the asyncify/inlining behavior it changed. Done means the transformed module preserves the expected 1, 2, 1, 3, 3 output.
Written by the indexing model from the issue text.
Description
While reading @kripken 's post on asyncify, I gave the test case shown a go:
(memory 1 1)
(import "spectest" "print" (func $print (param i32)))
(import "asyncify" "start_unwind" (func $asyncify_start_unwind (param i32)))
(import "asyncify" "stop_unwind" (func $asyncify_stop_unwind))
(import "asyncify" "start_rewind" (func $asyncify_start_rewind (param i32)))
(import "asyncify" "stop_rewind" (func $asyncify_stop_rewind))
(global $sleeping (mut i32) (i32.const 0))
(start $runtime)
(func $main
(call $print (i32.const 1))
(call $sleep)
(call $print (i32.const 3))
)
(func $sleep
(if
(i32.eqz (global.get $sleeping))
(block
;; Start to sleep.
(global.set $sleeping (i32.const 1))
(i32.store (i32.const 16) (i32.const 24))
(i32.store (i32.const 20) (i32.const 1024))
(call $asyncify_start_unwind (i32.const 16))
)
(block
;; Resume after sleep.
(call $asyncify_stop_rewind)
(global.set $sleeping (i32.const 0))
)
)
)
(func $runtime
;; Call main the first time, let the stack unwind.
(call $main)
(call $asyncify_stop_unwind)
;; We could do anything we want around here while
;; the code is paused!
(call $print (i32.const 2))
;; Set the rewind in motion.
(call $asyncify_start_rewind (i32.const 16))
(call $main)
)
)
I was quite surprised that after:
$ bin/wasm-opt -o output.wat input.wat -O2 --asyncify -S
$ bin/wasm-shell output.wat
BUILDING MODULE [line: 1]
1 : i32
3 : i32
2 : i32
1 : i32
3 : i32
Bisecting shows that the first bad commit is https://github.com/WebAssembly/binaryen/commit/1a6efdb4233a077bc6e5e8a340baf5672bb5bced . The title of the issue is an assumption due to the description in the first bad commit.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 77
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/binaryen
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
WebAssembly/binaryen#9135 · 1 comment ·
-
Difficulty 2/5 Half a day Newbie friendliness 76/100
WebAssembly/binaryen#9018 · 3 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
WebAssembly/binaryen#9133 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
WebAssembly/binaryen#9123 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
WebAssembly/binaryen#9122 ·
All issues in WebAssembly/binaryen
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objectionary/eo#8923 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Coarray integration tests carry no LABELS, so run_tests.py silently skips them under every backend Opencoarray
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
internal.h中,漏掉了1个定义。 Open
Difficulty 1/5 Under an hour Newbie friendliness 95/100