Motivation
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- wasm
- Lĩnh vực
- compilers
Hướng nghiên cứu
Start with the issue's Motivation section and the linked LLVM Coroutines documentation. Review how the proposal distinguishes compiler transformations for async/await and generators from stack switching for green threads. Done means the proposal's motivation and scope clearly reflect the intended use case.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
At the moment, the overview gives these goals:
Motivation
- Support for Asynch/await programming pattern.
- Support for green threads.
- Support for yield-style generators.
Of these, only green threads require any changes to WebAssembly:
- Async/await programming can relatively easily be implemented in the compiler. In particular, LLVM has implemented it as a series of passes, which you can read about here. In my experience, this works really well even in WebAssembly because after the passes have done their work, the code is converted to a form that looks like hand-written async code. No special features from the instruction set are required for this to work: the only requirement is the ability to call a function pointer.
- Yield-style generators are actually very similar to async/await and can also be implemented as a compiler pass. LLVM supports them using the same coroutine passes. Again, no special features are required from the instruction set.
While I've only mentioned LLVM above, other compilers do something similar. I believe Rust has a separate implementation of async/await (it doesn't appear to use LLVM coroutines). But an easier way to understand why async/await and yield-style generators do not need WebAssembly support is by realizing that they can all be implemented manually, by hand. And if it can be written by hand, a compiler can perform that transformation for you as a compiler pass.
What cannot be written by hand is stack switching. In particular, this is a problem in Go which uses stack switching extensively for goroutines (every blocking operation potentially results in a stack switch).
Therefore, I would propose that this proposal only focuses on the green threads use case, that requires stack switching (as evident from the name: stack-switching). Of course you could potentially use stack switching for async/await and yield-style generators, but I do not think we should focus on them as there are already ways to efficiently support them in WebAssembly.
- Ngôn ngữ chính
- WebAssembly
- Star
- 216
- Fork
- 19
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của WebAssembly/stack-switching
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
WebAssembly/stack-switching#156 · 1 bình luận ·
-
Should `cont.new` be constant?Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
WebAssembly/stack-switching#145 · 4 bình luận ·
-
Use `typeuse` in text format?Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
WebAssembly/stack-switching#144 · 4 bình luận ·
-
JSPI integrationĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
WebAssembly/stack-switching#131 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
WebAssembly/stack-switching#128 · 6 bình luận ·
Tất cả issue của WebAssembly/stack-switching
Issue tương tự
-
self-host checker: E021 bound check reads an untyped literal at i32, not the type the call bindsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
JakeChampion/lang#11055 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
codegen: memref.collapse_shape in an mlir! block leaves an affine.apply that is never loweredĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rhalbersma/xstd-bits#307 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày