Skip to content

ffi: fix optimized buffer conversions#64639

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:ffi-buffer-sig-bigint
Open

ffi: fix optimized buffer conversions#64639
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:ffi-buffer-sig-bigint

Conversation

@trivikr

@trivikr trivikr commented Jul 21, 2026

Copy link
Copy Markdown
Member

Fixes: #64638

Fast FFI calls with buffer or arraybuffer argument signatures accepted pointer-like values through the generic path, but rejected non-memory-backed values after optimization.

This change keeps the primary optimized entry point compatible with raw pointer conversions while retaining the specialized native fast path for memory-backed arguments. Optimized calls now consistently accept documented representations including bigint, strings, nullish values, buffers, typed arrays, and ArrayBuffer objects.


Assisted-by: openai:gpt-5.6-sol

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/ffi

@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 Jul 21, 2026
@trivikr trivikr added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jul 21, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 21, 2026
@nodejs-github-bot

This comment was marked as outdated.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.31034% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.12%. Comparing base (0992f6b) to head (139053a).

Files with missing lines Patch % Lines
lib/internal/ffi/fast-api.js 62.50% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64639      +/-   ##
==========================================
- Coverage   90.14%   90.12%   -0.02%     
==========================================
  Files         741      741              
  Lines      242112   242093      -19     
  Branches    45605    45602       -3     
==========================================
- Hits       218244   218186      -58     
- Misses      15360    15393      +33     
- Partials     8508     8514       +6     
Files with missing lines Coverage Δ
lib/ffi.js 94.92% <ø> (-0.04%) ⬇️
src/ffi/fast.cc 68.13% <100.00%> (+1.46%) ⬆️
src/ffi/fast.h 100.00% <ø> (ø)
src/node_ffi.cc 71.12% <100.00%> (+0.03%) ⬆️
lib/internal/ffi/fast-api.js 85.76% <62.50%> (-1.59%) ⬇️

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Preserve pointer-like argument conversions for buffer and arraybuffer
signatures after Fast API optimization. Keep memory-backed arguments
on the specialized native fast path.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.6-sol
@trivikr
trivikr force-pushed the ffi-buffer-sig-bigint branch from 3dd2628 to 139053a Compare July 23, 2026 04:38
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++. 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.

ffi: Fast FFI buffer/arraybuffer signatures reject bigint after optimization

3 participants