jit: support functions with no return value - #8479
Open
kyokuping wants to merge 1 commit into
Open
Conversation
Contributor
📝 WalkthroughWalkthroughThe JIT now supports ChangesJIT void return support
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant JITCompiler
participant CraneliftSignature
participant LibffiInvocation
JITCompiler->>CraneliftSignature: omit return parameter for JitType::None
JITCompiler->>LibffiInvocation: use libffi void type
LibffiInvocation-->>JITCompiler: return no value
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
kyokuping
marked this pull request as ready for review
August 10, 2026 09:52
kyokuping
marked this pull request as draft
August 10, 2026 10:20
kyokuping
marked this pull request as ready for review
August 10, 2026 10:21
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.
Summary
no_return_valuetest (crates/jit/tests/misc_tests.rs).JitType::Nonevariant to represent a void/Nonereturn, instead ofoverloading
Option<JitType>to mean both "return type not yet inferred"and "unsupported value". :
Option::None= not seen a return yet,Some(JitType::None)= confirmedvoid return,
Some(Int/Float/Bool)= confirmed typed return.JitType::to_craneliftnow returnsOption<types::Type>(Nonefor thevoid case), and all four call sites handle it instead of unconditionally
pushing a cranelift return param.
return_valuecomparesJitTypes directly and emitsreturn_(&[])whenthere's no cranelift value.
Summary by CodeRabbit
New Features
Bug Fixes