-
Notifications
You must be signed in to change notification settings - Fork 924
SinglePass: add support for riscv64 target #5711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This is only the basic plumbing and architecture, the actual implementation is to follow.
|
@syrusakbary The PR is basically ready to be merged. However, it depends on a smaller tweaks to the CI when it comes to testing of |
99e77da to
490d62d
Compare
|
The CI job |
Clarify terms regarding Generated Code and licensing conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds experimental RISC-V 64-bit support to the Wasmer SinglePass compiler, enabling WebAssembly compilation for RISC-V architecture. The implementation includes core instruction encoding, trap handling, unwinding support, and comprehensive test coverage.
Key changes:
- New RISC-V machine backend with full instruction set implementation (6219 lines)
- Trap handling and unwinding support for RISC-V architecture
- CI/CD integration with QEMU-based testing for RISC-V target
- Test suite adaptations for RISC-V-specific limitations (jump instruction range)
Reviewed Changes
Copilot reviewed 23 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/compiler-singlepass/src/machine_riscv.rs | Core RISC-V machine implementation with instruction encoding and code generation |
| lib/compiler-singlepass/src/riscv_decl.rs | RISC-V register definitions and calling convention support |
| lib/compiler-singlepass/src/emitter_riscv.rs | RISC-V instruction emitter (not shown in diff) |
| lib/vm/src/trap/traphandlers.rs | Added RISC-V trap code extraction from illegal instructions |
| lib/compiler-singlepass/src/unwind.rs | RISC-V DWARF unwinding support |
| tests/compilers/issues.rs | Test adaptations for RISC-V limitations and Cranelift workaround |
| lib/compiler-singlepass/Cargo.toml | Added tempfile dependency and riscv feature flag |
| .cargo/config.toml | RISC-V cross-compilation and QEMU runner configuration |
| .github/workflows/build.yml | CI integration for RISC-V WAST test suite |
| lib/compiler-singlepass/README.md | Updated documentation to list riscv64 as experimental target |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
The PR received a couple of fixed that very identified and reduced from running the RISC-V Singlepass compiler on tests for the following Rust crates:
|
The PR adds the rudimentary support for RISC-V 64-bit target into the SinglePass compiler.
Even though, the code still needs some polishing and various TODOs must be addressed, the compiler can pass all (104) thespectests.TODOs:
location_cmp+jmp_on_Xneeds polishing as RISC-V target does not provide a FLAGS register (Singlepass: refactor condition jumps to single fn (jmp_on_condition) #5750).spec/address.wastis flaky (sometimes trap is not properly triggered)compilertests (including the WASI tests) are green nowMinor improvements:
Machinetrait - wipe unused entry points in the Trait