-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
src: add internal binding for constructing SharedArrayBuffers #60497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Renegade334
wants to merge
2
commits into
nodejs:main
Choose a base branch
from
Renegade334:bound-sharedarraybuffer-construct
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
src: add internal binding for constructing SharedArrayBuffers #60497
Renegade334
wants to merge
2
commits into
nodejs:main
from
Renegade334:bound-sharedarraybuffer-construct
+87
−44
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Review requested:
|
2705b57 to
83074c3
Compare
aduh95
approved these changes
Oct 30, 2025
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60497 +/- ##
==========================================
- Coverage 88.58% 88.54% -0.05%
==========================================
Files 704 704
Lines 207839 207854 +15
Branches 40051 40039 -12
==========================================
- Hits 184117 184039 -78
- Misses 15791 15849 +58
- Partials 7931 7966 +35
🚀 New features to boost your workflow:
|
codebytere
approved these changes
Oct 31, 2025
cjihrig
approved these changes
Oct 31, 2025
Commit Queue failed- Loading data for nodejs/node/pull/60497 ✔ Done loading data for nodejs/node/pull/60497 ----------------------------------- PR info ------------------------------------ Title src: add internal binding for constructing SharedArrayBuffers (#60497) Author René <contact.9a5d6388@renegade334.me.uk> (@Renegade334) Branch Renegade334:bound-sharedarraybuffer-construct -> nodejs:main Labels lib / src, author ready, needs-ci, commit-queue-rebase, dont-land-on-v20.x, dont-land-on-v22.x Commits 2 - src: add internal binding for constructing SharedArrayBuffers - lib: replace global SharedArrayBuffer constructor with bound method Committers 1 - Renegade334 <contact.9a5d6388@renegade334.me.uk> PR-URL: https://github.com/nodejs/node/pull/60497 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/60497 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> -------------------------------------------------------------------------------- ℹ This PR was created on Thu, 30 Oct 2025 16:37:41 GMT ✔ Approvals: 3 ✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/60497#pullrequestreview-3400899628 ✔ - Shelley Vohr (@codebytere): https://github.com/nodejs/node/pull/60497#pullrequestreview-3403743107 ✔ - Colin Ihrig (@cjihrig): https://github.com/nodejs/node/pull/60497#pullrequestreview-3404542988 ⚠ This PR has conflicts that must be resolved ✔ Last GitHub CI successful ℹ Last Full PR CI on 2025-10-31T11:35:25Z: https://ci.nodejs.org/job/node-test-pull-request/69967/ - Querying data for job/node-test-pull-request/69967/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/18999682275 |
83074c3 to
3651c31
Compare
|
Rebased for merge conflict. |
aduh95
approved these changes
Nov 1, 2025
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.
commit-queue-rebase
Add this label to allow the Commit Queue to land a PR in several commits.
dont-land-on-v20.x
PRs that should not land on the v20.x-staging branch and should not be released in v20.x.
dont-land-on-v22.x
PRs that should not land on the v22.x-staging branch and should not be released in v22.x.
lib / src
Issues and PRs related to general changes in the lib or src directory.
needs-ci
PRs that need a full CI run.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SharedArrayBuffers are finding more and more use in core, but the flag-dependent exposure of the constructor is a permanent issue. In the common case where the constructor is available, the global is potentially user-mutable depending on when it's accessed, and in the case where the constructor isn't available, this either results in deliberately lost functionality or just straight runtime errors.
The approach here adds a utility binding to construct SABs via the V8 API, which is ubiquitously available independent of the flag state.
An alternative approach would be to use the JS global if present, and only call into C++ if absent. In reality, this method is vanishingly unlikely to ever be needed in a hot path, so the call cost isn't as much of a consideration, and using the API adds the primordial-esque safety factor.
Would supersede #60453. Does not land on v20.x or v22.x, as
MaybeNewwas added in V8 13.1.