Repository navigation
Add RISC-V 64-bit architecture support - #125
Conversation
This adds complete RISC-V 64-bit support to the coroutines implementation: - Context structure with sp, fp, and pc registers - Context initialization in initContext() - Full context switching with save/restore of all registers - Entry point (coroEntry) with correct stack layout handling - CI workflow updates to test RISC-V builds using QEMU The implementation follows the same patterns as existing x86_64 and aarch64 architectures, with proper register preservation and calling convention adherence.
|
Warning Rate limit exceeded@lalinsky has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 36 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughAdds RISC-V 64 architecture support to the project by extending the CI matrix to test on riscv64-linux via QEMU and implementing the necessary coroutine context management (Context type, initContext, switchContext, coroEntry) for the architecture. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds a comprehensive test demonstrating message passing between two coroutines using a simple channel implementation: - Single-slot channels with yield-based blocking - Sender sends messages 0-9, verifies echoes, then sends EOF (-1) - Receiver echoes messages and returns the last value received - Round-robin scheduler coordinates both coroutines - Validates proper context switching and synchronization
The Closure helper now automatically prepends the coroutine pointer as
the first argument when calling the wrapped function. This simplifies
the API:
Before:
var closure = Closure(fn).init(.{ &coro, arg1, arg2 });
After:
var closure = Closure(fn).init(.{ arg1, arg2 });
The coroutine is still passed to the function, but users don't need to
manually provide it in the init tuple. This makes the API cleaner and
less error-prone.
Summary
Implementation Details
This PR extends the existing coroutine system to support RISC-V 64-bit architecture, following the same patterns as the existing x86_64 and aarch64 implementations:
Context Structure (src/coroutines.zig:39-44)
sp,fp, andpcregistersExtraContextfield for future Windows TIB support (if needed)Context Initialization (src/coroutines.zig:64-69)
initContext()for RISC-V to properly set up initial stack pointer, frame pointer, and program counterContext Switching (src/coroutines.zig:312-391)
Entry Point (src/coroutines.zig:437-442)
coroEntry()for RISC-V with correct stack layout handlingCI Updates (.github/workflows/test.yml:21-24)
qemu-riscv64-staticTest Plan