GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — domain, src: clean up domain-related code by apapirovski · Pull Request #18291 · nodejs/node

Conversation

@apapirovski

@apapirovski apapirovski commented Jan 22, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Move the majority of C++ domain-related code into JS land by introducing a top level domain callback which handles entering & exiting the domain.

Move the rest of the domain necessities into their own file that creates an internal binding, to avoid exposing domain-related code on the process object.

Also a bit of other assorted domain-related cleanup.

(This happens to boost the performance of top-level domain code by roughly 33% but mostly I just wanted to have less domain-related code scattered all over.)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

domain, src

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
apapirovski added 3 commits January 21, 2018 13:10
@apapirovski
src: remove unnecessary block scope
fab0c98
@apapirovski
src: remove unnecessary async hooks check
0d66284
@apapirovski
src: remove outdated domain reference
9fdf293
@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 involving general changes in the lib/ or src/ directories. labels Jan 22, 2018
@apapirovski

apapirovski commented Jan 22, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

CI: https://ci.nodejs.org/job/node-test-pull-request/12657/
CitGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1219/

Ugh, I forgot we support older complier versions. Need to get rid of the variable length array.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@apapirovski
domain: further abstract usage in C++
c6cadb3
Move the majority of C++ domain-related code into JS land by introducing
a top level domain callback which handles entering & exiting the domain.

Move the rest of the domain necessities into their own file that creates
an internal binding, to avoid exposing domain-related code on the
process object.

Modify an existing test slightly to better test domain-related code.
@apapirovski
apapirovski force-pushed the patch-domain-improvements branch from 3f37b75 to c6cadb3 Compare January 22, 2018 17:02
@apapirovski

apapirovski commented Jan 22, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Fixed up.

CI: https://ci.nodejs.org/job/node-test-pull-request/12658/
CitGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1220/

Linter failure is not from this PR...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bnoordhuis
bnoordhuis approved these changes Jan 22, 2018
View reviewed changes

@bnoordhuis bnoordhuis left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM with a suggestion.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/node.cc Outdated
argv_array->Set(env->context(), i, argv[i]).FromJust();
}
Local<Value> domain_argv[] = { callback, argv_array };
ret = domain_cb->Call(env->context(), recv, 2, domain_argv);

@bnoordhuis bnoordhuis Jan 22, 2018

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It's probably faster to use spread in JS land and skip allocating the JS array here. I.e.:

std::vector<Local<Value>> args(1 + argc);
args[0] = callback;
std::copy(&argv[0], &argv[argc], &args[1]);
ret = domain_cb->Call(env->context(), recv, args.size(), &args[0]);

Then in JS:

function topLevelDomainCallback(cb, ...args) {
  // ...
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

apapirovski reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@apapirovski apapirovski Jan 22, 2018

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks @bnoordhuis, will update!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@apapirovski
fixup: bnoordhuis suggestion + test adjustment
930afeb
@apapirovski

apapirovski commented Jan 22, 2018

Copy link
Copy Markdown
Contributor Author

CI: https://ci.nodejs.org/job/node-test-pull-request/12660/

Now that linter & inspector tests are fixed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bnoordhuis
bnoordhuis approved these changes Jan 22, 2018
View reviewed changes
addaleax
addaleax approved these changes Jan 22, 2018
View reviewed changes
@apapirovski
apapirovski requested a review from AndreasMadsen January 25, 2018 16:44
@apapirovski

apapirovski commented Jan 25, 2018

Copy link
Copy Markdown
Contributor Author

@AndreasMadsen I would love to have you review this, if possible, as you've headed up most of the effort around the recent changes to domains. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Jan 26, 2018
View reviewed changes
@maclover7
maclover7 force-pushed the master branch from bb5575a to 993b716 Compare January 26, 2018 22:02
@cjihrig
cjihrig force-pushed the master branch from 993b716 to 082f952 Compare January 26, 2018 22:36
apapirovski added a commit that referenced this pull request Jan 29, 2018
@apapirovski
src: remove unnecessary block scope
7d3a302
PR-URL: #18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
apapirovski added a commit that referenced this pull request Jan 29, 2018
@apapirovski
src: remove unnecessary async hooks check
fdf107a
PR-URL: #18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
apapirovski added a commit that referenced this pull request Jan 29, 2018
@apapirovski
src: remove outdated domain reference
e4743ab
PR-URL: #18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
apapirovski added a commit that referenced this pull request Jan 29, 2018
@apapirovski
domain: further abstract usage in C++
eeede3b
Move the majority of C++ domain-related code into JS land by introducing
a top level domain callback which handles entering & exiting the domain.

Move the rest of the domain necessities into their own file that creates
an internal binding, to avoid exposing domain-related code on the
process object.

Modify an existing test slightly to better test domain-related code.

PR-URL: #18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@apapirovski

apapirovski commented Jan 29, 2018

Copy link
Copy Markdown
Contributor Author

Landed in 7d3a302, fdf107a, e4743ab and eeede3b

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@apapirovski apapirovski closed this Jan 29, 2018
@apapirovski
apapirovski deleted the patch-domain-improvements branch January 29, 2018 16:45
@apapirovski
apapirovski removed the request for review from AndreasMadsen January 29, 2018 16:45
@AndreasMadsen AndreasMadsen mentioned this pull request Jan 29, 2018
domain migration to async_hooks #17143
Closed
6 of 7 tasks
@apapirovski apapirovski mentioned this pull request Jan 30, 2018
src: fix vector subscript out of range #18460
Closed
2 tasks done
@MylesBorins MylesBorins added the backport-requested-v9.x label Feb 20, 2018
@MylesBorins

MylesBorins commented Feb 20, 2018

Copy link
Copy Markdown
Contributor

this doesn't land cleanly in v9.x, should it be backported?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MylesBorins pushed a commit that referenced this pull request Feb 20, 2018
@apapirovski @MylesBorins
domain: further abstract usage in C++
f4fbcf3
Move the majority of C++ domain-related code into JS land by introducing
a top level domain callback which handles entering & exiting the domain.

Move the rest of the domain necessities into their own file that creates
an internal binding, to avoid exposing domain-related code on the
process object.

Modify an existing test slightly to better test domain-related code.

PR-URL: #18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 21, 2018
@apapirovski @MylesBorins
domain: further abstract usage in C++
4296c63
Move the majority of C++ domain-related code into JS land by introducing
a top level domain callback which handles entering & exiting the domain.

Move the rest of the domain necessities into their own file that creates
an internal binding, to avoid exposing domain-related code on the
process object.

Modify an existing test slightly to better test domain-related code.

PR-URL: #18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 21, 2018
@apapirovski @MylesBorins
domain: further abstract usage in C++
44bf0f4
Move the majority of C++ domain-related code into JS land by introducing
a top level domain callback which handles entering & exiting the domain.

Move the rest of the domain necessities into their own file that creates
an internal binding, to avoid exposing domain-related code on the
process object.

Modify an existing test slightly to better test domain-related code.

PR-URL: #18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Feb 21, 2018
v9.6.0 proposal #18902
Merged
@MylesBorins MylesBorins added lts-watch-v6.x labels Feb 27, 2018
@MylesBorins

MylesBorins commented Feb 27, 2018

Copy link
Copy Markdown
Contributor

Does this make sense for LTS?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@addaleax addaleax removed the backport-requested-v9.x label Feb 27, 2018
addaleax pushed a commit to addaleax/node that referenced this pull request Feb 27, 2018
@apapirovski @addaleax
src: remove unnecessary async hooks check
296523a
PR-URL: nodejs#18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@addaleax addaleax mentioned this pull request Feb 27, 2018
v9.7.0 proposal #19040
Closed
@MylesBorins

MylesBorins commented Mar 20, 2018

Copy link
Copy Markdown
Contributor

Should land with #18460

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
@apapirovski @MayaLekova
src: remove unnecessary block scope
07b16f5
PR-URL: nodejs#18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
@apapirovski @MayaLekova
src: remove unnecessary async hooks check
281f4d3
PR-URL: nodejs#18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
@apapirovski @MayaLekova
src: remove outdated domain reference
b9e8528
PR-URL: nodejs#18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
@apapirovski @MayaLekova
domain: further abstract usage in C++
e48f648
Move the majority of C++ domain-related code into JS land by introducing
a top level domain callback which handles entering & exiting the domain.

Move the rest of the domain necessities into their own file that creates
an internal binding, to avoid exposing domain-related code on the
process object.

Modify an existing test slightly to better test domain-related code.

PR-URL: nodejs#18291
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins added backport-requested-v8.x and removed lts-watch-v6.x labels May 23, 2018
@MylesBorins

MylesBorins commented May 23, 2018

Copy link
Copy Markdown
Contributor

Should this be backported to v8.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

If backporting please include #18460

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bnoordhuis bnoordhuis bnoordhuis approved these changes
@jasnell jasnell jasnell approved these changes
@addaleax addaleax addaleax approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. domain Issues and PRs related to the domain subsystem. lib / src Issues and PRs involving general changes in the lib/ or src/ directories.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@apapirovski @MylesBorins @bnoordhuis @jasnell @addaleax @AndreasMadsen @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.