-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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: fix building --without-v8-platform #11088
Conversation
v8_platform.platform_ is referenced by node::Start without regard to the value of NODE_USE_V8_PLATFORM, so it should be declared unconditionally, otherwise Node fails to compile when !NODE_USE_V8_PLATFORM.
The call signature of v8_platform.StartInspector needs to be the same whether or not NODE_USE_V8_PLATFORM, otherwise Node will fail to compile if HAVE_INSPECTOR and !NODE_USE_V8_PLATFORM.
Second commit LGTM but @matthewloring should review the first one because I don't think passing a nullptr to |
node::tracing::Agent::Start can't accept a nullptr argument to its platform parameter, so don't call it when Node is compiled with NODE_USE_V8_PLATFORM=0.
907f1f2
to
0e9c0cb
Compare
@bnoordhuis, @matthewloring: We can't throw an exception, because Note: I opted to warn rather than exiting if Note that I had to move the call to |
I don't have a preference between an error and a warning. The approach looks good on my end. |
Erm, to be precise: I didn't have to move that call, since |
src/node.cc
Outdated
@@ -228,16 +228,31 @@ static struct { | |||
} | |||
#endif // HAVE_INSPECTOR | |||
|
|||
void StartTracingAgent() { | |||
tracing_agent = new tracing::Agent(); |
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.
Can you make this a property of v8_platform
while you're here (and call it tracing_agent_
)? Maybe also insert a CHECK(tracing_agent_ == nullptr)
to detect double calls.
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.
Yes, I've done both of these things in b93584b. In the process, I also spotted another direct call to tracing_agent->Stop()
and replaced it with a call to v8_platform.StopTracingAgent()
.
Move tracing_agent global into the v8_platform struct, renaming it to tracing_agent_; CHECK(tracing_agent_ == nullptr) in StartTracingAgent() to detect double calls; and relace another tracing_agent->Stop() call with a call to StopTracingAgent().
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, LGTM. CI: https://ci.nodejs.org/job/node-test-pull-request/6171/
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
* declare v8_platform.platform_ unconditionally v8_platform.platform_ is referenced by node::Start without regard to the value of NODE_USE_V8_PLATFORM, so it should be declared unconditionally, otherwise Node fails to compile when !NODE_USE_V8_PLATFORM. * update v8_platform.StartInspector signature The call signature of v8_platform.StartInspector needs to be the same whether or not NODE_USE_V8_PLATFORM, otherwise Node will fail to compile if HAVE_INSPECTOR and !NODE_USE_V8_PLATFORM. * don't call tracing_agent->Start w/nullptr node::tracing::Agent::Start can't accept a nullptr argument to its platform parameter, so don't call it when Node is compiled with NODE_USE_V8_PLATFORM=0. * refactor tracing_agent into v8_platform Move tracing_agent global into the v8_platform struct, renaming it to tracing_agent_; CHECK(tracing_agent_ == nullptr) in StartTracingAgent() to detect double calls; and relace another tracing_agent->Stop() call with a call to StopTracingAgent(). PR-URL: #11088 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Landed in 046f66a |
This commits depends on a |
The issue doesn't exist in v7.x, so there's no need to backport anything. |
Erm, correction: one of the issues addressed in this PR does exist in v7.x, so I've opened #11157 to backport its fix. |
* declare v8_platform.platform_ unconditionally v8_platform.platform_ is referenced by node::Start without regard to the value of NODE_USE_V8_PLATFORM, so it should be declared unconditionally, otherwise Node fails to compile when !NODE_USE_V8_PLATFORM. * update v8_platform.StartInspector signature The call signature of v8_platform.StartInspector needs to be the same whether or not NODE_USE_V8_PLATFORM, otherwise Node will fail to compile if HAVE_INSPECTOR and !NODE_USE_V8_PLATFORM. * don't call tracing_agent->Start w/nullptr node::tracing::Agent::Start can't accept a nullptr argument to its platform parameter, so don't call it when Node is compiled with NODE_USE_V8_PLATFORM=0. * refactor tracing_agent into v8_platform Move tracing_agent global into the v8_platform struct, renaming it to tracing_agent_; CHECK(tracing_agent_ == nullptr) in StartTracingAgent() to detect double calls; and relace another tracing_agent->Stop() call with a call to StopTracingAgent(). PR-URL: nodejs#11088 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Marking |
Node fails to compile when configured
--without-v8-platform
because of two issues with the implementation in src/node.cc when !NODE_USE_V8_PLATFORM. This branch fixes those two issues.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes (Note:make -j4 test
passes with these changes when I build with the default configure options. It fails when I build--without-v8-platform
, but since previously it didn't even compile with that option, these changes are still an improvement.)Affected core subsystem(s)
The affected core subsystem appears to be "src", or possibly "build." The only file that is changed is src/node.cc.