fix(riscv64): implement fixed-parameter and return-saving calling convention#13826
Open
gounthar wants to merge 1 commit into
Open
fix(riscv64): implement fixed-parameter and return-saving calling convention#13826gounthar wants to merge 1 commit into
gounthar wants to merge 1 commit into
Conversation
…vention Master restored the LLVM backend with a riscv64 target, but SubstrateRISCV64RegisterConfig.getCallingConvention still threw for fixed parameter assignments and return saving. Port the implementation (return-buffer placeholder in x28, custom-ABI parameter assignment), mirroring the AArch64 register config.
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
Master restored the LLVM backend with a riscv64 target, but
SubstrateRISCV64RegisterConfig.getCallingConventionstill throws "Fixed parameter assignments and return saving are not yet supported on this platform" for custom-ABI calls. The first foreign call during image generation (throwNewNullPointerException) trips it, so native-image cannot get past "Compiling methods" on riscv64.This implements the fixed-parameter-assignment and return-saving path for riscv64, mirroring the existing AArch64 register config: the return-buffer placeholder parameter is parked in x28 (t3) where AArch64 uses r8, and custom-ABI parameters are assigned to their fixed register/stack locations. The standard-ABI path is unchanged in behaviour, only moved under the
!type.customABI()branch.Related Issues
Part of reviving the riscv64 LLVM backend, discussed in #13351.
Testing
Built substratevm for linux-riscv64 on a Banana Pi F3 (SpaceMiT K1) and ran native-image on a HelloWorld with
--tool:llvm-backend --no-fallback. Before this change the build aborted ingetCallingConventionat the first foreign call; after it, the build proceeds through all method compilation. The image does not yet link on riscv64 due to a separate, independent issue (the in-process object reader still uses the LLVM 13 bytedeco preset against LLVM 20.1.4 objects, discussed in #13351).Documentation
No documentation changes needed.
Contributor Checklist