Conversation
This refactors JIT code generation by: 1. Simplifying RVOP macro from 3 to 2 parameters, removing now-unused DSL-based GEN blocks from rv32_template.c. This eliminates ~1300 lines of dead code that was obsoleted when rv32_jit.c was added (commit 9cd48ea). 2. Introducing JIT helper macros in rv32_jit.c to reduce duplication: - GEN_BRANCH/GEN_CBRANCH for conditional branches - GEN_ALU_IMM/GEN_ALU_REG for arithmetic operations - GEN_SHIFT_IMM/GEN_SHIFT_REG for shift operations - GEN_SLT_IMM/GEN_SLT_REG for set-less-than operations - GEN_LOAD/GEN_STORE for memory operations with MMIO support 3. Adding symbolic constants (JCC_*) in jit.h for jump condition codes, improving cross-architecture clarity. 4. Removing the deprecated gen-jit-template.py that was no longer used after the manual JIT handler approach was adopted. The interpreter and JIT now have clear separation of concerns: - rv32_template.c: Pure interpreter semantics - rv32_jit.c: Native code generation with helper macros Close #511
jserv
commented
Jan 5, 2026
Contributor
Author
jserv
left a comment
There was a problem hiding this comment.
Benchmarks
Details
| Benchmark suite | Current: d8129e5 | Previous: 5326a16 | Ratio |
|---|---|---|---|
Dhrystone |
1901 Average DMIPS over 10 runs |
1606 Average DMIPS over 10 runs |
0.84 |
Coremark |
1016.605 Average iterations/sec over 10 runs |
958.749 Average iterations/sec over 10 runs |
0.94 |
This comment was automatically generated by workflow using github-action-benchmark.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This refactors JIT code generation by:
The interpreter and JIT now have clear separation of concerns:
Close #511
Summary by cubic
Refactors Tier-1 JIT codegen to use shared helper macros and symbolic jump codes, simplifying the interpreter API and clearly separating interpreter semantics from native code generation. This reduces duplicated code and improves cross-architecture clarity (x86-64 and Arm64).
Written for commit d8129e5. Summary will update on new commits.