Skip to content

ffi: make Fast API functions collectable - #67177

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:ffi-dynlib-v8-template
Open

trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:ffi-dynlib-v8-template

Conversation

@trivikr

@trivikr trivikr commented Nov 1, 2026

Copy link
Copy Markdown
Member

Fixes: #67176

V8 strongly caches instantiations of low-serial FunctionTemplates, which pinned Fast API functions and, through them, their DynamicLibrary and trampoline.

FunctionTemplate::New() has no cache opt-out, so this adds an ObjectTemplate property to make these templates uncacheable, then deletes it from the new function.


Assisted-by: claude:opus-5.5

V8 strongly caches instantiations of low-serial FunctionTemplates,
which pinned Fast API functions and, through them, their
DynamicLibrary and trampoline. FunctionTemplate::New() has no opt-out,
so add an ObjectTemplate property to make these templates uncacheable,
then delete it from the new function.

Signed-off-by: Kamat, Trivikram <[email protected]>
Assisted-by: claude:opus-5.5
@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++. needs-ci PRs that need a full CI run. labels Nov 1, 2026
@trivikr trivikr added ffi Issues and PRs related to experimental Foreign Function Interface support. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Nov 1, 2026
@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.67%. Comparing base (e97c75e) to head (f9f336f).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/node_ffi.cc 82.35% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67177      +/-   ##
==========================================
- Coverage   90.68%   90.67%   -0.02%     
==========================================
  Files         797      797              
  Lines      278790   278805      +15     
  Branches    53617    53617              
==========================================
- Hits       252834   252815      -19     
- Misses      16303    16349      +46     
+ Partials     9653     9641      -12     
Files with missing lines Coverage Δ
src/node_ffi.cc 73.70% <82.35%> (+0.55%) ⬆️

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

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 1, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@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

@trivikr trivikr added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. labels Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue PRs queued for automated landing through the Commit Queue. ffi Issues and PRs related to experimental Foreign Function Interface support. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ffi: Fast API functions and their DynamicLibrary are pinned by V8's template instantiation cache

4 participants