Skip to content
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

src: initialize privateSymbols for per_context #57479

Merged
merged 4 commits into from
Apr 6, 2025

Conversation

jazelly
Copy link
Member

@jazelly jazelly commented Mar 15, 2025

In some cases, per_context files need to access privateSymbols. This commit lets GetPerContextExports to be able to pass down IsolateData to InitializePrimordials, so it can compile per_context files with privateSymbols from IsolateData.

With this change we can access privateSymbols in per_context/domexception.js like

const { transfer_mode_private_symbol } = privateSymbols;

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/startup

@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 Mar 15, 2025
@jazelly jazelly force-pushed the expose-isolate-data branch 2 times, most recently from 4044d5d to 4c9445f Compare March 15, 2025 05:27
@jazelly jazelly changed the title src,startup: expose isolate_data even before env src,bootstrap: expose isolate_data even before env Mar 15, 2025
@jazelly jazelly force-pushed the expose-isolate-data branch from 4c9445f to f4643b9 Compare March 15, 2025 05:32
Copy link

codecov bot commented Mar 15, 2025

Codecov Report

Attention: Patch coverage is 75.75758% with 8 lines in your changes missing coverage. Please review.

Project coverage is 90.23%. Comparing base (a6d3585) to head (40c0219).
Report is 72 commits behind head on main.

Files with missing lines Patch % Lines
src/api/environment.cc 73.91% 2 Missing and 4 partials ⚠️
src/node_messaging.cc 75.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #57479   +/-   ##
=======================================
  Coverage   90.23%   90.23%           
=======================================
  Files         630      630           
  Lines      185129   185077   -52     
  Branches    36234    36222   -12     
=======================================
- Hits       167049   167008   -41     
- Misses      11037    11039    +2     
+ Partials     7043     7030   -13     
Files with missing lines Coverage Δ
src/node_builtins.cc 79.41% <100.00%> (+0.29%) ⬆️
src/node_internals.h 81.03% <ø> (ø)
src/node_realm.cc 73.41% <100.00%> (ø)
src/node_messaging.cc 83.49% <75.00%> (+0.38%) ⬆️
src/api/environment.cc 75.18% <73.91%> (-0.63%) ⬇️

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

@jazelly jazelly added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 16, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 16, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@jazelly jazelly added blocked PRs that are blocked by other issues or PRs. and removed blocked PRs that are blocked by other issues or PRs. labels Mar 19, 2025
@jazelly jazelly force-pushed the expose-isolate-data branch from f4643b9 to 0b6c017 Compare March 24, 2025 20:47
@jazelly jazelly changed the title src,bootstrap: expose isolate_data even before env src: initialize privateSymbols for per_context Mar 24, 2025
@jazelly jazelly force-pushed the expose-isolate-data branch from 0b6c017 to 22cdade Compare March 24, 2025 20:57
@jazelly jazelly force-pushed the expose-isolate-data branch from 22cdade to e518bf4 Compare March 25, 2025 12:01
Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % a small nit

@jazelly jazelly added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 27, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 1, 2025
@github-actions github-actions bot added the request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. label Apr 1, 2025
Copy link
Contributor

github-actions bot commented Apr 1, 2025

Failed to start CI
   ⚠  Commits were pushed since the last approving review:
   ⚠  - src: initialize privateSymbols for per_context
   ⚠  - fix: MessagePort::MoveToContext crash
   ⚠  - fix: check isolate_data when InitializePrivateSymbols
   ⚠  - maybe local for initialize
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/14195293697

Comment on lines +618 to +620
// To initialize the per-context binding exports, a non-nullptr isolate_data
// is needed
CHECK(isolate_data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this CHECK given that we have it also in InitializePrivateSymbols?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they guard in different levels. InitializePrivateSymbols checks that it must be invoked with a non-null isolate_data. Here, it checks that if GetPerContextExports is invoked the "first time" (like in node_mksnapshot), the isolate_data must not be null.

@legendecas legendecas added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. labels Apr 2, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 2, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@jazelly jazelly added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed needs-ci PRs that need a full CI run. labels Apr 5, 2025
@aduh95 aduh95 added needs-ci PRs that need a full CI run. commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Apr 6, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 6, 2025
@nodejs-github-bot nodejs-github-bot merged commit 79eddc6 into nodejs:main Apr 6, 2025
75 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 79eddc6

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++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. 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.

4 participants