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

bootstrap: include code cache in the embedded snapshot #43023

Closed
wants to merge 5 commits into from

Conversation

joyeecheung
Copy link
Member

@joyeecheung joyeecheung commented May 9, 2022

src: move context snapshot index to SnapshotData

Also added comments for the members of SnapshotData and renamed
blob to v8_snapshot_blob_data for clarity.

bootstrap: include code cache in the embedded snapshot

Since V8 code cache encodes indices to the read-only space
it is safer to make sure that the code cache is generated in the
same heap used to generate the embdded snapshot. This patch
merges the code cache builder into the snapshot builder and
makes the code cache part of node::SnapshotData that is
deserialized into the native module loader during bootstrap.

Refs: #35711
Fixes: #31074

Also added comments for the members of SnapshotData and renamed
blob to v8_snapshot_blob_data for clarity.
Since V8 code cache encodes indices to the read-only space
it is safer to make sure that the code cache is generated in the
same heap used to generate the embdded snapshot. This patch
merges the code cache builder into the snapshot builder and
makes the code cache part of node::SnapshotData that is
deserialized into the native module loader during bootstrap.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/startup
  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added 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 May 9, 2022
@nodejs-github-bot
Copy link
Collaborator

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

src/env.h Outdated Show resolved Hide resolved
src/node_native_module.h Outdated Show resolved Hide resolved
src/node_native_module_env.h Outdated Show resolved Hide resolved
src/node_native_module_env.h Outdated Show resolved Hide resolved
src/node_native_module_env.cc Show resolved Hide resolved
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

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.

👍

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@joyeecheung joyeecheung added the commit-queue Add this label to land a pull request using GitHub Actions. label May 17, 2022
@joyeecheung joyeecheung removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 17, 2022
joyeecheung added a commit that referenced this pull request May 17, 2022
Also added comments for the members of SnapshotData and renamed
blob to v8_snapshot_blob_data for clarity.

PR-URL: #43023
Fixes: #31074
Refs: #35711
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
joyeecheung added a commit that referenced this pull request May 17, 2022
Since V8 code cache encodes indices to the read-only space
it is safer to make sure that the code cache is generated in the
same heap used to generate the embdded snapshot. This patch
merges the code cache builder into the snapshot builder and
makes the code cache part of node::SnapshotData that is
deserialized into the native module loader during bootstrap.

PR-URL: #43023
Fixes: #31074
Refs: #35711
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
@joyeecheung
Copy link
Member Author

Landed in 0ce4725...fbe1478

bengl pushed a commit that referenced this pull request May 30, 2022
Also added comments for the members of SnapshotData and renamed
blob to v8_snapshot_blob_data for clarity.

PR-URL: #43023
Fixes: #31074
Refs: #35711
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
bengl pushed a commit that referenced this pull request May 30, 2022
Since V8 code cache encodes indices to the read-only space
it is safer to make sure that the code cache is generated in the
same heap used to generate the embdded snapshot. This patch
merges the code cache builder into the snapshot builder and
makes the code cache part of node::SnapshotData that is
deserialized into the native module loader during bootstrap.

PR-URL: #43023
Fixes: #31074
Refs: #35711
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
@bengl bengl mentioned this pull request May 31, 2022
@danielleadams
Copy link
Contributor

@joyeecheung this does not land cleanly in v16.x. Do you mind opening a backport PR to v16.x-staging? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Remove circular dependency in code cache and snapshot building
6 participants