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: begin restructuring node.cc for better maintainability #20789

Closed
wants to merge 3 commits into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented May 16, 2018

Begins separating logical chunks of node.cc out into separate cc/h files for the purpose
of making these easier to maintain and making node.cc less of a monolithic jumble of code.

There is quite a bit in node.cc that can be divided into logical chunks and this PR only handles two of those. Before going too much further with it tho, I'd like to make sure folks are on board with this.

The eventual goal is to refactor the bootstrap model for node.js with an eye towards improving start up times, supporting snapshots, and generally making the bootstrap more maintainable. However, because there is so much bundled into node.cc, it is difficult to refactor and reviewing changes to make sure nothing breaks is quite challenging.

And yes, the idea would be to backport these changes to LTS lines as well.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

The prior commit causes a linting issue here.
Fix by changing from a struct to a class.
@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. labels May 16, 2018
@jasnell jasnell requested review from danbev and addaleax May 16, 2018 21:32
@jasnell
Copy link
Member Author

jasnell commented May 16, 2018

@mhdawson
Copy link
Member

To help in reviewing, does this change code or simply move to a new file. If there is code that had to be changed in more than a trivial way and it is not the bulk of the new files it would be useful to identify those portions.

@jasnell
Copy link
Member Author

jasnell commented May 16, 2018

The first and third commits simply move things around. There are no implementation changes.
The second commit changes a struct to a class to fix a weird linting issue.

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

LGTM, assuming you are volunteering to do backports :)

@jasnell
Copy link
Member Author

jasnell commented May 16, 2018

Yes, I'll do the backports for 8 and 6

@TimothyGu
Copy link
Member

Code changes LGTM. Do we need to make the new files inherit the license header in node.cc?

@jasnell
Copy link
Member Author

jasnell commented May 16, 2018

@TimothyGu ... no, the requirement for the license header was only maintaining it in the original files. New files do not need it. I know it's weird, but that's the agreement we came to.

@jasnell
Copy link
Member Author

jasnell commented May 17, 2018

@addaleax ... looking at the backport to 8... it's going to be quite a bit more involved because of the DomainEnter/DomainExit and related functions. I'm not entirely convinced we should backport this particular change to 8 and really don't think we should backport to 6. Thoughts?

@addaleax
Copy link
Member

@jasnell Makes sense … but we can backport the exceptions stuff, right?

@jasnell
Copy link
Member Author

jasnell commented May 17, 2018

We ought to be able to do at least part of it, yeah, would just need to be selective about which pieces.

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 17, 2018
jasnell added a commit that referenced this pull request May 19, 2018
PR-URL: #20789
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
jasnell added a commit that referenced this pull request May 19, 2018
The prior commit causes a linting issue here.
Fix by changing from a struct to a class.

PR-URL: #20789
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
jasnell added a commit that referenced this pull request May 19, 2018
PR-URL: #20789
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
@jasnell
Copy link
Member Author

jasnell commented May 19, 2018

Landed in fbd1c49, c68e6e1, and 9349e15.
backport PRs will come next week.

@jasnell jasnell closed this May 19, 2018
@Trott
Copy link
Member

Trott commented May 20, 2018

Is there a reason c68e6e1 wasn't squashed into fbd1c49? Or was it just an oversight? Landing them separately means that fbd1c49 is a broken commit on master. 😱

MylesBorins pushed a commit that referenced this pull request May 22, 2018
PR-URL: #20789
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 22, 2018
The prior commit causes a linting issue here.
Fix by changing from a struct to a class.

PR-URL: #20789
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 22, 2018
PR-URL: #20789
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
@addaleax addaleax mentioned this pull request May 22, 2018
@richardlau
Copy link
Member

This had broken addons because the new headers referenced in node.h are not packaged in the headers tarball that node-gyp downloads: #20921

@richardlau richardlau mentioned this pull request May 24, 2018
@jasnell jasnell mentioned this pull request May 24, 2018
2 tasks
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants