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

tools: refactor snapshot builder #38902

Closed
wants to merge 1 commit into from

Conversation

joyeecheung
Copy link
Member

This patch:

  • Moves the snapshot building code to src/ so that we can reuse it
    later when generating custom snapshots from an entry point accepted
    by the node binary.
  • Create a SnapshotData struct that incorporates all the data useful
    for a snapshot blob, including both the V8 data and the Node.js
    data.

@github-actions github-actions 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 Jun 2, 2021
@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@bl-ue bl-ue left a comment

Choose a reason for hiding this comment

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

Suggestion: indexesindices (while both are correct, the latter is preferred for technical use).

Hopefully I've updated all references to isolate_data_indexes and NodeMainInstance::GetIsolateDataIndices 🤞🏻

Edit: I just realized that you didn't add this code, you moved it from a different file. Scrap these suggestions if they'll cause any more complications than meets the untrained eye viewing this PR ;)

src/env.h Outdated Show resolved Hide resolved
src/node_snapshotable.cc Outdated Show resolved Hide resolved
src/node_snapshotable.cc Outdated Show resolved Hide resolved
@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@bl-ue bl-ue left a comment

Choose a reason for hiding this comment

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

One thing: for stringstreams that you only need write to, it's better to use ostringstream.

src/node_snapshotable.cc Outdated Show resolved Hide resolved
src/node_snapshotable.cc Outdated Show resolved Hide resolved
@RaisinTen
Copy link
Contributor

These need to be updated to GetIsolateDataIndices too:

src/node.cc:1113:        indexes = NodeMainInstance::GetIsolateDataIndexes();
src/node_main_instance.h:70:  static const std::vector<size_t>* GetIsolateDataIndexes();
src/node_snapshot_stub.cc:13:const std::vector<size_t>* NodeMainInstance::GetIsolateDataIndexes() {

@bl-ue
Copy link
Contributor

bl-ue commented Jun 2, 2021

If you don't want to do all that in this PR, I'd be happy to open a new PR correct the naming, @joyeecheung.

@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@bl-ue bl-ue left a comment

Choose a reason for hiding this comment

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

Sorry for the spamming...this is the last one 😛

src/node.cc Outdated Show resolved Hide resolved
This patch:

- Moves the snapshot building code to src/ so that we can reuse it
  later when generating custom snapshots from an entry point accepted
  by the node binary.
- Create a SnapshotData struct that incorporates all the data useful
  for a snapshot blob, including both the V8 data and the Node.js
  data.
@nodejs-github-bot
Copy link
Collaborator

@legendecas legendecas added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 8, 2021
joyeecheung added a commit that referenced this pull request Jun 10, 2021
This patch:

- Moves the snapshot building code to src/ so that we can reuse it
  later when generating custom snapshots from an entry point accepted
  by the node binary.
- Create a SnapshotData struct that incorporates all the data useful
  for a snapshot blob, including both the V8 data and the Node.js
  data.

PR-URL: #38902
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
@joyeecheung
Copy link
Member Author

Landed in 30e8b5e

targos pushed a commit that referenced this pull request Jun 11, 2021
This patch:

- Moves the snapshot building code to src/ so that we can reuse it
  later when generating custom snapshots from an entry point accepted
  by the node binary.
- Create a SnapshotData struct that incorporates all the data useful
  for a snapshot blob, including both the V8 data and the Node.js
  data.

PR-URL: #38902
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
@danielleadams danielleadams mentioned this pull request Jun 14, 2021
danielleadams pushed a commit that referenced this pull request Jun 17, 2021
This patch:

- Moves the snapshot building code to src/ so that we can reuse it
  later when generating custom snapshots from an entry point accepted
  by the node binary.
- Create a SnapshotData struct that incorporates all the data useful
  for a snapshot blob, including both the V8 data and the Node.js
  data.

PR-URL: #38902
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
@richardlau
Copy link
Member

Doesn't land cleanly on v14.x-staging. Blocked on at least #37114.

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