jit: support functions with no return value - #8479
Conversation
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 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 |
|
@coderabbitai review |
|
Assisted-by: codex-5.6-sol
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