Skip to content

src: use effective cppgc wrapper id to deduce non-cppgc id - #48660

Closed
joyeecheung wants to merge 2 commits into
nodejs:mainfrom
joyeecheung:wrapper
Closed

src: use effective cppgc wrapper id to deduce non-cppgc id#48660
joyeecheung wants to merge 2 commits into
nodejs:mainfrom
joyeecheung:wrapper

Conversation

@joyeecheung

@joyeecheungjoyeecheung commented Jul 5, 2023

Copy link
Copy Markdown
Member

deps: V8: cherry-pick 93275031284c

Original commit message:

[cppgc] expose wrapper descriptor on CppHeap
This makes it possible for embedders to:
1. Avoid creating wrapper objects that happen to have a layout that
leads V8 to consider the object cppgc-managed while it's not.
Refs: https://github.com/nodejs/node/pull/43521
2. Create cppgc-managed wrapper objects when they do not own the
CppHeap. Refs: https://github.com/nodejs/node/pull/45704
Bug: v8:13960
Change-Id: If31f4d56c5ead59dc0d56f937494d23d631f7438
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4598833
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#88490}

Refs: v8/v8@9327503

src: use effective cppgc wrapper id to deduce non-cppgc id

Previously we hard-code a wrapper id to be used in BaseObjects
to avoid accidentally triggering cppgc on these non-cppgc-managed
objects, but hard-coding can be be hacky and result in mismatch
when we start to create CppHeap ourselves. This patch makes it
more robust by deducing non-cppgc id from the effective cppgc id,
if there is one.

Refs: #48660

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/startup
  • @nodejs/v8-update

@nodejs-github-botnodejs-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 Jul 5, 2023
@richardlau

Copy link
Copy Markdown
Member

The V8 cherry-pick should have also bumped v8_embedder_string in common.gypi.

@joyeecheung

Copy link
Copy Markdown
MemberAuthor

@richardlau Thanks for catching it, it probably happened because I created the backport commit before ce4102e landed. I've amended the first commit.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@gengjiawengengjiawen added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 7, 2023
@richardlau

Copy link
Copy Markdown
Member

Did this get a V8 CI run?

@joyeecheungjoyeecheung removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 7, 2023
@joyeecheung

Copy link
Copy Markdown
MemberAuthor

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@joyeecheung

Copy link
Copy Markdown
MemberAuthor

Looks like there is a build error in our build machine, perhaps depot_tools is out of date ?

16:54:59 Cloning into '/home/iojs/build/workspace/node-test-commit-v8-linux/deps/v8/_depot_tools'...
16:55:05 File "/home/iojs/build/workspace/node-test-commit-v8-linux/deps/v8/_depot_tools/gclient.py", line 3461
16:55:05 f'160000,{value},{name}'
16:55:05 ^
16:55:05 SyntaxError: invalid syntax

@joyeecheung

Copy link
Copy Markdown
MemberAuthor

Rebased to resolve merge conflict

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
Original commit message:
[cppgc] expose wrapper descriptor on CppHeap
This makes it possible for embedders to:
1. Avoid creating wrapper objects that happen to have a layout that
leads V8 to consider the object cppgc-managed while it's not.
Refs: nodejs#43521
2. Create cppgc-managed wrapper objects when they do not own the
CppHeap. Refs: nodejs#45704
Bug: v8:13960
Change-Id: If31f4d56c5ead59dc0d56f937494d23d631f7438
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4598833
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#88490}
Refs: v8/v8@9327503
PR-URL: nodejs#48660
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
Previously we hard-code a wrapper id to be used in BaseObjects
to avoid accidentally triggering cppgc on these non-cppgc-managed
objects, but hard-coding can be be hacky and result in mismatch
when we start to create CppHeap ourselves. This patch makes it
more robust by deducing non-cppgc id from the effective cppgc id,
if there is one.
PR-URL: nodejs#48660
Refs: v8/v8@9327503
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
joyeecheung added a commit to joyeecheung/node that referenced this pull request Aug 15, 2023
Original commit message:
[cppgc] expose wrapper descriptor on CppHeap
This makes it possible for embedders to:
1. Avoid creating wrapper objects that happen to have a layout that
leads V8 to consider the object cppgc-managed while it's not.
Refs: nodejs#43521
2. Create cppgc-managed wrapper objects when they do not own the
CppHeap. Refs: nodejs#45704
Bug: v8:13960
Change-Id: If31f4d56c5ead59dc0d56f937494d23d631f7438
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4598833
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#88490}
Refs: v8/v8@9327503
PR-URL: nodejs#48660
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
joyeecheung added a commit to joyeecheung/node that referenced this pull request Aug 15, 2023
Previously we hard-code a wrapper id to be used in BaseObjects
to avoid accidentally triggering cppgc on these non-cppgc-managed
objects, but hard-coding can be be hacky and result in mismatch
when we start to create CppHeap ourselves. This patch makes it
more robust by deducing non-cppgc id from the effective cppgc id,
if there is one.
PR-URL: nodejs#48660
Refs: v8/v8@9327503
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
joyeecheung added a commit to joyeecheung/node that referenced this pull request Aug 17, 2023
Original commit message:
[cppgc] expose wrapper descriptor on CppHeap
This makes it possible for embedders to:
1. Avoid creating wrapper objects that happen to have a layout that
leads V8 to consider the object cppgc-managed while it's not.
Refs: nodejs#43521
2. Create cppgc-managed wrapper objects when they do not own the
CppHeap. Refs: nodejs#45704
Bug: v8:13960
Change-Id: If31f4d56c5ead59dc0d56f937494d23d631f7438
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4598833
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#88490}
Refs: v8/v8@9327503
PR-URL: nodejs#48660
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
joyeecheung added a commit to joyeecheung/node that referenced this pull request Aug 17, 2023
Previously we hard-code a wrapper id to be used in BaseObjects
to avoid accidentally triggering cppgc on these non-cppgc-managed
objects, but hard-coding can be be hacky and result in mismatch
when we start to create CppHeap ourselves. This patch makes it
more robust by deducing non-cppgc id from the effective cppgc id,
if there is one.
PR-URL: nodejs#48660
Refs: v8/v8@9327503
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
UlisesGascon pushed a commit that referenced this pull request Aug 18, 2023
Original commit message:
[cppgc] expose wrapper descriptor on CppHeap
This makes it possible for embedders to:
1. Avoid creating wrapper objects that happen to have a layout that
leads V8 to consider the object cppgc-managed while it's not.
Refs: #43521
2. Create cppgc-managed wrapper objects when they do not own the
CppHeap. Refs: #45704
Bug: v8:13960
Change-Id: If31f4d56c5ead59dc0d56f937494d23d631f7438
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4598833
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#88490}
Refs: v8/v8@9327503
PR-URL: #48660
Backport-PR-URL: #49187
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Refs: #40786
Refs: https://docs.google.com/document/d/1ny2Qz_EsUnXGKJRGxoA-FXIE2xpLgaMAN6jD7eAkqFQ/edit
UlisesGascon pushed a commit that referenced this pull request Aug 18, 2023
Previously we hard-code a wrapper id to be used in BaseObjects
to avoid accidentally triggering cppgc on these non-cppgc-managed
objects, but hard-coding can be be hacky and result in mismatch
when we start to create CppHeap ourselves. This patch makes it
more robust by deducing non-cppgc id from the effective cppgc id,
if there is one.
PR-URL: #48660
Backport-PR-URL: #49187
Refs: v8/v8@9327503
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Refs: #40786
Refs: https://docs.google.com/document/d/1ny2Qz_EsUnXGKJRGxoA-FXIE2xpLgaMAN6jD7eAkqFQ/edit
UlisesGascon pushed a commit that referenced this pull request Aug 18, 2023
This patch:
- Initializes cppgc in InitializeOncePerProcess() when
kNoInitializeCppgc is not set
- Create a CppHeap and attach it to the Isolate when
there isn't one already during IsolateData initialization.
The CppHeap is detached and terminated when IsolateData
is freed.
- Publishes the cppgc headers in the tarball.
This allows C++ addons to start using cppgc to manage objects.
A helper node::SetCppgcReference() is also added to help addons
enable cppgc tracing in a user-defined object.
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
Refs: #40786
PR-URL: #45704
Backport-PR-URL: #49187
Refs: https://docs.google.com/document/d/1ny2Qz_EsUnXGKJRGxoA-FXIE2xpLgaMAN6jD7eAkqFQ/edit
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
PR-URL: #48660
Refs: v8/v8@9327503
@UlisesGasconUlisesGascon mentioned this pull request Aug 18, 2023
UlisesGascon added a commit that referenced this pull request Aug 18, 2023
Notable changes:
deps:
* V8: cherry-pick 93275031284c (Joyee Cheung) #48660
doc:
* add new TSC members (Michael Dawson) #48841
* add rluvaton to collaborators (Raz Luvaton) #49215
esm:
* unflag import.meta.resolve (Guy Bedford) #49028
* add `initialize` hook, integrate with `register` (Izaak Schroeder) #48842
* unflag `Module.register` and allow nested loader `import()` (Izaak Schroeder) #48559
inspector:
* (SEMVER-MINOR) open add `SymbolDispose` (Chemi Atlow) #48765
test_runner:
* (SEMVER-MINOR) expose location of tests (Colin Ihrig) #48975
module:
* implement `register` utility (João Lenon) #46826
* make CJS load from ESM loader (Antoine du Hamel) #47999
src:
* add built-in `.env` file support (Yagiz Nizipli) #48890
PR-URL: #49185
UlisesGascon added a commit that referenced this pull request Aug 22, 2023
Notable changes:
deps:
* V8: cherry-pick 93275031284c (Joyee Cheung) #48660
doc:
* add new TSC members (Michael Dawson) #48841
* add rluvaton to collaborators (Raz Luvaton) #49215
esm:
* unflag import.meta.resolve (Guy Bedford) #49028
* add `initialize` hook, integrate with `register` (Izaak Schroeder) #48842
* unflag `Module.register` and allow nested loader `import()` (Izaak Schroeder) #48559
inspector:
* (SEMVER-MINOR) open add `SymbolDispose` (Chemi Atlow) #48765
module:
* implement `register` utility (João Lenon) #46826
* make CJS load from ESM loader (Antoine du Hamel) #47999
src:
* add built-in `.env` file support (Yagiz Nizipli) #48890
* initialize cppgc (Daryl Haresign and Joyee Cheung) #48660 and #45704
test_runner:
* (SEMVER-MINOR) expose location of tests (Colin Ihrig) #48975
PR-URL: #49185
UlisesGascon added a commit that referenced this pull request Aug 24, 2023
Notable changes:
deps:
* V8: cherry-pick 93275031284c (Joyee Cheung) #48660
doc:
* add new TSC members (Michael Dawson) #48841
* add rluvaton to collaborators (Raz Luvaton) #49215
esm:
* unflag import.meta.resolve (Guy Bedford) #49028
* add `initialize` hook, integrate with `register` (Izaak Schroeder) #48842
* unflag `Module.register` and allow nested loader `import()` (Izaak Schroeder) #48559
inspector:
* (SEMVER-MINOR) open add `SymbolDispose` (Chemi Atlow) #48765
module:
* implement `register` utility (João Lenon) #46826
* make CJS load from ESM loader (Antoine du Hamel) #47999
src:
* add built-in `.env` file support (Yagiz Nizipli) #48890
* initialize cppgc (Daryl Haresign and Joyee Cheung) #48660 and #45704
test_runner:
* (SEMVER-MINOR) expose location of tests (Colin Ihrig) #48975
PR-URL: #49185
UlisesGascon added a commit that referenced this pull request Aug 29, 2023
Notable changes:
deps:
* V8: cherry-pick 93275031284c (Joyee Cheung) #48660
doc:
* add new TSC members (Michael Dawson) #48841
* add rluvaton to collaborators (Raz Luvaton) #49215
esm:
* unflag import.meta.resolve (Guy Bedford) #49028
* add `initialize` hook, integrate with `register` (Izaak Schroeder) #48842
* unflag `Module.register` and allow nested loader `import()` (Izaak Schroeder) #48559
inspector:
* (SEMVER-MINOR) open add `SymbolDispose` (Chemi Atlow) #48765
module:
* implement `register` utility (João Lenon) #46826
* make CJS load from ESM loader (Antoine du Hamel) #47999
src:
* add built-in `.env` file support (Yagiz Nizipli) #48890
* initialize cppgc (Daryl Haresign and Joyee Cheung) #48660 and #45704
test_runner:
* (SEMVER-MINOR) expose location of tests (Colin Ihrig) #48975
PR-URL: #49185
UlisesGascon added a commit that referenced this pull request Aug 31, 2023
Notable changes:
deps:
* V8: cherry-pick 93275031284c (Joyee Cheung) #48660
doc:
* add new TSC members (Michael Dawson) #48841
* add rluvaton to collaborators (Raz Luvaton) #49215
esm:
* unflag import.meta.resolve (Guy Bedford) #49028
* add `initialize` hook, integrate with `register` (Izaak Schroeder) #48842
* unflag `Module.register` and allow nested loader `import()` (Izaak Schroeder) #48559
inspector:
* (SEMVER-MINOR) open add `SymbolDispose` (Chemi Atlow) #48765
module:
* implement `register` utility (João Lenon) #46826
* make CJS load from ESM loader (Antoine du Hamel) #47999
src:
* add built-in `.env` file support (Yagiz Nizipli) #48890
* initialize cppgc (Daryl Haresign and Joyee Cheung) #48660 and #45704
test_runner:
* (SEMVER-MINOR) expose location of tests (Colin Ihrig) #48975
PR-URL: #49185
UlisesGascon added a commit that referenced this pull request Sep 1, 2023
Notable changes:
deps:
* V8: cherry-pick 93275031284c (Joyee Cheung) #48660
doc:
* add new TSC members (Michael Dawson) #48841
* add rluvaton to collaborators (Raz Luvaton) #49215
esm:
* unflag import.meta.resolve (Guy Bedford) #49028
* add `initialize` hook, integrate with `register` (Izaak Schroeder) #48842
* unflag `Module.register` and allow nested loader `import()` (Izaak Schroeder) #48559
inspector:
* (SEMVER-MINOR) open add `SymbolDispose` (Chemi Atlow) #48765
module:
* implement `register` utility (João Lenon) #46826
* make CJS load from ESM loader (Antoine du Hamel) #47999
src:
* add built-in `.env` file support (Yagiz Nizipli) #48890
* initialize cppgc (Daryl Haresign and Joyee Cheung) #48660 and #45704
test_runner:
* (SEMVER-MINOR) expose location of tests (Colin Ihrig) #48975
PR-URL: #49185
juanarbol pushed a commit that referenced this pull request Sep 4, 2023
Notable changes:
deps:
* V8: cherry-pick 93275031284c (Joyee Cheung) #48660
doc:
* add new TSC members (Michael Dawson) #48841
* add rluvaton to collaborators (Raz Luvaton) #49215
esm:
* unflag import.meta.resolve (Guy Bedford) #49028
* add `initialize` hook, integrate with `register` (Izaak Schroeder) #48842
* unflag `Module.register` and allow nested loader `import()` (Izaak Schroeder) #48559
inspector:
* (SEMVER-MINOR) open add `SymbolDispose` (Chemi Atlow) #48765
module:
* implement `register` utility (João Lenon) #46826
* make CJS load from ESM loader (Antoine du Hamel) #47999
src:
* add built-in `.env` file support (Yagiz Nizipli) #48890
* initialize cppgc (Daryl Haresign and Joyee Cheung) #48660 and #45704
test_runner:
* (SEMVER-MINOR) expose location of tests (Colin Ihrig) #48975
PR-URL: #49185
minglechen pushed a commit to CTSRD-CHERI/node that referenced this pull request Dec 11, 2024
Original commit message:
[cppgc] expose wrapper descriptor on CppHeap
This makes it possible for embedders to:
1. Avoid creating wrapper objects that happen to have a layout that
leads V8 to consider the object cppgc-managed while it's not.
Refs: nodejs#43521
2. Create cppgc-managed wrapper objects when they do not own the
CppHeap. Refs: nodejs#45704
Bug: v8:13960
Change-Id: If31f4d56c5ead59dc0d56f937494d23d631f7438
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4598833
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#88490}
Refs: v8/v8@9327503
PR-URL: nodejs#48660
Backport-PR-URL: nodejs#49187
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Refs: nodejs#40786
Refs: https://docs.google.com/document/d/1ny2Qz_EsUnXGKJRGxoA-FXIE2xpLgaMAN6jD7eAkqFQ/edit
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-rebaseAdd this label to allow the Commit Queue to land a PR in several commits.lib / srcIssues and PRs related to general changes in the lib or src directory.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@joyeecheung@nodejs-github-bot@richardlau@UlisesGascon@gengjiawen@legendecas@lpinca@targos@RafaelGSS