FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

src: move arch, platform and release into node_metadata.cc by joyeecheung · Pull Request #25293 · nodejs/node · GitHub

/ node Public

src: move arch, platform and release into node_metadata.cc - #25293

Closed
joyeecheung wants to merge 2 commits into
nodejs:masterfrom
joyeecheung:move-more-metadata
Closed

src: move arch, platform and release into node_metadata.cc#25293
joyeecheung wants to merge 2 commits into
nodejs:masterfrom
joyeecheung:move-more-metadata

Conversation

joyeecheung commented Dec 31, 2018
edited
Loading

Copy link
Copy Markdown
Member

Move definitions of more metadata into node_metadata{.h, .cc}
so the data can be reused and easily inspected in C++.

In a peudo-release build:

(lldb) p node::per_process::metadata
(node::Metadata) $0 = {
  versions = {
    node = "12.0.0-nightly2018-12-31819a868a49a2b7dbb7b3adab2b79cc8b783f7279"
    v8 = "7.1.302.33-node.8"
    uv = "1.24.1"
    zlib = "1.2.11"
    ares = "1.15.0"
    modules = "68"
    nghttp2 = "1.34.0"
    napi = "3"
    llhttp = "1.0.1"
    http_parser = "2.8.0"
    openssl = "1.1.0j"
    cldr = "34.0"
    icu = "63.1"
    tz = "2018e"
    unicode = "11.0"
  }
  release = (name = "node", sourceUrl = "https://nodejs.org/download/release/v12.0.0-nightly2018-12-31819a868a49a2b7dbb7b3adab2b79cc8b783f7279/node-v12.0.0-nightly2018-12-31819a868a49a2b7dbb7b3adab2b79cc8b783f7279.tar.gz", headersUrl = "https://nodejs.org/download/release/v12.0.0-nightly2018-12-31819a868a49a2b7dbb7b3adab2b79cc8b783f7279/node-v12.0.0-nightly2018-12-31819a868a49a2b7dbb7b3adab2b79cc8b783f7279-headers.tar.gz")
  arch = "x64"
  platform = "darwin"
}
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Move definitions of more metadata into node_metadata{.h, .cc}
so the data can be reused and easily inspected in C++.

Copy link
Copy Markdown
Collaborator

nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Dec 31, 2018

Copy link
Copy Markdown
Member Author

Comment thread src/node_metadata.h Outdated
Release release;

std::string arch;
std::string platform;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can the extern Metadata metadata; on L104 be const?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't think Metadata itself can be const - the ICU data versions have to be loaded after they are initialized. Other members should be able to be made const though.

bnoordhuis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Turning string literals into mutable std::strings is kind of inelegant. It'd be better to have some kind of struct that lives in rodata:

extern "C" static const struct {
  char arch[sizeof(NODE_ARCH)];
  char platform[sizeof(NODE_PLATFORM)];
  // etc.
} node_metadata = {
  NODE_ARCH,
  NODE_PLATFORM,
  // etc.
};

Comment thread src/node_metadata.h Outdated

joyeecheung commented Jan 4, 2019
edited
Loading

Copy link
Copy Markdown
Member Author

I've marked per_process:metadata.release, per_process:metadata.arch and per_process:metadata.platform added in this PR const. It should be possible to move the non-intl version strings const too, but I'd prefer leave that to another PR (also it's probably better if we make sure Metadata is a singleton and all its members are static)

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

addaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just reaffirming my LGTM

joyeecheung added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jan 4, 2019

Copy link
Copy Markdown
Member Author

Landed in 6c01621

joyeecheung closed this Jan 6, 2019
joyeecheung added a commit that referenced this pull request Jan 6, 2019
Move definitions of more metadata into node_metadata{.h, .cc}
so the data can be reused and easily inspected in C++.

PR-URL: #25293
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>

addaleax commented Jan 9, 2019

Copy link
Copy Markdown
Member

This needs to be backported to v11.x.

refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
Move definitions of more metadata into node_metadata{.h, .cc}
so the data can be reused and easily inspected in C++.

PR-URL: nodejs#25293
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>

Copy link
Copy Markdown
Member

This applies cleanly now.

addaleax pushed a commit that referenced this pull request Jan 14, 2019
Move definitions of more metadata into node_metadata{.h, .cc}
so the data can be reused and easily inspected in C++.

PR-URL: #25293
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
BridgeAR mentioned this pull request Jan 16, 2019
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
Move definitions of more metadata into node_metadata{.h, .cc}
so the data can be reused and easily inspected in C++.

PR-URL: nodejs#25293
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins mentioned this pull request Jan 24, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 outstanding review comments, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL