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: track BaseObjects with an efficient list #55104

Closed
wants to merge 1 commit into from

Conversation

legendecas
Copy link
Member

Since BaseObjects are internal structs, use a linked list to efficiently
maintain the tracking list. This also makes iterating BaseObject list
efficient as it no longer needs to compare the BaseObject::DeleteMe
cleanup callback.

Refs: #54880

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/realm
  • @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 Sep 24, 2024
@legendecas legendecas marked this pull request as draft September 24, 2024 16:25
src/README.md Outdated Show resolved Hide resolved
src/README.md Outdated
Comment on lines 764 to 765
libuv objects is performed automatically, i.e. handles are closed and requests
are cancelled if possible.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
libuv objects is performed automatically, i.e. handles are closed and requests
are cancelled if possible.
libuv objects is performed automatically, (i.e. handles are closed and requests
are cancelled, if possible).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the suggestion but I don't think it is necessary to add parentheses here.

src/README.md Outdated
#### Cleanup realms and BaseObjects

Realm cleanup depends on the realm types. All realms are destroyed when the
[`Environment`][] is destroyed with cleanup hook. A [`ShadowRealm`][] can also
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[`Environment`][] is destroyed with cleanup hook. A [`ShadowRealm`][] can also
[`Environment`][] is destroyed with [a/the] cleanup hook. A [`ShadowRealm`][] can also

src/README.md Outdated Show resolved Hide resolved
@legendecas legendecas marked this pull request as ready for review September 24, 2024 22:39
Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 84.21053% with 6 lines in your changes missing coverage. Please review.

Project coverage is 88.24%. Comparing base (3c5ceff) to head (778da3f).
Report is 112 commits behind head on main.

Files with missing lines Patch % Lines
src/node_messaging.cc 28.57% 3 Missing and 2 partials ⚠️
src/node_realm-inl.h 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55104      +/-   ##
==========================================
- Coverage   88.24%   88.24%   -0.01%     
==========================================
  Files         651      651              
  Lines      183877   183867      -10     
  Branches    35858    35855       -3     
==========================================
- Hits       162266   162253      -13     
- Misses      14901    14904       +3     
  Partials     6710     6710              
Files with missing lines Coverage Δ
src/aliased_buffer-inl.h 93.58% <ø> (ø)
src/base_object.cc 84.61% <100.00%> (+0.94%) ⬆️
src/base_object.h 90.90% <100.00%> (+2.02%) ⬆️
src/cleanup_queue-inl.h 90.90% <ø> (+3.40%) ⬆️
src/cleanup_queue.h 100.00% <100.00%> (ø)
src/debug_utils-inl.h 83.33% <ø> (ø)
src/env.cc 85.55% <100.00%> (-0.17%) ⬇️
src/node_realm.cc 73.41% <100.00%> (ø)
src/node_realm.h 100.00% <ø> (ø)
src/node_shadow_realm.cc 62.85% <100.00%> (ø)
... and 3 more

... and 39 files with indirect coverage changes

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 25, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 25, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@legendecas legendecas added commit-queue Add this label to land a pull request using GitHub Actions. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Sep 26, 2024
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Sep 26, 2024
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/55104
✔  Done loading data for nodejs/node/pull/55104
----------------------------------- PR info ------------------------------------
Title      src: track BaseObjects with an efficient list (#55104)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     legendecas:realm/base-obj -> nodejs:main
Labels     c++, lib / src, author ready, needs-ci
Commits    1
 - src: track BaseObjects with an efficient list
Committers 1
 - Chengzhong Wu <legendecas@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/55104
Refs: https://github.com/nodejs/node/pull/54880
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/55104
Refs: https://github.com/nodejs/node/pull/54880
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 24 Sep 2024 16:11:00 GMT
   ✔  Approvals: 2
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/55104#pullrequestreview-2327733103
   ✔  - Joyee Cheung (@joyeecheung) (TSC): https://github.com/nodejs/node/pull/55104#pullrequestreview-2328639766
   ✘  Last GitHub CI failed
   ℹ  Last Full PR CI on 2024-09-26T08:31:26Z: https://ci.nodejs.org/job/node-test-pull-request/62782/
- Querying data for job/node-test-pull-request/62782/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/11056331072

legendecas added a commit that referenced this pull request Sep 26, 2024
PR-URL: #55104
Refs: #54880
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@legendecas
Copy link
Member Author

Landed in 8496670

@legendecas legendecas closed this Sep 26, 2024
@legendecas legendecas removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Sep 26, 2024
@legendecas legendecas deleted the realm/base-obj branch September 26, 2024 17:41
targos pushed a commit that referenced this pull request Oct 4, 2024
PR-URL: #55104
Refs: #54880
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@targos
Copy link
Member

targos commented Oct 4, 2024

I had to remove from v22.x-staging because it failed in GitHub CI (I think I didn't catch it because make test doesn't run pummel tests?):
https://github.com/nodejs/node/actions/runs/11179405352/job/31078955626

@targos targos added the backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. label Oct 4, 2024
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
PR-URL: nodejs#55104
Refs: nodejs#54880
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
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. backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. 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.

6 participants