fix(Singlepass): support ExternRef and FuncRef#6139
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the Singlepass compiler where FuncRef and ExternRef types were not supported as function parameters, causing a panic on the todo! macro. The fix adds support for these reference types in the x64 argument register allocator.
Changes:
- Added
Type::FuncRefandType::ExternRefto the argument register allocation logic in the Singlepass x64 backend - Added a comprehensive test case that validates FuncRef and ExternRef parameters work correctly in imported functions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/compiler-singlepass/src/x64_decl.rs | Added FuncRef and ExternRef to the type patterns in ArgumentRegisterAllocator for both Windows Fastcall and System V calling conventions, treating them as pointer-sized values that use general-purpose registers |
| tests/compilers/issues.rs | Added test case issue_4169_funcref_externref_import that verifies a module with funcref and externref import parameters can be compiled and instantiated successfully |
syrusakbary
reviewed
Jan 30, 2026
Member
syrusakbary
left a comment
There was a problem hiding this comment.
Don't we need to enable current spec tests to see if things fully work?
Contributor
Author
The spec connected to these types are already enabled - this particular PR is about trampoline support of the types. |
Add support for the types as the function arguments. Fixes: #4169
969a95d to
e282afc
Compare
syrusakbary
approved these changes
Feb 11, 2026
marxin
added a commit
that referenced
this pull request
Feb 11, 2026
Add support for the types as the function arguments. Fixes: #4169
syrusakbary
pushed a commit
that referenced
this pull request
Feb 13, 2026
* fix integration tests * fix part of snapshot-based tests * drop legacy dlopen.wasm * drop 2 broken wasm modules * drop legacy dlopen wasm module usage * port to latest bash * fix one test * drop non-existing package usage * fix one test * fix another test-case * fix one test-case * drop WCGI tests * fix python test-case with a sample script * disable create_exe - obsolete * fix one test-case * port 2 tests to bash * use bash * drop broken test-case * drop broken test-case * drop unused variables * fix panic expected output * fix expected string * use bash again * fix expected FS listing * drop broken test-case * drop 2 tests that depend on broken uutils * ignore known issue in WASIX - cwd * drop deploymed tests - have better tests * disable one more test - known issue * drop one more broken test * Include integration tests in CI * add wasmer binary dependency * restore 2 files * update expected output of a backtrace * restore one more webc file * Update lib/package/src/package/manifest.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * simplify * fix warnings * run integration tests on MUSL * use DEV_BACKEND_CIUSER_TOKEN env variable * fix other tests * CI: drop unused parts connected to integration tests * rename token variables * use more DEV_BACKEND_CIUSER_TOKEN * export secret to ENV variable * fix(sdk): Inaccurate handling of command-line arguments in `proc_exec`. (#6168) * fix(sdk): Inaccurate handling of command-line arguments in `proc_exec`. * refactor --------- Co-authored-by: Shachar Itzhaky <corwin.amber@gmail.com> * fix(Singlepass): support ExternRef and FuncRef (#6139) Add support for the types as the function arguments. Fixes: #4169 * chore: use vmctx name in LLVM IR dumps (#6185) * bump wasm-tools related crates (#6186) * bump wasm-tools related crates * run cargo update * align versions * feat(CLI): use --disable-cache if --compiler-debug-dir used (#6182) * use wasmer/coreutils * fix expected output * update wasix example * use more Cranelift in the integration tests (make it faster) * disable slow tests on macOS * skip one more test on macOS * enable more tests on MUSL * cargo fmt * disable one test on musl * skip the tests --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Shachar Itzhaky <corwin.amber@gmail.com>
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.
Add support for the types as the function arguments.
Fixes: #4169