Skip to content

ffi: add fast support for almost all other platforms#63941

Open
ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:ffi-fast-api-other-platforms
Open

ffi: add fast support for almost all other platforms#63941
ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:ffi-fast-api-other-platforms

Conversation

@ShogunPanda

Copy link
Copy Markdown
Contributor

This extends the experimental Fast FFI path to the remaining 64-bit Node.js architectures with conservative ABI-specific trampolines.
The change adds scalar, register-only Fast FFI emitters for:

  • Win64 x64
  • Windows ARM64 via the existing AArch64 emitter with Windows executable-memory support
  • Linux PPC64LE ELFv2
  • RISC-V 64
  • LoongArch64
  • s390x

The new emitters intentionally reject unsupported ABI shapes so calls fall back to SharedBuffer or generic libffi. Current fallback cases include buffer-shaped arguments on the new scalar-only emitters, stack-passed arguments, narrow returns where not yet normalized, 32-bit platforms, and AIX/PPC64BE.
s390x support is included for builds where FFI is available, such as --shared-ffi, since bundled FFI is not currently enabled for that target.

The contributor docs were updated to describe the supported platform matrix, per-ABI limits, and explicitly note that 32-bit platforms and AIX/PPC64BE remain out of scope.

Assisted-By: OpenAI:GPT-5.5 <openai/gpt-5.5>

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/ffi
  • @nodejs/gyp
  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jun 16, 2026

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

Signed-off-by: Paolo Insogna <paolo@cowtech.it>
@ShogunPanda ShogunPanda force-pushed the ffi-fast-api-other-platforms branch from 9f25eb3 to 7b91fc4 Compare June 16, 2026 13:13
@ShogunPanda ShogunPanda added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 16, 2026
@addaleax addaleax added ffi Issues and PRs related to experimental Foreign Function Interface support. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Jun 16, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 16, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. ffi Issues and PRs related to experimental Foreign Function Interface support. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants