Skip to content

fix(Singlepass): support ExternRef and FuncRef#6139

Merged
marxin merged 2 commits intomainfrom
singlepass-missing-tys
Feb 11, 2026
Merged

fix(Singlepass): support ExternRef and FuncRef#6139
marxin merged 2 commits intomainfrom
singlepass-missing-tys

Conversation

@marxin
Copy link
Contributor

@marxin marxin commented Jan 29, 2026

Add support for the types as the function arguments.

Fixes: #4169

@marxin marxin requested a review from syrusakbary as a code owner January 29, 2026 12:49
Copilot AI review requested due to automatic review settings January 29, 2026 12:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::FuncRef and Type::ExternRef to 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

Copy link
Member

@syrusakbary syrusakbary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to enable current spec tests to see if things fully work?

@marxin
Copy link
Contributor Author

marxin commented Feb 3, 2026

Don't we need to enable current spec tests to see if things fully work?

The spec connected to these types are already enabled - this particular PR is about trampoline support of the types.

@marxin marxin enabled auto-merge (squash) February 3, 2026 13:09
Add support for the types as the function arguments.

Fixes: #4169
@marxin marxin force-pushed the singlepass-missing-tys branch from 969a95d to e282afc Compare February 4, 2026 12:00
@marxin marxin requested a review from syrusakbary February 5, 2026 08:39
@marxin marxin merged commit 58f166d into main Feb 11, 2026
286 of 288 checks passed
@marxin marxin deleted the singlepass-missing-tys branch February 11, 2026 16:44
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unsupported ref types in ArgumentRegisterAllocator

3 participants