Skip to content

ffi: avoid mutable push on private arrays - #67895

Open
rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:ffi-private-arrays-no-push
Open

rozzilla wants to merge 1 commit into
nodejs:mainfrom
rozzilla:ffi-private-arrays-no-push

Conversation

@rozzilla

Copy link
Copy Markdown
Contributor

The shared-buffer and fast API wrappers for FFI functions collected per-argument type info, offsets and indexes with .push() on private arrays.

No tests are added because the three lines are already reached by the existing test/ffi tests (for example test-ffi-shared-buffer.js and test-ffi-fast-integer-validation.js).

Same approach as #67748, #67751 and #67752: private arrays only, no
performance claim.

The shared-buffer and fast API wrappers collected per-argument type
info, offsets and indexes with .push() on private arrays, which looks
up Array.prototype.push at call time. Replacing that method from user
code changed how wrapped functions were built. Use indexed assignments
instead.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
@nodejs-github-bot nodejs-github-bot added ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run. labels Nov 30, 2026
@codecov

codecov Bot commented Nov 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.59%. Comparing base (91f8170) to head (4fd8c54).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #67895   +/-   ##
=======================================
  Coverage   90.58%   90.59%           
=======================================
  Files         802      802           
  Lines      286659   286659           
  Branches    55370    55368    -2     
=======================================
+ Hits       259676   259693   +17     
+ Misses      17083    17074    -9     
+ Partials     9900     9892    -8     
Files with missing lines Coverage Δ
lib/internal/ffi-shared-buffer.js 60.11% <100.00%> (ø)
lib/internal/ffi/fast-api.js 96.12% <100.00%> (ø)

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

ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run.

2 participants