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

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
@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

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (6071907) to head (3dd2628).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64639      +/-   ##
==========================================
- Coverage   90.13%   90.13%   -0.01%     
==========================================
  Files         741      741              
  Lines      242076   242057      -19     
  Branches    45550    45559       +9     
==========================================
- Hits       218199   218168      -31     
- Misses      15391    15392       +1     
- Partials     8486     8497      +11     
Files with missing lines Coverage Δ
lib/ffi.js 94.92% <ø> (-0.04%) ⬇️
lib/internal/ffi/fast-api.js 78.13% <100.00%> (+3.86%) ⬆️
src/ffi/fast.cc 67.81% <100.00%> (+1.55%) ⬆️
src/ffi/fast.h 100.00% <ø> (ø)
src/node_ffi.cc 71.09% <100.00%> (+0.03%) ⬆️

... and 31 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.

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