fix(riscv): keep no-C control flow on the interpreter path - #218
fix(riscv): keep no-C control flow on the interpreter path#218carlosqwqqwq wants to merge 2 commits into
Conversation
cpu.rs exceeded the AGENTS.md hard split triggers (2000 lines / 150 kB). Move the vector (RVV) element access and data-path execution group, including set_vtype, into cpu/vector.rs with no behavior change.
Without C, IALIGN=32: JAL/branch targets must be 4-byte aligned and JALR targets are runtime-computed, so none of the three can be emitted as a translated branch without an alignment check. They now fall back to the interpreter, which delivers the architectural instruction-address-misaligned trap.
|
I reviewed the focused commit Two changes are needed before this is merge-ready:
Please also add aligned no-C JAL and conditional-branch controls so the regression proves the new fallback is limited to the misaligned static targets. This fix is non-RVV and should remain independent from #203. |
|
Thank you @carlosqwqqwq for identifying the no-C IALIGN gap and proposing a fix. We independently reimplemented and validated this behavior in #231, where it is consolidated with #220, #222, and #224. No commits from this branch were taken; the rollup was derived from the issue reproducer and the RISC-V ISA requirements. To keep review and CI on one maintained branch, I’m closing this PR as superseded by #231. You are credited as co-author on the consolidation commit—please review #231, particularly its conservative dynamic-JALR fallback. |
fix(riscv): keep no-C control flow on the interpreter path
Closes #217
Summary
Without C, IALIGN=32: JAL/branch targets must be 4-byte aligned and JALR targets are runtime-computed, so none of the three can be emitted as a translated branch without an alignment check. The lifter now returns
Unsupportedfor these cases so the interpreter delivers the architectural instruction-address-misaligned trap.Validation
cargo test --lib: 8214 passed, 0 failed.Notes
Translated-path IALIGN gate, distinct from the no-C JALR handling in the direct interpreter.